diff options
| author | Josh Magee <joshua_magee@playstation.sony.com> | 2013-12-19 03:17:11 +0000 |
|---|---|---|
| committer | Josh Magee <joshua_magee@playstation.sony.com> | 2013-12-19 03:17:11 +0000 |
| commit | 22b8ba2d67693f8e35d0b48db9ea0e48b66ba280 (patch) | |
| tree | b483ee80b3d3dc95f22544c50b973396a12ae9d7 /llvm/lib/Target | |
| parent | c4327996caeda7f8bd3ae0ca8209261de53d5c64 (diff) | |
| download | bcm5719-llvm-22b8ba2d67693f8e35d0b48db9ea0e48b66ba280.tar.gz bcm5719-llvm-22b8ba2d67693f8e35d0b48db9ea0e48b66ba280.zip | |
[stackprotector] Use analysis from the StackProtector pass for stack layout in PEI a nd LocalStackSlot passes.
This changes the MachineFrameInfo API to use the new SSPLayoutKind information
produced by the StackProtector pass (instead of a boolean flag) and updates a
few pass dependencies (to preserve the SSP analysis).
The stack layout follows the same approach used prior to this change - i.e.,
only LargeArray stack objects will be placed near the canary and everything
else will be laid out normally. After this change, structures containing large
arrays will also be placed near the canary - a case previously missed by the
old implementation.
Out of tree targets will need to update their usage of
MachineFrameInfo::CreateStackObject to remove the MayNeedSP argument.
The next patch will implement the rules for sspstrong and sspreq. The end goal
is to support ssp-strong stack layout rules.
WIP.
Differential Revision: http://llvm-reviews.chandlerc.com/D2158
llvm-svn: 197653
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp | 1 | ||||
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXAllocaHoisting.h | 1 | ||||
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h | 1 | ||||
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXSplitBBatBar.h | 1 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/XCore/XCoreISelLowering.cpp | 2 |
6 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp b/llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp index 44234e85dc6..552cac22eef 100644 --- a/llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp +++ b/llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp @@ -42,6 +42,7 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<MachineFunctionAnalysis>(); AU.addPreserved<MachineFunctionAnalysis>(); + AU.addPreserved("stack-protector"); FunctionPass::getAnalysisUsage(AU); } }; diff --git a/llvm/lib/Target/NVPTX/NVPTXAllocaHoisting.h b/llvm/lib/Target/NVPTX/NVPTXAllocaHoisting.h index 19d73c5783c..d3305701a5b 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAllocaHoisting.h +++ b/llvm/lib/Target/NVPTX/NVPTXAllocaHoisting.h @@ -32,6 +32,7 @@ public: void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DataLayout>(); + AU.addPreserved("stack-protector"); AU.addPreserved<MachineFunctionAnalysis>(); } diff --git a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h index 286e753fa92..780ed4974b2 100644 --- a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h +++ b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h @@ -29,6 +29,7 @@ struct NVPTXLowerAggrCopies : public FunctionPass { void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DataLayout>(); + AU.addPreserved("stack-protector"); AU.addPreserved<MachineFunctionAnalysis>(); } diff --git a/llvm/lib/Target/NVPTX/NVPTXSplitBBatBar.h b/llvm/lib/Target/NVPTX/NVPTXSplitBBatBar.h index bdafba9075a..03391feb3b4 100644 --- a/llvm/lib/Target/NVPTX/NVPTXSplitBBatBar.h +++ b/llvm/lib/Target/NVPTX/NVPTXSplitBBatBar.h @@ -26,6 +26,7 @@ struct NVPTXSplitBBatBar : public FunctionPass { NVPTXSplitBBatBar() : FunctionPass(ID) {} void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addPreserved("stack-protector"); AU.addPreserved<MachineFunctionAnalysis>(); } virtual bool runOnFunction(Function &F); diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 28a6ac0ab25..972b82fa946 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -1696,6 +1696,8 @@ bool X86FastISel::X86VisitIntrinsicCall(const IntrinsicInst &I) { const Value *Op1 = I.getArgOperand(0); // The guard's value. const AllocaInst *Slot = cast<AllocaInst>(I.getArgOperand(1)); + MFI.setStackProtectorIndex(FuncInfo.StaticAllocaMap[Slot]); + // Grab the frame index. X86AddressMode AM; if (!X86SelectAddress(Slot, AM)) return false; diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 6b0a2d0835e..668a2486396 100644 --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -1246,7 +1246,7 @@ XCoreTargetLowering::LowerCCCArguments(SDValue Chain, unsigned Size = ArgDI->Flags.getByValSize(); unsigned Align = std::max(StackSlotSize, ArgDI->Flags.getByValAlign()); // Create a new object on the stack and copy the pointee into it. - int FI = MFI->CreateStackObject(Size, Align, false, false); + int FI = MFI->CreateStackObject(Size, Align, false); SDValue FIN = DAG.getFrameIndex(FI, MVT::i32); InVals.push_back(FIN); MemOps.push_back(DAG.getMemcpy(Chain, dl, FIN, ArgDI->SDV, |

