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

@@ -238,7 +238,11 @@ int main(int argc, char** argv)
// Handle fixed-up arguments!
cl::SetVersionPrinter(&printVersion);
#if LDC_LLVM_VER >= 302
cl::ParseCommandLineOptions(final_args.size(), const_cast<char**>(&final_args[0]), "LLVM-based D Compiler\n");
#else
cl::ParseCommandLineOptions(final_args.size(), const_cast<char**>(&final_args[0]), "LLVM-based D Compiler\n", true);
#endif
// Print config file path if -v was passed
if (global.params.verbose) {
@@ -569,11 +573,15 @@ int main(int argc, char** argv)
gTargetMachine = target;
gTargetData = target->getTargetData();
#if LDC_LLVM_VER >= 302
gDataLayout = target->getDataLayout();
#else
gDataLayout = target->getTargetData();
#endif
global.params.isLE = gTargetData->isLittleEndian();
global.params.isLE = gDataLayout->isLittleEndian();
// Starting with LLVM 3.1 we could also use global.params.targetTriple.isArch64Bit();
global.params.is64bit = gTargetData->getPointerSizeInBits() == 64;
global.params.is64bit = gDataLayout->getPointerSizeInBits() == 64;
global.params.cpu = static_cast<ARCH>(global.params.targetTriple.getArch());
global.params.os = static_cast<OS>(global.params.targetTriple.getOS());