summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-04-14 04:57:51 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-04-14 04:57:51 +0000
commitc8fc76b0788357e3e0f1ba6a29f25458dc18e696 (patch)
treecd337945e34a86c61e22051031f60d1cbc6f73af /llvm/lib/Target/Sparc
parent2e64d7ab1dac9f5a663e286b30badbed4dc766b9 (diff)
downloadbcm5719-llvm-c8fc76b0788357e3e0f1ba6a29f25458dc18e696.tar.gz
bcm5719-llvm-c8fc76b0788357e3e0f1ba6a29f25458dc18e696.zip
Add support for the SPARC v9 abs44 code model.
This is the default model for non-PIC 64-bit code. It supports text+data+bss linked anywhere in the low 16 TB of the address space. llvm-svn: 179473
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r--llvm/lib/Target/Sparc/SparcISelLowering.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
index cfe3d4f2967..33003684f04 100644
--- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp
+++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
@@ -1392,12 +1392,13 @@ SDValue SparcTargetLowering::makeHiLoPair(SDValue Op,
// Build SDNodes for producing an address from a GlobalAddress, ConstantPool,
// or ExternalSymbol SDNode.
SDValue SparcTargetLowering::makeAddress(SDValue Op, SelectionDAG &DAG) const {
+ DebugLoc DL = Op.getDebugLoc();
+ EVT VT = getPointerTy();
+
// Handle PIC mode first.
if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
// This is the pic32 code model, the GOT is known to be smaller than 4GB.
SDValue HiLo = makeHiLoPair(Op, SPII::MO_HI, SPII::MO_LO, DAG);
- DebugLoc DL = Op.getDebugLoc();
- EVT VT = getPointerTy();
SDValue GlobalBase = DAG.getNode(SPISD::GLOBAL_BASE_REG, DL, VT);
SDValue AbsAddr = DAG.getNode(ISD::ADD, DL, VT, GlobalBase, HiLo);
return DAG.getLoad(VT, DL, DAG.getEntryNode(), AbsAddr,
@@ -1405,10 +1406,19 @@ SDValue SparcTargetLowering::makeAddress(SDValue Op, SelectionDAG &DAG) const {
}
// This is one of the absolute code models.
- assert(getTargetMachine().getCodeModel() == CodeModel::Small &&
- "Only the abs32 code model is supported");
-
- return makeHiLoPair(Op, SPII::MO_HI, SPII::MO_LO, DAG);
+ switch(getTargetMachine().getCodeModel()) {
+ default:
+ llvm_unreachable("Unsupported absolute code model");
+ case CodeModel::Small:
+ return makeHiLoPair(Op, SPII::MO_HI, SPII::MO_LO, DAG);
+ case CodeModel::Medium: {
+ SDValue H44 = makeHiLoPair(Op, SPII::MO_H44, SPII::MO_M44, DAG);
+ H44 = DAG.getNode(ISD::SHL, DL, VT, H44, DAG.getIntPtrConstant(12));
+ SDValue L44 = withTargetFlags(Op, SPII::MO_L44, DAG);
+ L44 = DAG.getNode(SPISD::Lo, DL, VT, L44);
+ return DAG.getNode(ISD::ADD, DL, VT, H44, L44);
+ }
+ }
}
SDValue SparcTargetLowering::LowerGlobalAddress(SDValue Op,
OpenPOWER on IntegriCloud