[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Reid Spencer
reid at x10sys.com
Sun Dec 17 10:51:06 PST 2006
Changes in directory llvm/lib/Target/CBackend:
Writer.cpp updated: 1.298 -> 1.299
---
Log message:
Fix PR1058: http://llvm.org/PR1058 :
Generate the BITCAST_TEMPORARY regardless of the uses or inlinability of
the instruction. This temporary is needed to perform the instruction, not
provide storage for its results.
---
Diffs of the changes: (+13 -8)
Writer.cpp | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.298 llvm/lib/Target/CBackend/Writer.cpp:1.299
--- llvm/lib/Target/CBackend/Writer.cpp:1.298 Mon Dec 11 23:04:59 2006
+++ llvm/lib/Target/CBackend/Writer.cpp Sun Dec 17 12:50:51 2006
@@ -1696,7 +1696,7 @@
bool PrintedVar = false;
// print local variable information for the function
- for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I)
+ for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
if (const AllocaInst *AI = isDirectAlloca(&*I)) {
Out << " ";
printType(Out, AI->getAllocatedType(), Mang->getValueName(AI));
@@ -1714,16 +1714,20 @@
Out << ";\n";
}
PrintedVar = true;
- } else if (isa<BitCastInst>(*I) &&
- ((I->getType()->isFloatingPoint() &&
- I->getOperand(0)->getType()->isInteger()) ||
- (I->getType()->isInteger() &&
- I->getOperand(0)->getType()->isFloatingPoint()))) {
- // We need a temporary for the BitCast to use so it can pluck a
- // value out of a union to do the BitCast.
+ }
+ // We need a temporary for the BitCast to use so it can pluck a value out
+ // of a uniont to do the BitCast. This is separate from the need for a
+ // variable to hold the result of the BitCast.
+ if (isa<BitCastInst>(*I) &&
+ ((I->getType()->isFloatingPoint() &&
+ I->getOperand(0)->getType()->isInteger()) ||
+ (I->getType()->isInteger() &&
+ I->getOperand(0)->getType()->isFloatingPoint()))) {
Out << " llvmBitCastUnion " << Mang->getValueName(&*I)
<< "__BITCAST_TEMPORARY;\n";
+ PrintedVar = true;
}
+ }
if (PrintedVar)
Out << '\n';
@@ -2026,6 +2030,7 @@
I.getOperand(0)->getType()->isInteger()) ||
(I.getType()->isInteger() &&
I.getOperand(0)->getType()->isFloatingPoint()))) {
+
// These int<->float and long<->double casts need to be handled specially
Out << Mang->getValueName(&I) << "__BITCAST_TEMPORARY."
<< getFloatBitCastField(I.getOperand(0)->getType()) << " = ";
More information about the llvm-commits
mailing list