Mercurial > projects > ldc
comparison gen/runtime.cpp @ 197:bfcb657756f6 trunk
[svn r213] Fixed: foreach on an object seems to have been broken, the issue was that DMD generates an implicit delegate with conflicting types for 'this'.
Fixed: string switch runtime support had wrong param types.
Fixed: string switch on a temporary slice was broken.
author | lindquist |
---|---|
date | Mon, 12 May 2008 20:02:52 +0200 |
parents | 2900754a6989 |
children | e881c9b1c738 |
comparison
equal
deleted
inserted
replaced
196:48bebfd701a5 | 197:bfcb657756f6 |
---|---|
141 { | 141 { |
142 std::vector<const llvm::Type*> t; | 142 std::vector<const llvm::Type*> t; |
143 t.push_back(DtoSize_t()); | 143 t.push_back(DtoSize_t()); |
144 t.push_back(rt_ptr(elemty)); | 144 t.push_back(rt_ptr(elemty)); |
145 return rt_ptr(llvm::StructType::get(t)); | 145 return rt_ptr(llvm::StructType::get(t)); |
146 } | |
147 | |
148 static const llvm::Type* rt_array2(const llvm::Type* elemty) | |
149 { | |
150 std::vector<const llvm::Type*> t; | |
151 t.push_back(DtoSize_t()); | |
152 t.push_back(rt_ptr(elemty)); | |
153 return llvm::StructType::get(t); | |
146 } | 154 } |
147 | 155 |
148 static const llvm::Type* rt_dg1() | 156 static const llvm::Type* rt_dg1() |
149 { | 157 { |
150 std::vector<const llvm::Type*> types; | 158 std::vector<const llvm::Type*> types; |
703 | 711 |
704 // int _d_switch_string(char[][] table, char[] ca) | 712 // int _d_switch_string(char[][] table, char[] ca) |
705 { | 713 { |
706 std::string fname("_d_switch_string"); | 714 std::string fname("_d_switch_string"); |
707 std::vector<const llvm::Type*> types; | 715 std::vector<const llvm::Type*> types; |
708 types.push_back(rt_array(stringTy)); | 716 types.push_back(rt_array(rt_array2(byteTy))); |
709 types.push_back(stringTy); | 717 types.push_back(stringTy); |
710 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 718 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
711 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 719 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
712 } | 720 } |
713 | 721 |
714 // int _d_switch_ustring(wchar[][] table, wchar[] ca) | 722 // int _d_switch_ustring(wchar[][] table, wchar[] ca) |
715 { | 723 { |
716 std::string fname("_d_switch_ustring"); | 724 std::string fname("_d_switch_ustring"); |
717 std::vector<const llvm::Type*> types; | 725 std::vector<const llvm::Type*> types; |
718 types.push_back(rt_array(wstringTy)); | 726 types.push_back(rt_array(rt_array2(shortTy))); |
719 types.push_back(wstringTy); | 727 types.push_back(wstringTy); |
720 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 728 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
721 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 729 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
722 } | 730 } |
723 | 731 |
724 // int _d_switch_dstring(dchar[][] table, dchar[] ca) | 732 // int _d_switch_dstring(dchar[][] table, dchar[] ca) |
725 { | 733 { |
726 std::string fname("_d_switch_dstring"); | 734 std::string fname("_d_switch_dstring"); |
727 std::vector<const llvm::Type*> types; | 735 std::vector<const llvm::Type*> types; |
728 types.push_back(rt_array(dstringTy)); | 736 types.push_back(rt_array(rt_array2(intTy))); |
729 types.push_back(dstringTy); | 737 types.push_back(dstringTy); |
730 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 738 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
731 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 739 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
732 } | 740 } |
733 } | 741 } |