Mercurial > projects > ldc
annotate gen/runtime.cpp @ 205:9d44ec83acd1 trunk
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
Fixed: Implemented volatile statements. Uses the LLVM memory barrier intrinsic, closes #21 .
author | lindquist |
---|---|
date | Tue, 13 May 2008 17:58:11 +0200 |
parents | e881c9b1c738 |
children | c4c9b4ac021b |
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(); |
100 return llvm::cast<llvm::Function>(target->getOrInsertFunction(name, fnty)); | |
101 } | |
40 | 102 |
52 | 103 ////////////////////////////////////////////////////////////////////////////////////////////////// |
104 | |
105 llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* name) | |
106 { | |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
107 llvm::GlobalVariable* gv = target->getNamedGlobal(name); |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
108 if (gv) { |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
109 return gv; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
110 } |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
111 |
52 | 112 if (global.params.noruntime) { |
113 error("No implicit runtime calls allowed with -noruntime option enabled"); | |
114 fatal(); | |
115 } | |
116 | |
117 if (!M) { | |
118 assert(!runtime_failed); | |
119 LLVM_D_InitRuntime(); | |
120 } | |
121 | |
122 llvm::GlobalVariable* g = M->getNamedGlobal(name); | |
123 if (!g) { | |
124 error("Runtime global '%s' was not found", name); | |
125 fatal(); | |
126 //return NULL; | |
127 } | |
128 | |
129 const llvm::PointerType* t = g->getType(); | |
130 return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target); | |
131 } | |
132 | 132 |
133 ////////////////////////////////////////////////////////////////////////////////////////////////// | |
134 | |
135 static const llvm::Type* rt_ptr(const llvm::Type* t) | |
136 { | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
137 return getPtrToType(t); |
132 | 138 } |
139 | |
140 static const llvm::Type* rt_array(const llvm::Type* elemty) | |
141 { | |
142 std::vector<const llvm::Type*> t; | |
143 t.push_back(DtoSize_t()); | |
144 t.push_back(rt_ptr(elemty)); | |
145 return rt_ptr(llvm::StructType::get(t)); | |
146 } | |
147 | |
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
|
148 static const llvm::Type* rt_array2(const llvm::Type* 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
|
149 { |
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
|
150 std::vector<const llvm::Type*> 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
|
151 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
|
152 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
|
153 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
|
154 } |
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 |
132 | 156 static const llvm::Type* rt_dg1() |
157 { | |
158 std::vector<const llvm::Type*> types; | |
159 types.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
160 types.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
161 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false); | |
162 | |
163 std::vector<const llvm::Type*> t; | |
164 t.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
165 t.push_back(rt_ptr(fty)); | |
166 return rt_ptr(llvm::StructType::get(t)); | |
167 } | |
168 | |
169 static const llvm::Type* rt_dg2() | |
170 { | |
171 std::vector<const llvm::Type*> types; | |
172 types.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
173 types.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
174 types.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
175 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false); | |
176 | |
177 std::vector<const llvm::Type*> t; | |
178 t.push_back(rt_ptr(llvm::Type::Int8Ty)); | |
179 t.push_back(rt_ptr(fty)); | |
180 return rt_ptr(llvm::StructType::get(t)); | |
181 } | |
182 | |
183 static void LLVM_D_BuildRuntimeModule() | |
184 { | |
185 M = new llvm::Module("llvmdc internal runtime"); | |
186 | |
187 const llvm::Type* voidTy = llvm::Type::VoidTy; | |
188 const llvm::Type* boolTy = llvm::Type::Int1Ty; | |
189 const llvm::Type* byteTy = llvm::Type::Int8Ty; | |
190 const llvm::Type* shortTy = llvm::Type::Int16Ty; | |
191 const llvm::Type* intTy = llvm::Type::Int32Ty; | |
192 const llvm::Type* longTy = llvm::Type::Int64Ty; | |
193 const llvm::Type* floatTy = llvm::Type::FloatTy; | |
194 const llvm::Type* doubleTy = llvm::Type::DoubleTy; | |
195 const llvm::Type* sizeTy = DtoSize_t(); | |
196 const llvm::Type* voidPtrTy = rt_ptr(byteTy); | |
197 const llvm::Type* stringTy = rt_array(byteTy); | |
198 const llvm::Type* wstringTy = rt_array(shortTy); | |
199 const llvm::Type* dstringTy = rt_array(intTy); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
163
diff
changeset
|
200 const llvm::Type* objectTy = rt_ptr(ClassDeclaration::object->type->ir.type->get()); |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
163
diff
changeset
|
201 const llvm::Type* classInfoTy = rt_ptr(ClassDeclaration::classinfo->type->ir.type->get()); |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
163
diff
changeset
|
202 const llvm::Type* typeInfoTy = rt_ptr(Type::typeinfo->type->ir.type->get()); |
132 | 203 const llvm::Type* aaTy = rt_ptr(llvm::OpaqueType::get()); |
204 | |
205 ///////////////////////////////////////////////////////////////////////////////////// | |
206 ///////////////////////////////////////////////////////////////////////////////////// | |
207 ///////////////////////////////////////////////////////////////////////////////////// | |
208 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
209 // 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
|
210 // 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
|
211 // void _d_switch_error( char[] file, uint line ) |
132 | 212 { |
213 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
|
214 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
|
215 std::string fname3("_d_switch_error"); |
132 | 216 std::vector<const llvm::Type*> types; |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
217 types.push_back(stringTy); |
132 | 218 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
|
219 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
|
220 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
|
221 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, 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
|
222 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
223 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
224 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
225 // 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
|
226 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
227 std::string fname("_d_assert_msg"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
228 std::vector<const llvm::Type*> types; |
132 | 229 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
|
230 types.push_back(stringTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
231 types.push_back(intTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
232 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
|
233 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 234 } |
235 | |
236 ///////////////////////////////////////////////////////////////////////////////////// | |
237 ///////////////////////////////////////////////////////////////////////////////////// | |
238 ///////////////////////////////////////////////////////////////////////////////////// | |
239 | |
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
|
240 // void* _d_allocmemoryT(TypeInfo ti) |
132 | 241 { |
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
|
242 std::string fname("_d_allocmemoryT"); |
132 | 243 std::vector<const llvm::Type*> 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
|
244 types.push_back(typeInfoTy); |
132 | 245 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
|
246 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 247 } |
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 // 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
|
250 // void* _d_newarrayiT(TypeInfo ti, size_t length) |
132 | 251 { |
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
|
252 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
|
253 std::string fname2("_d_newarrayiT"); |
132 | 254 std::vector<const llvm::Type*> 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 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
|
260 } |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
261 |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
262 // 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
|
263 // 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
|
264 { |
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
265 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
|
266 std::string fname2("_d_arraysetlengthiT"); |
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 std::vector<const llvm::Type*> types; |
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 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
|
269 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
|
270 types.push_back(sizeTy); |
132 | 271 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
|
272 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
|
273 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
|
274 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 275 } |
276 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
277 // 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
|
278 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
279 std::string fname("_d_newclass"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
280 std::vector<const llvm::Type*> types; |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
281 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
282 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
|
283 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
|
284 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
285 |
132 | 286 ///////////////////////////////////////////////////////////////////////////////////// |
287 ///////////////////////////////////////////////////////////////////////////////////// | |
288 ///////////////////////////////////////////////////////////////////////////////////// | |
289 | |
290 #define ARRAY_INIT(TY,suffix) \ | |
291 { \ | |
292 std::string fname("_d_array_init_"); \ | |
293 fname.append(suffix); \ | |
294 std::vector<const llvm::Type*> types; \ | |
295 types.push_back(rt_ptr(TY)); \ | |
296 types.push_back(sizeTy); \ | |
297 types.push_back(TY); \ | |
298 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
|
299 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
132 | 300 } |
301 | |
302 ARRAY_INIT(boolTy,"i1") | |
303 ARRAY_INIT(byteTy,"i8") | |
304 ARRAY_INIT(shortTy,"i16") | |
305 ARRAY_INIT(intTy,"i32") | |
306 ARRAY_INIT(longTy,"i64") | |
307 ARRAY_INIT(floatTy,"float") | |
308 ARRAY_INIT(doubleTy,"double") | |
309 ARRAY_INIT(voidPtrTy,"pointer") | |
310 | |
311 #undef ARRAY_INIT | |
312 | |
313 // array init mem | |
314 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) | |
315 { | |
316 std::string fname("_d_array_init_mem"); | |
317 std::vector<const llvm::Type*> types; | |
318 types.push_back(voidPtrTy); | |
319 types.push_back(sizeTy); | |
320 types.push_back(voidPtrTy); | |
321 types.push_back(sizeTy); | |
322 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
|
323 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 324 } |
325 | |
326 ///////////////////////////////////////////////////////////////////////////////////// | |
327 ///////////////////////////////////////////////////////////////////////////////////// | |
328 ///////////////////////////////////////////////////////////////////////////////////// | |
329 | |
330 #define STR_APPLY1(TY,a,b) \ | |
331 { \ | |
332 std::string fname(a); \ | |
333 std::string fname2(b); \ | |
334 std::vector<const llvm::Type*> types; \ | |
335 types.push_back(TY); \ | |
336 types.push_back(rt_dg1()); \ | |
337 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
338 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
|
339 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 340 } |
341 STR_APPLY1(stringTy, "_aApplycw1", "_aApplycd1") | |
342 STR_APPLY1(wstringTy, "_aApplywc1", "_aApplywd1") | |
343 STR_APPLY1(dstringTy, "_aApplydc1", "_aApplydw1") | |
344 #undef STR_APPLY | |
345 | |
346 #define STR_APPLY2(TY,a,b) \ | |
347 { \ | |
348 std::string fname(a); \ | |
349 std::string fname2(b); \ | |
350 std::vector<const llvm::Type*> types; \ | |
351 types.push_back(TY); \ | |
352 types.push_back(rt_dg2()); \ | |
353 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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); \ |
9d44ec83acd1
[svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
lindquist
parents:
203
diff
changeset
|
355 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 356 } |
357 STR_APPLY2(stringTy, "_aApplycw2", "_aApplycd2") | |
358 STR_APPLY2(wstringTy, "_aApplywc2", "_aApplywd2") | |
359 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | |
360 #undef STR_APPLY2 | |
361 | |
362 #define STR_APPLY_R1(TY,a,b) \ | |
363 { \ | |
364 std::string fname(a); \ | |
365 std::string fname2(b); \ | |
366 std::vector<const llvm::Type*> types; \ | |
367 types.push_back(TY); \ | |
368 types.push_back(rt_dg1()); \ | |
369 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
370 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
|
371 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 372 } |
373 STR_APPLY_R1(stringTy, "_aApplyRcw1", "_aApplyRcd1") | |
374 STR_APPLY_R1(wstringTy, "_aApplyRwc1", "_aApplyRwd1") | |
375 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | |
376 #undef STR_APPLY | |
377 | |
378 #define STR_APPLY_R2(TY,a,b) \ | |
379 { \ | |
380 std::string fname(a); \ | |
381 std::string fname2(b); \ | |
382 std::vector<const llvm::Type*> types; \ | |
383 types.push_back(TY); \ | |
384 types.push_back(rt_dg2()); \ | |
385 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
386 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
|
387 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 388 } |
389 STR_APPLY_R2(stringTy, "_aApplyRcw2", "_aApplyRcd2") | |
390 STR_APPLY_R2(wstringTy, "_aApplyRwc2", "_aApplyRwd2") | |
391 STR_APPLY_R2(dstringTy, "_aApplyRdc2", "_aApplyRdw2") | |
392 #undef STR_APPLY2 | |
393 | |
394 ///////////////////////////////////////////////////////////////////////////////////// | |
395 ///////////////////////////////////////////////////////////////////////////////////// | |
396 ///////////////////////////////////////////////////////////////////////////////////// | |
397 | |
398 // fixes the length for dynamic array casts | |
399 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
400 { | |
401 std::string fname("_d_array_cast_len"); | |
402 std::vector<const llvm::Type*> types; | |
403 types.push_back(sizeTy); | |
404 types.push_back(sizeTy); | |
405 types.push_back(sizeTy); | |
406 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
|
407 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 408 } |
409 | |
410 ///////////////////////////////////////////////////////////////////////////////////// | |
411 ///////////////////////////////////////////////////////////////////////////////////// | |
412 ///////////////////////////////////////////////////////////////////////////////////// | |
413 | |
414 // builds the d string[] for the D main args from the C main args | |
415 // void _d_main_args(uint n, char** args, ref char[][] res) | |
416 { | |
417 std::string fname("_d_main_args"); | |
418 std::vector<const llvm::Type*> types; | |
419 types.push_back(intTy); | |
420 types.push_back(rt_ptr(rt_ptr(byteTy))); | |
421 types.push_back(rt_array(stringTy->getContainedType(0))); | |
422 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
|
423 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 424 } |
425 | |
426 ///////////////////////////////////////////////////////////////////////////////////// | |
427 ///////////////////////////////////////////////////////////////////////////////////// | |
428 ///////////////////////////////////////////////////////////////////////////////////// | |
429 | |
430 // cast to object | |
431 // Object _d_toObject(void* p) | |
432 { | |
433 std::string fname("_d_toObject"); | |
434 std::vector<const llvm::Type*> types; | |
435 types.push_back(voidPtrTy); | |
436 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
|
437 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 438 } |
439 | |
440 // cast interface | |
441 // Object _d_interface_cast(void* p, ClassInfo c) | |
442 { | |
443 std::string fname("_d_interface_cast"); | |
444 std::vector<const llvm::Type*> types; | |
445 types.push_back(voidPtrTy); | |
446 types.push_back(classInfoTy); | |
447 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
|
448 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 449 } |
450 | |
451 // dynamic cast | |
452 // Object _d_dynamic_cast(Object o, ClassInfo c) | |
453 { | |
454 std::string fname("_d_dynamic_cast"); | |
455 std::vector<const llvm::Type*> types; | |
456 types.push_back(objectTy); | |
457 types.push_back(classInfoTy); | |
458 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
|
459 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 460 } |
461 | |
462 ///////////////////////////////////////////////////////////////////////////////////// | |
463 ///////////////////////////////////////////////////////////////////////////////////// | |
464 ///////////////////////////////////////////////////////////////////////////////////// | |
465 | |
466 // char[] _adReverseChar(char[] a) | |
467 // char[] _adSortChar(char[] a) | |
468 { | |
469 std::string fname("_adReverseChar"); | |
470 std::string fname2("_adSortChar"); | |
471 std::vector<const llvm::Type*> types; | |
472 types.push_back(stringTy); | |
473 types.push_back(stringTy); | |
474 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
|
475 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
|
476 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 477 } |
478 | |
479 // wchar[] _adReverseWchar(wchar[] a) | |
480 // wchar[] _adSortWchar(wchar[] a) | |
481 { | |
482 std::string fname("_adReverseWchar"); | |
483 std::string fname2("_adSortWchar"); | |
484 std::vector<const llvm::Type*> types; | |
485 types.push_back(wstringTy); | |
486 types.push_back(wstringTy); | |
487 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
|
488 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
|
489 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 490 } |
491 | |
492 // Array _adReverse(Array a, size_t szelem) | |
493 { | |
494 std::string fname("_adReverse"); | |
495 std::vector<const llvm::Type*> types; | |
496 types.push_back(rt_array(byteTy)); | |
497 types.push_back(rt_array(byteTy)); | |
498 types.push_back(sizeTy); | |
499 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
|
500 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 501 } |
502 | |
503 // Array _adDupT(TypeInfo ti, Array a) | |
504 { | |
505 std::string fname("_adDupT"); | |
506 std::vector<const llvm::Type*> types; | |
507 types.push_back(rt_array(byteTy)); | |
508 types.push_back(typeInfoTy); | |
509 types.push_back(rt_array(byteTy)); | |
510 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
|
511 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 512 } |
513 | |
514 // int _adEq(Array a1, Array a2, TypeInfo ti) | |
515 // int _adCmp(Array a1, Array a2, TypeInfo ti) | |
516 { | |
517 std::string fname("_adEq"); | |
518 std::string fname2("_adCmp"); | |
519 std::vector<const llvm::Type*> types; | |
520 types.push_back(rt_array(byteTy)); | |
521 types.push_back(rt_array(byteTy)); | |
522 types.push_back(typeInfoTy); | |
523 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
524 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
|
525 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 526 } |
527 | |
528 // int _adCmpChar(Array a1, Array a2) | |
529 { | |
530 std::string fname("_adCmpChar"); | |
531 std::vector<const llvm::Type*> types; | |
532 types.push_back(rt_array(byteTy)); | |
533 types.push_back(rt_array(byteTy)); | |
534 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
535 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 536 } |
537 | |
538 // Array _adSort(Array a, TypeInfo ti) | |
539 { | |
540 std::string fname("_adSort"); | |
541 std::vector<const llvm::Type*> types; | |
542 types.push_back(rt_array(byteTy)); | |
543 types.push_back(rt_array(byteTy)); | |
544 types.push_back(typeInfoTy); | |
545 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
|
546 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 547 } |
548 | |
549 ///////////////////////////////////////////////////////////////////////////////////// | |
550 ///////////////////////////////////////////////////////////////////////////////////// | |
551 ///////////////////////////////////////////////////////////////////////////////////// | |
552 | |
553 // size_t _aaLen(AA aa) | |
554 { | |
555 std::string fname("_aaLen"); | |
556 std::vector<const llvm::Type*> types; | |
557 types.push_back(aaTy); | |
558 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
|
559 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 560 } |
561 | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
562 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
132 | 563 { |
564 std::string fname("_aaGet"); | |
565 std::vector<const llvm::Type*> types; | |
566 types.push_back(aaTy); | |
567 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
|
568 types.push_back(sizeTy); |
132 | 569 types.push_back(voidPtrTy); |
570 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
|
571 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 572 } |
573 | |
574 // void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) | |
575 { | |
576 std::string fname("_aaGetRvalue"); | |
577 std::vector<const llvm::Type*> types; | |
578 types.push_back(aaTy); | |
579 types.push_back(typeInfoTy); | |
580 types.push_back(sizeTy); | |
581 types.push_back(voidPtrTy); | |
582 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
|
583 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 584 } |
585 | |
586 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | |
587 { | |
588 std::string fname("_aaIn"); | |
589 std::vector<const llvm::Type*> types; | |
590 types.push_back(aaTy); | |
591 types.push_back(typeInfoTy); | |
592 types.push_back(voidPtrTy); | |
593 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
|
594 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 595 } |
596 | |
597 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | |
598 { | |
599 std::string fname("_aaDel"); | |
600 std::vector<const llvm::Type*> types; | |
601 types.push_back(aaTy); | |
602 types.push_back(typeInfoTy); | |
603 types.push_back(voidPtrTy); | |
604 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
|
605 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 606 } |
607 | |
608 // ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize) | |
609 { | |
610 std::string fname("_aaValues"); | |
611 std::vector<const llvm::Type*> types; | |
612 types.push_back(rt_array(byteTy)); | |
613 types.push_back(aaTy); | |
614 types.push_back(sizeTy); | |
615 types.push_back(sizeTy); | |
616 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
|
617 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 618 } |
619 | |
620 // void* _aaRehash(AA* paa, TypeInfo keyti) | |
621 { | |
622 std::string fname("_aaRehash"); | |
623 std::vector<const llvm::Type*> types; | |
624 types.push_back(aaTy); | |
625 types.push_back(typeInfoTy); | |
626 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
|
627 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 628 } |
629 | |
630 // ArrayRet_t _aaKeys(AA aa, size_t keysize) | |
631 { | |
632 std::string fname("_aaKeys"); | |
633 std::vector<const llvm::Type*> types; | |
634 types.push_back(rt_array(byteTy)); | |
635 types.push_back(aaTy); | |
636 types.push_back(sizeTy); | |
637 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
|
638 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 639 } |
640 | |
641 // int _aaApply(AA aa, size_t keysize, dg_t dg) | |
642 { | |
643 std::string fname("_aaApply"); | |
644 std::vector<const llvm::Type*> types; | |
645 types.push_back(aaTy); | |
646 types.push_back(sizeTy); | |
647 types.push_back(rt_dg1()); | |
648 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
649 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 650 } |
651 | |
652 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | |
653 { | |
654 std::string fname("_aaApply2"); | |
655 std::vector<const llvm::Type*> types; | |
656 types.push_back(aaTy); | |
657 types.push_back(sizeTy); | |
658 types.push_back(rt_dg1()); | |
659 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
660 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 661 } |
662 | |
663 ///////////////////////////////////////////////////////////////////////////////////// | |
664 ///////////////////////////////////////////////////////////////////////////////////// | |
665 ///////////////////////////////////////////////////////////////////////////////////// | |
666 | |
667 // void _moduleCtor() | |
668 // void _moduleDtor() | |
669 { | |
670 std::string fname("_moduleCtor"); | |
671 std::string fname2("_moduleDtor"); | |
672 std::vector<const llvm::Type*> types; | |
673 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
|
674 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
|
675 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 676 } |
677 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
678 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
679 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
680 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
681 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
682 // 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
|
683 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
684 std::string fname("_d_toObject"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
685 std::vector<const llvm::Type*> types; |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
686 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
687 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
|
688 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
|
689 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
690 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
691 // 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
|
692 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
693 std::string fname("_d_dynamic_cast"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
694 std::vector<const llvm::Type*> types; |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
695 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
696 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
697 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
|
698 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
|
699 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
700 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
701 // 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
|
702 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
703 std::string fname("_d_interface_cast"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
704 std::vector<const llvm::Type*> types; |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
705 types.push_back(voidPtrTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
706 types.push_back(classInfoTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
707 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
|
708 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
|
709 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
710 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
711 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
712 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
713 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
714 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
715 // 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
|
716 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
717 std::string fname("_d_throw_exception"); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
718 std::vector<const llvm::Type*> types; |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
719 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
720 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
|
721 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
|
722 } |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
723 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
724 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
725 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
726 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
727 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
728 // 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
|
729 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
730 std::string fname("_d_switch_string"); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
731 std::vector<const llvm::Type*> 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
|
732 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
|
733 types.push_back(stringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
734 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
735 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
736 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
737 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
738 // 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
|
739 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
740 std::string fname("_d_switch_ustring"); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
741 std::vector<const llvm::Type*> 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
|
742 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
|
743 types.push_back(wstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
744 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
745 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
746 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
747 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
748 // 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
|
749 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
750 std::string fname("_d_switch_dstring"); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
751 std::vector<const llvm::Type*> 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
|
752 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
|
753 types.push_back(dstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
754 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, 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
|
755 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
756 } |
132 | 757 } |
758 | |
759 | |
760 | |
761 | |
762 | |
763 |