Mercurial > projects > ldc
diff gen/runtime.cpp @ 133:44a95ac7368a trunk
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
In particular, assertions has been fixed to include file/line info, and much more!
author | lindquist |
---|---|
date | Mon, 14 Jan 2008 05:11:54 +0100 |
parents | 1700239cab2e |
children | 5c17f81fc1c1 |
line wrap: on
line diff
--- a/gen/runtime.cpp Fri Jan 11 17:57:40 2008 +0100 +++ b/gen/runtime.cpp Mon Jan 14 05:11:54 2008 +0100 @@ -133,7 +133,7 @@ static const llvm::Type* rt_ptr(const llvm::Type* t) { - return llvm::PointerType::get(t); + return getPtrToType(t); } static const llvm::Type* rt_array(const llvm::Type* elemty) @@ -197,15 +197,30 @@ ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - // assert - // void _d_assert(bool cond, uint line, char[] msg) + // void _d_assert( char[] file, uint line ) + // void _d_array_bounds( char[] file, uint line ) + // void _d_switch_error( char[] file, uint line ) { std::string fname("_d_assert"); + std::string fname2("_d_array_bounds"); + std::string fname3("_d_switch_error"); std::vector<const llvm::Type*> types; - types.push_back(boolTy); + types.push_back(stringTy); types.push_back(intTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); + } + + // void _d_assert_msg( char[] msg, char[] file, uint line ) + { + std::string fname("_d_assert_msg"); + std::vector<const llvm::Type*> types; types.push_back(stringTy); - const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); + types.push_back(stringTy); + types.push_back(intTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); } @@ -234,6 +249,15 @@ new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); } + // Object _d_newclass(ClassInfo ci) + { + std::string fname("_d_newclass"); + std::vector<const llvm::Type*> types; + types.push_back(classInfoTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// @@ -626,6 +650,51 @@ new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); } + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + // Object _d_toObject(void* p) + { + std::string fname("_d_toObject"); + std::vector<const llvm::Type*> types; + types.push_back(voidPtrTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + + // Object _d_dynamic_cast(Object o, ClassInfo c) + { + std::string fname("_d_dynamic_cast"); + std::vector<const llvm::Type*> types; + types.push_back(objectTy); + types.push_back(classInfoTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + + // Object _d_interface_cast(void* p, ClassInfo c) + { + std::string fname("_d_interface_cast"); + std::vector<const llvm::Type*> types; + types.push_back(voidPtrTy); + types.push_back(classInfoTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } + + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////// + + // void _d_throw_exception(Object e) + { + std::string fname("_d_throw_exception"); + std::vector<const llvm::Type*> types; + types.push_back(objectTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); + new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); + } }