[llvm-commits] [llvm] r58799 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h include/llvm/Intrinsics.td lib/CodeGen/PrologEpilogInserter.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/StackProtector.cpp
Bill Wendling
isanbard at gmail.com
Wed Nov 5 23:23:03 PST 2008
Author: void
Date: Thu Nov 6 01:23:03 2008
New Revision: 58799
URL: http://llvm.org/viewvc/llvm-project?rev=58799&view=rev
Log:
- Rename stackprotector_{prologue,epilogue} to stackprotector_{create,check}.
- Get rid of "HasStackProtector" in MachineFrameInfo.
- Modify intrinsics to tell which are doing what with memory.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
llvm/trunk/include/llvm/Intrinsics.td
llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/trunk/lib/CodeGen/StackProtector.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=58799&r1=58798&r2=58799&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Thu Nov 6 01:23:03 2008
@@ -150,9 +150,6 @@
/// only valid during and after prolog/epilog code insertion.
bool HasCalls;
- /// HasStackProtector - Set to true if this function has stack protectors.
- bool HasStackProtector;
-
/// StackProtectorIdx - The frame index for the stack protector.
int StackProtectorIdx;
@@ -186,7 +183,6 @@
HasVarSizedObjects = false;
FrameAddressTaken = false;
HasCalls = false;
- HasStackProtector = false;
StackProtectorIdx = -1;
MaxCallFrameSize = 0;
MMI = 0;
@@ -203,11 +199,6 @@
///
bool hasVarSizedObjects() const { return HasVarSizedObjects; }
- /// hasStackProtector - Return true if the function has a stack protector.
- ///
- bool hasStackProtector() const { return HasStackProtector; }
- void setStackProtector(bool T) { HasStackProtector = T; }
-
/// getStackProtectorIndex/setStackProtectorIndex - Return the index for the
/// stack protector object.
///
Modified: llvm/trunk/include/llvm/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=58799&r1=58798&r2=58799&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/Intrinsics.td Thu Nov 6 01:23:03 2008
@@ -176,9 +176,12 @@
def int_readcyclecounter : Intrinsic<[llvm_i64_ty]>;
-// Stack protector intrinsics.
-def int_stackprotector_prologue : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>;
-def int_stackprotector_epilogue : Intrinsic<[llvm_ptr_ty]>;
+// Stack Protector Intrinsics - The stackprotector_create writes the stack guard
+// to the correct place on the stack frame. The stackprotector_check reads back
+// the stack guard that the stackprotector_create stored.
+def int_stackprotector_create : Intrinsic<[llvm_void_ty, llvm_ptr_ty],
+ [IntrWriteMem]>;
+def int_stackprotector_check : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>;
//===------------------- Standard C Library Intrinsics --------------------===//
//
Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=58799&r1=58798&r2=58799&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Thu Nov 6 01:23:03 2008
@@ -408,7 +408,7 @@
// Make sure that the stack protector comes before the local variables on the
// stack.
- if (FFI->hasStackProtector()) {
+ if (FFI->getStackProtectorIndex() >= 0) {
int FI = FFI->getStackProtectorIndex();
// If stack grows down, we need to add size of find the lowest
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=58799&r1=58798&r2=58799&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Thu Nov 6 01:23:03 2008
@@ -3795,7 +3795,7 @@
DAG.setRoot(DAG.getNode(ISD::STACKRESTORE, MVT::Other, getRoot(), Tmp));
return 0;
}
- case Intrinsic::stackprotector_prologue: {
+ case Intrinsic::stackprotector_create: {
// Emit code into the DAG to store the stack guard onto the stack.
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
@@ -3809,8 +3809,6 @@
unsigned Align =
TLI.getTargetData()->getPrefTypeAlignment(PtrTy.getTypeForMVT());
int FI = MFI->CreateStackObject(PtrTy.getSizeInBits() / 8, Align);
-
- MFI->setStackProtector(true);
MFI->setStackProtectorIndex(FI);
SDValue FIN = DAG.getFrameIndex(FI, PtrTy);
@@ -3823,7 +3821,7 @@
DAG.setRoot(Result);
return 0;
}
- case Intrinsic::stackprotector_epilogue: {
+ case Intrinsic::stackprotector_check: {
// Emit code into the DAG to retrieve the stack guard off of the stack.
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=58799&r1=58798&r2=58799&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Thu Nov 6 01:23:03 2008
@@ -118,7 +118,7 @@
Constant *StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard", GuardTy);
LoadInst *LI = new LoadInst(StackGuardVar, "StackGuard", false, InsertPt);
CallInst::
- Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector_prologue),
+ Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector_create),
LI, "", InsertPt);
// Create the basic block to jump to when the guard check fails.
@@ -163,7 +163,7 @@
// Generate the stack protector instructions in the old basic block.
LoadInst *LI1 = new LoadInst(StackGuardVar, "", false, BB);
CallInst *CI = CallInst::
- Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector_epilogue),
+ Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector_check),
"", BB);
ICmpInst *Cmp = new ICmpInst(CmpInst::ICMP_EQ, CI, LI1, "", BB);
BranchInst::Create(NewBB, FailBB, Cmp, BB);
More information about the llvm-commits
mailing list