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