Mercurial > projects > ldc
annotate gen/runtime.cpp @ 424:c8d98ccad0cc
Error if static array is cast to an array such that oldarraysize % newelemsize != 0.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 29 Jul 2008 12:32:01 +0200 |
parents | 351c0077d0b3 |
children | cc40db549aea |
rev | line source |
---|---|
1 | 1 #include <cassert> |
2 | |
52 | 3 #include "gen/llvm.h" |
1 | 4 #include "llvm/Module.h" |
5 #include "llvm/Bitcode/ReaderWriter.h" | |
6 #include "llvm/Support/MemoryBuffer.h" | |
7 | |
8 #include "root.h" | |
9 #include "mars.h" | |
132 | 10 #include "lexer.h" |
11 #include "dsymbol.h" | |
12 #include "mtype.h" | |
13 #include "aggregate.h" | |
1 | 14 |
4
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
15 #include "gen/runtime.h" |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
16 #include "gen/logger.h" |
132 | 17 #include "gen/tollvm.h" |
157
5c17f81fc1c1
[svn r173] moved IR state previously stored in Type into IrType and a Type->IrType map; fixes #7
ChristianK
parents:
133
diff
changeset
|
18 #include "gen/irstate.h" |
4
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
19 |
1 | 20 static llvm::Module* M = NULL; |
21 static bool runtime_failed = false; | |
22 | |
132 | 23 static void LLVM_D_BuildRuntimeModule(); |
24 | |
52 | 25 ////////////////////////////////////////////////////////////////////////////////////////////////// |
26 | |
1 | 27 bool LLVM_D_InitRuntime() |
28 { | |
132 | 29 Logger::println("*** Initializing D runtime declarations ***"); |
1 | 30 LOG_SCOPE; |
31 | |
132 | 32 LLVM_D_BuildRuntimeModule(); |
33 return true; | |
1 | 34 } |
35 | |
36 void LLVM_D_FreeRuntime() | |
37 { | |
38 if (M) { | |
132 | 39 Logger::println("*** Freeing D runtime declarations ***"); |
1 | 40 delete M; |
132 | 41 M = NULL; |
1 | 42 } |
43 } | |
44 | |
52 | 45 ////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | |
1 | 47 llvm::Function* LLVM_D_GetRuntimeFunction(llvm::Module* target, const char* name) |
48 { | |
49 if (global.params.noruntime) { | |
50 error("No implicit runtime calls allowed with -noruntime option enabled"); | |
51 fatal(); | |
52 } | |
52 | 53 |
1 | 54 if (!M) { |
55 assert(!runtime_failed); | |
56 LLVM_D_InitRuntime(); | |
57 } | |
52 | 58 |
98
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
59 llvm::Function* fn = target->getFunction(name); |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
60 if (fn) |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
61 return fn; |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
62 |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
63 fn = M->getFunction(name); |
40 | 64 if (!fn) { |
98
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
65 printf("Runtime function '%s' was not found\n", name); |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
66 assert(0); |
40 | 67 //return NULL; |
68 } | |
52 | 69 |
1 | 70 const llvm::FunctionType* fnty = fn->getFunctionType(); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
71 llvm::Function* resfn = llvm::cast<llvm::Function>(target->getOrInsertFunction(name, fnty)); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
72 resfn->setParamAttrs(fn->getParamAttrs()); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
73 return resfn; |
1 | 74 } |
40 | 75 |
52 | 76 ////////////////////////////////////////////////////////////////////////////////////////////////// |
77 | |
78 llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* name) | |
79 { | |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
80 llvm::GlobalVariable* gv = target->getNamedGlobal(name); |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
81 if (gv) { |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
82 return gv; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
83 } |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
84 |
52 | 85 if (global.params.noruntime) { |
86 error("No implicit runtime calls allowed with -noruntime option enabled"); | |
87 fatal(); | |
88 } | |
89 | |
90 if (!M) { | |
91 assert(!runtime_failed); | |
92 LLVM_D_InitRuntime(); | |
93 } | |
94 | |
95 llvm::GlobalVariable* g = M->getNamedGlobal(name); | |
96 if (!g) { | |
97 error("Runtime global '%s' was not found", name); | |
98 fatal(); | |
99 //return NULL; | |
100 } | |
101 | |
102 const llvm::PointerType* t = g->getType(); | |
103 return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target); | |
104 } | |
132 | 105 |
106 ////////////////////////////////////////////////////////////////////////////////////////////////// | |
107 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
108 static const LLType* rt_ptr(const LLType* t) |
132 | 109 { |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
110 return getPtrToType(t); |
132 | 111 } |
112 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
113 static const LLType* rt_array(const LLType* elemty) |
132 | 114 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
115 std::vector<const LLType*> t; |
132 | 116 t.push_back(DtoSize_t()); |
117 t.push_back(rt_ptr(elemty)); | |
118 return rt_ptr(llvm::StructType::get(t)); | |
119 } | |
120 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
121 static const LLType* rt_array2(const LLType* elemty) |
197
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
122 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
123 std::vector<const LLType*> t; |
197
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
124 t.push_back(DtoSize_t()); |
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
125 t.push_back(rt_ptr(elemty)); |
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
126 return llvm::StructType::get(t); |
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
127 } |
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
128 |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
129 static const LLType* rt_dg1() |
132 | 130 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
131 std::vector<const LLType*> types; |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
132 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
133 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
134 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); |
132 | 135 |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
136 std::vector<const LLType*> t; |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
137 t.push_back(rt_ptr(LLType::Int8Ty)); |
132 | 138 t.push_back(rt_ptr(fty)); |
139 return rt_ptr(llvm::StructType::get(t)); | |
140 } | |
141 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
142 static const LLType* rt_dg2() |
132 | 143 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
144 std::vector<const LLType*> types; |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
145 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
146 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
147 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
148 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); |
132 | 149 |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
150 std::vector<const LLType*> t; |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
151 t.push_back(rt_ptr(LLType::Int8Ty)); |
132 | 152 t.push_back(rt_ptr(fty)); |
153 return rt_ptr(llvm::StructType::get(t)); | |
154 } | |
155 | |
156 static void LLVM_D_BuildRuntimeModule() | |
157 { | |
158 M = new llvm::Module("llvmdc internal runtime"); | |
159 | |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
160 const LLType* voidTy = LLType::VoidTy; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
161 const LLType* boolTy = LLType::Int1Ty; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
162 const LLType* byteTy = LLType::Int8Ty; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
163 const LLType* shortTy = LLType::Int16Ty; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
164 const LLType* intTy = LLType::Int32Ty; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
165 const LLType* longTy = LLType::Int64Ty; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
166 const LLType* floatTy = LLType::FloatTy; |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
167 const LLType* doubleTy = LLType::DoubleTy; |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
314
diff
changeset
|
168 const LLType* realTy = (global.params.useFP80) ? LLType::X86_FP80Ty : LLType::DoubleTy; |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
169 const LLType* sizeTy = DtoSize_t(); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
170 const LLType* voidPtrTy = rt_ptr(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
171 const LLType* stringTy = rt_array(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
172 const LLType* wstringTy = rt_array(shortTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
173 const LLType* dstringTy = rt_array(intTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
174 const LLType* objectTy = rt_ptr(ClassDeclaration::object->type->ir.type->get()); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
175 const LLType* classInfoTy = rt_ptr(ClassDeclaration::classinfo->type->ir.type->get()); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
176 const LLType* typeInfoTy = rt_ptr(Type::typeinfo->type->ir.type->get()); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
177 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get()); |
132 | 178 |
179 ///////////////////////////////////////////////////////////////////////////////////// | |
180 ///////////////////////////////////////////////////////////////////////////////////// | |
181 ///////////////////////////////////////////////////////////////////////////////////// | |
182 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
183 // void _d_assert( char[] file, uint line ) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
184 // void _d_array_bounds( char[] file, uint line ) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
185 // void _d_switch_error( char[] file, uint line ) |
132 | 186 { |
187 std::string fname("_d_assert"); | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
188 std::string fname2("_d_array_bounds"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
189 std::string fname3("_d_switch_error"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
190 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
191 types.push_back(stringTy); |
132 | 192 types.push_back(intTy); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
193 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
194 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
195 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
196 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
197 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
198 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M)->setParamAttrs(palist); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
199 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
200 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
201 // void _d_assert_msg( char[] msg, char[] file, uint line ) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
202 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
203 std::string fname("_d_assert_msg"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
204 std::vector<const LLType*> types; |
132 | 205 types.push_back(stringTy); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
206 types.push_back(stringTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
207 types.push_back(intTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
208 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
209 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
210 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
211 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
212 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 213 } |
214 | |
215 ///////////////////////////////////////////////////////////////////////////////////// | |
216 ///////////////////////////////////////////////////////////////////////////////////// | |
217 ///////////////////////////////////////////////////////////////////////////////////// | |
218 | |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
219 // void* _d_allocmemoryT(TypeInfo ti) |
132 | 220 { |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
221 std::string fname("_d_allocmemoryT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
222 std::vector<const LLType*> types; |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
223 types.push_back(typeInfoTy); |
132 | 224 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
225 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 226 } |
227 | |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
228 // void* _d_newarrayT(TypeInfo ti, size_t length) |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
229 // void* _d_newarrayiT(TypeInfo ti, size_t length) |
132 | 230 { |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
231 std::string fname("_d_newarrayT"); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
232 std::string fname2("_d_newarrayiT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
233 std::vector<const LLType*> types; |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
234 types.push_back(typeInfoTy); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
235 types.push_back(sizeTy); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
236 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
237 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
238 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
239 } |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
240 |
286
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
241 // void* _d_newarraymT(TypeInfo ti, size_t length, size_t* dims) |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
242 // void* _d_newarraymiT(TypeInfo ti, size_t length, size_t* dims) |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
243 { |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
244 std::string fname("_d_newarraymT"); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
245 std::string fname2("_d_newarraymiT"); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
246 std::vector<const LLType*> types; |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
247 types.push_back(typeInfoTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
248 types.push_back(sizeTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
249 types.push_back(rt_ptr(sizeTy)); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
250 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
251 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
252 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
253 } |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
254 |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
255 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
256 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
257 { |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
258 std::string fname("_d_arraysetlengthT"); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
259 std::string fname2("_d_arraysetlengthiT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
260 std::vector<const LLType*> types; |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
261 types.push_back(typeInfoTy); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
262 types.push_back(sizeTy); |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
263 types.push_back(sizeTy); |
132 | 264 types.push_back(voidPtrTy); |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
265 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
266 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
267 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 268 } |
269 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
270 // Object _d_newclass(ClassInfo ci) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
271 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
272 std::string fname("_d_newclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
273 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
274 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
275 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
276 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
277 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
278 |
209
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
279 // void _d_delarray(size_t plength, void* pdata) |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
280 { |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
281 std::string fname("_d_delarray"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
282 std::vector<const LLType*> types; |
209
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
283 types.push_back(sizeTy); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
284 types.push_back(voidPtrTy); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
285 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
286 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
287 } |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
288 |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
289 // void _d_delmemory(void* p) |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
290 // void _d_delinterface(void* p) |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
291 // void _d_callfinalizer(void* p) |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
292 { |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
293 std::string fname("_d_delmemory"); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
294 std::string fname2("_d_delinterface"); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
295 std::string fname3("_d_callfinalizer"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
296 std::vector<const LLType*> types; |
209
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
297 types.push_back(voidPtrTy); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
298 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
299 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
300 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
301 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
302 } |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
303 |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
304 // void _d_delclass(Object p) |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
305 { |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
306 std::string fname("_d_delclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
307 std::vector<const LLType*> types; |
209
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
308 types.push_back(objectTy); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
309 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
310 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
311 } |
c4c9b4ac021b
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
lindquist
parents:
205
diff
changeset
|
312 |
132 | 313 ///////////////////////////////////////////////////////////////////////////////////// |
314 ///////////////////////////////////////////////////////////////////////////////////// | |
315 ///////////////////////////////////////////////////////////////////////////////////// | |
316 | |
317 #define ARRAY_INIT(TY,suffix) \ | |
318 { \ | |
319 std::string fname("_d_array_init_"); \ | |
320 fname.append(suffix); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
321 std::vector<const LLType*> types; \ |
132 | 322 types.push_back(rt_ptr(TY)); \ |
323 types.push_back(sizeTy); \ | |
324 types.push_back(TY); \ | |
325 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \ | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
326 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
132 | 327 } |
328 | |
329 ARRAY_INIT(boolTy,"i1") | |
330 ARRAY_INIT(byteTy,"i8") | |
331 ARRAY_INIT(shortTy,"i16") | |
332 ARRAY_INIT(intTy,"i32") | |
333 ARRAY_INIT(longTy,"i64") | |
334 ARRAY_INIT(floatTy,"float") | |
335 ARRAY_INIT(doubleTy,"double") | |
339
385a18242485
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
lindquist
parents:
314
diff
changeset
|
336 ARRAY_INIT(realTy,"real") |
132 | 337 ARRAY_INIT(voidPtrTy,"pointer") |
338 | |
339 #undef ARRAY_INIT | |
340 | |
341 // array init mem | |
342 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) | |
343 { | |
344 std::string fname("_d_array_init_mem"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
345 std::vector<const LLType*> types; |
132 | 346 types.push_back(voidPtrTy); |
347 types.push_back(sizeTy); | |
348 types.push_back(voidPtrTy); | |
349 types.push_back(sizeTy); | |
350 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
351 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 352 } |
353 | |
354 ///////////////////////////////////////////////////////////////////////////////////// | |
355 ///////////////////////////////////////////////////////////////////////////////////// | |
356 ///////////////////////////////////////////////////////////////////////////////////// | |
357 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
358 // int _aApplycd1(char[] aa, dg_t dg) |
132 | 359 #define STR_APPLY1(TY,a,b) \ |
360 { \ | |
361 std::string fname(a); \ | |
362 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
363 std::vector<const LLType*> types; \ |
132 | 364 types.push_back(TY); \ |
365 types.push_back(rt_dg1()); \ | |
366 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
367 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
368 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
369 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
370 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
371 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 372 } |
373 STR_APPLY1(stringTy, "_aApplycw1", "_aApplycd1") | |
374 STR_APPLY1(wstringTy, "_aApplywc1", "_aApplywd1") | |
375 STR_APPLY1(dstringTy, "_aApplydc1", "_aApplydw1") | |
376 #undef STR_APPLY | |
377 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
378 // int _aApplycd2(char[] aa, dg2_t dg) |
132 | 379 #define STR_APPLY2(TY,a,b) \ |
380 { \ | |
381 std::string fname(a); \ | |
382 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
383 std::vector<const LLType*> types; \ |
132 | 384 types.push_back(TY); \ |
385 types.push_back(rt_dg2()); \ | |
386 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
387 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
388 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
389 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
390 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
391 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 392 } |
393 STR_APPLY2(stringTy, "_aApplycw2", "_aApplycd2") | |
394 STR_APPLY2(wstringTy, "_aApplywc2", "_aApplywd2") | |
395 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | |
396 #undef STR_APPLY2 | |
397 | |
398 #define STR_APPLY_R1(TY,a,b) \ | |
399 { \ | |
400 std::string fname(a); \ | |
401 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
402 std::vector<const LLType*> types; \ |
132 | 403 types.push_back(TY); \ |
404 types.push_back(rt_dg1()); \ | |
405 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
406 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
407 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
408 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
409 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
410 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 411 } |
412 STR_APPLY_R1(stringTy, "_aApplyRcw1", "_aApplyRcd1") | |
413 STR_APPLY_R1(wstringTy, "_aApplyRwc1", "_aApplyRwd1") | |
414 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | |
415 #undef STR_APPLY | |
416 | |
417 #define STR_APPLY_R2(TY,a,b) \ | |
418 { \ | |
419 std::string fname(a); \ | |
420 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
421 std::vector<const LLType*> types; \ |
132 | 422 types.push_back(TY); \ |
423 types.push_back(rt_dg2()); \ | |
424 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
425 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
426 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
427 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
428 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
429 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 430 } |
431 STR_APPLY_R2(stringTy, "_aApplyRcw2", "_aApplyRcd2") | |
432 STR_APPLY_R2(wstringTy, "_aApplyRwc2", "_aApplyRwd2") | |
433 STR_APPLY_R2(dstringTy, "_aApplyRdc2", "_aApplyRdw2") | |
434 #undef STR_APPLY2 | |
435 | |
436 ///////////////////////////////////////////////////////////////////////////////////// | |
437 ///////////////////////////////////////////////////////////////////////////////////// | |
438 ///////////////////////////////////////////////////////////////////////////////////// | |
439 | |
440 // fixes the length for dynamic array casts | |
441 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
442 { | |
443 std::string fname("_d_array_cast_len"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
444 std::vector<const LLType*> types; |
132 | 445 types.push_back(sizeTy); |
446 types.push_back(sizeTy); | |
447 types.push_back(sizeTy); | |
448 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
449 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 450 } |
451 | |
452 ///////////////////////////////////////////////////////////////////////////////////// | |
453 ///////////////////////////////////////////////////////////////////////////////////// | |
454 ///////////////////////////////////////////////////////////////////////////////////// | |
455 | |
456 // builds the d string[] for the D main args from the C main args | |
457 // void _d_main_args(uint n, char** args, ref char[][] res) | |
458 { | |
459 std::string fname("_d_main_args"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
460 std::vector<const LLType*> types; |
132 | 461 types.push_back(intTy); |
462 types.push_back(rt_ptr(rt_ptr(byteTy))); | |
463 types.push_back(rt_array(stringTy->getContainedType(0))); | |
464 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
465 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 466 } |
467 | |
468 ///////////////////////////////////////////////////////////////////////////////////// | |
469 ///////////////////////////////////////////////////////////////////////////////////// | |
470 ///////////////////////////////////////////////////////////////////////////////////// | |
471 | |
472 // cast to object | |
473 // Object _d_toObject(void* p) | |
474 { | |
475 std::string fname("_d_toObject"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
476 std::vector<const LLType*> types; |
132 | 477 types.push_back(voidPtrTy); |
478 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
479 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 480 } |
481 | |
482 // cast interface | |
483 // Object _d_interface_cast(void* p, ClassInfo c) | |
484 { | |
485 std::string fname("_d_interface_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
486 std::vector<const LLType*> types; |
132 | 487 types.push_back(voidPtrTy); |
488 types.push_back(classInfoTy); | |
489 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
490 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 491 } |
492 | |
493 // dynamic cast | |
494 // Object _d_dynamic_cast(Object o, ClassInfo c) | |
495 { | |
496 std::string fname("_d_dynamic_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
497 std::vector<const LLType*> types; |
132 | 498 types.push_back(objectTy); |
499 types.push_back(classInfoTy); | |
500 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
501 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 502 } |
503 | |
504 ///////////////////////////////////////////////////////////////////////////////////// | |
505 ///////////////////////////////////////////////////////////////////////////////////// | |
506 ///////////////////////////////////////////////////////////////////////////////////// | |
507 | |
508 // char[] _adReverseChar(char[] a) | |
509 // char[] _adSortChar(char[] a) | |
510 { | |
511 std::string fname("_adReverseChar"); | |
512 std::string fname2("_adSortChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
513 std::vector<const LLType*> types; |
132 | 514 types.push_back(stringTy); |
515 types.push_back(stringTy); | |
516 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
517 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
518 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
519 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
520 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 521 } |
522 | |
523 // wchar[] _adReverseWchar(wchar[] a) | |
524 // wchar[] _adSortWchar(wchar[] a) | |
525 { | |
526 std::string fname("_adReverseWchar"); | |
527 std::string fname2("_adSortWchar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
528 std::vector<const LLType*> types; |
132 | 529 types.push_back(wstringTy); |
530 types.push_back(wstringTy); | |
531 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
532 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
533 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
534 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
535 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 536 } |
537 | |
538 // Array _adReverse(Array a, size_t szelem) | |
539 { | |
540 std::string fname("_adReverse"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
541 std::vector<const LLType*> types; |
132 | 542 types.push_back(rt_array(byteTy)); |
543 types.push_back(rt_array(byteTy)); | |
544 types.push_back(sizeTy); | |
545 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
546 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
547 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
548 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 549 } |
550 | |
551 // Array _adDupT(TypeInfo ti, Array a) | |
552 { | |
553 std::string fname("_adDupT"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
554 std::vector<const LLType*> types; |
132 | 555 types.push_back(rt_array(byteTy)); |
556 types.push_back(typeInfoTy); | |
557 types.push_back(rt_array(byteTy)); | |
558 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
559 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
560 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
561 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 562 } |
563 | |
564 // int _adEq(Array a1, Array a2, TypeInfo ti) | |
565 // int _adCmp(Array a1, Array a2, TypeInfo ti) | |
566 { | |
567 std::string fname("_adEq"); | |
568 std::string fname2("_adCmp"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
569 std::vector<const LLType*> types; |
132 | 570 types.push_back(rt_array(byteTy)); |
571 types.push_back(rt_array(byteTy)); | |
572 types.push_back(typeInfoTy); | |
573 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
574 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
575 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
576 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
577 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
578 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 579 } |
580 | |
581 // int _adCmpChar(Array a1, Array a2) | |
582 { | |
583 std::string fname("_adCmpChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
584 std::vector<const LLType*> types; |
132 | 585 types.push_back(rt_array(byteTy)); |
586 types.push_back(rt_array(byteTy)); | |
587 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
588 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
589 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
590 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
591 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 592 } |
593 | |
594 // Array _adSort(Array a, TypeInfo ti) | |
595 { | |
596 std::string fname("_adSort"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
597 std::vector<const LLType*> types; |
132 | 598 types.push_back(rt_array(byteTy)); |
599 types.push_back(rt_array(byteTy)); | |
600 types.push_back(typeInfoTy); | |
601 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
602 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
603 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
604 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 605 } |
606 | |
607 ///////////////////////////////////////////////////////////////////////////////////// | |
608 ///////////////////////////////////////////////////////////////////////////////////// | |
609 ///////////////////////////////////////////////////////////////////////////////////// | |
610 | |
611 // size_t _aaLen(AA aa) | |
612 { | |
613 std::string fname("_aaLen"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
614 std::vector<const LLType*> types; |
132 | 615 types.push_back(aaTy); |
616 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
617 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 618 } |
619 | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
620 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
132 | 621 { |
622 std::string fname("_aaGet"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
623 std::vector<const LLType*> types; |
132 | 624 types.push_back(aaTy); |
625 types.push_back(typeInfoTy); | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
626 types.push_back(sizeTy); |
132 | 627 types.push_back(voidPtrTy); |
628 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
629 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 630 } |
631 | |
632 // void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) | |
633 { | |
634 std::string fname("_aaGetRvalue"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
635 std::vector<const LLType*> types; |
132 | 636 types.push_back(aaTy); |
637 types.push_back(typeInfoTy); | |
638 types.push_back(sizeTy); | |
639 types.push_back(voidPtrTy); | |
640 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
641 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 642 } |
643 | |
644 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | |
645 { | |
646 std::string fname("_aaIn"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
647 std::vector<const LLType*> types; |
132 | 648 types.push_back(aaTy); |
649 types.push_back(typeInfoTy); | |
650 types.push_back(voidPtrTy); | |
651 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
652 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 653 } |
654 | |
655 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | |
656 { | |
657 std::string fname("_aaDel"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
658 std::vector<const LLType*> types; |
132 | 659 types.push_back(aaTy); |
660 types.push_back(typeInfoTy); | |
661 types.push_back(voidPtrTy); | |
662 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
663 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 664 } |
665 | |
666 // ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize) | |
667 { | |
668 std::string fname("_aaValues"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
669 std::vector<const LLType*> types; |
132 | 670 types.push_back(rt_array(byteTy)); |
671 types.push_back(aaTy); | |
672 types.push_back(sizeTy); | |
673 types.push_back(sizeTy); | |
674 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
675 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 676 } |
677 | |
678 // void* _aaRehash(AA* paa, TypeInfo keyti) | |
679 { | |
680 std::string fname("_aaRehash"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
681 std::vector<const LLType*> types; |
132 | 682 types.push_back(aaTy); |
683 types.push_back(typeInfoTy); | |
684 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
685 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 686 } |
687 | |
688 // ArrayRet_t _aaKeys(AA aa, size_t keysize) | |
689 { | |
690 std::string fname("_aaKeys"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
691 std::vector<const LLType*> types; |
132 | 692 types.push_back(rt_array(byteTy)); |
693 types.push_back(aaTy); | |
694 types.push_back(sizeTy); | |
695 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
696 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 697 } |
698 | |
699 // int _aaApply(AA aa, size_t keysize, dg_t dg) | |
700 { | |
701 std::string fname("_aaApply"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
702 std::vector<const LLType*> types; |
132 | 703 types.push_back(aaTy); |
704 types.push_back(sizeTy); | |
705 types.push_back(rt_dg1()); | |
706 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
707 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
708 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
709 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 710 } |
711 | |
712 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | |
713 { | |
714 std::string fname("_aaApply2"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
715 std::vector<const LLType*> types; |
132 | 716 types.push_back(aaTy); |
717 types.push_back(sizeTy); | |
718 types.push_back(rt_dg1()); | |
719 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
720 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
721 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
722 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 723 } |
724 | |
725 ///////////////////////////////////////////////////////////////////////////////////// | |
726 ///////////////////////////////////////////////////////////////////////////////////// | |
727 ///////////////////////////////////////////////////////////////////////////////////// | |
728 | |
729 // void _moduleCtor() | |
730 // void _moduleDtor() | |
731 { | |
732 std::string fname("_moduleCtor"); | |
733 std::string fname2("_moduleDtor"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
734 std::vector<const LLType*> types; |
132 | 735 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
736 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
737 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 738 } |
739 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
740 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
741 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
742 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
743 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
744 // Object _d_toObject(void* p) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
745 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
746 std::string fname("_d_toObject"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
747 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
748 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
749 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
750 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
751 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
752 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
753 // Object _d_dynamic_cast(Object o, ClassInfo c) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
754 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
755 std::string fname("_d_dynamic_cast"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
756 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
757 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
758 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
759 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
760 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
761 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
762 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
763 // Object _d_interface_cast(void* p, ClassInfo c) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
764 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
765 std::string fname("_d_interface_cast"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
766 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
767 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
768 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
769 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
770 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
771 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
772 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
773 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
774 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
775 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
776 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
777 // void _d_throw_exception(Object e) |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
778 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
779 std::string fname("_d_throw_exception"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
780 std::vector<const LLType*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
781 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
782 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
205
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
783 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
784 } |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
785 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
786 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
787 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
788 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
789 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
790 // int _d_switch_string(char[][] table, char[] ca) |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
791 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
792 std::string fname("_d_switch_string"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
793 std::vector<const LLType*> types; |
197
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
794 types.push_back(rt_array(rt_array2(byteTy))); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
795 types.push_back(stringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
796 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
797 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
798 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
799 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
800 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
801 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
802 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
803 // int _d_switch_ustring(wchar[][] table, wchar[] ca) |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
804 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
805 std::string fname("_d_switch_ustring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
806 std::vector<const LLType*> types; |
197
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
807 types.push_back(rt_array(rt_array2(shortTy))); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
808 types.push_back(wstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
809 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
810 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
811 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
812 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
813 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
814 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
815 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
816 // int _d_switch_dstring(dchar[][] table, dchar[] ca) |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
817 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
818 std::string fname("_d_switch_dstring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
819 std::vector<const LLType*> types; |
197
bfcb657756f6
[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'.
lindquist
parents:
191
diff
changeset
|
820 types.push_back(rt_array(rt_array2(intTy))); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
821 types.push_back(dstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
822 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
823 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
824 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
825 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
826 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
827 } |
132 | 828 |
309 | 829 ///////////////////////////////////////////////////////////////////////////////////// |
830 ///////////////////////////////////////////////////////////////////////////////////// | |
831 ///////////////////////////////////////////////////////////////////////////////////// | |
132 | 832 |
309 | 833 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) |
834 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) | |
835 { | |
836 std::string fname("_d_criticalenter"); | |
837 std::string fname2("_d_criticalexit"); | |
838 std::vector<const LLType*> types; | |
839 types.push_back(rt_ptr(DtoMutexType())); | |
840 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
841 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
842 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
843 } | |
132 | 844 |
309 | 845 // void _d_monitorenter(Object h) |
846 // void _d_monitorexit(Object h) | |
847 { | |
848 std::string fname("_d_monitorenter"); | |
849 std::string fname2("_d_monitorexit"); | |
850 std::vector<const LLType*> types; | |
851 types.push_back(objectTy); | |
852 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
853 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
854 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
855 } | |
314
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
856 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
857 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
858 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
859 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
860 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
861 // int _d_eh_personality(int ver, int actions, ulong eh_class, ptr eh_info, ptr context) |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
862 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
863 std::string fname("_d_eh_personality"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
864 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
865 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
866 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
867 types.push_back(longTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
868 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
869 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
870 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
871 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
872 } |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
873 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
874 // void _d_eh_resume_unwind(ptr exc_struct) |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
875 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
876 std::string fname("_d_eh_resume_unwind"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
877 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
878 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
879 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
880 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
881 } |
309 | 882 } |