Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 414:ac1fcc138e42
Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Cleaned up CallExp::toElem, moved implementation to tocall.cpp providing a single procedure to call arbitrary D functions fairly easily.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 28 Jul 2008 02:11:34 +0200 |
parents | 6590ec13f14d |
children | cc40db549aea |
comparison
equal
deleted
inserted
replaced
413:1a9bdbd4ac60 | 414:ac1fcc138e42 |
---|---|
281 return llvm::GlobalValue::ExternalLinkage; | 281 return llvm::GlobalValue::ExternalLinkage; |
282 } | 282 } |
283 | 283 |
284 ////////////////////////////////////////////////////////////////////////////////////////// | 284 ////////////////////////////////////////////////////////////////////////////////////////// |
285 | 285 |
286 unsigned DtoCallingConv(LINK l) | |
287 { | |
288 if (l == LINKc || l == LINKcpp) | |
289 return llvm::CallingConv::C; | |
290 else if (l == LINKd || l == LINKdefault) | |
291 return llvm::CallingConv::Fast; | |
292 else if (l == LINKwindows) | |
293 return llvm::CallingConv::X86_StdCall; | |
294 else | |
295 assert(0 && "Unsupported calling convention"); | |
296 } | |
297 | |
298 ////////////////////////////////////////////////////////////////////////////////////////// | |
299 | |
300 LLValue* DtoPointedType(LLValue* ptr, LLValue* val) | 286 LLValue* DtoPointedType(LLValue* ptr, LLValue* val) |
301 { | 287 { |
302 const LLType* ptrTy = ptr->getType()->getContainedType(0); | 288 const LLType* ptrTy = ptr->getType()->getContainedType(0); |
303 const LLType* valTy = val->getType(); | 289 const LLType* valTy = val->getType(); |
304 // ptr points to val's type | 290 // ptr points to val's type |
592 } | 578 } |
593 | 579 |
594 const LLStructType* isaStruct(const LLType* t) | 580 const LLStructType* isaStruct(const LLType* t) |
595 { | 581 { |
596 return llvm::dyn_cast<LLStructType>(t); | 582 return llvm::dyn_cast<LLStructType>(t); |
583 } | |
584 | |
585 const LLFunctionType* isaFunction(LLValue* v) | |
586 { | |
587 return llvm::dyn_cast<LLFunctionType>(v->getType()); | |
588 } | |
589 | |
590 const LLFunctionType* isaFunction(const LLType* t) | |
591 { | |
592 return llvm::dyn_cast<LLFunctionType>(t); | |
597 } | 593 } |
598 | 594 |
599 LLConstant* isaConstant(LLValue* v) | 595 LLConstant* isaConstant(LLValue* v) |
600 { | 596 { |
601 return llvm::dyn_cast<llvm::Constant>(v); | 597 return llvm::dyn_cast<llvm::Constant>(v); |