diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /tools/lto | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'tools/lto')
-rw-r--r-- | tools/lto/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tools/lto/Makefile | 4 | ||||
-rw-r--r-- | tools/lto/lto.cpp | 36 |
3 files changed, 28 insertions, 15 deletions
diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt index 71391b7..559b22b 100644 --- a/tools/lto/CMakeLists.txt +++ b/tools/lto/CMakeLists.txt @@ -1,14 +1,11 @@ set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} - Core LTO MC MCDisassembler Support ) -add_definitions( -DLLVM_VERSION_INFO=\"${PACKAGE_VERSION}\" ) - set(SOURCES LTODisassembler.cpp lto.cpp diff --git a/tools/lto/Makefile b/tools/lto/Makefile index a4fe9ac..530c05a 100644 --- a/tools/lto/Makefile +++ b/tools/lto/Makefile @@ -17,10 +17,6 @@ EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports include $(LEVEL)/Makefile.common -ifdef LLVM_VERSION_INFO -CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"' -endif - ifeq ($(HOST_OS),Darwin) # Special hack to allow libLTO to have an offset version number. ifdef LLVM_LTO_VERSION_OFFSET diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index b401f9a..ef37c90 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -32,6 +32,10 @@ static cl::opt<bool> DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), cl::desc("Do not run the GVN load PRE pass")); +static cl::opt<bool> +DisableLTOVectorization("disable-lto-vectorization", cl::init(false), + cl::desc("Do not run loop or slp vectorization during LTO")); + // Holds most recent error string. // *** Not thread safe *** static std::string sLastErrorString; @@ -146,6 +150,24 @@ lto_module_t lto_module_create_from_memory_with_path(const void* mem, LTOModule::createFromBuffer(mem, length, Options, sLastErrorString, path)); } +lto_module_t lto_module_create_in_local_context(const void *mem, size_t length, + const char *path) { + lto_initialize(); + llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); + return wrap(LTOModule::createInLocalContext(mem, length, Options, + sLastErrorString, path)); +} + +lto_module_t lto_module_create_in_codegen_context(const void *mem, + size_t length, + const char *path, + lto_code_gen_t cg) { + lto_initialize(); + llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); + return wrap(LTOModule::createInContext(mem, length, Options, sLastErrorString, + path, &unwrap(cg)->getContext())); +} + void lto_module_dispose(lto_module_t mod) { delete unwrap(mod); } const char* lto_module_get_target_triple(lto_module_t mod) { @@ -205,7 +227,7 @@ lto_code_gen_t lto_codegen_create(void) { void lto_codegen_dispose(lto_code_gen_t cg) { delete unwrap(cg); } bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) { - return !unwrap(cg)->addModule(unwrap(mod), sLastErrorString); + return !unwrap(cg)->addModule(unwrap(mod)); } bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) { @@ -222,10 +244,6 @@ void lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu) { return unwrap(cg)->setCpu(cpu); } -void lto_codegen_set_attr(lto_code_gen_t cg, const char *attr) { - return unwrap(cg)->setAttr(attr); -} - void lto_codegen_set_assembler_path(lto_code_gen_t cg, const char *path) { // In here only for backwards compatibility. We use MC now. } @@ -256,7 +274,8 @@ const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) { parsedOptions = true; } return unwrap(cg)->compile(length, DisableOpt, DisableInline, - DisableGVNLoadPRE, sLastErrorString); + DisableGVNLoadPRE, DisableLTOVectorization, + sLastErrorString); } bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) { @@ -265,8 +284,9 @@ bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) { lto_add_attrs(cg); parsedOptions = true; } - return !unwrap(cg)->compile_to_file(name, DisableOpt, DisableInline, - DisableGVNLoadPRE, sLastErrorString); + return !unwrap(cg)->compile_to_file( + name, DisableOpt, DisableInline, DisableGVNLoadPRE, + DisableLTOVectorization, sLastErrorString); } void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) { |