comparison gen/irstate.h @ 1277:6bd5ce91b136

Add some attributes to runtime calls, to provide the standard LLVM optimization passes with more information.
author Frits van Bommel <fvbommel wxs.nl>
date Wed, 29 Apr 2009 17:47:24 +0200
parents 3d1b16dabd25
children 329e45865d84
comparison
equal deleted inserted replaced
1276:fa20726fe074 1277:6bd5ce91b136
180 { 180 {
181 // intrinsics don't support invoking 181 // intrinsics don't support invoking
182 LLFunction* funcval = llvm::dyn_cast<LLFunction>(Callee); 182 LLFunction* funcval = llvm::dyn_cast<LLFunction>(Callee);
183 if (funcval && funcval->isIntrinsic()) 183 if (funcval && funcval->isIntrinsic())
184 { 184 {
185 return ir->CreateCall(Callee, ArgBegin, ArgEnd, Name); 185 llvm::CallInst* call = ir->CreateCall(Callee, ArgBegin, ArgEnd, Name);
186 if (LLFunction* fn = llvm::dyn_cast<LLFunction>(Callee))
187 call->setAttributes(fn->getAttributes());
188 return call;
186 } 189 }
187 190
188 llvm::BasicBlock* postinvoke = llvm::BasicBlock::Create("postinvoke", topfunc(), scopeend()); 191 llvm::BasicBlock* postinvoke = llvm::BasicBlock::Create("postinvoke", topfunc(), scopeend());
189 llvm::InvokeInst* invoke = ir->CreateInvoke(Callee, postinvoke, pad, ArgBegin, ArgEnd, Name); 192 llvm::InvokeInst* invoke = ir->CreateInvoke(Callee, postinvoke, pad, ArgBegin, ArgEnd, Name);
193 if (LLFunction* fn = llvm::dyn_cast<LLFunction>(Callee))
194 invoke->setAttributes(fn->getAttributes());
190 scope() = IRScope(postinvoke, scopeend()); 195 scope() = IRScope(postinvoke, scopeend());
191 return invoke; 196 return invoke;
192 } 197 }
193 else 198 else
194 return ir->CreateCall(Callee, ArgBegin, ArgEnd, Name); 199 {
200 llvm::CallInst* call = ir->CreateCall(Callee, ArgBegin, ArgEnd, Name);
201 if (LLFunction* fn = llvm::dyn_cast<LLFunction>(Callee))
202 call->setAttributes(fn->getAttributes());
203 return call;
204 }
195 } 205 }
196 206
197 #endif // LDC_GEN_IRSTATE_H 207 #endif // LDC_GEN_IRSTATE_H