Mercurial > projects > ldc
annotate gen/runtime.cpp @ 1529:ad7f2f1862d6
Adjust LDC to work with the LLVMContext LLVM changes.
This means we now require a fairly new LLVM revision. I use 75234.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 10 Jul 2009 21:30:02 +0200 |
parents | f19adff18813 |
children | c88b16d4a13c |
rev | line source |
---|---|
52 | 1 #include "gen/llvm.h" |
1521
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
2 #include "gen/llvm-version.h" |
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
3 #if LLVM_REV >= 74640 |
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
4 #include "llvm/LLVMContext.h" |
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
5 #endif |
1 | 6 #include "llvm/Module.h" |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
7 #include "llvm/Attributes.h" |
1 | 8 #include "llvm/Bitcode/ReaderWriter.h" |
9 #include "llvm/Support/MemoryBuffer.h" | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
10 #include "llvm/Support/CommandLine.h" |
1 | 11 |
12 #include "root.h" | |
13 #include "mars.h" | |
132 | 14 #include "lexer.h" |
15 #include "dsymbol.h" | |
16 #include "mtype.h" | |
17 #include "aggregate.h" | |
1 | 18 |
4
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
19 #include "gen/runtime.h" |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
20 #include "gen/logger.h" |
132 | 21 #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
|
22 #include "gen/irstate.h" |
4
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
23 |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
24 using namespace llvm::Attribute; |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
25 |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
26 ////////////////////////////////////////////////////////////////////////////////////////////////// |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
27 |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
28 static llvm::cl::opt<bool> noruntime("noruntime", |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
29 llvm::cl::desc("Do not allow code that generates implicit runtime calls"), |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
30 llvm::cl::ZeroOrMore); |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
31 |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
32 ////////////////////////////////////////////////////////////////////////////////////////////////// |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
33 |
1 | 34 static llvm::Module* M = NULL; |
35 static bool runtime_failed = false; | |
36 | |
132 | 37 static void LLVM_D_BuildRuntimeModule(); |
38 | |
52 | 39 ////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | |
1 | 41 bool LLVM_D_InitRuntime() |
42 { | |
132 | 43 Logger::println("*** Initializing D runtime declarations ***"); |
1 | 44 LOG_SCOPE; |
45 | |
1161
f528e55fb32f
Force initialize the runtime module in Module::genLLVMModule. It is required
Christian Kamm <kamm incasoftware de>
parents:
986
diff
changeset
|
46 if (!M) |
f528e55fb32f
Force initialize the runtime module in Module::genLLVMModule. It is required
Christian Kamm <kamm incasoftware de>
parents:
986
diff
changeset
|
47 LLVM_D_BuildRuntimeModule(); |
f528e55fb32f
Force initialize the runtime module in Module::genLLVMModule. It is required
Christian Kamm <kamm incasoftware de>
parents:
986
diff
changeset
|
48 |
132 | 49 return true; |
1 | 50 } |
51 | |
52 void LLVM_D_FreeRuntime() | |
53 { | |
54 if (M) { | |
132 | 55 Logger::println("*** Freeing D runtime declarations ***"); |
1 | 56 delete M; |
132 | 57 M = NULL; |
1 | 58 } |
59 } | |
60 | |
52 | 61 ////////////////////////////////////////////////////////////////////////////////////////////////// |
62 | |
1 | 63 llvm::Function* LLVM_D_GetRuntimeFunction(llvm::Module* target, const char* name) |
64 { | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
65 if (noruntime) { |
1 | 66 error("No implicit runtime calls allowed with -noruntime option enabled"); |
67 fatal(); | |
68 } | |
52 | 69 |
1 | 70 if (!M) { |
71 assert(!runtime_failed); | |
72 LLVM_D_InitRuntime(); | |
73 } | |
52 | 74 |
98
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
75 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
|
76 if (fn) |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
77 return fn; |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
78 |
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
79 fn = M->getFunction(name); |
40 | 80 if (!fn) { |
98
6789050b5ad1
[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references.
lindquist
parents:
86
diff
changeset
|
81 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
|
82 assert(0); |
40 | 83 //return NULL; |
84 } | |
52 | 85 |
1 | 86 const llvm::FunctionType* fnty = fn->getFunctionType(); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
87 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
|
88 resfn->setAttributes(fn->getAttributes()); |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
89 return resfn; |
1 | 90 } |
40 | 91 |
52 | 92 ////////////////////////////////////////////////////////////////////////////////////////////////// |
93 | |
94 llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* name) | |
95 { | |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
96 llvm::GlobalVariable* gv = target->getNamedGlobal(name); |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
97 if (gv) { |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
98 return gv; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
99 } |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
52
diff
changeset
|
100 |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
797
diff
changeset
|
101 if (noruntime) { |
52 | 102 error("No implicit runtime calls allowed with -noruntime option enabled"); |
103 fatal(); | |
104 } | |
105 | |
106 if (!M) { | |
107 assert(!runtime_failed); | |
108 LLVM_D_InitRuntime(); | |
109 } | |
110 | |
111 llvm::GlobalVariable* g = M->getNamedGlobal(name); | |
112 if (!g) { | |
113 error("Runtime global '%s' was not found", name); | |
114 fatal(); | |
115 //return NULL; | |
116 } | |
117 | |
118 const llvm::PointerType* t = g->getType(); | |
1529
ad7f2f1862d6
Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents:
1527
diff
changeset
|
119 return new llvm::GlobalVariable(*target, t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName()); |
52 | 120 } |
132 | 121 |
122 ////////////////////////////////////////////////////////////////////////////////////////////////// | |
123 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
124 static const LLType* rt_ptr(const LLType* t) |
132 | 125 { |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
126 return getPtrToType(t); |
132 | 127 } |
128 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
129 static const LLType* rt_array(const LLType* elemty) |
132 | 130 { |
794
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
131 return llvm::StructType::get(DtoSize_t(), rt_ptr(elemty), NULL); |
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
|
132 } |
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
|
133 |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
134 static const LLType* rt_dg1() |
132 | 135 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
136 std::vector<const LLType*> 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
|
137 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
|
138 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
|
139 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); |
794
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
140 return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); |
132 | 141 } |
142 | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
143 static const LLType* rt_dg2() |
132 | 144 { |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
145 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
|
146 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
147 types.push_back(rt_ptr(LLType::Int8Ty)); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
240
diff
changeset
|
148 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
|
149 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); |
794
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
150 return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); |
132 | 151 } |
152 | |
153 static void LLVM_D_BuildRuntimeModule() | |
154 { | |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
155 Logger::println("building module"); |
1521
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
156 #if LLVM_REV >= 74640 |
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
157 M = new llvm::Module("ldc internal runtime", llvm::getGlobalContext()); |
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
158 #else |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
647
diff
changeset
|
159 M = new llvm::Module("ldc internal runtime"); |
1521
982eb70e83b2
Fix build for LLVM >= r74640
Benjamin Kramer <benny.kra@gmail.com>
parents:
1512
diff
changeset
|
160 #endif |
132 | 161 |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
162 Logger::println("building basic 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 const LLType* sizeTy = DtoSize_t(); |
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
170 |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
171 Logger::println("building float 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
|
172 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
|
173 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
|
174 const LLType* realTy; |
741
4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents:
728
diff
changeset
|
175 if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64)) |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
176 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
|
177 else |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
340
diff
changeset
|
178 realTy = LLType::DoubleTy; |
586
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
179 |
794
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
180 const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, NULL); |
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
181 const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, NULL); |
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
741
diff
changeset
|
182 const LLType* crealTy = llvm::StructType::get(realTy, realTy, NULL); |
586
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
183 |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
184 Logger::println("building aggr types"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
185 const LLType* voidPtrTy = rt_ptr(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
186 const LLType* stringTy = rt_array(byteTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
187 const LLType* wstringTy = rt_array(shortTy); |
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
188 const LLType* dstringTy = rt_array(intTy); |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
189 |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
190 Logger::println("building class types"); |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
191 const LLType* objectTy = DtoType(ClassDeclaration::object->type); |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
192 const LLType* classInfoTy = DtoType(ClassDeclaration::classinfo->type); |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
193 const LLType* typeInfoTy = DtoType(Type::typeinfo->type); |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
194 |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
195 Logger::println("building aa type"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
196 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get()); |
132 | 197 |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
198 Logger::println("building functions"); |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
794
diff
changeset
|
199 |
132 | 200 ///////////////////////////////////////////////////////////////////////////////////// |
201 ///////////////////////////////////////////////////////////////////////////////////// | |
202 ///////////////////////////////////////////////////////////////////////////////////// | |
203 | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
204 // Construct some attribute lists used below (possibly multiple times) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
205 llvm::AttrListPtr |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
206 NoAttrs, |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
207 Attr_NoAlias |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
208 = NoAttrs.addAttr(0, NoAlias), |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
209 Attr_NoUnwind |
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
210 = NoAttrs.addAttr(~0U, NoUnwind), |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
211 Attr_ReadOnly |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
212 = NoAttrs.addAttr(~0U, ReadOnly), |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
213 Attr_ReadOnly_NoUnwind |
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
214 = Attr_ReadOnly.addAttr(~0U, NoUnwind), |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
215 Attr_ReadOnly_1_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
216 = Attr_ReadOnly.addAttr(1, NoCapture), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
217 Attr_ReadOnly_1_3_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
218 = Attr_ReadOnly_1_NoCapture.addAttr(3, NoCapture), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
219 Attr_ReadOnly_1_4_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
220 = Attr_ReadOnly_1_NoCapture.addAttr(4, NoCapture), |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
221 Attr_ReadOnly_NoUnwind_1_NoCapture |
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
222 = Attr_ReadOnly_1_NoCapture.addAttr(~0U, NoUnwind), |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
223 Attr_ReadNone |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
224 = NoAttrs.addAttr(~0U, ReadNone), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
225 Attr_1_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
226 = NoAttrs.addAttr(1, NoCapture), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
227 Attr_NoAlias_1_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
228 = Attr_1_NoCapture.addAttr(0, NoAlias), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
229 Attr_NoAlias_3_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
230 = Attr_NoAlias.addAttr(3, NoCapture), |
1512
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
231 Attr_1_2_NoCapture |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
232 = Attr_1_NoCapture.addAttr(2, NoCapture), |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
233 Attr_1_3_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
234 = Attr_1_NoCapture.addAttr(3, NoCapture), |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
235 Attr_1_4_NoCapture |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
236 = Attr_1_NoCapture.addAttr(4, NoCapture); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
237 |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
238 ///////////////////////////////////////////////////////////////////////////////////// |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
239 ///////////////////////////////////////////////////////////////////////////////////// |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
240 ///////////////////////////////////////////////////////////////////////////////////// |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
241 |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
242 // 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
|
243 // 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
|
244 // void _d_switch_error( char[] file, uint line ) |
132 | 245 { |
246 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
|
247 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
|
248 std::string fname3("_d_switch_error"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
249 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
|
250 types.push_back(stringTy); |
132 | 251 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
|
252 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
253 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
254 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
255 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
256 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
257 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
258 // 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
|
259 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
260 std::string fname("_d_assert_msg"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
261 std::vector<const LLType*> types; |
132 | 262 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
|
263 types.push_back(stringTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
264 types.push_back(intTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
265 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
266 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 267 } |
268 | |
269 ///////////////////////////////////////////////////////////////////////////////////// | |
270 ///////////////////////////////////////////////////////////////////////////////////// | |
271 ///////////////////////////////////////////////////////////////////////////////////// | |
272 | |
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
|
273 // void* _d_allocmemoryT(TypeInfo ti) |
132 | 274 { |
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 std::string fname("_d_allocmemoryT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
276 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
|
277 types.push_back(typeInfoTy); |
132 | 278 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
279 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
280 ->setAttributes(Attr_NoAlias); |
132 | 281 } |
282 | |
203
e881c9b1c738
[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
lindquist
parents:
197
diff
changeset
|
283 // void* _d_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
|
284 // 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
|
285 // void* _d_newarrayvT(TypeInfo ti, size_t length) |
132 | 286 { |
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
|
287 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
|
288 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
|
289 std::string fname3("_d_newarrayvT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
294 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
295 ->setAttributes(Attr_NoAlias); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
296 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
297 ->setAttributes(Attr_NoAlias); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
298 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
299 ->setAttributes(Attr_NoAlias); |
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
|
300 } |
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
|
301 |
286
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
302 // 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
|
303 // 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
|
304 // 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
|
305 { |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
306 std::string fname("_d_newarraymT"); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
307 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
|
308 std::string fname3("_d_newarraymvT"); |
286
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
309 std::vector<const LLType*> types; |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
310 types.push_back(typeInfoTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
311 types.push_back(sizeTy); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
312 types.push_back(rt_ptr(sizeTy)); |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
313 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
314 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
315 ->setAttributes(Attr_NoAlias_3_NoCapture); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
316 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
317 ->setAttributes(Attr_NoAlias_3_NoCapture); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
318 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
319 ->setAttributes(Attr_NoAlias_3_NoCapture); |
286
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
320 } |
a3b7c19c866c
[svn r307] Fixed: multidimensional new expressions now work. Eg.:
lindquist
parents:
244
diff
changeset
|
321 |
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
|
322 // 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
|
323 // 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
|
324 { |
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
|
325 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
|
326 std::string fname2("_d_arraysetlengthiT"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
327 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
|
328 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
|
329 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
|
330 types.push_back(sizeTy); |
132 | 331 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
|
332 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
1293
00b408a5b7fa
Remove bogus noalias attribute from _d_arraysetlength[i]T.
Frits van Bommel <fvbommel wxs.nl>
parents:
1277
diff
changeset
|
333 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
00b408a5b7fa
Remove bogus noalias attribute from _d_arraysetlength[i]T.
Frits van Bommel <fvbommel wxs.nl>
parents:
1277
diff
changeset
|
334 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 335 } |
336 | |
728
635f91212b78
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create.
Christian Kamm <kamm incasoftware de>
parents:
719
diff
changeset
|
337 // Object _d_allocclass(ClassInfo ci) |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
338 { |
728
635f91212b78
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create.
Christian Kamm <kamm incasoftware de>
parents:
719
diff
changeset
|
339 std::string fname("_d_allocclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
340 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
|
341 types.push_back(classInfoTy); |
1506
76936858d1c6
Return `void*` from _d_allocclass so LLVM doesn't do weird things with it...
Frits van Bommel <fvbommel wxs.nl>
parents:
1485
diff
changeset
|
342 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
343 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
344 ->setAttributes(Attr_NoAlias); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
345 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
346 |
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
|
347 // 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
|
348 { |
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
|
349 std::string fname("_d_delarray"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 } |
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
|
356 |
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
|
357 // 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
|
358 // 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
|
359 // 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
|
360 { |
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
|
361 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
|
362 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
|
363 std::string fname3("_d_callfinalizer"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 } |
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
|
371 |
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
|
372 // 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
|
373 { |
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
|
374 std::string fname("_d_delclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
375 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
|
376 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
|
377 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
|
378 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
|
379 } |
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
|
380 |
132 | 381 ///////////////////////////////////////////////////////////////////////////////////// |
382 ///////////////////////////////////////////////////////////////////////////////////// | |
383 ///////////////////////////////////////////////////////////////////////////////////// | |
384 | |
385 #define ARRAY_INIT(TY,suffix) \ | |
386 { \ | |
387 std::string fname("_d_array_init_"); \ | |
388 fname.append(suffix); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
389 std::vector<const LLType*> types; \ |
132 | 390 types.push_back(rt_ptr(TY)); \ |
391 types.push_back(sizeTy); \ | |
392 types.push_back(TY); \ | |
393 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \ | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
394 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) \ |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
395 ->setAttributes(Attr_1_NoCapture); \ |
132 | 396 } |
397 | |
398 ARRAY_INIT(shortTy,"i16") | |
399 ARRAY_INIT(intTy,"i32") | |
400 ARRAY_INIT(longTy,"i64") | |
401 ARRAY_INIT(floatTy,"float") | |
402 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
|
403 ARRAY_INIT(realTy,"real") |
586
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
404 ARRAY_INIT(cfloatTy,"cfloat") |
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
405 ARRAY_INIT(cdoubleTy,"cdouble") |
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
406 ARRAY_INIT(crealTy,"creal") |
132 | 407 ARRAY_INIT(voidPtrTy,"pointer") |
408 | |
409 #undef ARRAY_INIT | |
410 | |
411 // array init mem | |
412 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) | |
1328
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
413 // + |
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
414 // array slice copy when assertions are on! |
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
415 // void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) |
132 | 416 { |
417 std::string fname("_d_array_init_mem"); | |
1328
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
418 std::string fname2("_d_array_slice_copy"); |
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(voidPtrTy); |
421 types.push_back(sizeTy); | |
422 types.push_back(voidPtrTy); | |
423 types.push_back(sizeTy); | |
424 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
425 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
426 ->setAttributes(Attr_1_3_NoCapture); |
1328
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
427 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M) |
c78fd2d30da1
Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1300
diff
changeset
|
428 ->setAttributes(Attr_1_3_NoCapture); |
132 | 429 } |
430 | |
431 ///////////////////////////////////////////////////////////////////////////////////// | |
432 ///////////////////////////////////////////////////////////////////////////////////// | |
433 ///////////////////////////////////////////////////////////////////////////////////// | |
434 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
435 // int _aApplycd1(char[] aa, dg_t dg) |
132 | 436 #define STR_APPLY1(TY,a,b) \ |
437 { \ | |
438 std::string fname(a); \ | |
439 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
440 std::vector<const LLType*> types; \ |
132 | 441 types.push_back(TY); \ |
442 types.push_back(rt_dg1()); \ | |
443 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
719
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
444 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
445 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 446 } |
447 STR_APPLY1(stringTy, "_aApplycw1", "_aApplycd1") | |
448 STR_APPLY1(wstringTy, "_aApplywc1", "_aApplywd1") | |
449 STR_APPLY1(dstringTy, "_aApplydc1", "_aApplydw1") | |
450 #undef STR_APPLY | |
451 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
452 // int _aApplycd2(char[] aa, dg2_t dg) |
132 | 453 #define STR_APPLY2(TY,a,b) \ |
454 { \ | |
455 std::string fname(a); \ | |
456 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
457 std::vector<const LLType*> types; \ |
132 | 458 types.push_back(TY); \ |
459 types.push_back(rt_dg2()); \ | |
460 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
719
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
461 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
462 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 463 } |
464 STR_APPLY2(stringTy, "_aApplycw2", "_aApplycd2") | |
465 STR_APPLY2(wstringTy, "_aApplywc2", "_aApplywd2") | |
466 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | |
467 #undef STR_APPLY2 | |
468 | |
469 #define STR_APPLY_R1(TY,a,b) \ | |
470 { \ | |
471 std::string fname(a); \ | |
472 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
473 std::vector<const LLType*> types; \ |
132 | 474 types.push_back(TY); \ |
475 types.push_back(rt_dg1()); \ | |
476 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
719
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
477 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
478 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 479 } |
480 STR_APPLY_R1(stringTy, "_aApplyRcw1", "_aApplyRcd1") | |
481 STR_APPLY_R1(wstringTy, "_aApplyRwc1", "_aApplyRwd1") | |
482 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | |
483 #undef STR_APPLY | |
484 | |
485 #define STR_APPLY_R2(TY,a,b) \ | |
486 { \ | |
487 std::string fname(a); \ | |
488 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
489 std::vector<const LLType*> types; \ |
132 | 490 types.push_back(TY); \ |
491 types.push_back(rt_dg2()); \ | |
492 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | |
719
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
493 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
7261ff0f95ff
Implemented first class delegates. closes #101
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
494 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 495 } |
496 STR_APPLY_R2(stringTy, "_aApplyRcw2", "_aApplyRcd2") | |
497 STR_APPLY_R2(wstringTy, "_aApplyRwc2", "_aApplyRwd2") | |
498 STR_APPLY_R2(dstringTy, "_aApplyRdc2", "_aApplyRdw2") | |
499 #undef STR_APPLY2 | |
500 | |
501 ///////////////////////////////////////////////////////////////////////////////////// | |
502 ///////////////////////////////////////////////////////////////////////////////////// | |
503 ///////////////////////////////////////////////////////////////////////////////////// | |
504 | |
505 // fixes the length for dynamic array casts | |
506 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
507 { | |
508 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
|
509 std::vector<const LLType*> types; |
132 | 510 types.push_back(sizeTy); |
511 types.push_back(sizeTy); | |
512 types.push_back(sizeTy); | |
513 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
514 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
515 ->setAttributes(Attr_ReadNone); |
132 | 516 } |
517 | |
518 ///////////////////////////////////////////////////////////////////////////////////// | |
519 ///////////////////////////////////////////////////////////////////////////////////// | |
520 ///////////////////////////////////////////////////////////////////////////////////// | |
521 | |
522 // cast to object | |
523 // Object _d_toObject(void* p) | |
524 { | |
525 std::string fname("_d_toObject"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
526 std::vector<const LLType*> types; |
132 | 527 types.push_back(voidPtrTy); |
528 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
529 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
530 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 531 } |
532 | |
533 // cast interface | |
534 // Object _d_interface_cast(void* p, ClassInfo c) | |
535 { | |
536 std::string fname("_d_interface_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
537 std::vector<const LLType*> types; |
132 | 538 types.push_back(voidPtrTy); |
539 types.push_back(classInfoTy); | |
540 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
541 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
542 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 543 } |
544 | |
545 // dynamic cast | |
546 // Object _d_dynamic_cast(Object o, ClassInfo c) | |
547 { | |
548 std::string fname("_d_dynamic_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
549 std::vector<const LLType*> types; |
132 | 550 types.push_back(objectTy); |
551 types.push_back(classInfoTy); | |
552 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
553 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
554 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 555 } |
556 | |
557 ///////////////////////////////////////////////////////////////////////////////////// | |
558 ///////////////////////////////////////////////////////////////////////////////////// | |
559 ///////////////////////////////////////////////////////////////////////////////////// | |
560 | |
561 // char[] _adReverseChar(char[] a) | |
562 // char[] _adSortChar(char[] a) | |
563 { | |
564 std::string fname("_adReverseChar"); | |
565 std::string fname2("_adSortChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
566 std::vector<const LLType*> types; |
132 | 567 types.push_back(stringTy); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
568 const llvm::FunctionType* fty = llvm::FunctionType::get(stringTy, types, false); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
569 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
570 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 571 } |
572 | |
573 // wchar[] _adReverseWchar(wchar[] a) | |
574 // wchar[] _adSortWchar(wchar[] a) | |
575 { | |
576 std::string fname("_adReverseWchar"); | |
577 std::string fname2("_adSortWchar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
578 std::vector<const LLType*> types; |
132 | 579 types.push_back(wstringTy); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
580 const llvm::FunctionType* fty = llvm::FunctionType::get(wstringTy, types, false); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
581 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
582 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 583 } |
584 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
585 // void[] _adReverse(void[] a, size_t szelem) |
132 | 586 { |
587 std::string fname("_adReverse"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
588 std::vector<const LLType*> types; |
132 | 589 types.push_back(rt_array(byteTy)); |
590 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
591 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
592 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
593 ->setAttributes(Attr_NoUnwind); |
132 | 594 } |
595 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
596 // void[] _adDupT(TypeInfo ti, void[] a) |
132 | 597 { |
598 std::string fname("_adDupT"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
599 std::vector<const LLType*> types; |
132 | 600 types.push_back(typeInfoTy); |
601 types.push_back(rt_array(byteTy)); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
602 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
1373
551b01341728
Remove an incorrect attribute: `noalias` doesn't apply to struct types, even if
Frits van Bommel <fvbommel wxs.nl>
parents:
1328
diff
changeset
|
603 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 604 } |
605 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
606 // int _adEq(void[] a1, void[] a2, TypeInfo ti) |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
607 // int _adCmp(void[] a1, void[] a2, TypeInfo ti) |
132 | 608 { |
609 std::string fname("_adEq"); | |
610 std::string fname2("_adCmp"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
611 std::vector<const LLType*> types; |
132 | 612 types.push_back(rt_array(byteTy)); |
613 types.push_back(rt_array(byteTy)); | |
614 types.push_back(typeInfoTy); | |
615 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
616 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
617 ->setAttributes(Attr_ReadOnly); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
618 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
619 ->setAttributes(Attr_ReadOnly); |
132 | 620 } |
621 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
622 // int _adCmpChar(void[] a1, void[] a2) |
132 | 623 { |
624 std::string fname("_adCmpChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
625 std::vector<const LLType*> types; |
132 | 626 types.push_back(rt_array(byteTy)); |
627 types.push_back(rt_array(byteTy)); | |
628 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
629 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
630 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 631 } |
632 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
633 // void[] _adSort(void[] a, TypeInfo ti) |
132 | 634 { |
635 std::string fname("_adSort"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
636 std::vector<const LLType*> types; |
132 | 637 types.push_back(rt_array(byteTy)); |
638 types.push_back(typeInfoTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
639 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
640 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 641 } |
642 | |
643 ///////////////////////////////////////////////////////////////////////////////////// | |
644 ///////////////////////////////////////////////////////////////////////////////////// | |
645 ///////////////////////////////////////////////////////////////////////////////////// | |
646 | |
647 // size_t _aaLen(AA aa) | |
648 { | |
649 std::string fname("_aaLen"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
650 std::vector<const LLType*> types; |
132 | 651 types.push_back(aaTy); |
652 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
653 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
1300
329e45865d84
Add 'nounwind' attribute to the relevant runtime functions, and use it when
Frits van Bommel <fvbommel wxs.nl>
parents:
1293
diff
changeset
|
654 ->setAttributes(Attr_ReadOnly_NoUnwind_1_NoCapture); |
132 | 655 } |
656 | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
657 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
132 | 658 { |
659 std::string fname("_aaGet"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
660 std::vector<const LLType*> types; |
132 | 661 types.push_back(aaTy); |
662 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
|
663 types.push_back(sizeTy); |
132 | 664 types.push_back(voidPtrTy); |
665 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
666 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
667 ->setAttributes(Attr_1_4_NoCapture); |
132 | 668 } |
669 | |
670 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | |
671 { | |
672 std::string fname("_aaIn"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
673 std::vector<const LLType*> types; |
132 | 674 types.push_back(aaTy); |
675 types.push_back(typeInfoTy); | |
676 types.push_back(voidPtrTy); | |
677 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
678 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
679 ->setAttributes(Attr_ReadOnly_1_3_NoCapture); |
132 | 680 } |
681 | |
682 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | |
683 { | |
684 std::string fname("_aaDel"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
685 std::vector<const LLType*> types; |
132 | 686 types.push_back(aaTy); |
687 types.push_back(typeInfoTy); | |
688 types.push_back(voidPtrTy); | |
689 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
690 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
691 ->setAttributes(Attr_1_3_NoCapture); |
132 | 692 } |
693 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
694 // void[] _aaValues(AA aa, size_t keysize, size_t valuesize) |
132 | 695 { |
696 std::string fname("_aaValues"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
697 std::vector<const LLType*> types; |
132 | 698 types.push_back(aaTy); |
699 types.push_back(sizeTy); | |
700 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
701 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
702 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
703 ->setAttributes(Attr_NoAlias_1_NoCapture); |
132 | 704 } |
705 | |
706 // void* _aaRehash(AA* paa, TypeInfo keyti) | |
707 { | |
708 std::string fname("_aaRehash"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
709 std::vector<const LLType*> types; |
132 | 710 types.push_back(aaTy); |
711 types.push_back(typeInfoTy); | |
712 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
|
713 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 714 } |
715 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
716 // void[] _aaKeys(AA aa, size_t keysize) |
132 | 717 { |
718 std::string fname("_aaKeys"); | |
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); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
722 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
723 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
724 ->setAttributes(Attr_NoAlias_1_NoCapture); |
132 | 725 } |
726 | |
727 // int _aaApply(AA aa, size_t keysize, dg_t dg) | |
728 { | |
729 std::string fname("_aaApply"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
730 std::vector<const LLType*> types; |
132 | 731 types.push_back(aaTy); |
732 types.push_back(sizeTy); | |
733 types.push_back(rt_dg1()); | |
734 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
735 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
736 ->setAttributes(Attr_1_NoCapture); |
132 | 737 } |
738 | |
739 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | |
740 { | |
741 std::string fname("_aaApply2"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
742 std::vector<const LLType*> types; |
132 | 743 types.push_back(aaTy); |
744 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
745 types.push_back(rt_dg2()); |
132 | 746 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
747 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
748 ->setAttributes(Attr_1_NoCapture); |
132 | 749 } |
750 | |
1512
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
751 // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti) |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
752 { |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
753 std::string fname("_aaEq"); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
754 std::vector<const LLType*> types; |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
755 types.push_back(aaTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
756 types.push_back(aaTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
757 types.push_back(typeInfoTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
758 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
759 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
760 ->setAttributes(Attr_1_2_NoCapture); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
761 } |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
762 |
132 | 763 ///////////////////////////////////////////////////////////////////////////////////// |
764 ///////////////////////////////////////////////////////////////////////////////////// | |
765 ///////////////////////////////////////////////////////////////////////////////////// | |
766 | |
767 // void _moduleCtor() | |
768 // void _moduleDtor() | |
769 { | |
770 std::string fname("_moduleCtor"); | |
771 std::string fname2("_moduleDtor"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
772 std::vector<const LLType*> types; |
132 | 773 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
|
774 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
|
775 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 776 } |
777 | |
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 // 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
|
783 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
784 std::string fname("_d_throw_exception"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
785 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
|
786 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
787 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
|
788 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
|
789 } |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
790 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
791 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
792 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
793 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
794 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
795 // 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
|
796 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
797 std::string fname("_d_switch_string"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
798 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
799 types.push_back(rt_array(stringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
800 types.push_back(stringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
801 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
802 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
803 ->setAttributes(Attr_ReadOnly); |
191
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 // 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
|
807 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
808 std::string fname("_d_switch_ustring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
809 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
810 types.push_back(rt_array(wstringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
811 types.push_back(wstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
812 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
813 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
814 ->setAttributes(Attr_ReadOnly); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
815 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
816 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
817 // int _d_switch_dstring(dchar[][] table, dchar[] ca) |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
818 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
819 std::string fname("_d_switch_dstring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
820 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
821 types.push_back(rt_array(dstringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
822 types.push_back(dstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
823 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
824 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
825 ->setAttributes(Attr_ReadOnly); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
826 } |
132 | 827 |
309 | 828 ///////////////////////////////////////////////////////////////////////////////////// |
829 ///////////////////////////////////////////////////////////////////////////////////// | |
830 ///////////////////////////////////////////////////////////////////////////////////// | |
132 | 831 |
309 | 832 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) |
833 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) | |
834 { | |
835 std::string fname("_d_criticalenter"); | |
836 std::string fname2("_d_criticalexit"); | |
837 std::vector<const LLType*> types; | |
838 types.push_back(rt_ptr(DtoMutexType())); | |
839 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
840 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
841 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
842 } | |
132 | 843 |
309 | 844 // void _d_monitorenter(Object h) |
845 // void _d_monitorexit(Object h) | |
846 { | |
847 std::string fname("_d_monitorenter"); | |
848 std::string fname2("_d_monitorexit"); | |
849 std::vector<const LLType*> types; | |
850 types.push_back(objectTy); | |
851 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
1277
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
852 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
853 ->setAttributes(Attr_1_NoCapture); |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
854 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M) |
6bd5ce91b136
Add some attributes to runtime calls, to provide the standard LLVM optimization
Frits van Bommel <fvbommel wxs.nl>
parents:
1161
diff
changeset
|
855 ->setAttributes(Attr_1_NoCapture); |
309 | 856 } |
314
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
857 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
858 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
859 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
860 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
861 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
862 // 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
|
863 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
864 std::string fname("_d_eh_personality"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
865 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
866 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
867 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
868 types.push_back(longTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
869 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
870 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
871 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
|
872 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
|
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 // void _d_eh_resume_unwind(ptr exc_struct) |
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 std::string fname("_d_eh_resume_unwind"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
878 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
879 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
880 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
|
881 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
|
882 } |
530
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
883 |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
884 ///////////////////////////////////////////////////////////////////////////////////// |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
885 ///////////////////////////////////////////////////////////////////////////////////// |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
886 ///////////////////////////////////////////////////////////////////////////////////// |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
887 |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
888 // void _d_invariant(Object o) |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
889 { |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
890 std::string fname("_d_invariant"); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
891 std::vector<const LLType*> types; |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
892 types.push_back(objectTy); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
893 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
894 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
895 } |
309 | 896 } |