summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-09-30 16:39:19 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-09-30 16:39:19 +0000
commitc13c9e5a9d288eac494a38f0710d34446167f940 (patch)
tree9963870fcea50321766abe308393c6f996187897 /include
parent4b5205d2a3e0df909f29de0bff8ea775ad21fe0f (diff)
downloadllvm-c13c9e5a9d288eac494a38f0710d34446167f940.tar.gz
llvm-c13c9e5a9d288eac494a38f0710d34446167f940.tar.bz2
llvm-c13c9e5a9d288eac494a38f0710d34446167f940.tar.xz
Move command line options to the users of libLTO. Fixes --enable-shared build.
Patch by Richard Sandiford. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/LTO/LTOCodeGenerator.h21
-rw-r--r--include/llvm/LTO/LTOModule.h12
2 files changed, 24 insertions, 9 deletions
diff --git a/include/llvm/LTO/LTOCodeGenerator.h b/include/llvm/LTO/LTOCodeGenerator.h
index 3d151b93af..08e6374824 100644
--- a/include/llvm/LTO/LTOCodeGenerator.h
+++ b/include/llvm/LTO/LTOCodeGenerator.h
@@ -39,6 +39,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Linker.h"
+#include "llvm/Target/TargetOptions.h"
#include <string>
#include <vector>
@@ -64,6 +65,7 @@ struct LTOCodeGenerator {
// Merge given module, return true on success.
bool addModule(struct LTOModule*, std::string &errMsg);
+ void setTargetOptions(llvm::TargetOptions options);
void setDebugInfo(lto_debug_model);
void setCodePICModel(lto_codegen_model);
@@ -90,7 +92,11 @@ struct LTOCodeGenerator {
// Do not try to remove the object file in LTOCodeGenerator's destructor
// as we don't who (LTOCodeGenerator or the obj file) will last longer.
//
- bool compile_to_file(const char **name, std::string &errMsg);
+ bool compile_to_file(const char **name,
+ bool disableOpt,
+ bool disableInline,
+ bool disableGVNLoadPRE,
+ std::string &errMsg);
// As with compile_to_file(), this function compiles the merged module into
// single object file. Instead of returning the object-file-path to the caller
@@ -98,12 +104,20 @@ struct LTOCodeGenerator {
// caller. This function should delete intermediate object file once its content
// is brought to memory. Return NULL if the compilation was not successful.
//
- const void *compile(size_t *length, std::string &errMsg);
+ const void *compile(size_t *length,
+ bool disableOpt,
+ bool disableInline,
+ bool disableGVNLoadPRE,
+ std::string &errMsg);
private:
void initializeLTOPasses();
- bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
+ bool generateObjectFile(llvm::raw_ostream &out,
+ bool disableOpt,
+ bool disableInline,
+ bool disableGVNLoadPRE,
+ std::string &errMsg);
void applyScopeRestrictions();
void applyRestriction(llvm::GlobalValue &GV,
std::vector<const char*> &MustPreserveList,
@@ -125,6 +139,7 @@ private:
std::vector<char *> CodegenOptions;
std::string MCpu;
std::string NativeObjectPath;
+ llvm::TargetOptions Options;
};
#endif // LTO_CODE_GENERATOR_H
diff --git a/include/llvm/LTO/LTOModule.h b/include/llvm/LTO/LTOModule.h
index 973466cc0e..f4693c8d22 100644
--- a/include/llvm/LTO/LTOModule.h
+++ b/include/llvm/LTO/LTOModule.h
@@ -84,14 +84,17 @@ public:
/// InitializeAllAsmPrinters();
/// InitializeAllAsmParsers();
static LTOModule *makeLTOModule(const char* path,
+ llvm::TargetOptions options,
std::string &errMsg);
static LTOModule *makeLTOModule(int fd, const char *path,
- size_t size, std::string &errMsg);
+ size_t size, llvm::TargetOptions options,
+ std::string &errMsg);
static LTOModule *makeLTOModule(int fd, const char *path,
size_t map_size,
- off_t offset,
+ off_t offset, llvm::TargetOptions options,
std::string& errMsg);
static LTOModule *makeLTOModule(const void *mem, size_t length,
+ llvm::TargetOptions options,
std::string &errMsg);
/// getTargetTriple - Return the Module's target triple.
@@ -132,10 +135,6 @@ public:
return _asm_undefines;
}
- /// getTargetOptions - Fill the TargetOptions object with the options
- /// specified on the command line.
- static void getTargetOptions(llvm::TargetOptions &Options);
-
private:
/// parseSymbols - Parse the symbols from the module and model-level ASM and
/// add them to either the defined or undefined lists.
@@ -187,6 +186,7 @@ private:
/// makeLTOModule - Create an LTOModule (private version). N.B. This
/// method takes ownership of the buffer.
static LTOModule *makeLTOModule(llvm::MemoryBuffer *buffer,
+ llvm::TargetOptions options,
std::string &errMsg);
/// makeBuffer - Create a MemoryBuffer from a memory range.