Mercurial > projects > ldc
annotate gen/runtime.cpp @ 445:cc40db549aea
Changed the handling of variadic intrinsics a bit.
Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues.
Changed the handling of parameter attributes to a bit more generalized approach.
Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 .
Parameter attribs now properly set for intrinsic calls if necessary.
Made the tango.math.Math patch less intrusive.
Fixed/added some mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 17:59:58 +0200 |
parents | 351c0077d0b3 |
children | d30c40f1128d |
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; |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
168 const LLType* realTy; |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
169 if (global.params.cpu == ARCHx86) |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
170 realTy = LLType::X86_FP80Ty; |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
171 else |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
172 realTy = LLType::DoubleTy; |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
173 const LLType* sizeTy = DtoSize_t(); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
174 const LLType* voidPtrTy = rt_ptr(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
175 const LLType* stringTy = rt_array(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
176 const LLType* wstringTy = rt_array(shortTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
177 const LLType* dstringTy = rt_array(intTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
178 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
|
179 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
|
180 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
|
181 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get()); |
132 | 182 |
183 ///////////////////////////////////////////////////////////////////////////////////// | |
184 ///////////////////////////////////////////////////////////////////////////////////// | |
185 ///////////////////////////////////////////////////////////////////////////////////// | |
186 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
187 // 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
|
188 // 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
|
189 // void _d_switch_error( char[] file, uint line ) |
132 | 190 { |
191 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
|
192 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
|
193 std::string fname3("_d_switch_error"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
194 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
|
195 types.push_back(stringTy); |
132 | 196 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
|
197 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
|
198 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
199 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
200 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
|
201 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
|
202 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
|
203 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
204 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
205 // 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
|
206 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
207 std::string fname("_d_assert_msg"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
208 std::vector<const LLType*> types; |
132 | 209 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
|
210 types.push_back(stringTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
211 types.push_back(intTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
212 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
|
213 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
214 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
215 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
216 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 217 } |
218 | |
219 ///////////////////////////////////////////////////////////////////////////////////// | |
220 ///////////////////////////////////////////////////////////////////////////////////// | |
221 ///////////////////////////////////////////////////////////////////////////////////// | |
222 | |
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 // void* _d_allocmemoryT(TypeInfo ti) |
132 | 224 { |
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
|
225 std::string fname("_d_allocmemoryT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
226 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
|
227 types.push_back(typeInfoTy); |
132 | 228 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
|
229 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 230 } |
231 | |
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
|
232 // 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
|
233 // void* _d_newarrayiT(TypeInfo ti, size_t length) |
132 | 234 { |
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
|
235 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
|
236 std::string fname2("_d_newarrayiT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 } |
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
|
244 |
286
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
245 // 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
|
246 // 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
|
247 { |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
248 std::string fname("_d_newarraymT"); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
249 std::string fname2("_d_newarraymiT"); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
250 std::vector<const LLType*> types; |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
251 types.push_back(typeInfoTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
252 types.push_back(sizeTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
253 types.push_back(rt_ptr(sizeTy)); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
254 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
|
255 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
256 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
257 } |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
258 |
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
|
259 // 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
|
260 // 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
|
261 { |
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 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
|
263 std::string fname2("_d_arraysetlengthiT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
264 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
|
265 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
|
266 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
|
267 types.push_back(sizeTy); |
132 | 268 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
|
269 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
|
270 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
|
271 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 272 } |
273 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
274 // 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
|
275 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
276 std::string fname("_d_newclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
277 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
|
278 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
279 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
|
280 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
|
281 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
282 |
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 // 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
|
284 { |
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 std::string fname("_d_delarray"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 } |
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 // 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
|
294 // 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
|
295 // 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
|
296 { |
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 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
|
298 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
|
299 std::string fname3("_d_callfinalizer"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 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
|
304 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
|
305 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
|
306 } |
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
|
307 |
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 // 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
|
309 { |
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 std::string fname("_d_delclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 } |
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
|
316 |
132 | 317 ///////////////////////////////////////////////////////////////////////////////////// |
318 ///////////////////////////////////////////////////////////////////////////////////// | |
319 ///////////////////////////////////////////////////////////////////////////////////// | |
320 | |
321 #define ARRAY_INIT(TY,suffix) \ | |
322 { \ | |
323 std::string fname("_d_array_init_"); \ | |
324 fname.append(suffix); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
325 std::vector<const LLType*> types; \ |
132 | 326 types.push_back(rt_ptr(TY)); \ |
327 types.push_back(sizeTy); \ | |
328 types.push_back(TY); \ | |
329 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
|
330 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
132 | 331 } |
332 | |
333 ARRAY_INIT(boolTy,"i1") | |
334 ARRAY_INIT(byteTy,"i8") | |
335 ARRAY_INIT(shortTy,"i16") | |
336 ARRAY_INIT(intTy,"i32") | |
337 ARRAY_INIT(longTy,"i64") | |
338 ARRAY_INIT(floatTy,"float") | |
339 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
|
340 ARRAY_INIT(realTy,"real") |
132 | 341 ARRAY_INIT(voidPtrTy,"pointer") |
342 | |
343 #undef ARRAY_INIT | |
344 | |
345 // array init mem | |
346 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) | |
347 { | |
348 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
|
349 std::vector<const LLType*> types; |
132 | 350 types.push_back(voidPtrTy); |
351 types.push_back(sizeTy); | |
352 types.push_back(voidPtrTy); | |
353 types.push_back(sizeTy); | |
354 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
|
355 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 356 } |
357 | |
358 ///////////////////////////////////////////////////////////////////////////////////// | |
359 ///////////////////////////////////////////////////////////////////////////////////// | |
360 ///////////////////////////////////////////////////////////////////////////////////// | |
361 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
362 // int _aApplycd1(char[] aa, dg_t dg) |
132 | 363 #define STR_APPLY1(TY,a,b) \ |
364 { \ | |
365 std::string fname(a); \ | |
366 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
367 std::vector<const LLType*> types; \ |
132 | 368 types.push_back(TY); \ |
369 types.push_back(rt_dg1()); \ | |
370 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
|
371 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
372 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
373 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
374 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
|
375 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 376 } |
377 STR_APPLY1(stringTy, "_aApplycw1", "_aApplycd1") | |
378 STR_APPLY1(wstringTy, "_aApplywc1", "_aApplywd1") | |
379 STR_APPLY1(dstringTy, "_aApplydc1", "_aApplydw1") | |
380 #undef STR_APPLY | |
381 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
382 // int _aApplycd2(char[] aa, dg2_t dg) |
132 | 383 #define STR_APPLY2(TY,a,b) \ |
384 { \ | |
385 std::string fname(a); \ | |
386 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
387 std::vector<const LLType*> types; \ |
132 | 388 types.push_back(TY); \ |
389 types.push_back(rt_dg2()); \ | |
390 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
|
391 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
392 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
393 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
394 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
|
395 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 396 } |
397 STR_APPLY2(stringTy, "_aApplycw2", "_aApplycd2") | |
398 STR_APPLY2(wstringTy, "_aApplywc2", "_aApplywd2") | |
399 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | |
400 #undef STR_APPLY2 | |
401 | |
402 #define STR_APPLY_R1(TY,a,b) \ | |
403 { \ | |
404 std::string fname(a); \ | |
405 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
406 std::vector<const LLType*> types; \ |
132 | 407 types.push_back(TY); \ |
408 types.push_back(rt_dg1()); \ | |
409 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
|
410 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
411 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
412 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
413 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
|
414 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 415 } |
416 STR_APPLY_R1(stringTy, "_aApplyRcw1", "_aApplyRcd1") | |
417 STR_APPLY_R1(wstringTy, "_aApplyRwc1", "_aApplyRwd1") | |
418 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | |
419 #undef STR_APPLY | |
420 | |
421 #define STR_APPLY_R2(TY,a,b) \ | |
422 { \ | |
423 std::string fname(a); \ | |
424 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
425 std::vector<const LLType*> types; \ |
132 | 426 types.push_back(TY); \ |
427 types.push_back(rt_dg2()); \ | |
428 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
|
429 llvm::PAListPtr palist; \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
430 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
431 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); \ |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
432 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
|
433 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); \ |
132 | 434 } |
435 STR_APPLY_R2(stringTy, "_aApplyRcw2", "_aApplyRcd2") | |
436 STR_APPLY_R2(wstringTy, "_aApplyRwc2", "_aApplyRwd2") | |
437 STR_APPLY_R2(dstringTy, "_aApplyRdc2", "_aApplyRdw2") | |
438 #undef STR_APPLY2 | |
439 | |
440 ///////////////////////////////////////////////////////////////////////////////////// | |
441 ///////////////////////////////////////////////////////////////////////////////////// | |
442 ///////////////////////////////////////////////////////////////////////////////////// | |
443 | |
444 // fixes the length for dynamic array casts | |
445 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
446 { | |
447 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
|
448 std::vector<const LLType*> types; |
132 | 449 types.push_back(sizeTy); |
450 types.push_back(sizeTy); | |
451 types.push_back(sizeTy); | |
452 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
|
453 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 454 } |
455 | |
456 ///////////////////////////////////////////////////////////////////////////////////// | |
457 ///////////////////////////////////////////////////////////////////////////////////// | |
458 ///////////////////////////////////////////////////////////////////////////////////// | |
459 | |
460 // builds the d string[] for the D main args from the C main args | |
461 // void _d_main_args(uint n, char** args, ref char[][] res) | |
462 { | |
463 std::string fname("_d_main_args"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
464 std::vector<const LLType*> types; |
132 | 465 types.push_back(intTy); |
466 types.push_back(rt_ptr(rt_ptr(byteTy))); | |
467 types.push_back(rt_array(stringTy->getContainedType(0))); | |
468 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
|
469 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 470 } |
471 | |
472 ///////////////////////////////////////////////////////////////////////////////////// | |
473 ///////////////////////////////////////////////////////////////////////////////////// | |
474 ///////////////////////////////////////////////////////////////////////////////////// | |
475 | |
476 // cast to object | |
477 // Object _d_toObject(void* p) | |
478 { | |
479 std::string fname("_d_toObject"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
480 std::vector<const LLType*> types; |
132 | 481 types.push_back(voidPtrTy); |
482 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
|
483 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 484 } |
485 | |
486 // cast interface | |
487 // Object _d_interface_cast(void* p, ClassInfo c) | |
488 { | |
489 std::string fname("_d_interface_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
490 std::vector<const LLType*> types; |
132 | 491 types.push_back(voidPtrTy); |
492 types.push_back(classInfoTy); | |
493 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
|
494 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 495 } |
496 | |
497 // dynamic cast | |
498 // Object _d_dynamic_cast(Object o, ClassInfo c) | |
499 { | |
500 std::string fname("_d_dynamic_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
501 std::vector<const LLType*> types; |
132 | 502 types.push_back(objectTy); |
503 types.push_back(classInfoTy); | |
504 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
|
505 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 506 } |
507 | |
508 ///////////////////////////////////////////////////////////////////////////////////// | |
509 ///////////////////////////////////////////////////////////////////////////////////// | |
510 ///////////////////////////////////////////////////////////////////////////////////// | |
511 | |
512 // char[] _adReverseChar(char[] a) | |
513 // char[] _adSortChar(char[] a) | |
514 { | |
515 std::string fname("_adReverseChar"); | |
516 std::string fname2("_adSortChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
517 std::vector<const LLType*> types; |
132 | 518 types.push_back(stringTy); |
519 types.push_back(stringTy); | |
520 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
|
521 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
522 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
523 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
|
524 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 525 } |
526 | |
527 // wchar[] _adReverseWchar(wchar[] a) | |
528 // wchar[] _adSortWchar(wchar[] a) | |
529 { | |
530 std::string fname("_adReverseWchar"); | |
531 std::string fname2("_adSortWchar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
532 std::vector<const LLType*> types; |
132 | 533 types.push_back(wstringTy); |
534 types.push_back(wstringTy); | |
535 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
|
536 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
537 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
538 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
|
539 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 540 } |
541 | |
542 // Array _adReverse(Array a, size_t szelem) | |
543 { | |
544 std::string fname("_adReverse"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
545 std::vector<const LLType*> types; |
132 | 546 types.push_back(rt_array(byteTy)); |
547 types.push_back(rt_array(byteTy)); | |
548 types.push_back(sizeTy); | |
549 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
|
550 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
551 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
552 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 553 } |
554 | |
555 // Array _adDupT(TypeInfo ti, Array a) | |
556 { | |
557 std::string fname("_adDupT"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
558 std::vector<const LLType*> types; |
132 | 559 types.push_back(rt_array(byteTy)); |
560 types.push_back(typeInfoTy); | |
561 types.push_back(rt_array(byteTy)); | |
562 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
|
563 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
564 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
565 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 566 } |
567 | |
568 // int _adEq(Array a1, Array a2, TypeInfo ti) | |
569 // int _adCmp(Array a1, Array a2, TypeInfo ti) | |
570 { | |
571 std::string fname("_adEq"); | |
572 std::string fname2("_adCmp"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
573 std::vector<const LLType*> types; |
132 | 574 types.push_back(rt_array(byteTy)); |
575 types.push_back(rt_array(byteTy)); | |
576 types.push_back(typeInfoTy); | |
577 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
|
578 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
579 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
580 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
581 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
|
582 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setParamAttrs(palist); |
132 | 583 } |
584 | |
585 // int _adCmpChar(Array a1, Array a2) | |
586 { | |
587 std::string fname("_adCmpChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
588 std::vector<const LLType*> types; |
132 | 589 types.push_back(rt_array(byteTy)); |
590 types.push_back(rt_array(byteTy)); | |
591 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
|
592 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
593 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
594 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
595 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 596 } |
597 | |
598 // Array _adSort(Array a, TypeInfo ti) | |
599 { | |
600 std::string fname("_adSort"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
601 std::vector<const LLType*> types; |
132 | 602 types.push_back(rt_array(byteTy)); |
603 types.push_back(rt_array(byteTy)); | |
604 types.push_back(typeInfoTy); | |
605 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
|
606 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
607 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
608 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 609 } |
610 | |
611 ///////////////////////////////////////////////////////////////////////////////////// | |
612 ///////////////////////////////////////////////////////////////////////////////////// | |
613 ///////////////////////////////////////////////////////////////////////////////////// | |
614 | |
615 // size_t _aaLen(AA aa) | |
616 { | |
617 std::string fname("_aaLen"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
618 std::vector<const LLType*> types; |
132 | 619 types.push_back(aaTy); |
620 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
|
621 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 622 } |
623 | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
624 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
132 | 625 { |
626 std::string fname("_aaGet"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
627 std::vector<const LLType*> types; |
132 | 628 types.push_back(aaTy); |
629 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
|
630 types.push_back(sizeTy); |
132 | 631 types.push_back(voidPtrTy); |
632 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
|
633 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 634 } |
635 | |
636 // void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) | |
637 { | |
638 std::string fname("_aaGetRvalue"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
639 std::vector<const LLType*> types; |
132 | 640 types.push_back(aaTy); |
641 types.push_back(typeInfoTy); | |
642 types.push_back(sizeTy); | |
643 types.push_back(voidPtrTy); | |
644 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
|
645 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 646 } |
647 | |
648 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | |
649 { | |
650 std::string fname("_aaIn"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
651 std::vector<const LLType*> types; |
132 | 652 types.push_back(aaTy); |
653 types.push_back(typeInfoTy); | |
654 types.push_back(voidPtrTy); | |
655 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
|
656 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 657 } |
658 | |
659 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | |
660 { | |
661 std::string fname("_aaDel"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
662 std::vector<const LLType*> types; |
132 | 663 types.push_back(aaTy); |
664 types.push_back(typeInfoTy); | |
665 types.push_back(voidPtrTy); | |
666 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
|
667 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 668 } |
669 | |
670 // ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize) | |
671 { | |
672 std::string fname("_aaValues"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
673 std::vector<const LLType*> types; |
132 | 674 types.push_back(rt_array(byteTy)); |
675 types.push_back(aaTy); | |
676 types.push_back(sizeTy); | |
677 types.push_back(sizeTy); | |
678 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
|
679 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 680 } |
681 | |
682 // void* _aaRehash(AA* paa, TypeInfo keyti) | |
683 { | |
684 std::string fname("_aaRehash"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
685 std::vector<const LLType*> types; |
132 | 686 types.push_back(aaTy); |
687 types.push_back(typeInfoTy); | |
688 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
|
689 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 690 } |
691 | |
692 // ArrayRet_t _aaKeys(AA aa, size_t keysize) | |
693 { | |
694 std::string fname("_aaKeys"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
695 std::vector<const LLType*> types; |
132 | 696 types.push_back(rt_array(byteTy)); |
697 types.push_back(aaTy); | |
698 types.push_back(sizeTy); | |
699 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
|
700 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 701 } |
702 | |
703 // int _aaApply(AA aa, size_t keysize, dg_t dg) | |
704 { | |
705 std::string fname("_aaApply"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
706 std::vector<const LLType*> types; |
132 | 707 types.push_back(aaTy); |
708 types.push_back(sizeTy); | |
709 types.push_back(rt_dg1()); | |
710 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
|
711 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
712 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
713 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 714 } |
715 | |
716 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | |
717 { | |
718 std::string fname("_aaApply2"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
719 std::vector<const LLType*> types; |
132 | 720 types.push_back(aaTy); |
721 types.push_back(sizeTy); | |
722 types.push_back(rt_dg1()); | |
723 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
|
724 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
725 palist = palist.addAttr(3, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
726 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist); |
132 | 727 } |
728 | |
729 ///////////////////////////////////////////////////////////////////////////////////// | |
730 ///////////////////////////////////////////////////////////////////////////////////// | |
731 ///////////////////////////////////////////////////////////////////////////////////// | |
732 | |
733 // void _moduleCtor() | |
734 // void _moduleDtor() | |
735 { | |
736 std::string fname("_moduleCtor"); | |
737 std::string fname2("_moduleDtor"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
738 std::vector<const LLType*> types; |
132 | 739 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
|
740 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
|
741 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 742 } |
743 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
744 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
747 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
748 // 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
|
749 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
750 std::string fname("_d_toObject"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
751 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
|
752 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
753 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
|
754 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
|
755 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
756 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
757 // 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
|
758 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
759 std::string fname("_d_dynamic_cast"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
760 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
|
761 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
762 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
763 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
|
764 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
|
765 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
766 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
767 // 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
|
768 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
769 std::string fname("_d_interface_cast"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
770 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
|
771 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
772 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
773 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
|
774 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
|
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
780 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
781 // 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
|
782 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
783 std::string fname("_d_throw_exception"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
784 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
|
785 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
786 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
|
787 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
|
788 } |
191
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
793 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
794 // 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
|
795 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
796 std::string fname("_d_switch_string"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
797 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
|
798 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
|
799 types.push_back(stringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
800 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
|
801 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
802 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
803 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
804 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
|
805 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
806 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
807 // 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
|
808 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
809 std::string fname("_d_switch_ustring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
810 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
|
811 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
|
812 types.push_back(wstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
813 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
|
814 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
815 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
816 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
817 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
|
818 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
819 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
820 // 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
|
821 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
822 std::string fname("_d_switch_dstring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
823 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
|
824 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
|
825 types.push_back(dstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
826 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
|
827 llvm::PAListPtr palist; |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
828 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
829 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); |
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
830 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
|
831 } |
132 | 832 |
309 | 833 ///////////////////////////////////////////////////////////////////////////////////// |
834 ///////////////////////////////////////////////////////////////////////////////////// | |
835 ///////////////////////////////////////////////////////////////////////////////////// | |
132 | 836 |
309 | 837 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) |
838 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) | |
839 { | |
840 std::string fname("_d_criticalenter"); | |
841 std::string fname2("_d_criticalexit"); | |
842 std::vector<const LLType*> types; | |
843 types.push_back(rt_ptr(DtoMutexType())); | |
844 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
845 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
846 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
847 } | |
132 | 848 |
309 | 849 // void _d_monitorenter(Object h) |
850 // void _d_monitorexit(Object h) | |
851 { | |
852 std::string fname("_d_monitorenter"); | |
853 std::string fname2("_d_monitorexit"); | |
854 std::vector<const LLType*> types; | |
855 types.push_back(objectTy); | |
856 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
857 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
858 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
859 } | |
314
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
864 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
865 // 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
|
866 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
867 std::string fname("_d_eh_personality"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
868 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
869 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
870 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
871 types.push_back(longTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
872 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
873 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
874 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
|
875 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
|
876 } |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
877 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
878 // void _d_eh_resume_unwind(ptr exc_struct) |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
879 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
880 std::string fname("_d_eh_resume_unwind"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
881 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
882 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
883 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
|
884 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
|
885 } |
309 | 886 } |