Mercurial > projects > ldc
comparison ir/irlandingpad.cpp @ 1571:8d086d552909
IntegerType is now contextifed.
Requires llvm >= 78969. resistor says this will be the last context API change :)
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Fri, 14 Aug 2009 00:39:18 +0200 |
parents | d6e8d5db259f |
children | f4c56ed32238 |
comparison
equal
deleted
inserted
replaced
1570:ab03cfb3a212 | 1571:8d086d552909 |
---|---|
8 #include "ir/irlandingpad.h" | 8 #include "ir/irlandingpad.h" |
9 | 9 |
10 IRLandingPadInfo::IRLandingPadInfo(Catch* catchstmt, llvm::BasicBlock* end) | 10 IRLandingPadInfo::IRLandingPadInfo(Catch* catchstmt, llvm::BasicBlock* end) |
11 : finallyBody(NULL) | 11 : finallyBody(NULL) |
12 { | 12 { |
13 target = llvm::BasicBlock::Create("catch", gIR->topfunc(), end); | 13 target = llvm::BasicBlock::Create(gIR->context(), "catch", gIR->topfunc(), end); |
14 gIR->scope() = IRScope(target,end); | 14 gIR->scope() = IRScope(target,end); |
15 | 15 |
16 // assign storage to catch var | 16 // assign storage to catch var |
17 if(catchstmt->var) { | 17 if(catchstmt->var) { |
18 // use the same storage for all exceptions that are not accessed in | 18 // use the same storage for all exceptions that are not accessed in |
131 selectorargs.insert(selectorargs.begin(), it->catchType->ir.irStruct->getClassInfoSymbol()); | 131 selectorargs.insert(selectorargs.begin(), it->catchType->ir.irStruct->getClassInfoSymbol()); |
132 } | 132 } |
133 } | 133 } |
134 // if there's a finally, the eh table has to have a 0 action | 134 // if there's a finally, the eh table has to have a 0 action |
135 if(hasFinally) | 135 if(hasFinally) |
136 selectorargs.push_back(LLConstantInt::get(LLType::Int32Ty, 0)); | 136 selectorargs.push_back(LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0)); |
137 | 137 |
138 // personality fn | 138 // personality fn |
139 llvm::Function* personality_fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_eh_personality"); | 139 llvm::Function* personality_fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_eh_personality"); |
140 LLValue* personality_fn_arg = gIR->ir->CreateBitCast(personality_fn, getPtrToType(LLType::Int8Ty)); | 140 LLValue* personality_fn_arg = gIR->ir->CreateBitCast(personality_fn, getPtrToType(LLType::getInt8Ty(gIR->context()))); |
141 selectorargs.insert(selectorargs.begin(), personality_fn_arg); | 141 selectorargs.insert(selectorargs.begin(), personality_fn_arg); |
142 | 142 |
143 // eh storage target | 143 // eh storage target |
144 selectorargs.insert(selectorargs.begin(), eh_ptr); | 144 selectorargs.insert(selectorargs.begin(), eh_ptr); |
145 | 145 |
179 // otherwise it's a catch and we'll add a switch case | 179 // otherwise it's a catch and we'll add a switch case |
180 else | 180 else |
181 { | 181 { |
182 if(!switchinst) | 182 if(!switchinst) |
183 { | 183 { |
184 switchinst = gIR->ir->CreateSwitch(eh_sel, llvm::BasicBlock::Create("switchdefault", gIR->topfunc(), gIR->scopeend()), infos.size()); | 184 switchinst = gIR->ir->CreateSwitch(eh_sel, llvm::BasicBlock::Create(gIR->context(), "switchdefault", gIR->topfunc(), gIR->scopeend()), infos.size()); |
185 gIR->scope() = IRScope(switchinst->getDefaultDest(), gIR->scopeend()); | 185 gIR->scope() = IRScope(switchinst->getDefaultDest(), gIR->scopeend()); |
186 } | 186 } |
187 // dubious comment | 187 // dubious comment |
188 // catches matched first get the largest switchval, so do size - unique int | 188 // catches matched first get the largest switchval, so do size - unique int |
189 llvm::ConstantInt* switchval = LLConstantInt::get(DtoSize_t(), catchToInt[rit->catchType]); | 189 llvm::ConstantInt* switchval = LLConstantInt::get(DtoSize_t(), catchToInt[rit->catchType]); |