Exemple #1
0
llvm::Constant* embedRelocatablePtr(const void* addr, llvm::Type* type, llvm::StringRef shared_name) {
    assert(addr);

    if (!ENABLE_JIT_OBJECT_CACHE)
        return embedConstantPtr(addr, type);

    std::string name;
    if (!shared_name.empty()) {
        llvm::GlobalVariable* gv = g.cur_module->getGlobalVariable(shared_name, true);
        if (gv)
            return gv;
        assert(!relocatable_syms.count(name));
        name = shared_name;
    } else {
        name = (llvm::Twine("c") + llvm::Twine(relocatable_syms.size())).str();
    }

    relocatable_syms[name] = addr;

    llvm::Type* var_type = type->getPointerElementType();
    return new llvm::GlobalVariable(*g.cur_module, var_type, true, llvm::GlobalVariable::ExternalLinkage, 0, name);
}
Exemple #2
0
 size_t size() const { return UniqueDirs.size(); }
Exemple #3
0
 size_t size() const { return UniqueFiles.size(); }
Exemple #4
0
 size_t size() { return UniqueFiles.size(); }
Exemple #5
0
 size_t size() { return UniqueDirs.size(); }