// 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()));
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) {
} 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 ";
TextSection = "_text";
DataSection = "_data";
+ JumpTableDataSection = NULL;
SwitchToSectionDirective = "";
TextSectionStartSuffix = "\tsegment 'CODE'";
DataSectionStartSuffix = "\tsegment 'DATA'";