summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-07-11 17:11:54 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-07-11 17:11:54 +0000
commitf67cd8259d6f50ff342c038966ff39e055e901e1 (patch)
tree2b137da9bf2871ae4b3aa2b0b9af9aa92e3c89c6 /llvm/lib
parentada8c398d0f810c37e6a9d2d22c8312bf4e595a2 (diff)
downloadbcm5719-llvm-f67cd8259d6f50ff342c038966ff39e055e901e1.tar.gz
bcm5719-llvm-f67cd8259d6f50ff342c038966ff39e055e901e1.zip
[Hexagon] Do not rely on callee-saved info in hasFP
llvm-svn: 307675
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp14
-rw-r--r--llvm/lib/Target/Hexagon/HexagonISelLowering.cpp9
2 files changed, 9 insertions, 14 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index 97a53dcbaed..c790579cceb 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -979,18 +979,6 @@ bool HexagonFrameLowering::hasFP(const MachineFunction &MF) const {
if (MFI.hasCalls() || HMFI.hasClobberLR())
return true;
- // Frame pointer elimination is a possiblility at this point, but
- // to know if FP is necessary we need to know if spill/restore
- // functions will be used (they require FP to be valid).
- // This means that hasFP shouldn't really be called before CSI is
- // calculated, and some measures are taken to make sure of that
- // (e.g. default implementations of virtual functions that call it
- // are overridden apropriately).
- assert(MFI.isCalleeSavedInfoValid() && "Need to know CSI");
- const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
- if (useSpillFunction(MF, CSI) || useRestoreFunction(MF, CSI))
- return true;
-
return false;
}
@@ -2437,6 +2425,8 @@ bool HexagonFrameLowering::shouldInlineCSR(const MachineFunction &MF,
const CSIVect &CSI) const {
if (MF.getInfo<HexagonMachineFunctionInfo>()->hasEHReturn())
return true;
+ if (!hasFP(MF))
+ return true;
if (!isOptSize(MF) && !isMinSize(MF))
if (MF.getTarget().getOptLevel() > CodeGenOpt::Default)
return true;
diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
index f52decac9e4..67242764d45 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -716,6 +716,7 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
bool IsStructRet = (Outs.empty()) ? false : Outs[0].Flags.isSRet();
MachineFunction &MF = DAG.getMachineFunction();
+ MachineFrameInfo &MFI = MF.getFrameInfo();
auto PtrVT = getPointerTy(MF.getDataLayout());
// Check for varargs.
@@ -832,7 +833,6 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
if (NeedsArgAlign && Subtarget.hasV60TOps()) {
DEBUG(dbgs() << "Function needs byte stack align due to call args\n");
- MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
// V6 vectors passed by value have 64 or 128 byte alignment depending
// on whether we are 64 byte vector mode or 128 byte.
bool UseHVXDbl = Subtarget.useHVXDblOps();
@@ -916,10 +916,15 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
Ops.push_back(Glue);
if (IsTailCall) {
- MF.getFrameInfo().setHasTailCall();
+ MFI.setHasTailCall();
return DAG.getNode(HexagonISD::TC_RETURN, dl, NodeTys, Ops);
}
+ // Set this here because we need to know this for "hasFP" in frame lowering.
+ // The target-independent code calls getFrameRegister before setting it, and
+ // getFrameRegister uses hasFP to determine whether the function has FP.
+ MFI.setHasCalls(true);
+
unsigned OpCode = DoesNotReturn ? HexagonISD::CALLnr : HexagonISD::CALL;
Chain = DAG.getNode(OpCode, dl, NodeTys, Ops);
Glue = Chain.getValue(1);
OpenPOWER on IntegriCloud