X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FLinker%2FLinker.h;h=38fa5562f300c6e2997d34c204a2379233536c61;hb=76c60c37de0a6250ce3be524e121d95ba7035c2e;hp=de23acb7e524ce358389cab4d05a8b45f4a445ed;hpb=cf0db29df20d9c665da7e82bb261bdd7cf7f1b2b;p=oota-llvm.git diff --git a/include/llvm/Linker/Linker.h b/include/llvm/Linker/Linker.h index de23acb7e52..38fa5562f30 100644 --- a/include/llvm/Linker/Linker.h +++ b/include/llvm/Linker/Linker.h @@ -14,6 +14,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/IR/DiagnosticInfo.h" +#include "llvm/IR/FunctionInfo.h" namespace llvm { class Module; @@ -60,36 +61,44 @@ public: bool hasType(StructType *Ty); }; - Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler); - Linker(Module *M); - ~Linker(); + enum Flags { + None = 0, + OverrideFromSrc = (1 << 0), + LinkOnlyNeeded = (1 << 1), + InternalizeLinkedSymbols = (1 << 2) + }; + + Linker(Module &M, DiagnosticHandlerFunction DiagnosticHandler); + Linker(Module &M); - Module *getModule() const { return Composite; } - void deleteModule(); + Module &getModule() const { return Composite; } /// \brief Link \p Src into the composite. The source is destroyed. /// Passing OverrideSymbols as true will have symbols from Src /// shadow those in the Dest. + /// For ThinLTO function importing/exporting the \p FunctionInfoIndex + /// is passed. If a \p FuncToImport is provided, only that single + /// function is imported from the source module. /// Returns true on error. - bool linkInModule(Module *Src, bool OverrideSymbols = false); - - /// \brief Set the composite to the passed-in module. - void setModule(Module *Dst); + bool linkInModule(Module &Src, unsigned Flags = Flags::None, + const FunctionInfoIndex *Index = nullptr, + Function *FuncToImport = nullptr); - static bool LinkModules(Module *Dest, Module *Src, - DiagnosticHandlerFunction DiagnosticHandler); + static bool linkModules(Module &Dest, Module &Src, + DiagnosticHandlerFunction DiagnosticHandler, + unsigned Flags = Flags::None); - static bool LinkModules(Module *Dest, Module *Src); + static bool linkModules(Module &Dest, Module &Src, + unsigned Flags = Flags::None); private: - void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler); - Module *Composite; + Module &Composite; IdentifiedStructTypeSet IdentifiedStructTypes; DiagnosticHandlerFunction DiagnosticHandler; }; -} // namespace llvm +} // End llvm namespace #endif