Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/gen/tollvm.cpp Sun Jul 27 18:52:40 2008 +0200 +++ b/gen/tollvm.cpp Mon Jul 28 02:11:34 2008 +0200 @@ -283,20 +283,6 @@ ////////////////////////////////////////////////////////////////////////////////////////// -unsigned DtoCallingConv(LINK l) -{ - if (l == LINKc || l == LINKcpp) - return llvm::CallingConv::C; - else if (l == LINKd || l == LINKdefault) - return llvm::CallingConv::Fast; - else if (l == LINKwindows) - return llvm::CallingConv::X86_StdCall; - else - assert(0 && "Unsupported calling convention"); -} - -////////////////////////////////////////////////////////////////////////////////////////// - LLValue* DtoPointedType(LLValue* ptr, LLValue* val) { const LLType* ptrTy = ptr->getType()->getContainedType(0); @@ -596,6 +582,16 @@ return llvm::dyn_cast<LLStructType>(t); } +const LLFunctionType* isaFunction(LLValue* v) +{ + return llvm::dyn_cast<LLFunctionType>(v->getType()); +} + +const LLFunctionType* isaFunction(const LLType* t) +{ + return llvm::dyn_cast<LLFunctionType>(t); +} + LLConstant* isaConstant(LLValue* v) { return llvm::dyn_cast<llvm::Constant>(v);