mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -266,7 +266,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
|
||||
void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
|
||||
AllocaInst *InvokeNum,
|
||||
SwitchInst *CatchSwitch) {
|
||||
ConstantInt *InvokeNoC = ConstantInt::get(Type::Int32Ty, InvokeNo);
|
||||
ConstantInt *InvokeNoC = Context->getConstantInt(Type::Int32Ty, InvokeNo);
|
||||
|
||||
// If the unwind edge has phi nodes, split the edge.
|
||||
if (isa<PHINode>(II->getUnwindDest()->begin())) {
|
||||
@@ -417,7 +417,7 @@ splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes) {
|
||||
// If we decided we need a spill, do it.
|
||||
if (NeedsSpill) {
|
||||
++NumSpilled;
|
||||
DemoteRegToStack(*Inst, true);
|
||||
DemoteRegToStack(*Context, *Inst, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,13 +470,15 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
||||
// alloca because the value needs to be live across invokes.
|
||||
unsigned Align = TLI ? TLI->getJumpBufAlignment() : 0;
|
||||
AllocaInst *JmpBuf =
|
||||
new AllocaInst(JBLinkTy, 0, Align, "jblink", F.begin()->begin());
|
||||
new AllocaInst(*Context, JBLinkTy, 0, Align,
|
||||
"jblink", F.begin()->begin());
|
||||
|
||||
std::vector<Value*> Idx;
|
||||
Idx.push_back(Context->getNullValue(Type::Int32Ty));
|
||||
Idx.push_back(ConstantInt::get(Type::Int32Ty, 1));
|
||||
Idx.push_back(Context->getConstantInt(Type::Int32Ty, 1));
|
||||
OldJmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(),
|
||||
"OldBuf", EntryBB->getTerminator());
|
||||
"OldBuf",
|
||||
EntryBB->getTerminator());
|
||||
|
||||
// Copy the JBListHead to the alloca.
|
||||
Value *OldBuf = new LoadInst(JBListHead, "oldjmpbufptr", true,
|
||||
@@ -492,9 +494,9 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
||||
|
||||
// Create an alloca which keeps track of which invoke is currently
|
||||
// executing. For normal calls it contains zero.
|
||||
AllocaInst *InvokeNum = new AllocaInst(Type::Int32Ty, 0, "invokenum",
|
||||
EntryBB->begin());
|
||||
new StoreInst(ConstantInt::get(Type::Int32Ty, 0), InvokeNum, true,
|
||||
AllocaInst *InvokeNum = new AllocaInst(*Context, Type::Int32Ty, 0,
|
||||
"invokenum",EntryBB->begin());
|
||||
new StoreInst(Context->getConstantInt(Type::Int32Ty, 0), InvokeNum, true,
|
||||
EntryBB->getTerminator());
|
||||
|
||||
// Insert a load in the Catch block, and a switch on its value. By default,
|
||||
@@ -513,7 +515,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
||||
BasicBlock *ContBlock = EntryBB->splitBasicBlock(EntryBB->getTerminator(),
|
||||
"setjmp.cont");
|
||||
|
||||
Idx[1] = ConstantInt::get(Type::Int32Ty, 0);
|
||||
Idx[1] = Context->getConstantInt(Type::Int32Ty, 0);
|
||||
Value *JmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(),
|
||||
"TheJmpBuf",
|
||||
EntryBB->getTerminator());
|
||||
@@ -567,12 +569,12 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
||||
// Get a pointer to the jmpbuf and longjmp.
|
||||
std::vector<Value*> Idx;
|
||||
Idx.push_back(Context->getNullValue(Type::Int32Ty));
|
||||
Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
|
||||
Idx.push_back(Context->getConstantInt(Type::Int32Ty, 0));
|
||||
Idx[0] = GetElementPtrInst::Create(BufPtr, Idx.begin(), Idx.end(), "JmpBuf",
|
||||
UnwindBlock);
|
||||
Idx[0] = new BitCastInst(Idx[0], PointerType::getUnqual(Type::Int8Ty),
|
||||
"tmp", UnwindBlock);
|
||||
Idx[1] = ConstantInt::get(Type::Int32Ty, 1);
|
||||
Idx[1] = Context->getConstantInt(Type::Int32Ty, 1);
|
||||
CallInst::Create(LongJmpFn, Idx.begin(), Idx.end(), "", UnwindBlock);
|
||||
new UnreachableInst(UnwindBlock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user