aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-03 18:33:18 +0000
committerChris Lattner <sabre@nondot.org>2010-01-03 18:33:18 +0000
commit991876a06d263c5fd22c99648c77a810bc0dea06 (patch)
treef6066465b3ef1c05235668ec8779f540654823fb /lib
parentbf7f4f5468321a6971628f2efdfc99758e453e21 (diff)
downloadexternal_llvm-991876a06d263c5fd22c99648c77a810bc0dea06.zip
external_llvm-991876a06d263c5fd22c99648c77a810bc0dea06.tar.gz
external_llvm-991876a06d263c5fd22c99648c77a810bc0dea06.tar.bz2
fix PR5930, allowing the asmprinter to emit difference between
two labels as a truncate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 6b24e24..6f26fc4 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/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: