diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-05-12 03:19:04 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-05-12 03:19:04 +0000 |
commit | 92d4aec5737cf81f08059bbc5c18f39d8c16c429 (patch) | |
tree | 94d60b56b4cdb6644db1beb4a6224046587493c9 /lib/Target/Mips | |
parent | 30cec40241d73fa274afeae7b7bac3632d344900 (diff) | |
download | external_llvm-92d4aec5737cf81f08059bbc5c18f39d8c16c429.zip external_llvm-92d4aec5737cf81f08059bbc5c18f39d8c16c429.tar.gz external_llvm-92d4aec5737cf81f08059bbc5c18f39d8c16c429.tar.bz2 |
Make the following changes in MipsISelLowering.cpp:
- Stop creating stack frame objects needed for saving $gp.
- Insert a node that copies the global pointer register to register $gp
before the call node. This will ensure $gp is valid at the entry of the
called function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index d5cc747..a8b738b 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -2455,11 +2455,6 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee, Chain = CallSeqStart = DAG.getCALLSEQ_START(InChain, NextStackOffsetVal); ByValChain = InChain; - // If this is the first call, create a stack frame object that points to - // a location to which .cprestore saves $gp. - if (IsO32 && IsPIC && MipsFI->globalBaseRegFixed() && !MipsFI->getGPFI()) - MipsFI->setGPFI(MFI->CreateFixedObject(4, 0, true)); - // Get the frame index of the stack frame object that points to the location // of dynamically allocated area on the stack. int DynAllocFI = MipsFI->getDynAllocFI(); @@ -2482,9 +2477,6 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee, NextStackOffset = (NextStackOffset + StackAlignment - 1) / StackAlignment * StackAlignment; - if (MipsFI->needGPSaveRestore()) - MFI->setObjectOffset(MipsFI->getGPFI(), NextStackOffset); - MFI->setObjectOffset(DynAllocFI, NextStackOffset); } @@ -2656,6 +2648,14 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee, Callee = DAG.getRegister(T9Reg, getPointerTy()); } + // Insert node "GP copy globalreg" before call to function. + // Lazy-binding stubs require GP to point to the GOT. + if (IsPICCall) { + unsigned GPReg = IsN64 ? Mips::GP_64 : Mips::GP; + EVT Ty = IsN64 ? MVT::i64 : MVT::i32; + RegsToPass.push_back(std::make_pair(GPReg, GetGlobalReg(DAG, Ty))); + } + // Build a sequence of copy-to-reg nodes chained together with token // chain and flag operands which copy the outgoing args into registers. // The InFlag in necessary since all emitted instructions must be |