comparison ir/irlandingpad.cpp @ 1545:7fcb72d518f6

More factory methods moved to LLVMContext
author Benjamin Kramer <benny.kra@gmail.com>
date Wed, 15 Jul 2009 18:09:41 +0200
parents e1e93343fc11
children d6e8d5db259f
comparison
equal deleted inserted replaced
1544:8863cf7236e6 1545:7fcb72d518f6
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(llvm::ConstantInt::get(LLType::Int32Ty, 0)); 136 selectorargs.push_back(gIR->context().getConstantInt(LLType::Int32Ty, 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::Int8Ty));
141 selectorargs.insert(selectorargs.begin(), personality_fn_arg); 141 selectorargs.insert(selectorargs.begin(), personality_fn_arg);
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("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 = llvm::ConstantInt::get(DtoSize_t(), catchToInt[rit->catchType]); 189 llvm::ConstantInt* switchval = gIR->context().getConstantInt(DtoSize_t(), catchToInt[rit->catchType]);
190 // and make sure we don't add the same switchval twice, may happen with nested trys 190 // and make sure we don't add the same switchval twice, may happen with nested trys
191 if(!switchinst->findCaseValue(switchval)) 191 if(!switchinst->findCaseValue(switchval))
192 switchinst->addCase(switchval, rit->target); 192 switchinst->addCase(switchval, rit->target);
193 } 193 }
194 } 194 }