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