X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Flto%2FLTOModule.h;h=902e9c5438952dffa9003abcc989b578c1ac7e4a;hb=107b2f26aa02a089a6b05ab86ebe033836fc06fa;hp=e5f6dea7a7c5993fe1f0d6fde143abab35e59dea;hpb=24b878031d4f62baf0e9a0573aeebc9dfd54b546;p=oota-llvm.git diff --git a/tools/lto/LTOModule.h b/tools/lto/LTOModule.h index e5f6dea7a7c..902e9c54389 100644 --- a/tools/lto/LTOModule.h +++ b/tools/lto/LTOModule.h @@ -14,30 +14,28 @@ #ifndef LTO_MODULE_H #define LTO_MODULE_H -#include "llvm/Module.h" +#include "llvm-c/lto.h" +#include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/IR/Module.h" #include "llvm/MC/MCContext.h" #include "llvm/Target/Mangler.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/ADT/OwningPtr.h" -#include "llvm/ADT/StringMap.h" - -#include "llvm-c/lto.h" - -#include #include - +#include // Forward references to llvm classes. namespace llvm { class Function; class GlobalValue; class MemoryBuffer; + class TargetOptions; class Value; } -// -// C++ class which implements the opaque lto_module_t type. -// +//===----------------------------------------------------------------------===// +/// LTOModule - C++ class which implements the opaque lto_module_t type. +/// struct LTOModule { private: typedef llvm::StringMap StringSet; @@ -46,7 +44,7 @@ private: const char *name; uint32_t attributes; bool isFunction; - llvm::GlobalValue *symbol; + const llvm::GlobalValue *symbol; }; llvm::OwningPtr _module; @@ -84,7 +82,6 @@ public: static LTOModule *makeLTOModule(int fd, const char *path, size_t size, std::string &errMsg); static LTOModule *makeLTOModule(int fd, const char *path, - size_t file_size, size_t map_size, off_t offset, std::string& errMsg); @@ -129,6 +126,10 @@ 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. @@ -136,16 +137,16 @@ private: /// addPotentialUndefinedSymbol - Add a symbol which isn't defined just yet /// to a list to be resolved later. - void addPotentialUndefinedSymbol(llvm::GlobalValue *dcl, bool isFunc); + void addPotentialUndefinedSymbol(const llvm::GlobalValue *dcl, bool isFunc); /// addDefinedSymbol - Add a defined symbol to the list. - void addDefinedSymbol(llvm::GlobalValue *def, bool isFunction); + void addDefinedSymbol(const llvm::GlobalValue *def, bool isFunction); /// addDefinedFunctionSymbol - Add a function symbol as defined to the list. - void addDefinedFunctionSymbol(llvm::Function *f); + void addDefinedFunctionSymbol(const llvm::Function *f); /// addDefinedDataSymbol - Add a data symbol as defined to the list. - void addDefinedDataSymbol(llvm::GlobalValue *v); + void addDefinedDataSymbol(const llvm::GlobalValue *v); /// addAsmGlobalSymbols - Add global symbols from module-level ASM to the /// defined or undefined lists. @@ -160,17 +161,17 @@ private: void addAsmGlobalSymbolUndef(const char *); /// addObjCClass - Parse i386/ppc ObjC class data structure. - void addObjCClass(llvm::GlobalVariable *clgv); + void addObjCClass(const llvm::GlobalVariable *clgv); /// addObjCCategory - Parse i386/ppc ObjC category data structure. - void addObjCCategory(llvm::GlobalVariable *clgv); + void addObjCCategory(const llvm::GlobalVariable *clgv); /// addObjCClassRef - Parse i386/ppc ObjC class list data structure. - void addObjCClassRef(llvm::GlobalVariable *clgv); + void addObjCClassRef(const llvm::GlobalVariable *clgv); /// objcClassNameFromExpression - Get string that the data pointer points /// to. - bool objcClassNameFromExpression(llvm::Constant* c, std::string &name); + bool objcClassNameFromExpression(const llvm::Constant* c, std::string &name); /// isTargetMatch - Returns 'true' if the memory buffer is for the specified /// target triple.