Line 0
Link Here
|
|
|
1 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
2 |
index 89930e5..99ef0cc 100644 |
3 |
--- a/CMakeLists.txt |
4 |
+++ b/CMakeLists.txt |
5 |
@@ -23,8 +23,8 @@ if(UNIX) |
6 |
OUTPUT_VARIABLE LLVM_VERSION |
7 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
8 |
) |
9 |
- if(NOT ${LLVM_VERSION} STREQUAL "3.1") |
10 |
- message(FATAL_ERROR "Clay requires LLVM 3.1.") |
11 |
+ if(NOT ${LLVM_VERSION} STREQUAL "3.2") |
12 |
+ message(FATAL_ERROR "Clay requires LLVM 3.2.") |
13 |
endif() |
14 |
|
15 |
execute_process( |
16 |
diff --git a/README.txt b/README.txt |
17 |
index 855a4ab..7999b24 100644 |
18 |
--- a/README.txt |
19 |
+++ b/README.txt |
20 |
@@ -9,7 +9,7 @@ Visit http://claylabs.com/clay for more information. |
21 |
Pre-requisites |
22 |
-------------- |
23 |
|
24 |
-Clay requires LLVM 3.1, Clang 3.1, and CMake version 2.6 or later. |
25 |
+Clay requires LLVM 3.2, Clang 3.2, and CMake version 2.6 or later. |
26 |
|
27 |
CMake Configuration |
28 |
------------------- |
29 |
@@ -20,7 +20,7 @@ be customized by passing cmake arguments of the form |
30 |
CMake variables such as CMAKE_INSTALL_PREFIX and CMAKE_BUILD_TYPE, Clay's |
31 |
build system uses the following variables: |
32 |
|
33 |
-* LLVM_DIR can be set to the install prefix of an LLVM 3.1 installation. |
34 |
+* LLVM_DIR can be set to the install prefix of an LLVM 3.2 installation. |
35 |
If not set, CMake will look for an 'llvm-config' script on the PATH. |
36 |
* PYTHON_EXECUTABLE can be set to the path of a Python 2.x interpreter. |
37 |
Clay uses a Python 2 script to drive its test suite. Some platforms |
38 |
@@ -70,7 +70,7 @@ and the MSVC compiler. There are some issues with Debug builds and |
39 |
LLVM, so both LLVM and Clay will need to be built as Release. The |
40 |
default LLVM install directory needs Administrator permissions, so |
41 |
you may want to set a CMAKE_INSTALL_PREFIX as well. to change it. |
42 |
-Place the Clang repository in llvm-3.1/tools/clang so that LLVM builds |
43 |
+Place the Clang repository in llvm-3.2/tools/clang so that LLVM builds |
44 |
it automatically and compile LLVM with the following commands: |
45 |
|
46 |
mkdir build |
47 |
diff --git a/compiler/src/clay.hpp b/compiler/src/clay.hpp |
48 |
index 339b262..2c95623 100644 |
49 |
--- a/compiler/src/clay.hpp |
50 |
+++ b/compiler/src/clay.hpp |
51 |
@@ -27,8 +27,6 @@ |
52 |
#endif |
53 |
|
54 |
#include <llvm/ADT/Triple.h> |
55 |
-#include <llvm/Analysis/DebugInfo.h> |
56 |
-#include <llvm/Analysis/DIBuilder.h> |
57 |
#include <llvm/Assembly/Writer.h> |
58 |
#include <llvm/Assembly/Parser.h> |
59 |
#include <llvm/Assembly/PrintModulePass.h> |
60 |
@@ -36,12 +34,16 @@ |
61 |
#include <llvm/Bitcode/ReaderWriter.h> |
62 |
#include <llvm/CodeGen/LinkAllAsmWriterComponents.h> |
63 |
#include <llvm/CodeGen/LinkAllCodegenComponents.h> |
64 |
+#include <llvm/DataLayout.h> |
65 |
+#include <llvm/DebugInfo.h> |
66 |
#include <llvm/DerivedTypes.h> |
67 |
+#include <llvm/DIBuilder.h> |
68 |
#include <llvm/ExecutionEngine/ExecutionEngine.h> |
69 |
#include <llvm/ExecutionEngine/GenericValue.h> |
70 |
#include <llvm/ExecutionEngine/JIT.h> |
71 |
#include <llvm/Function.h> |
72 |
#include <llvm/Intrinsics.h> |
73 |
+#include <llvm/IRBuilder.h> |
74 |
#include <llvm/LinkAllVMCore.h> |
75 |
#include <llvm/LLVMContext.h> |
76 |
#include <llvm/Module.h> |
77 |
@@ -50,7 +52,6 @@ |
78 |
#include <llvm/Support/FileSystem.h> |
79 |
#include <llvm/Support/FormattedStream.h> |
80 |
#include <llvm/Support/Host.h> |
81 |
-#include <llvm/Support/IRBuilder.h> |
82 |
#include <llvm/Support/MemoryBuffer.h> |
83 |
#include <llvm/Support/Path.h> |
84 |
#include <llvm/Support/PathV2.h> |
85 |
@@ -59,7 +60,6 @@ |
86 |
#include <llvm/Support/TargetSelect.h> |
87 |
#include <llvm/Support/TargetSelect.h> |
88 |
#include <llvm/Support/raw_ostream.h> |
89 |
-#include <llvm/Target/TargetData.h> |
90 |
#include <llvm/Target/TargetOptions.h> |
91 |
#include <llvm/Transforms/IPO/PassManagerBuilder.h> |
92 |
#include <llvm/Transforms/IPO.h> |
93 |
@@ -3450,7 +3450,7 @@ static const unsigned short DW_LANG_user_CLAY = 0xC1A4; |
94 |
|
95 |
extern llvm::Module *llvmModule; |
96 |
extern llvm::DIBuilder *llvmDIBuilder; |
97 |
-extern const llvm::TargetData *llvmTargetData; |
98 |
+extern const llvm::DataLayout *llvmDataLayout; |
99 |
|
100 |
llvm::PointerType *exceptionReturnType(); |
101 |
llvm::Value *noExceptionReturnValue(); |
102 |
diff --git a/compiler/src/codegen.cpp b/compiler/src/codegen.cpp |
103 |
index f6ed737..1fb574e 100644 |
104 |
--- a/compiler/src/codegen.cpp |
105 |
+++ b/compiler/src/codegen.cpp |
106 |
@@ -5,7 +5,7 @@ namespace clay { |
107 |
llvm::Module *llvmModule = NULL; |
108 |
llvm::DIBuilder *llvmDIBuilder = NULL; |
109 |
llvm::ExecutionEngine *llvmEngine; |
110 |
-const llvm::TargetData *llvmTargetData; |
111 |
+const llvm::DataLayout *llvmDataLayout; |
112 |
|
113 |
static vector<CValuePtr> initializedGlobals; |
114 |
static CodegenContextPtr constructorsCtx; |
115 |
@@ -2886,7 +2886,10 @@ void codegenCodeBody(InvokeEntryPtr entry) |
116 |
llvmModule); |
117 |
|
118 |
for (unsigned i = 1; i <= llArgTypes.size(); ++i) { |
119 |
- llFunc->addAttribute(i, llvm::Attribute::NoAlias); |
120 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
121 |
+ llFunc->getContext(), |
122 |
+ llvm::Attributes::NoAlias); |
123 |
+ llFunc->addAttribute(i, attrs); |
124 |
} |
125 |
|
126 |
entry->llvmFunc = llFunc; |
127 |
@@ -2903,15 +2906,22 @@ void codegenCodeBody(InvokeEntryPtr entry) |
128 |
for (unsigned i = 0; i < entry->argsKey.size(); ++i) { |
129 |
llvm::DIType argType = llvmTypeDebugInfo(entry->argsKey[i]); |
130 |
llvm::DIType argRefType |
131 |
- = llvmDIBuilder->createReferenceType(argType); |
132 |
+ = llvmDIBuilder->createReferenceType( |
133 |
+ llvm::dwarf::DW_TAG_reference_type, |
134 |
+ argType); |
135 |
debugParamTypes.push_back(argRefType); |
136 |
} |
137 |
for (unsigned i = 0; i < entry->returnTypes.size(); ++i) { |
138 |
llvm::DIType returnType = llvmTypeDebugInfo(entry->returnTypes[i]); |
139 |
llvm::DIType returnRefType = entry->returnIsRef[i] |
140 |
? llvmDIBuilder->createReferenceType( |
141 |
- llvmDIBuilder->createReferenceType(returnType)) |
142 |
- : llvmDIBuilder->createReferenceType(returnType); |
143 |
+ llvm::dwarf::DW_TAG_reference_type, |
144 |
+ llvmDIBuilder->createReferenceType( |
145 |
+ llvm::dwarf::DW_TAG_reference_type, |
146 |
+ returnType)) |
147 |
+ : llvmDIBuilder->createReferenceType( |
148 |
+ llvm::dwarf::DW_TAG_reference_type, |
149 |
+ returnType); |
150 |
|
151 |
debugParamTypes.push_back(returnRefType); |
152 |
} |
153 |
@@ -2983,6 +2993,7 @@ void codegenCodeBody(InvokeEntryPtr entry) |
154 |
file, // file |
155 |
line, // line |
156 |
llvmDIBuilder->createReferenceType( |
157 |
+ llvm::dwarf::DW_TAG_reference_type, |
158 |
llvmTypeDebugInfo(entry->fixedArgTypes[i])), // type |
159 |
true, // alwaysPreserve |
160 |
0, // flags |
161 |
@@ -3025,6 +3036,7 @@ void codegenCodeBody(InvokeEntryPtr entry) |
162 |
file, // file |
163 |
line, // line |
164 |
llvmDIBuilder->createReferenceType( |
165 |
+ llvm::dwarf::DW_TAG_reference_type, |
166 |
llvmTypeDebugInfo(entry->varArgTypes[i])), // type |
167 |
true, // alwaysPreserve |
168 |
0, // flags |
169 |
@@ -3084,6 +3096,7 @@ void codegenCodeBody(InvokeEntryPtr entry) |
170 |
file, // file |
171 |
line, // line |
172 |
llvmDIBuilder->createReferenceType( |
173 |
+ llvm::dwarf::DW_TAG_reference_type, |
174 |
llvmTypeDebugInfo(returns[i].type)), // type |
175 |
true, // alwaysPreserve |
176 |
0, // flags |
177 |
@@ -4076,6 +4089,7 @@ EnvPtr codegenBinding(BindingPtr x, EnvPtr env, CodegenContextPtr ctx) |
178 |
file, // file |
179 |
line, // line |
180 |
llvmDIBuilder->createReferenceType( |
181 |
+ llvm::dwarf::DW_TAG_reference_type, |
182 |
llvmTypeDebugInfo(pv->type)), // type |
183 |
true, // alwaysPreserve |
184 |
0, // flags |
185 |
@@ -4133,6 +4147,7 @@ EnvPtr codegenBinding(BindingPtr x, EnvPtr env, CodegenContextPtr ctx) |
186 |
pv->isTemp |
187 |
? llvmTypeDebugInfo(pv->type) |
188 |
: llvmDIBuilder->createReferenceType( |
189 |
+ llvm::dwarf::DW_TAG_reference_type, |
190 |
llvmTypeDebugInfo(pv->type)), // type |
191 |
true, // alwaysPreserve |
192 |
0, // flags |
193 |
@@ -6464,8 +6479,8 @@ llvm::TargetMachine *initLLVM(std::string const &targetTriple, |
194 |
targetTriple, "", "", llvm::TargetOptions(), reloc, codeModel); |
195 |
|
196 |
if (targetMachine != NULL) { |
197 |
- llvmTargetData = targetMachine->getTargetData(); |
198 |
- llvmModule->setDataLayout(llvmTargetData->getStringRepresentation()); |
199 |
+ llvmDataLayout = targetMachine->getDataLayout(); |
200 |
+ llvmModule->setDataLayout(llvmDataLayout->getStringRepresentation()); |
201 |
} |
202 |
|
203 |
return targetMachine; |
204 |
diff --git a/compiler/src/externals.cpp b/compiler/src/externals.cpp |
205 |
index f7cd333..ba43797 100644 |
206 |
--- a/compiler/src/externals.cpp |
207 |
+++ b/compiler/src/externals.cpp |
208 |
@@ -23,11 +23,12 @@ static llvm::Value *promoteCVarArg(CallingConv conv, |
209 |
} |
210 |
case FLOAT_TYPE : { |
211 |
FloatType *ft = (FloatType *)t.ptr(); |
212 |
- if (ft->bits == 32) |
213 |
+ if (ft->bits == 32) { |
214 |
if(ft->isImaginary) |
215 |
return ctx->builder->CreateFPExt(llv, llvmType(imag64Type)); |
216 |
else |
217 |
return ctx->builder->CreateFPExt(llv, llvmType(float64Type)); |
218 |
+ } |
219 |
return llv; |
220 |
} |
221 |
default : |
222 |
@@ -43,8 +44,12 @@ llvm::Type *ExternalTarget::pushReturnType(CallingConv conv, |
223 |
if (type == NULL) |
224 |
return llvmVoidType(); |
225 |
else if (typeReturnsBySretPointer(conv, type)) { |
226 |
- llArgTypes.push_back(llvmPointerType(type)); |
227 |
- llAttributes.push_back(make_pair(llArgTypes.size(), llvm::Attribute::StructRet)); |
228 |
+ llvm::Type *llType = llvmPointerType(type); |
229 |
+ llArgTypes.push_back(llType); |
230 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
231 |
+ llType->getContext(), |
232 |
+ llvm::Attributes::StructRet); |
233 |
+ llAttributes.push_back(make_pair(llArgTypes.size(), attrs)); |
234 |
return llvmVoidType(); |
235 |
} else { |
236 |
llvm::Type *bitcastType = typeReturnsAsBitcastType(conv, type); |
237 |
@@ -61,8 +66,12 @@ void ExternalTarget::pushArgumentType(CallingConv conv, |
238 |
vector< pair<unsigned, llvm::Attributes> > &llAttributes) |
239 |
{ |
240 |
if (typePassesByByvalPointer(conv, type, false)) { |
241 |
- llArgTypes.push_back(llvmPointerType(type)); |
242 |
- llAttributes.push_back(make_pair(llArgTypes.size(), llvm::Attribute::ByVal)); |
243 |
+ llvm::Type *llType = llvmPointerType(type); |
244 |
+ llArgTypes.push_back(llType); |
245 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
246 |
+ llType->getContext(), |
247 |
+ llvm::Attributes::ByVal); |
248 |
+ llAttributes.push_back(make_pair(llArgTypes.size(), attrs)); |
249 |
} else { |
250 |
llvm::Type *bitcastType = typePassesAsBitcastType(conv, type, false); |
251 |
if (bitcastType != NULL) |
252 |
@@ -171,7 +180,10 @@ void ExternalTarget::loadStructRetArgument(CallingConv conv, |
253 |
CValuePtr out0 = out->values[0]; |
254 |
assert(out0->type == type); |
255 |
llArgs.push_back(out0->llValue); |
256 |
- llAttributes.push_back(make_pair(llArgs.size(), llvm::Attribute::StructRet)); |
257 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
258 |
+ out0->llValue->getContext(), |
259 |
+ llvm::Attributes::StructRet); |
260 |
+ llAttributes.push_back(make_pair(llArgs.size(), attrs)); |
261 |
} |
262 |
} |
263 |
|
264 |
@@ -183,7 +195,10 @@ void ExternalTarget::loadArgument(CallingConv conv, |
265 |
{ |
266 |
if (typePassesByByvalPointer(conv, cv->type, false)) { |
267 |
llArgs.push_back(cv->llValue); |
268 |
- llAttributes.push_back(make_pair(llArgs.size(), llvm::Attribute::ByVal)); |
269 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
270 |
+ cv->llValue->getContext(), |
271 |
+ llvm::Attributes::ByVal); |
272 |
+ llAttributes.push_back(make_pair(llArgs.size(), attrs)); |
273 |
} else { |
274 |
llvm::Type *bitcastType = typePassesAsBitcastType(conv, cv->type, false); |
275 |
if (bitcastType != NULL) { |
276 |
@@ -206,7 +221,10 @@ void ExternalTarget::loadVarArgument(CallingConv conv, |
277 |
{ |
278 |
if (typePassesByByvalPointer(conv, cv->type, true)) { |
279 |
llArgs.push_back(cv->llValue); |
280 |
- llAttributes.push_back(make_pair(llArgs.size(), llvm::Attribute::ByVal)); |
281 |
+ llvm::Attributes attrs = llvm::Attributes::get( |
282 |
+ cv->llValue->getContext(), |
283 |
+ llvm::Attributes::ByVal); |
284 |
+ llAttributes.push_back(make_pair(llArgs.size(), attrs)); |
285 |
} else { |
286 |
llvm::Type *bitcastType = typePassesAsBitcastType(conv, cv->type, true); |
287 |
if (bitcastType != NULL) { |
288 |
@@ -845,21 +863,26 @@ llvm::Type *X86_64_ExternalTarget::llvmWordType(TypePtr type) |
289 |
llvm::StructType *llType = llvm::StructType::create(llvm::getGlobalContext(), "x86-64 " + typeName(type)); |
290 |
vector<llvm::Type*> llWordTypes; |
291 |
vector<WordClass>::const_iterator i = wordClasses.begin(); |
292 |
+ size_t size = typeSize(type); |
293 |
while (i != wordClasses.end()) { |
294 |
+ assert(size > 0); |
295 |
switch (*i) { |
296 |
// docs don't cover this case. is it possible? |
297 |
// e.g. struct { __m128 a; __m256 b; }; |
298 |
case NO_CLASS: |
299 |
assert(false); |
300 |
break; |
301 |
- case INTEGER: |
302 |
- llWordTypes.push_back(llvmIntType(64)); |
303 |
+ case INTEGER: { |
304 |
+ size_t wordSize = size >= 8 ? 64 : size*8; |
305 |
+ llWordTypes.push_back(llvmIntType(wordSize)); |
306 |
++i; |
307 |
break; |
308 |
+ } |
309 |
case SSE_INT_VECTOR: { |
310 |
int vectorRun = 0; |
311 |
do { ++vectorRun; ++i; } while (i != wordClasses.end() && *i == SSEUP); |
312 |
- // 8-byte int vectors are allocated to MMX registers |
313 |
+ // 8-byte int vectors are allocated to MMX registers, so always generate |
314 |
+ // a <float x n> vector for 64-bit SSE words. |
315 |
if (vectorRun == 1) |
316 |
llWordTypes.push_back(llvm::VectorType::get(llvmFloatType(64), vectorRun)); |
317 |
else |
318 |
@@ -913,6 +936,8 @@ llvm::Type *X86_64_ExternalTarget::llvmWordType(TypePtr type) |
319 |
assert(false); |
320 |
break; |
321 |
} |
322 |
+ assert(size >= 8 || i == wordClasses.end()); |
323 |
+ size -= 8; |
324 |
} |
325 |
llType->setBody(llWordTypes); |
326 |
return llType; |
327 |
diff --git a/compiler/src/loader.cpp b/compiler/src/loader.cpp |
328 |
index cd90f58..78b6a18 100644 |
329 |
--- a/compiler/src/loader.cpp |
330 |
+++ b/compiler/src/loader.cpp |
331 |
@@ -70,8 +70,8 @@ static std::string getCPU(llvm::Triple const &triple) { |
332 |
} |
333 |
} |
334 |
|
335 |
-static std::string getPtrSize(const llvm::TargetData *targetData) { |
336 |
- switch (targetData->getPointerSizeInBits()) { |
337 |
+static std::string getPtrSize(const llvm::DataLayout *dataLayout) { |
338 |
+ switch (dataLayout->getPointerSizeInBits()) { |
339 |
case 32 : return "32"; |
340 |
case 64 : return "64"; |
341 |
default : assert(false); return ""; |
342 |
@@ -84,7 +84,7 @@ static void initModuleSuffixes() { |
343 |
string os = getOS(triple); |
344 |
string osgroup = getOSGroup(triple); |
345 |
string cpu = getCPU(triple); |
346 |
- string bits = getPtrSize(llvmTargetData); |
347 |
+ string bits = getPtrSize(llvmDataLayout); |
348 |
moduleSuffixes.push_back("." + os + "." + cpu + "." + bits + ".clay"); |
349 |
moduleSuffixes.push_back("." + os + "." + cpu + ".clay"); |
350 |
moduleSuffixes.push_back("." + os + "." + bits + ".clay"); |
351 |
diff --git a/compiler/src/main.cpp b/compiler/src/main.cpp |
352 |
index f2fbd85..a24c20f 100644 |
353 |
--- a/compiler/src/main.cpp |
354 |
+++ b/compiler/src/main.cpp |
355 |
@@ -72,12 +72,12 @@ static void optimizeLLVM(llvm::Module *module, unsigned optLevel, bool internali |
356 |
llvm::PassManager passes; |
357 |
|
358 |
string moduleDataLayout = module->getDataLayout(); |
359 |
- llvm::TargetData *td = new llvm::TargetData(moduleDataLayout); |
360 |
- passes.add(td); |
361 |
+ llvm::DataLayout *dl = new llvm::DataLayout(moduleDataLayout); |
362 |
+ passes.add(dl); |
363 |
|
364 |
llvm::FunctionPassManager fpasses(module); |
365 |
|
366 |
- fpasses.add(new llvm::TargetData(*td)); |
367 |
+ fpasses.add(new llvm::DataLayout(*dl)); |
368 |
|
369 |
addOptimizationPasses(passes, fpasses, optLevel, internalize); |
370 |
|
371 |
@@ -116,7 +116,7 @@ static void generateAssembly(llvm::Module *module, |
372 |
|
373 |
llvm::FunctionPassManager fpasses(module); |
374 |
|
375 |
- fpasses.add(new llvm::TargetData(module)); |
376 |
+ fpasses.add(new llvm::DataLayout(module)); |
377 |
fpasses.add(llvm::createVerifierPass()); |
378 |
|
379 |
targetMachine->setAsmVerbosityDefault(true); |
380 |
@@ -180,7 +180,7 @@ static bool generateBinary(llvm::Module *module, |
381 |
vector<const char *> clangArgs; |
382 |
clangArgs.push_back(clangPath.c_str()); |
383 |
|
384 |
- switch (llvmTargetData->getPointerSizeInBits()) { |
385 |
+ switch (llvmDataLayout->getPointerSizeInBits()) { |
386 |
case 32 : |
387 |
clangArgs.push_back("-m32"); |
388 |
break; |
389 |
diff --git a/compiler/src/types.cpp b/compiler/src/types.cpp |
390 |
index 8f86faa..6990a15 100644 |
391 |
--- a/compiler/src/types.cpp |
392 |
+++ b/compiler/src/types.cpp |
393 |
@@ -43,11 +43,11 @@ static vector<vector<StaticTypePtr> > staticTypes; |
394 |
// |
395 |
|
396 |
static size_t llTypeSize(llvm::Type *llt) { |
397 |
- return (size_t)llvmTargetData->getTypeAllocSize(llt); |
398 |
+ return (size_t)llvmDataLayout->getTypeAllocSize(llt); |
399 |
} |
400 |
|
401 |
static size_t llTypeAlignment(llvm::Type *llt) { |
402 |
- return (size_t)llvmTargetData->getABITypeAlignment(llt); |
403 |
+ return (size_t)llvmDataLayout->getABITypeAlignment(llt); |
404 |
} |
405 |
|
406 |
static size_t debugTypeSize(llvm::Type *llt) { |
407 |
@@ -81,7 +81,7 @@ void initTypes() { |
408 |
complex80Type = new ComplexType(80); |
409 |
|
410 |
cIntType = int32Type; |
411 |
- switch (llvmTargetData->getPointerSizeInBits()) { |
412 |
+ switch (llvmDataLayout->getPointerSizeInBits()) { |
413 |
case 32 : |
414 |
cSizeTType = uint32Type; |
415 |
cPtrDiffTType = int32Type; |
416 |
@@ -826,7 +826,7 @@ const llvm::StructLayout *tupleTypeLayout(TupleType *t) { |
417 |
if (t->layout == NULL) { |
418 |
llvm::StructType *st = |
419 |
llvm::cast<llvm::StructType>(llvmType(t)); |
420 |
- t->layout = llvmTargetData->getStructLayout(st); |
421 |
+ t->layout = llvmDataLayout->getStructLayout(st); |
422 |
} |
423 |
return t->layout; |
424 |
} |
425 |
@@ -835,7 +835,7 @@ const llvm::StructLayout *complexTypeLayout(ComplexType *t) { |
426 |
if (t->layout == NULL) { |
427 |
llvm::StructType *st = |
428 |
llvm::cast<llvm::StructType>(llvmType(t)); |
429 |
- t->layout = llvmTargetData->getStructLayout(st); |
430 |
+ t->layout = llvmDataLayout->getStructLayout(st); |
431 |
} |
432 |
return t->layout; |
433 |
} |
434 |
@@ -844,7 +844,7 @@ const llvm::StructLayout *recordTypeLayout(RecordType *t) { |
435 |
if (t->layout == NULL) { |
436 |
llvm::StructType *st = |
437 |
llvm::cast<llvm::StructType>(llvmType(t)); |
438 |
- t->layout = llvmTargetData->getStructLayout(st); |
439 |
+ t->layout = llvmDataLayout->getStructLayout(st); |
440 |
} |
441 |
return t->layout; |
442 |
} |
443 |
@@ -1101,15 +1101,22 @@ static void declareLLVMType(TypePtr t) { |
444 |
for (unsigned i = 0; i < x->argTypes.size(); ++i) { |
445 |
llvm::DIType argType = llvmTypeDebugInfo(x->argTypes[i]); |
446 |
llvm::DIType argRefType |
447 |
- = llvmDIBuilder->createReferenceType(argType); |
448 |
+ = llvmDIBuilder->createReferenceType( |
449 |
+ llvm::dwarf::DW_TAG_reference_type, |
450 |
+ argType); |
451 |
debugParamTypes.push_back(argRefType); |
452 |
} |
453 |
for (unsigned i = 0; i < x->returnTypes.size(); ++i) { |
454 |
llvm::DIType returnType = llvmTypeDebugInfo(x->returnTypes[i]); |
455 |
llvm::DIType returnRefType = x->returnIsRef[i] |
456 |
? llvmDIBuilder->createReferenceType( |
457 |
- llvmDIBuilder->createReferenceType(returnType)) |
458 |
- : llvmDIBuilder->createReferenceType(returnType); |
459 |
+ llvm::dwarf::DW_TAG_reference_type, |
460 |
+ llvmDIBuilder->createReferenceType( |
461 |
+ llvm::dwarf::DW_TAG_reference_type, |
462 |
+ returnType)) |
463 |
+ : llvmDIBuilder->createReferenceType( |
464 |
+ llvm::dwarf::DW_TAG_reference_type, |
465 |
+ returnType); |
466 |
|
467 |
debugParamTypes.push_back(returnRefType); |
468 |
} |
469 |
@@ -1259,7 +1266,8 @@ static void declareLLVMType(TypePtr t) { |
470 |
line, |
471 |
debugTypeSize(t->llType), |
472 |
debugTypeAlignment(t->llType), |
473 |
- enumArray); |
474 |
+ enumArray, |
475 |
+ llvm::DIType()); |
476 |
} |
477 |
break; |
478 |
} |
479 |
@@ -1358,8 +1366,8 @@ static void defineLLVMType(TypePtr t) { |
480 |
size_t maxSize = 0; |
481 |
for (unsigned i = 0; i < x->memberTypes.size(); ++i) { |
482 |
llvm::Type *llt = llvmType(x->memberTypes[i]); |
483 |
- size_t align = (size_t)llvmTargetData->getABITypeAlignment(llt); |
484 |
- size_t size = (size_t)llvmTargetData->getTypeAllocSize(llt); |
485 |
+ size_t align = (size_t)llvmDataLayout->getABITypeAlignment(llt); |
486 |
+ size_t size = (size_t)llvmDataLayout->getTypeAllocSize(llt); |
487 |
if (align > maxAlign) { |
488 |
maxAlign = align; |
489 |
maxAlignType = llt; |