Add changes for LLVM 3.2

- The Attributes class was changed again
- TargetData was renamed to DataLayout

Compiles again with LLVm 3.0, 3.1 and trunk(3.2).
This commit is contained in:
kai
2012-10-13 18:54:42 +02:00
parent d523be3010
commit a7c7b514c0
23 changed files with 267 additions and 29 deletions

View File

@@ -121,10 +121,17 @@ void emit_file(llvm::TargetMachine &Target, llvm::Module& m, llvm::raw_fd_ostrea
// Build up all of the passes that we want to do to the module.
FunctionPassManager Passes(&m);
#if LDC_LLVM_VER >= 302
if (const DataLayout *DL = Target.getDataLayout())
Passes.add(new DataLayout(*DL));
else
Passes.add(new DataLayout(&m));
#else
if (const TargetData *TD = Target.getTargetData())
Passes.add(new TargetData(*TD));
else
Passes.add(new TargetData(&m));
#endif
llvm::formatted_raw_ostream fout(out);
if (Target.addPassesToEmitFile(Passes, fout, fileType, codeGenOptLevel()))