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