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