diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index d4facd27a4fd537c498374c27e6576e1a89c777c..6e5dab7851fdc0791e19c298e2a134280ff6bc34 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -217,12 +217,20 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) { SwitchToDataSection(JumpTableSection, 0); EmitAlignment(Log2_32(TD->getPointerAlignment())); + + // Pick the directive to use based on the pointer size. FIXME: when we support + // PIC jumptables, this should always use the 32-bit directive for label + // differences. + const char *PtrDataDirective = Data32bitsDirective; + if (TD->getPointerSize() == 8) + PtrDataDirective = Data64bitsDirective; + for (unsigned i = 0, e = JT.size(); i != e; ++i) { O << PrivateGlobalPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n"; const std::vector &JTBBs = JT[i].MBBs; for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { - O << Data32bitsDirective << ' '; + O << PtrDataDirective << ' '; printBasicBlockLabel(JTBBs[ii]); O << '\n'; }