Mercurial > projects > ldc
annotate gen/runtime.cpp @ 1524:b265fb6ce15b
Merge.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Mon, 06 Jul 2009 23:56:11 +0100 |
parents | 833337c65fd3 982eb70e83b2 |
children | f19adff18813 |
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(); | |
119 return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target); | |
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 { |
1523
833337c65fd3
Fixed some unmerged parts of the D2 frontend.
Robert Clipsham <robert@octarineparrot.com>
parents:
1512
diff
changeset
|
339 #if DMDV2 |
833337c65fd3
Fixed some unmerged parts of the D2 frontend.
Robert Clipsham <robert@octarineparrot.com>
parents:
1512
diff
changeset
|
340 std::string fname("_d_newclass"); |
833337c65fd3
Fixed some unmerged parts of the D2 frontend.
Robert Clipsham <robert@octarineparrot.com>
parents:
1512
diff
changeset
|
341 #else |
728
635f91212b78
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create.
Christian Kamm <kamm incasoftware de>
parents:
719
diff
changeset
|
342 std::string fname("_d_allocclass"); |
1523
833337c65fd3
Fixed some unmerged parts of the D2 frontend.
Robert Clipsham <robert@octarineparrot.com>
parents:
1512
diff
changeset
|
343 #endif |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 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
|
348 ->setAttributes(Attr_NoAlias); |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
349 } |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
350 |
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 // 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
|
352 { |
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 std::string fname("_d_delarray"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 } |
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 // 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
|
362 // 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
|
363 // 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
|
364 { |
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 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
|
366 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
|
367 std::string fname3("_d_callfinalizer"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 } |
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
|
375 |
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 // 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
|
377 { |
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 std::string fname("_d_delclass"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
379 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
|
380 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
|
381 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
|
382 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
|
383 } |
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
|
384 |
132 | 385 ///////////////////////////////////////////////////////////////////////////////////// |
386 ///////////////////////////////////////////////////////////////////////////////////// | |
387 ///////////////////////////////////////////////////////////////////////////////////// | |
388 | |
389 #define ARRAY_INIT(TY,suffix) \ | |
390 { \ | |
391 std::string fname("_d_array_init_"); \ | |
392 fname.append(suffix); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
393 std::vector<const LLType*> types; \ |
132 | 394 types.push_back(rt_ptr(TY)); \ |
395 types.push_back(sizeTy); \ | |
396 types.push_back(TY); \ | |
397 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
|
398 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
|
399 ->setAttributes(Attr_1_NoCapture); \ |
132 | 400 } |
401 | |
402 ARRAY_INIT(shortTy,"i16") | |
403 ARRAY_INIT(intTy,"i32") | |
404 ARRAY_INIT(longTy,"i64") | |
405 ARRAY_INIT(floatTy,"float") | |
406 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
|
407 ARRAY_INIT(realTy,"real") |
586
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
408 ARRAY_INIT(cfloatTy,"cfloat") |
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
409 ARRAY_INIT(cdoubleTy,"cdouble") |
192b82878b78
Fixed most regressions from last commit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
530
diff
changeset
|
410 ARRAY_INIT(crealTy,"creal") |
132 | 411 ARRAY_INIT(voidPtrTy,"pointer") |
412 | |
413 #undef ARRAY_INIT | |
414 | |
415 // array init mem | |
416 // 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
|
417 // + |
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 // 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
|
419 // void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) |
132 | 420 { |
421 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
|
422 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
|
423 std::vector<const LLType*> types; |
132 | 424 types.push_back(voidPtrTy); |
425 types.push_back(sizeTy); | |
426 types.push_back(voidPtrTy); | |
427 types.push_back(sizeTy); | |
428 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
|
429 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
|
430 ->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
|
431 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
|
432 ->setAttributes(Attr_1_3_NoCapture); |
132 | 433 } |
434 | |
435 ///////////////////////////////////////////////////////////////////////////////////// | |
436 ///////////////////////////////////////////////////////////////////////////////////// | |
437 ///////////////////////////////////////////////////////////////////////////////////// | |
438 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
439 // int _aApplycd1(char[] aa, dg_t dg) |
132 | 440 #define STR_APPLY1(TY,a,b) \ |
441 { \ | |
442 std::string fname(a); \ | |
443 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
444 std::vector<const LLType*> types; \ |
132 | 445 types.push_back(TY); \ |
446 types.push_back(rt_dg1()); \ | |
447 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
|
448 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
|
449 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 450 } |
451 STR_APPLY1(stringTy, "_aApplycw1", "_aApplycd1") | |
452 STR_APPLY1(wstringTy, "_aApplywc1", "_aApplywd1") | |
453 STR_APPLY1(dstringTy, "_aApplydc1", "_aApplydw1") | |
454 #undef STR_APPLY | |
455 | |
240
0db62b770a49
[svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
lindquist
parents:
213
diff
changeset
|
456 // int _aApplycd2(char[] aa, dg2_t dg) |
132 | 457 #define STR_APPLY2(TY,a,b) \ |
458 { \ | |
459 std::string fname(a); \ | |
460 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
461 std::vector<const LLType*> types; \ |
132 | 462 types.push_back(TY); \ |
463 types.push_back(rt_dg2()); \ | |
464 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
|
465 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
|
466 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 467 } |
468 STR_APPLY2(stringTy, "_aApplycw2", "_aApplycd2") | |
469 STR_APPLY2(wstringTy, "_aApplywc2", "_aApplywd2") | |
470 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | |
471 #undef STR_APPLY2 | |
472 | |
473 #define STR_APPLY_R1(TY,a,b) \ | |
474 { \ | |
475 std::string fname(a); \ | |
476 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
477 std::vector<const LLType*> types; \ |
132 | 478 types.push_back(TY); \ |
479 types.push_back(rt_dg1()); \ | |
480 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
|
481 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
|
482 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 483 } |
484 STR_APPLY_R1(stringTy, "_aApplyRcw1", "_aApplyRcd1") | |
485 STR_APPLY_R1(wstringTy, "_aApplyRwc1", "_aApplyRwd1") | |
486 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | |
487 #undef STR_APPLY | |
488 | |
489 #define STR_APPLY_R2(TY,a,b) \ | |
490 { \ | |
491 std::string fname(a); \ | |
492 std::string fname2(b); \ | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
493 std::vector<const LLType*> types; \ |
132 | 494 types.push_back(TY); \ |
495 types.push_back(rt_dg2()); \ | |
496 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
|
497 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
|
498 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ |
132 | 499 } |
500 STR_APPLY_R2(stringTy, "_aApplyRcw2", "_aApplyRcd2") | |
501 STR_APPLY_R2(wstringTy, "_aApplyRwc2", "_aApplyRwd2") | |
502 STR_APPLY_R2(dstringTy, "_aApplyRdc2", "_aApplyRdw2") | |
503 #undef STR_APPLY2 | |
504 | |
505 ///////////////////////////////////////////////////////////////////////////////////// | |
506 ///////////////////////////////////////////////////////////////////////////////////// | |
507 ///////////////////////////////////////////////////////////////////////////////////// | |
508 | |
509 // fixes the length for dynamic array casts | |
510 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
511 { | |
512 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
|
513 std::vector<const LLType*> types; |
132 | 514 types.push_back(sizeTy); |
515 types.push_back(sizeTy); | |
516 types.push_back(sizeTy); | |
517 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
|
518 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
|
519 ->setAttributes(Attr_ReadNone); |
132 | 520 } |
521 | |
522 ///////////////////////////////////////////////////////////////////////////////////// | |
523 ///////////////////////////////////////////////////////////////////////////////////// | |
524 ///////////////////////////////////////////////////////////////////////////////////// | |
525 | |
526 // cast to object | |
527 // Object _d_toObject(void* p) | |
528 { | |
529 std::string fname("_d_toObject"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
530 std::vector<const LLType*> types; |
132 | 531 types.push_back(voidPtrTy); |
532 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
|
533 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
|
534 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 535 } |
536 | |
537 // cast interface | |
538 // Object _d_interface_cast(void* p, ClassInfo c) | |
539 { | |
540 std::string fname("_d_interface_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
541 std::vector<const LLType*> types; |
132 | 542 types.push_back(voidPtrTy); |
543 types.push_back(classInfoTy); | |
544 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
|
545 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
|
546 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 547 } |
548 | |
549 // dynamic cast | |
550 // Object _d_dynamic_cast(Object o, ClassInfo c) | |
551 { | |
552 std::string fname("_d_dynamic_cast"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
553 std::vector<const LLType*> types; |
132 | 554 types.push_back(objectTy); |
555 types.push_back(classInfoTy); | |
556 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
|
557 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
|
558 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 559 } |
560 | |
561 ///////////////////////////////////////////////////////////////////////////////////// | |
562 ///////////////////////////////////////////////////////////////////////////////////// | |
563 ///////////////////////////////////////////////////////////////////////////////////// | |
564 | |
565 // char[] _adReverseChar(char[] a) | |
566 // char[] _adSortChar(char[] a) | |
567 { | |
568 std::string fname("_adReverseChar"); | |
569 std::string fname2("_adSortChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
570 std::vector<const LLType*> types; |
132 | 571 types.push_back(stringTy); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
572 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
|
573 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
|
574 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 575 } |
576 | |
577 // wchar[] _adReverseWchar(wchar[] a) | |
578 // wchar[] _adSortWchar(wchar[] a) | |
579 { | |
580 std::string fname("_adReverseWchar"); | |
581 std::string fname2("_adSortWchar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
582 std::vector<const LLType*> types; |
132 | 583 types.push_back(wstringTy); |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
584 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
|
585 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
|
586 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 587 } |
588 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
589 // void[] _adReverse(void[] a, size_t szelem) |
132 | 590 { |
591 std::string fname("_adReverse"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
592 std::vector<const LLType*> types; |
132 | 593 types.push_back(rt_array(byteTy)); |
594 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
595 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
|
596 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
|
597 ->setAttributes(Attr_NoUnwind); |
132 | 598 } |
599 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
600 // void[] _adDupT(TypeInfo ti, void[] a) |
132 | 601 { |
602 std::string fname("_adDupT"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
603 std::vector<const LLType*> types; |
132 | 604 types.push_back(typeInfoTy); |
605 types.push_back(rt_array(byteTy)); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
606 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
|
607 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 608 } |
609 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
610 // 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
|
611 // int _adCmp(void[] a1, void[] a2, TypeInfo ti) |
132 | 612 { |
613 std::string fname("_adEq"); | |
614 std::string fname2("_adCmp"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
615 std::vector<const LLType*> types; |
132 | 616 types.push_back(rt_array(byteTy)); |
617 types.push_back(rt_array(byteTy)); | |
618 types.push_back(typeInfoTy); | |
619 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
|
620 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
|
621 ->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
|
622 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
|
623 ->setAttributes(Attr_ReadOnly); |
132 | 624 } |
625 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
626 // int _adCmpChar(void[] a1, void[] a2) |
132 | 627 { |
628 std::string fname("_adCmpChar"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
629 std::vector<const LLType*> types; |
132 | 630 types.push_back(rt_array(byteTy)); |
631 types.push_back(rt_array(byteTy)); | |
632 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
|
633 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
|
634 ->setAttributes(Attr_ReadOnly_NoUnwind); |
132 | 635 } |
636 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
637 // void[] _adSort(void[] a, TypeInfo ti) |
132 | 638 { |
639 std::string fname("_adSort"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
640 std::vector<const LLType*> types; |
132 | 641 types.push_back(rt_array(byteTy)); |
642 types.push_back(typeInfoTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
643 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
|
644 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 645 } |
646 | |
647 ///////////////////////////////////////////////////////////////////////////////////// | |
648 ///////////////////////////////////////////////////////////////////////////////////// | |
649 ///////////////////////////////////////////////////////////////////////////////////// | |
650 | |
651 // size_t _aaLen(AA aa) | |
652 { | |
653 std::string fname("_aaLen"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
654 std::vector<const LLType*> types; |
132 | 655 types.push_back(aaTy); |
656 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
|
657 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
|
658 ->setAttributes(Attr_ReadOnly_NoUnwind_1_NoCapture); |
132 | 659 } |
660 | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
661 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
132 | 662 { |
663 std::string fname("_aaGet"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
664 std::vector<const LLType*> types; |
132 | 665 types.push_back(aaTy); |
666 types.push_back(typeInfoTy); | |
163
a8cd9bc1021a
[svn r179] lots and lots of fixes, much more of tango now compiles/works.
lindquist
parents:
157
diff
changeset
|
667 types.push_back(sizeTy); |
132 | 668 types.push_back(voidPtrTy); |
669 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
|
670 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
|
671 ->setAttributes(Attr_1_4_NoCapture); |
132 | 672 } |
673 | |
674 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | |
675 { | |
676 std::string fname("_aaIn"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
677 std::vector<const LLType*> types; |
132 | 678 types.push_back(aaTy); |
679 types.push_back(typeInfoTy); | |
680 types.push_back(voidPtrTy); | |
681 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
|
682 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
|
683 ->setAttributes(Attr_ReadOnly_1_3_NoCapture); |
132 | 684 } |
685 | |
686 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | |
687 { | |
688 std::string fname("_aaDel"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
689 std::vector<const LLType*> types; |
132 | 690 types.push_back(aaTy); |
691 types.push_back(typeInfoTy); | |
692 types.push_back(voidPtrTy); | |
693 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
|
694 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
|
695 ->setAttributes(Attr_1_3_NoCapture); |
132 | 696 } |
697 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
698 // void[] _aaValues(AA aa, size_t keysize, size_t valuesize) |
132 | 699 { |
700 std::string fname("_aaValues"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
701 std::vector<const LLType*> types; |
132 | 702 types.push_back(aaTy); |
703 types.push_back(sizeTy); | |
704 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
705 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
|
706 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
|
707 ->setAttributes(Attr_NoAlias_1_NoCapture); |
132 | 708 } |
709 | |
710 // void* _aaRehash(AA* paa, TypeInfo keyti) | |
711 { | |
712 std::string fname("_aaRehash"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
713 std::vector<const LLType*> types; |
132 | 714 types.push_back(aaTy); |
715 types.push_back(typeInfoTy); | |
716 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
|
717 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
132 | 718 } |
719 | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
720 // void[] _aaKeys(AA aa, size_t keysize) |
132 | 721 { |
722 std::string fname("_aaKeys"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
723 std::vector<const LLType*> types; |
132 | 724 types.push_back(aaTy); |
725 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
726 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
|
727 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
|
728 ->setAttributes(Attr_NoAlias_1_NoCapture); |
132 | 729 } |
730 | |
731 // int _aaApply(AA aa, size_t keysize, dg_t dg) | |
732 { | |
733 std::string fname("_aaApply"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
734 std::vector<const LLType*> types; |
132 | 735 types.push_back(aaTy); |
736 types.push_back(sizeTy); | |
737 types.push_back(rt_dg1()); | |
738 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
|
739 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
|
740 ->setAttributes(Attr_1_NoCapture); |
132 | 741 } |
742 | |
743 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | |
744 { | |
745 std::string fname("_aaApply2"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
746 std::vector<const LLType*> types; |
132 | 747 types.push_back(aaTy); |
748 types.push_back(sizeTy); | |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
749 types.push_back(rt_dg2()); |
132 | 750 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
|
751 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
|
752 ->setAttributes(Attr_1_NoCapture); |
132 | 753 } |
754 | |
1512
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
755 // 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
|
756 { |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
757 std::string fname("_aaEq"); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
758 std::vector<const LLType*> types; |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
759 types.push_back(aaTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
760 types.push_back(aaTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
761 types.push_back(typeInfoTy); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
762 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
|
763 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
|
764 ->setAttributes(Attr_1_2_NoCapture); |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
765 } |
09734fb929c0
Make == for associative arrays test for equality, not identity.
Christian Kamm <kamm incasoftware de>
parents:
1506
diff
changeset
|
766 |
132 | 767 ///////////////////////////////////////////////////////////////////////////////////// |
768 ///////////////////////////////////////////////////////////////////////////////////// | |
769 ///////////////////////////////////////////////////////////////////////////////////// | |
770 | |
771 // void _moduleCtor() | |
772 // void _moduleDtor() | |
773 { | |
774 std::string fname("_moduleCtor"); | |
775 std::string fname2("_moduleDtor"); | |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
776 std::vector<const LLType*> types; |
132 | 777 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
|
778 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
|
779 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
132 | 780 } |
781 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
782 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
783 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
784 ///////////////////////////////////////////////////////////////////////////////////// |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
785 |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
786 // 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
|
787 { |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
788 std::string fname("_d_throw_exception"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
789 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
|
790 types.push_back(objectTy); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
132
diff
changeset
|
791 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
|
792 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
|
793 } |
191
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
798 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
799 // 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
|
800 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
801 std::string fname("_d_switch_string"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
802 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
803 types.push_back(rt_array(stringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
804 types.push_back(stringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
805 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
|
806 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
|
807 ->setAttributes(Attr_ReadOnly); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
808 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
809 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
810 // 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
|
811 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
812 std::string fname("_d_switch_ustring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
813 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
814 types.push_back(rt_array(wstringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
815 types.push_back(wstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
816 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
|
817 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
|
818 ->setAttributes(Attr_ReadOnly); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
819 } |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
820 |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
821 // 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
|
822 { |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
823 std::string fname("_d_switch_dstring"); |
213
7816aafeea3c
[svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents:
209
diff
changeset
|
824 std::vector<const LLType*> types; |
715
30b42a283c8e
Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
825 types.push_back(rt_array(dstringTy)); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
826 types.push_back(dstringTy); |
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
827 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
|
828 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
|
829 ->setAttributes(Attr_ReadOnly); |
191
2900754a6989
[svn r207] Fixed: the runtime support didn't handle string switch.
lindquist
parents:
173
diff
changeset
|
830 } |
132 | 831 |
309 | 832 ///////////////////////////////////////////////////////////////////////////////////// |
833 ///////////////////////////////////////////////////////////////////////////////////// | |
834 ///////////////////////////////////////////////////////////////////////////////////// | |
132 | 835 |
309 | 836 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) |
837 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) | |
838 { | |
839 std::string fname("_d_criticalenter"); | |
840 std::string fname2("_d_criticalexit"); | |
841 std::vector<const LLType*> types; | |
842 types.push_back(rt_ptr(DtoMutexType())); | |
843 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | |
844 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | |
845 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | |
846 } | |
132 | 847 |
309 | 848 // void _d_monitorenter(Object h) |
849 // void _d_monitorexit(Object h) | |
850 { | |
851 std::string fname("_d_monitorenter"); | |
852 std::string fname2("_d_monitorexit"); | |
853 std::vector<const LLType*> types; | |
854 types.push_back(objectTy); | |
855 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
|
856 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
|
857 ->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
|
858 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
|
859 ->setAttributes(Attr_1_NoCapture); |
309 | 860 } |
314
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
861 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
862 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
863 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
864 ///////////////////////////////////////////////////////////////////////////////////// |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
865 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
866 // 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
|
867 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
868 std::string fname("_d_eh_personality"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
869 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
870 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
871 types.push_back(intTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
872 types.push_back(longTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
873 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
874 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
875 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
|
876 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
|
877 } |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
878 |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
879 // void _d_eh_resume_unwind(ptr exc_struct) |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
880 { |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
881 std::string fname("_d_eh_resume_unwind"); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
882 std::vector<const LLType*> types; |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
883 types.push_back(voidPtrTy); |
8d98e42ece93
[svn r335] The basics of exception handling are in place.
ChristianK
parents:
309
diff
changeset
|
884 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
|
885 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
|
886 } |
530
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 ///////////////////////////////////////////////////////////////////////////////////// |
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 ///////////////////////////////////////////////////////////////////////////////////// |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
891 |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
892 // void _d_invariant(Object o) |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
893 { |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
894 std::string fname("_d_invariant"); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
895 std::vector<const LLType*> types; |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
896 types.push_back(objectTy); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
897 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
898 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
d30c40f1128d
Make class invariants work.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
899 } |
309 | 900 } |