Constant, ConstantFP,
GlobalAddress, FrameIndex, JumpTable, ConstantPool, ExternalSymbol,
+ // The relocation value to add to the value loaded from a jump table
+ JumpTableRelocBase,
+
// TargetConstant* - Like Constant*, but the DAG does not do any folding or
// simplification of the constant.
TargetConstant,
const char *Data16bitsDirective; // Defaults to "\t.short\t"
const char *Data32bitsDirective; // Defaults to "\t.long\t"
const char *Data64bitsDirective; // Defaults to "\t.quad\t"
+ const char *JumpTableDirective; // if used, the jump table reloc flag
//===--- Alignment Information ----------------------------------------===//
const char *getData64bitsDirective() const {
return Data64bitsDirective;
}
+ const char *getJumpTableDirective() const {
+ return JumpTableDirective;
+ }
const char *getAlignDirective() const {
return AlignDirective;
}
// JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables,
// and 32 bits for PIC since PIC jump table entries are differences, not
// pointers to blocks.
- const char *JTEntryDirective = TAI->getData32bitsDirective();
+ // Use the architecture specific relocation directive, if it is set
+ const char *JTEntryDirective = TAI->getJumpTableDirective();
+ if (!JTEntryDirective)
+ JTEntryDirective = TAI->getData32bitsDirective();
// Pick the directive to use to print the jump table entries, and switch to
// the appropriate section.
<< '_' << i << "_set_" << JTBBs[ii]->getNumber();
} else if (TM.getRelocationModel() == Reloc::PIC_) {
printBasicBlockLabel(JTBBs[ii], false, false);
- O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
- << getFunctionNumber() << '_' << i;
+ //If the arch uses custom Jump Table directives, don't calc relative to JT
+ if (!TAI->getJumpTableDirective())
+ O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
+ << getFunctionNumber() << '_' << i;
} else {
printBasicBlockLabel(JTBBs[ii], false, false);
}
#endif
assert(0 && "Do not know how to legalize this operator!");
abort();
+ case ISD::JumpTableRelocBase:
+ switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
+ case TargetLowering::Custom:
+ Tmp1 = TLI.LowerOperation(Op, DAG);
+ if (Tmp1.Val) Result = Tmp1;
+ break;
+ default:
+ Result = LegalizeOp(Node->getOperand(0));
+ break;
+ }
+ break;
case ISD::GlobalAddress:
case ISD::ExternalSymbol:
case ISD::ConstantPool:
SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD,
DAG.getSrcValue(0));
if (isPIC) {
+ SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB);
ADD = DAG.getNode(ISD::ADD, PTy,
- ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), TAB);
+ ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc);
DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), ADD));
} else {
DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), LD));
ConstantPoolSection("\t.section .rodata\n"),
JumpTableDataSection("\t.section .rodata\n"),
JumpTableTextSection("\t.text\n"),
+ JumpTableDirective(0),
StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
FourByteConstantSection(0),