diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-03 18:33:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-03 18:33:18 +0000 |
commit | 1dae8766b18a9d5757ff76668bbd3fd05213c3d5 (patch) | |
tree | 58fa17976dba1e94229cfb352840625f55e5f888 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 0128f668a912fe06121a58d38f515e629e649ae5 (diff) | |
download | bcm5719-llvm-1dae8766b18a9d5757ff76668bbd3fd05213c3d5.tar.gz bcm5719-llvm-1dae8766b18a9d5757ff76668bbd3fd05213c3d5.zip |
fix PR5930, allowing the asmprinter to emit difference between
two labels as a truncate.
llvm-svn: 92455
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6b24e24d371..6f26fc402a6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -819,7 +819,6 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { const TargetData *TD = TM.getTargetData(); unsigned Opcode = CE->getOpcode(); switch (Opcode) { - case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: case Instruction::FPTrunc: @@ -865,7 +864,6 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { return EmitConstantValueOnly(Op); } - case Instruction::PtrToInt: { // Support only foldable casts to/from pointers that can be eliminated by // changing the pointer to the appropriately sized integer type. @@ -887,6 +885,14 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { O << ") & " << S.str() << ')'; break; } + + case Instruction::Trunc: + // We emit the value and depend on the assembler to truncate the generated + // expression properly. This is important for differences between + // blockaddress labels. Since the two labels are in the same function, it + // is reasonable to treat their delta as a 32-bit value. + return EmitConstantValueOnly(CE->getOperand(0)); + case Instruction::Add: case Instruction::Sub: case Instruction::And: |