summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2006-09-24 19:45:58 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2006-09-24 19:45:58 +0000
commit783a4a9d86565b5993efbb86c401097579d04369 (patch)
tree9f0461e03ea430e222d0ed78a149fa87c003f87e /llvm/lib/CodeGen/SelectionDAG
parent3cec4952ab21ffe32c3b0629c2fbe80064d75c8a (diff)
downloadbcm5719-llvm-783a4a9d86565b5993efbb86c401097579d04369.tar.gz
bcm5719-llvm-783a4a9d86565b5993efbb86c401097579d04369.zip
Add support for other relocation bases to jump tables, as well as custom asm directives
llvm-svn: 30593
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp11
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp3
2 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index cb8588c0318..9507e4be844 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -558,6 +558,17 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
#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:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index cf26eb29512..27a45a1d522 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -868,8 +868,9 @@ void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable &JT) {
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));
OpenPOWER on IntegriCloud