summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/DemoteRegToStack.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-14 23:09:55 +0000
committerOwen Anderson <resistor@mac.com>2009-07-14 23:09:55 +0000
commit9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe (patch)
treef15d2aa3fea09947494a5d0bb36583dbe3be000a /lib/Transforms/Utils/DemoteRegToStack.cpp
parenta89b7ea9d6819606eea3ba945913127a212b836f (diff)
downloadexternal_llvm-9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe.zip
external_llvm-9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe.tar.gz
external_llvm-9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe.tar.bz2
Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/DemoteRegToStack.cpp')
-rw-r--r--lib/Transforms/Utils/DemoteRegToStack.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp
index b8dd754..6cf043b 100644
--- a/lib/Transforms/Utils/DemoteRegToStack.cpp
+++ b/lib/Transforms/Utils/DemoteRegToStack.cpp
@@ -29,7 +29,8 @@ using namespace llvm;
/// invalidating the SSA information for the value. It returns the pointer to
/// the alloca inserted to create a stack slot for I.
///
-AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
+AllocaInst* llvm::DemoteRegToStack(LLVMContext &Context,
+ Instruction &I, bool VolatileLoads,
Instruction *AllocaPoint) {
if (I.use_empty()) {
I.eraseFromParent();
@@ -39,10 +40,11 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
// Create a stack slot to hold the value.
AllocaInst *Slot;
if (AllocaPoint) {
- Slot = new AllocaInst(I.getType(), 0, I.getName()+".reg2mem", AllocaPoint);
+ Slot = new AllocaInst(Context, I.getType(), 0,
+ I.getName()+".reg2mem", AllocaPoint);
} else {
Function *F = I.getParent()->getParent();
- Slot = new AllocaInst(I.getType(), 0, I.getName()+".reg2mem",
+ Slot = new AllocaInst(Context, I.getType(), 0, I.getName()+".reg2mem",
F->getEntryBlock().begin());
}
@@ -107,7 +109,8 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
/// DemotePHIToStack - This function takes a virtual register computed by a phi
/// node and replaces it with a slot in the stack frame, allocated via alloca.
/// The phi node is deleted and it returns the pointer to the alloca inserted.
-AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
+AllocaInst* llvm::DemotePHIToStack(LLVMContext &Context, PHINode *P,
+ Instruction *AllocaPoint) {
if (P->use_empty()) {
P->eraseFromParent();
return 0;
@@ -116,10 +119,11 @@ AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
// Create a stack slot to hold the value.
AllocaInst *Slot;
if (AllocaPoint) {
- Slot = new AllocaInst(P->getType(), 0, P->getName()+".reg2mem", AllocaPoint);
+ Slot = new AllocaInst(Context, P->getType(), 0,
+ P->getName()+".reg2mem", AllocaPoint);
} else {
Function *F = P->getParent()->getParent();
- Slot = new AllocaInst(P->getType(), 0, P->getName()+".reg2mem",
+ Slot = new AllocaInst(Context, P->getType(), 0, P->getName()+".reg2mem",
F->getEntryBlock().begin());
}