diff options
| author | Akira Hatanaka <ahatanaka@mips.com> | 2012-08-22 03:18:13 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-08-22 03:18:13 +0000 |
| commit | e7338cd550a4ccde6796d2987b482ea9f0e239ef (patch) | |
| tree | 8a7a5d4c5768e1389c53c38dbf0db39827c1c50d /lib/Target/Mips/MipsISelLowering.cpp | |
| parent | 6522a9e04bcfa447299f4fd10ee9afffd5834a47 (diff) | |
| download | external_llvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.zip external_llvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.tar.gz external_llvm-e7338cd550a4ccde6796d2987b482ea9f0e239ef.tar.bz2 | |
Add register Mips::GP to the list of reserved registers if target is bare-metal
to prevent it from being clobbered. mips uses $gp to access small data section.
This bug was originally reported by Carl Norum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsISelLowering.cpp')
| -rw-r--r-- | lib/Target/Mips/MipsISelLowering.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index c5207c6..91f91b1 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -1578,8 +1578,8 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op, SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0, MipsII::MO_GPREL); SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1); - SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32); - return DAG.getNode(ISD::ADD, dl, MVT::i32, GOT, GPRelNode); + SDValue GPReg = DAG.getRegister(Mips::GP, MVT::i32); + return DAG.getNode(ISD::ADD, dl, MVT::i32, GPReg, GPRelNode); } // %hi/%lo relocation SDValue GAHi = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0, |
