diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm-c/lto.h | 15 | ||||
-rw-r--r-- | include/llvm/LTO/LTOCodeGenerator.h | 10 | ||||
-rw-r--r-- | include/llvm/Transforms/IPO.h | 9 |
3 files changed, 31 insertions, 3 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h index 89f54b7a7b..2292f470eb 100644 --- a/include/llvm-c/lto.h +++ b/include/llvm-c/lto.h @@ -40,7 +40,7 @@ typedef bool lto_bool_t; * @{ */ -#define LTO_API_VERSION 5 +#define LTO_API_VERSION 6 typedef enum { LTO_SYMBOL_ALIGNMENT_MASK = 0x0000001F, /* log2 of alignment */ @@ -73,6 +73,11 @@ typedef enum { LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC = 2 } lto_codegen_model; +typedef enum { + LTO_INTERNALIZE_FULL = 0, + LTO_INTERNALIZE_NONE = 1, + LTO_INTERNALIZE_HIDDEN = 2 +} lto_internalize_strategy; /** opaque reference to a loaded object module */ typedef struct LTOModule* lto_module_t; @@ -264,6 +269,14 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args, int nargs); /** + * Sets the strategy to use during internalize. Default strategy is + * LTO_INTERNALIZE_FULL. + */ +extern void +lto_codegen_set_internalize_strategy(lto_code_gen_t cg, + lto_internalize_strategy); + +/** * Tells LTO optimization passes that this symbol must be preserved * because it is referenced by native code or a command line option. */ diff --git a/include/llvm/LTO/LTOCodeGenerator.h b/include/llvm/LTO/LTOCodeGenerator.h index 04d18fd157..defea4f7ca 100644 --- a/include/llvm/LTO/LTOCodeGenerator.h +++ b/include/llvm/LTO/LTOCodeGenerator.h @@ -70,6 +70,7 @@ struct LTOCodeGenerator { void setTargetOptions(llvm::TargetOptions options); void setDebugInfo(lto_debug_model); void setCodePICModel(lto_codegen_model); + void setInternalizeStrategy(lto_internalize_strategy); void setCpu(const char *mCpu) { MCpu = mCpu; } @@ -114,6 +115,14 @@ struct LTOCodeGenerator { bool disableGVNLoadPRE, std::string &errMsg); + bool shouldInternalize() const { + return InternalizeStrategy != LTO_INTERNALIZE_NONE; + } + + bool shouldOnlyInternalizeHidden() const { + return InternalizeStrategy == LTO_INTERNALIZE_HIDDEN; + } + private: void initializeLTOPasses(); @@ -138,6 +147,7 @@ private: bool EmitDwarfDebugInfo; bool ScopeRestrictionsDone; lto_codegen_model CodeModel; + lto_internalize_strategy InternalizeStrategy; StringSet MustPreserveSymbols; StringSet AsmUndefinedRefs; llvm::MemoryBuffer *NativeObjectFile; diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h index 7f51c516b9..b4f65b25d5 100644 --- a/include/llvm/Transforms/IPO.h +++ b/include/llvm/Transforms/IPO.h @@ -108,14 +108,19 @@ Pass *createPruneEHPass(); //// /// The symbols in \p ExportList are never internalized. /// +/// When OnlyHidden=true, only symbols with hidden visibility are internalized. +/// /// The symbol in DSOList are internalized if it is safe to drop them from /// the symbol table. /// /// Note that commandline options that are used with the above function are not /// used now! -ModulePass *createInternalizePass(ArrayRef<const char *> ExportList); +ModulePass *createInternalizePass(ArrayRef<const char *> ExportList, + bool OnlyHidden = false); /// createInternalizePass - Same as above, but with an empty exportList. -ModulePass *createInternalizePass(); +ModulePass *createInternalizePass(bool OnlyHidden = false); +/// createInternalizePass - Resolve ambiguity when passed a const char *. +ModulePass *createInternalizePass(const char *SingleExport); //===----------------------------------------------------------------------===// /// createDeadArgEliminationPass - This pass removes arguments from functions |