diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-04-14 04:57:51 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-04-14 04:57:51 +0000 |
commit | 87ce01739b058fd6d929cd8e609ceecf82f919a7 (patch) | |
tree | c4d7a8840439606bc4d2f911198f7dbf9b758cf3 /lib/Target | |
parent | cab0abd03ded35006f594c2a7707753eefd88530 (diff) | |
download | external_llvm-87ce01739b058fd6d929cd8e609ceecf82f919a7.zip external_llvm-87ce01739b058fd6d929cd8e609ceecf82f919a7.tar.gz external_llvm-87ce01739b058fd6d929cd8e609ceecf82f919a7.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/Sparc/SparcISelLowering.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index cfe3d4f..3300368 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/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, |