diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2006-12-19 21:04:20 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2006-12-19 21:04:20 +0000 |
commit | 24287ddb81aca5d2579dc30ebd3528d2521529d7 (patch) | |
tree | 1f80728c26c726bf7fb49c4f9668c195b9863be8 | |
parent | a68941b2d461a9c8827caf69af1050526b5dd167 (diff) |
Fix for PR1059: http://llvm.org/PR1059
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32685 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 9 | ||||
-rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.cpp | 11 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 1 |
3 files changed, 16 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 833ed28f08..82e110a275 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -214,14 +214,17 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. TargetLowering *LoweringInfo = TM.getTargetLowering(); - - if (IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) { + + const char* JumpTableDataSection = TAI->getJumpTableDataSection(); + if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || + !JumpTableDataSection) { // In PIC mode, we need to emit the jump table to the same section as the // function body itself, otherwise the label differences won't make sense. + // We should also do if the section name is NULL. const Function *F = MF.getFunction(); SwitchToTextSection(getSectionForFunction(*F).c_str(), F); } else { - SwitchToDataSection(TAI->getJumpTableDataSection()); + SwitchToDataSection(JumpTableDataSection); } EmitAlignment(Log2_32(MJTI->getAlignment())); diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index dd73a2d318..142177c4ee 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -113,7 +113,7 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO, const char *Modifier) { const MRegisterInfo &RI = *TM.getRegisterInfo(); switch (MO.getType()) { - case MachineOperand::MO_Register: + case MachineOperand::MO_Register: { if (MRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) { @@ -126,13 +126,20 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO, } else O << "reg" << MO.getReg(); return; - + } case MachineOperand::MO_Immediate: O << MO.getImmedValue(); return; case MachineOperand::MO_MachineBasicBlock: printBasicBlockLabel(MO.getMachineBasicBlock()); return; + case MachineOperand::MO_JumpTableIndex: { + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); + if (!isMemOp) O << "OFFSET "; + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << "_" << MO.getJumpTableIndex(); + return; + } case MachineOperand::MO_ConstantPoolIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp) O << "OFFSET "; diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index ed9f1ac313..7164038034 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -152,6 +152,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { TextSection = "_text"; DataSection = "_data"; + JumpTableDataSection = NULL; SwitchToSectionDirective = ""; TextSectionStartSuffix = "\tsegment 'CODE'"; DataSectionStartSuffix = "\tsegment 'DATA'"; |