class GlobalValue;
class Value;
class Function;
- class LLVMContext;
}
//
// C++ class which implements the opaque lto_module_t
//
-class LTOModule {
-public:
+struct LTOModule {
static bool isBitcodeFile(const void* mem, size_t length);
static bool isBitcodeFile(const char* path);
const char* triplePrefix);
static LTOModule* makeLTOModule(const char* path,
- llvm::LLVMContext& Context,
std::string& errMsg);
+ 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);
static LTOModule* makeLTOModule(const void* mem, size_t length,
- llvm::LLVMContext& Context,
std::string& errMsg);
const char* getTargetTriple();
+ void setTargetTriple(const char*);
uint32_t getSymbolCount();
lto_symbol_attributes getSymbolAttributes(uint32_t index);
const char* getSymbolName(uint32_t index);
llvm::Module * getLLVVMModule() { return _module.get(); }
+ const std::vector<const char*> &getAsmUndefinedRefs() {
+ return _asm_undefines;
+ }
private:
LTOModule(llvm::Module* m, llvm::TargetMachine* t);
- void lazyParseSymbols();
+ bool ParseSymbols();
void addDefinedSymbol(llvm::GlobalValue* def,
llvm::Mangler& mangler,
bool isFunction);
void addPotentialUndefinedSymbol(llvm::GlobalValue* decl,
llvm::Mangler &mangler);
- void findExternalRefs(llvm::Value* value,
- llvm::Mangler& mangler);
void addDefinedFunctionSymbol(llvm::Function* f,
llvm::Mangler &mangler);
void addDefinedDataSymbol(llvm::GlobalValue* v,
llvm::Mangler &mangler);
- void addAsmGlobalSymbol(const char *);
+ bool addAsmGlobalSymbols(llvm::MCContext &Context);
+ void addAsmGlobalSymbol(const char *,
+ lto_symbol_attributes scope);
+ void addAsmGlobalSymbolUndef(const char *);
void addObjCClass(llvm::GlobalVariable* clgv);
void addObjCCategory(llvm::GlobalVariable* clgv);
void addObjCClassRef(llvm::GlobalVariable* clgv);
const char* triplePrefix);
static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer,
- llvm::LLVMContext& Context,
std::string& errMsg);
static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length);
llvm::OwningPtr<llvm::Module> _module;
llvm::OwningPtr<llvm::TargetMachine> _target;
- bool _symbolsParsed;
std::vector<NameAndAttributes> _symbols;
// _defines and _undefines only needed to disambiguate tentative definitions
StringSet _defines;
llvm::StringMap<NameAndAttributes> _undefines;
+ std::vector<const char*> _asm_undefines;
};
-extern std::string getFeatureString(const char *TargetTriple);
-
#endif // LTO_MODULE_H