mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-13 06:28:52 +03:00
clang format
This commit is contained in:
parent
b613a53948
commit
91c1b8e69c
8 changed files with 76 additions and 88 deletions
|
@ -545,7 +545,7 @@ generateFuncList(IRState *irs, const Types &types,
|
||||||
|
|
||||||
auto &context = irs->context();
|
auto &context = irs->context();
|
||||||
auto nullp = llvm::ConstantPointerNull::get(
|
auto nullp = llvm::ConstantPointerNull::get(
|
||||||
llvm::PointerType::get(llvm::IntegerType::get(context, 8), 0));
|
llvm::PointerType::get(llvm::IntegerType::get(context, 8), 0));
|
||||||
for (auto &&it : globalVals) {
|
for (auto &&it : globalVals) {
|
||||||
auto func = llvm::dyn_cast<llvm::Function>(it.first);
|
auto func = llvm::dyn_cast<llvm::Function>(it.first);
|
||||||
if (func != nullptr && it.second == GlobalValVisibility::Internal) {
|
if (func != nullptr && it.second == GlobalValVisibility::Internal) {
|
||||||
|
|
|
@ -9,24 +9,22 @@
|
||||||
|
|
||||||
#include "bind.h"
|
#include "bind.h"
|
||||||
|
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/IR/BasicBlock.h"
|
#include "llvm/IR/BasicBlock.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
#include "llvm/IR/IRBuilder.h"
|
#include "llvm/IR/IRBuilder.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
|
||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
|
|
||||||
#include "valueparser.h"
|
#include "valueparser.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
enum {
|
enum { SmallParamsCount = 5 };
|
||||||
SmallParamsCount = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
llvm::FunctionType *getDstFuncType(llvm::FunctionType &srcType,
|
llvm::FunctionType *getDstFuncType(llvm::FunctionType &srcType,
|
||||||
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
||||||
assert(!srcType.isVarArg());
|
assert(!srcType.isVarArg());
|
||||||
llvm::SmallVector<llvm::Type*, SmallParamsCount> newParams;
|
llvm::SmallVector<llvm::Type *, SmallParamsCount> newParams;
|
||||||
const auto srcParamsCount = srcType.params().size();
|
const auto srcParamsCount = srcType.params().size();
|
||||||
assert(params.size() == srcParamsCount);
|
assert(params.size() == srcParamsCount);
|
||||||
for (size_t i = 0; i < srcParamsCount; ++i) {
|
for (size_t i = 0; i < srcParamsCount; ++i) {
|
||||||
|
@ -35,57 +33,54 @@ llvm::FunctionType *getDstFuncType(llvm::FunctionType &srcType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto retType = srcType.getReturnType();
|
auto retType = srcType.getReturnType();
|
||||||
return llvm::FunctionType::get(retType, newParams, /*isVarArg*/false);
|
return llvm::FunctionType::get(retType, newParams, /*isVarArg*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Function *createBindFunc(llvm::Module &module,
|
llvm::Function *createBindFunc(llvm::Module &module, llvm::Function &srcFunc,
|
||||||
llvm::Function &srcFunc,
|
|
||||||
llvm::Function &exampleFunc,
|
llvm::Function &exampleFunc,
|
||||||
llvm::FunctionType &funcType,
|
llvm::FunctionType &funcType,
|
||||||
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
||||||
auto newFunc = llvm::Function::Create(
|
auto newFunc = llvm::Function::Create(
|
||||||
&funcType, llvm::GlobalValue::ExternalLinkage, "\1.jit_bind",
|
&funcType, llvm::GlobalValue::ExternalLinkage, "\1.jit_bind", &module);
|
||||||
&module);
|
|
||||||
|
|
||||||
newFunc->setCallingConv(srcFunc.getCallingConv());
|
newFunc->setCallingConv(srcFunc.getCallingConv());
|
||||||
// auto srcAttributes = srcFunc.getAttributes();
|
// auto srcAttributes = srcFunc.getAttributes();
|
||||||
// newFunc->addAttributes(llvm::AttributeList::ReturnIndex,
|
// newFunc->addAttributes(llvm::AttributeList::ReturnIndex,
|
||||||
// srcAttributes.getRetAttributes());
|
// srcAttributes.getRetAttributes());
|
||||||
// newFunc->addAttributes(llvm::AttributeList::FunctionIndex,
|
// newFunc->addAttributes(llvm::AttributeList::FunctionIndex,
|
||||||
// srcAttributes.getFnAttributes());
|
// srcAttributes.getFnAttributes());
|
||||||
// unsigned dstInd = 0;
|
// unsigned dstInd = 0;
|
||||||
// for (size_t i = 0; i < params.size(); ++i) {
|
// for (size_t i = 0; i < params.size(); ++i) {
|
||||||
// if (params[i].data == nullptr) {
|
// if (params[i].data == nullptr) {
|
||||||
// newFunc->addAttributes(llvm::AttributeList::FirstArgIndex + dstInd,
|
// newFunc->addAttributes(llvm::AttributeList::FirstArgIndex + dstInd,
|
||||||
// srcAttributes.getParamAttributes(
|
// srcAttributes.getParamAttributes(
|
||||||
// static_cast<unsigned>(i)));
|
// static_cast<unsigned>(i)));
|
||||||
// ++dstInd;
|
// ++dstInd;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// assert(dstInd == funcType.getNumParams());
|
// assert(dstInd == funcType.getNumParams());
|
||||||
newFunc->setAttributes(exampleFunc.getAttributes());
|
newFunc->setAttributes(exampleFunc.getAttributes());
|
||||||
return newFunc;
|
return newFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llvm::Value *
|
||||||
llvm::Value *allocParam(
|
allocParam(llvm::IRBuilder<> &builder, llvm::Type &srcType,
|
||||||
llvm::IRBuilder<> &builder, llvm::Type &srcType, const
|
const llvm::DataLayout &layout, const ParamSlice ¶m,
|
||||||
llvm::DataLayout &layout, const ParamSlice& param,
|
llvm::function_ref<void(const std::string &)> errHandler,
|
||||||
llvm::function_ref<void(const std::string &)> errHandler,
|
const BindOverride &override) {
|
||||||
const BindOverride &override) {
|
|
||||||
if (param.type == ParamType::Aggregate && srcType.isPointerTy()) {
|
if (param.type == ParamType::Aggregate && srcType.isPointerTy()) {
|
||||||
auto elemType = llvm::cast<llvm::PointerType>(&srcType)->getElementType();
|
auto elemType = llvm::cast<llvm::PointerType>(&srcType)->getElementType();
|
||||||
auto stackArg = builder.CreateAlloca(elemType);
|
auto stackArg = builder.CreateAlloca(elemType);
|
||||||
stackArg->setAlignment(layout.getABITypeAlignment(elemType));
|
stackArg->setAlignment(layout.getABITypeAlignment(elemType));
|
||||||
auto init = parseInitializer(layout, *elemType, param.data, errHandler,
|
auto init =
|
||||||
override);
|
parseInitializer(layout, *elemType, param.data, errHandler, override);
|
||||||
builder.CreateStore(init, stackArg);
|
builder.CreateStore(init, stackArg);
|
||||||
return stackArg;
|
return stackArg;
|
||||||
}
|
}
|
||||||
auto stackArg = builder.CreateAlloca(&srcType);
|
auto stackArg = builder.CreateAlloca(&srcType);
|
||||||
stackArg->setAlignment(layout.getABITypeAlignment(&srcType));
|
stackArg->setAlignment(layout.getABITypeAlignment(&srcType));
|
||||||
auto init = parseInitializer(layout, srcType, param.data, errHandler,
|
auto init =
|
||||||
override);
|
parseInitializer(layout, srcType, param.data, errHandler, override);
|
||||||
builder.CreateStore(init, stackArg);
|
builder.CreateStore(init, stackArg);
|
||||||
return builder.CreateLoad(stackArg);
|
return builder.CreateLoad(stackArg);
|
||||||
}
|
}
|
||||||
|
@ -94,17 +89,17 @@ void doBind(llvm::Module &module, llvm::Function &dstFunc,
|
||||||
llvm::Function &srcFunc, const llvm::ArrayRef<ParamSlice> ¶ms,
|
llvm::Function &srcFunc, const llvm::ArrayRef<ParamSlice> ¶ms,
|
||||||
llvm::function_ref<void(const std::string &)> errHandler,
|
llvm::function_ref<void(const std::string &)> errHandler,
|
||||||
const BindOverride &override) {
|
const BindOverride &override) {
|
||||||
auto& context = dstFunc.getContext();
|
auto &context = dstFunc.getContext();
|
||||||
auto bb = llvm::BasicBlock::Create(context, "", &dstFunc);
|
auto bb = llvm::BasicBlock::Create(context, "", &dstFunc);
|
||||||
|
|
||||||
llvm::IRBuilder<> builder(context);
|
llvm::IRBuilder<> builder(context);
|
||||||
builder.SetInsertPoint(bb);
|
builder.SetInsertPoint(bb);
|
||||||
llvm::SmallVector<llvm::Value*, SmallParamsCount> args;
|
llvm::SmallVector<llvm::Value *, SmallParamsCount> args;
|
||||||
auto currentArg = dstFunc.arg_begin();
|
auto currentArg = dstFunc.arg_begin();
|
||||||
auto funcType = srcFunc.getFunctionType();
|
auto funcType = srcFunc.getFunctionType();
|
||||||
auto &layout = module.getDataLayout();
|
auto &layout = module.getDataLayout();
|
||||||
for (size_t i = 0; i < params.size(); ++i) {
|
for (size_t i = 0; i < params.size(); ++i) {
|
||||||
llvm::Value* arg = nullptr;
|
llvm::Value *arg = nullptr;
|
||||||
const auto ¶m = params[i];
|
const auto ¶m = params[i];
|
||||||
if (param.data == nullptr) {
|
if (param.data == nullptr) {
|
||||||
arg = currentArg;
|
arg = currentArg;
|
||||||
|
@ -133,10 +128,12 @@ void doBind(llvm::Module &module, llvm::Function &dstFunc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Function *bindParamsToFunc(llvm::Module &module, llvm::Function &srcFunc, llvm::Function &exampleFunc,
|
llvm::Function *
|
||||||
const llvm::ArrayRef<ParamSlice> ¶ms,
|
bindParamsToFunc(llvm::Module &module, llvm::Function &srcFunc,
|
||||||
llvm::function_ref<void(const std::string &)> errHandler,
|
llvm::Function &exampleFunc,
|
||||||
const BindOverride &override) {
|
const llvm::ArrayRef<ParamSlice> ¶ms,
|
||||||
|
llvm::function_ref<void(const std::string &)> errHandler,
|
||||||
|
const BindOverride &override) {
|
||||||
auto srcType = srcFunc.getFunctionType();
|
auto srcType = srcFunc.getFunctionType();
|
||||||
auto dstType = getDstFuncType(*srcType, params);
|
auto dstType = getDstFuncType(*srcType, params);
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,14 @@ class Module;
|
||||||
class Function;
|
class Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
using BindOverride =
|
using BindOverride = llvm::Optional<
|
||||||
llvm::Optional<llvm::function_ref<llvm::Constant*(
|
llvm::function_ref<llvm::Constant *(llvm::Type &, const void *, size_t)>>;
|
||||||
llvm::Type &, const void *, size_t)>>;
|
|
||||||
|
|
||||||
|
llvm::Function *
|
||||||
llvm::Function *bindParamsToFunc(
|
bindParamsToFunc(llvm::Module &module, llvm::Function &srcFunc,
|
||||||
llvm::Module &module, llvm::Function &srcFunc,llvm::Function &exampleFunc,
|
llvm::Function &exampleFunc,
|
||||||
const llvm::ArrayRef<ParamSlice> ¶ms,
|
const llvm::ArrayRef<ParamSlice> ¶ms,
|
||||||
llvm::function_ref<void(const std::string &)> errHandler,
|
llvm::function_ref<void(const std::string &)> errHandler,
|
||||||
const BindOverride &override = BindOverride{});
|
const BindOverride &override = BindOverride{});
|
||||||
|
|
||||||
#endif // BIND_H
|
#endif // BIND_H
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#include "llvm/Bitcode/BitcodeReader.h"
|
#include "llvm/Bitcode/BitcodeReader.h"
|
||||||
#include "llvm/ExecutionEngine/JITSymbol.h"
|
#include "llvm/ExecutionEngine/JITSymbol.h"
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/Mangler.h"
|
|
||||||
#include "llvm/IR/GlobalVariable.h"
|
#include "llvm/IR/GlobalVariable.h"
|
||||||
|
#include "llvm/IR/Mangler.h"
|
||||||
#include "llvm/Linker/Linker.h"
|
#include "llvm/Linker/Linker.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
|
@ -112,7 +112,7 @@ private:
|
||||||
|
|
||||||
struct BindHandle final {
|
struct BindHandle final {
|
||||||
std::string name;
|
std::string name;
|
||||||
void* handle = nullptr;
|
void *handle = nullptr;
|
||||||
};
|
};
|
||||||
std::vector<BindHandle> bindHandles;
|
std::vector<BindHandle> bindHandles;
|
||||||
|
|
||||||
|
@ -148,9 +148,7 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<BindHandle> &getBindHandles() const {
|
const std::vector<BindHandle> &getBindHandles() const { return bindHandles; }
|
||||||
return bindHandles;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addBindHandle(llvm::StringRef name, void *handle) {
|
void addBindHandle(llvm::StringRef name, void *handle) {
|
||||||
assert(!name.empty());
|
assert(!name.empty());
|
||||||
|
@ -174,7 +172,7 @@ void *resolveSymbol(llvm::JITSymbol &symbol) {
|
||||||
|
|
||||||
void generateBind(const Context &context, JITContext &jitContext,
|
void generateBind(const Context &context, JITContext &jitContext,
|
||||||
JitModuleInfo &moduleInfo, llvm::Module &module) {
|
JitModuleInfo &moduleInfo, llvm::Module &module) {
|
||||||
auto getIrFunc = [&](const void *ptr)->llvm::Function * {
|
auto getIrFunc = [&](const void *ptr) -> llvm::Function * {
|
||||||
assert(ptr != nullptr);
|
assert(ptr != nullptr);
|
||||||
auto funcDesc = moduleInfo.getFunc(ptr);
|
auto funcDesc = moduleInfo.getFunc(ptr);
|
||||||
if (funcDesc == nullptr) {
|
if (funcDesc == nullptr) {
|
||||||
|
@ -187,32 +185,30 @@ void generateBind(const Context &context, JITContext &jitContext,
|
||||||
bindFuncs.reserve(jitContext.getBindInstances().size() * 2);
|
bindFuncs.reserve(jitContext.getBindInstances().size() * 2);
|
||||||
|
|
||||||
auto genBind = [&](void *bindPtr, void *originalFunc, void *exampleFunc,
|
auto genBind = [&](void *bindPtr, void *originalFunc, void *exampleFunc,
|
||||||
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
const llvm::ArrayRef<ParamSlice> ¶ms) {
|
||||||
assert(bindPtr != nullptr);
|
assert(bindPtr != nullptr);
|
||||||
assert(bindFuncs.end() == bindFuncs.find(bindPtr));
|
assert(bindFuncs.end() == bindFuncs.find(bindPtr));
|
||||||
auto funcToInline = getIrFunc(originalFunc);
|
auto funcToInline = getIrFunc(originalFunc);
|
||||||
if (funcToInline != nullptr) {
|
if (funcToInline != nullptr) {
|
||||||
auto exampleIrFunc = getIrFunc(exampleFunc);
|
auto exampleIrFunc = getIrFunc(exampleFunc);
|
||||||
assert(exampleIrFunc != nullptr);
|
assert(exampleIrFunc != nullptr);
|
||||||
auto errhandler = [&](const std::string &str) {
|
auto errhandler = [&](const std::string &str) { fatal(context, str); };
|
||||||
fatal(context, str);
|
auto overrideHandler = [&](llvm::Type &type, const void *data,
|
||||||
};
|
size_t size) -> llvm::Constant * {
|
||||||
auto overrideHandler =
|
|
||||||
[&](llvm::Type &type, const void *data, size_t size)->
|
|
||||||
llvm::Constant *{
|
|
||||||
if (type.isPointerTy()) {
|
if (type.isPointerTy()) {
|
||||||
auto getBindFunc = [&]() {
|
auto getBindFunc = [&]() {
|
||||||
auto handle = *static_cast<void * const *>(data);
|
auto handle = *static_cast<void *const *>(data);
|
||||||
return handle != nullptr && jitContext.hasBindFunction(handle) ?
|
return handle != nullptr && jitContext.hasBindFunction(handle)
|
||||||
handle : nullptr;
|
? handle
|
||||||
|
: nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto ptype = llvm::cast<llvm::PointerType>(&type);
|
auto ptype = llvm::cast<llvm::PointerType>(&type);
|
||||||
auto elemType = ptype->getElementType();
|
auto elemType = ptype->getElementType();
|
||||||
if (elemType->isFunctionTy()) {
|
if (elemType->isFunctionTy()) {
|
||||||
(void)size;
|
(void)size;
|
||||||
assert(size == sizeof(void*));
|
assert(size == sizeof(void *));
|
||||||
auto val = *reinterpret_cast<void * const *>(data);
|
auto val = *reinterpret_cast<void *const *>(data);
|
||||||
if (val != nullptr) {
|
if (val != nullptr) {
|
||||||
auto ret = getIrFunc(val);
|
auto ret = getIrFunc(val);
|
||||||
if (ret != nullptr && ret->getType() != &type) {
|
if (ret != nullptr && ret->getType() != &type) {
|
||||||
|
@ -226,17 +222,16 @@ void generateBind(const Context &context, JITContext &jitContext,
|
||||||
auto bindIrFunc = it->second;
|
auto bindIrFunc = it->second;
|
||||||
auto funcPtrType = bindIrFunc->getType();
|
auto funcPtrType = bindIrFunc->getType();
|
||||||
auto globalVar1 = new llvm::GlobalVariable(
|
auto globalVar1 = new llvm::GlobalVariable(
|
||||||
module, funcPtrType, true,
|
module, funcPtrType, true, llvm::GlobalValue::PrivateLinkage,
|
||||||
llvm::GlobalValue::PrivateLinkage,
|
bindIrFunc, ".jit_bind_handle");
|
||||||
bindIrFunc, ".jit_bind_handle");
|
|
||||||
return llvm::ConstantExpr::getBitCast(globalVar1, &type);
|
return llvm::ConstantExpr::getBitCast(globalVar1, &type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
auto func = bindParamsToFunc(module, *funcToInline, *exampleIrFunc,
|
auto func =
|
||||||
params, errhandler,
|
bindParamsToFunc(module, *funcToInline, *exampleIrFunc, params,
|
||||||
BindOverride(overrideHandler));
|
errhandler, BindOverride(overrideHandler));
|
||||||
moduleInfo.addBindHandle(func->getName(), bindPtr);
|
moduleInfo.addBindHandle(func->getName(), bindPtr);
|
||||||
bindFuncs.insert({bindPtr, func});
|
bindFuncs.insert({bindPtr, func});
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,7 +250,7 @@ void generateBind(const Context &context, JITContext &jitContext,
|
||||||
void applyBind(const Context &context, JITContext &jitContext,
|
void applyBind(const Context &context, JITContext &jitContext,
|
||||||
const JitModuleInfo &moduleInfo) {
|
const JitModuleInfo &moduleInfo) {
|
||||||
auto &layout = jitContext.getDataLayout();
|
auto &layout = jitContext.getDataLayout();
|
||||||
for (auto& elem : moduleInfo.getBindHandles()) {
|
for (auto &elem : moduleInfo.getBindHandles()) {
|
||||||
auto decorated = decorate(elem.name, layout);
|
auto decorated = decorate(elem.name, layout);
|
||||||
auto symbol = jitContext.findSymbol(decorated);
|
auto symbol = jitContext.findSymbol(decorated);
|
||||||
auto addr = resolveSymbol(symbol);
|
auto addr = resolveSymbol(symbol);
|
||||||
|
@ -264,7 +259,7 @@ void applyBind(const Context &context, JITContext &jitContext,
|
||||||
elem.name + "\" (\"" + decorated + "\")";
|
elem.name + "\" (\"" + decorated + "\")";
|
||||||
fatal(context, desc);
|
fatal(context, desc);
|
||||||
} else {
|
} else {
|
||||||
auto handle = static_cast<void**>(elem.handle);
|
auto handle = static_cast<void **>(elem.handle);
|
||||||
*handle = addr;
|
*handle = addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ void JITContext::unregisterBind(void *handle) {
|
||||||
|
|
||||||
bool JITContext::hasBindFunction(const void *handle) const {
|
bool JITContext::hasBindFunction(const void *handle) const {
|
||||||
assert(handle != nullptr);
|
assert(handle != nullptr);
|
||||||
auto it = bindInstances.find(const_cast<void*>(handle));
|
auto it = bindInstances.find(const_cast<void *>(handle));
|
||||||
return it != bindInstances.end();
|
return it != bindInstances.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ private:
|
||||||
using ParamsVec = llvm::SmallVector<ParamSlice, 5>;
|
using ParamsVec = llvm::SmallVector<ParamSlice, 5>;
|
||||||
ParamsVec params;
|
ParamsVec params;
|
||||||
};
|
};
|
||||||
llvm::MapVector<void*, BindDesc> bindInstances;
|
llvm::MapVector<void *, BindDesc> bindInstances;
|
||||||
|
|
||||||
struct ListenerCleaner final {
|
struct ListenerCleaner final {
|
||||||
JITContext &owner;
|
JITContext &owner;
|
||||||
|
@ -124,13 +124,13 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void registerBind(void *handle, void *originalFunc, void *exampleFunc,
|
void registerBind(void *handle, void *originalFunc, void *exampleFunc,
|
||||||
const llvm::ArrayRef<ParamSlice>& params);
|
const llvm::ArrayRef<ParamSlice> ¶ms);
|
||||||
|
|
||||||
void unregisterBind(void *handle);
|
void unregisterBind(void *handle);
|
||||||
|
|
||||||
bool hasBindFunction(const void *handle) const;
|
bool hasBindFunction(const void *handle) const;
|
||||||
|
|
||||||
const llvm::MapVector<void*, BindDesc> &getBindInstances() const {
|
const llvm::MapVector<void *, BindDesc> &getBindInstances() const {
|
||||||
return bindInstances;
|
return bindInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,7 @@
|
||||||
#include <cstddef> //size_t
|
#include <cstddef> //size_t
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
enum ParamType : uint32_t {
|
enum ParamType : uint32_t { Simple = 0, Aggregate = 1 };
|
||||||
Simple = 0,
|
|
||||||
Aggregate = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ParamSlice {
|
struct ParamSlice {
|
||||||
const void *data;
|
const void *data;
|
||||||
|
|
|
@ -54,8 +54,8 @@ void rtCompileProcessImpl(const Context *context, std::size_t contextSize) {
|
||||||
JIT_API_ENTRYPOINT(dynamiccompile_modules_head, context, contextSize);
|
JIT_API_ENTRYPOINT(dynamiccompile_modules_head, context, contextSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerBindPayload(void *handle, void *originalFunc, const ParamSlice *desc,
|
void registerBindPayload(void *handle, void *originalFunc,
|
||||||
size_t descSize) {
|
const ParamSlice *desc, size_t descSize) {
|
||||||
JIT_REG_BIND_PAYLOAD(handle, originalFunc, desc, descSize);
|
JIT_REG_BIND_PAYLOAD(handle, originalFunc, desc, descSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue