summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-26 05:15:20 +0000
committerChris Lattner <sabre@nondot.org>2010-01-26 05:15:20 +0000
commitcc0f734cd0ea84bc9a7d5a2df40a11126ac3ae2a (patch)
tree9c0dc2424260b5d1a7bef946eddca2fe013ced1d /llvm/lib/CodeGen/AsmPrinter
parent279de3ef6407711e1465915a7bb2bb4ba6ca92da (diff)
downloadbcm5719-llvm-cc0f734cd0ea84bc9a7d5a2df40a11126ac3ae2a.tar.gz
bcm5719-llvm-cc0f734cd0ea84bc9a7d5a2df40a11126ac3ae2a.zip
simplify asmprinter: only emit .set directives when entries have
EK_LabelDifference32 kind and the target has .set support. Simplify X86AsmPrinter::printPICJumpTableSetLabel to make use of recent helpers. llvm-svn: 94518
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 1b58f1ab00f..c1b45c3917c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -511,14 +511,16 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) {
// If this jump table was deleted, ignore it.
if (JTBBs.empty()) continue;
- // For PIC codegen, if possible we want to use the SetDirective to reduce
- // the number of relocations the assembler will generate for the jump table.
- // Set directives are all printed before the jump table itself.
- SmallPtrSet<MachineBasicBlock*, 16> EmittedSets;
- if (MAI->getSetDirective() && IsPic)
+ // For the EK_LabelDifference32 entry, if the target supports .set, emit a
+ // .set directive for each unique entry. This reduces the number of
+ // relocations the assembler will generate for the jump table.
+ if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
+ MAI->getSetDirective()) {
+ SmallPtrSet<MachineBasicBlock*, 16> EmittedSets;
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
if (EmittedSets.insert(JTBBs[ii]))
printPICJumpTableSetLabel(i, JTBBs[ii]);
+ }
// On some targets (e.g. Darwin) we want to emit two consequtive labels
// before each jump table. The first label is never referenced, but tells
OpenPOWER on IntegriCloud