Update to LLVM 7

Updating to LLVM 7 mainly involved the following steps:

* Upgrade APIs for folding ConstantExpr.
* Upgrade APIs for GraphTraits.
* Upgrade APIs for DominatorTreeBase.
* Upgrade APIs for BinaryFormat to parse ELFs.
* Fix the LLVM Linker to properly link the QEMU helpers.
* Disable the new optnone attribute even with optimization -O0. This is
  necessary to allow SROA to do its job properly.
* Upgrade APIs to delete Instructions.
* Properly cleaning up orphaned metadata still referring to Instructions
  that have been destroyed. Recent versions of LLVM are more strict in
  this respect, and will assert when compiled in debug.
* Avoid using LLVM `getGlobalContext` which has been removed from newer
  versions of LLVM.
* Upgrade tests to use the new APIs.
* Upgrade APIs for instruction iterators and reverse iterators.
This commit is contained in:
Pietro Fezzardi
2018-11-05 08:55:01 +01:00
committed by Alessandro Di Federico
parent b34a421ec4
commit b9273210d0
22 changed files with 369 additions and 363 deletions
+4 -3
View File
@@ -11,6 +11,7 @@
// LLVM includes
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
@@ -62,7 +63,7 @@ static void writeMetadataIfNew(const Instruction *TheInstruction,
MDString *PrevMD = nullptr;
do {
if (TheInstruction == TheInstruction->getParent()->begin())
if (TheInstruction->getIterator() == TheInstruction->getParent()->begin())
TheInstruction = nullptr;
else {
TheInstruction = TheInstruction->getPrevNode();
@@ -149,9 +150,9 @@ DebugHelper::DebugHelper(std::string Output,
}
if (DebugInfo != DebugInfoType::None) {
auto File = Builder.createFile(this->DebugPath, "");
CompileUnit = Builder.createCompileUnit(dwarf::DW_LANG_C,
this->DebugPath,
"",
File,
"revamb",
false,
"",