mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Fix the super obnoxious "cast to pointer from integer of different size" warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -946,13 +946,8 @@ void CWriter::visitBranchInst(BranchInst &I) {
|
|||||||
|
|
||||||
void CWriter::visitBinaryOperator(Instruction &I) {
|
void CWriter::visitBinaryOperator(Instruction &I) {
|
||||||
// binary instructions, shift instructions, setCond instructions.
|
// binary instructions, shift instructions, setCond instructions.
|
||||||
if (isa<PointerType>(I.getType())) {
|
assert(!isa<PointerType>(I.getType()));
|
||||||
Out << "(";
|
|
||||||
printType(Out, I.getType());
|
|
||||||
Out << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isa<PointerType>(I.getType())) Out << "(long long)";
|
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
|
|
||||||
switch (I.getOpcode()) {
|
switch (I.getOpcode()) {
|
||||||
@ -975,14 +970,20 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
|||||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isa<PointerType>(I.getType())) Out << "(long long)";
|
|
||||||
writeOperand(I.getOperand(1));
|
writeOperand(I.getOperand(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWriter::visitCastInst(CastInst &I) {
|
void CWriter::visitCastInst(CastInst &I) {
|
||||||
Out << "(";
|
Out << "(";
|
||||||
printType(Out, I.getType(), string(""),/*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType(), string(""),/*ignoreName*/false,
|
||||||
|
/*namedContext*/false);
|
||||||
Out << ")";
|
Out << ")";
|
||||||
|
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
||||||
|
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
||||||
|
// Avoid "cast to pointer from integer of different size" warnings
|
||||||
|
Out << "(long)";
|
||||||
|
}
|
||||||
|
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,13 +946,8 @@ void CWriter::visitBranchInst(BranchInst &I) {
|
|||||||
|
|
||||||
void CWriter::visitBinaryOperator(Instruction &I) {
|
void CWriter::visitBinaryOperator(Instruction &I) {
|
||||||
// binary instructions, shift instructions, setCond instructions.
|
// binary instructions, shift instructions, setCond instructions.
|
||||||
if (isa<PointerType>(I.getType())) {
|
assert(!isa<PointerType>(I.getType()));
|
||||||
Out << "(";
|
|
||||||
printType(Out, I.getType());
|
|
||||||
Out << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isa<PointerType>(I.getType())) Out << "(long long)";
|
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
|
|
||||||
switch (I.getOpcode()) {
|
switch (I.getOpcode()) {
|
||||||
@ -975,14 +970,20 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
|||||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isa<PointerType>(I.getType())) Out << "(long long)";
|
|
||||||
writeOperand(I.getOperand(1));
|
writeOperand(I.getOperand(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWriter::visitCastInst(CastInst &I) {
|
void CWriter::visitCastInst(CastInst &I) {
|
||||||
Out << "(";
|
Out << "(";
|
||||||
printType(Out, I.getType(), string(""),/*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType(), string(""),/*ignoreName*/false,
|
||||||
|
/*namedContext*/false);
|
||||||
Out << ")";
|
Out << ")";
|
||||||
|
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
||||||
|
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
||||||
|
// Avoid "cast to pointer from integer of different size" warnings
|
||||||
|
Out << "(long)";
|
||||||
|
}
|
||||||
|
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user