#include "llvm/IR/Verifier.h"
#include "llvm/InitializePasses.h"
#include "llvm/LTO/LTOModule.h"
-#include "llvm/Linker.h"
+#include "llvm/Linker/Linker.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
LTOCodeGenerator::LTOCodeGenerator()
: Context(getGlobalContext()), Linker(new Module("ld-temp.o", Context)),
TargetMach(NULL), EmitDwarfDebugInfo(false), ScopeRestrictionsDone(false),
- CodeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
- InternalizeStrategy(LTO_INTERNALIZE_FULL), NativeObjectFile(NULL),
+ CodeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), NativeObjectFile(NULL),
DiagHandler(NULL), DiagContext(NULL) {
initializeLTOPasses();
}
llvm_unreachable("Unknown PIC model!");
}
-void
-LTOCodeGenerator::setInternalizeStrategy(lto_internalize_strategy Strategy) {
- switch (Strategy) {
- case LTO_INTERNALIZE_FULL:
- case LTO_INTERNALIZE_NONE:
- case LTO_INTERNALIZE_HIDDEN:
- InternalizeStrategy = Strategy;
- return;
- }
- llvm_unreachable("Unknown internalize strategy!");
-}
-
bool LTOCodeGenerator::writeMergedModules(const char *path,
std::string &errMsg) {
if (!determineTarget(errMsg))
delete NativeObjectFile;
// read .o file into memory buffer
- OwningPtr<MemoryBuffer> BuffPtr;
+ std::unique_ptr<MemoryBuffer> BuffPtr;
if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
errMsg = ec.message();
sys::fs::remove(NativeObjectPath);
return NULL;
}
- NativeObjectFile = BuffPtr.take();
+ NativeObjectFile = BuffPtr.release();
// remove temp files
sys::fs::remove(NativeObjectPath);
MCpu = "core2";
else if (Triple.getArch() == llvm::Triple::x86)
MCpu = "yonah";
+ else if (Triple.getArch() == llvm::Triple::arm64)
+ MCpu = "cyclone";
}
TargetMach = march->createTargetMachine(TripleStr, MCpu, FeatureStr, Options,
}
void LTOCodeGenerator::applyScopeRestrictions() {
- if (ScopeRestrictionsDone || !shouldInternalize())
+ if (ScopeRestrictionsDone)
return;
Module *mergedModule = Linker.getModule();
LLVMCompilerUsed->setSection("llvm.metadata");
}
- passes.add(
- createInternalizePass(MustPreserveList, shouldOnlyInternalizeHidden()));
+ passes.add(createInternalizePass(MustPreserveList));
// apply scope restrictions
passes.run(*mergedModule);
case DS_Warning:
Severity = LTO_DS_WARNING;
break;
+ case DS_Remark:
+ Severity = LTO_DS_REMARK;
+ break;
case DS_Note:
Severity = LTO_DS_NOTE;
break;