mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
clang-format
This commit is contained in:
parent
c6ec90e8ef
commit
938ac0e4bf
5 changed files with 45 additions and 57 deletions
|
@ -26,9 +26,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
enum {
|
||||
ApiVersion = LDC_DYNAMIC_COMPILE_API_VERSION
|
||||
};
|
||||
enum { ApiVersion = LDC_DYNAMIC_COMPILE_API_VERSION };
|
||||
|
||||
const char *DynamicCompileModulesHeadName = "dynamiccompile_modules_head";
|
||||
|
||||
|
@ -577,8 +575,7 @@ llvm::GlobalVariable *generateModuleListElem(IRState *irs, const Types &types,
|
|||
auto symListInit = generateSymList(irs, types, globalVals);
|
||||
auto varlistInit = generateVarList(irs, types);
|
||||
llvm::Constant *fields[] = {
|
||||
llvm::ConstantInt::get(irs->context(),
|
||||
APInt(32, ApiVersion)), // version
|
||||
llvm::ConstantInt::get(irs->context(), APInt(32, ApiVersion)), // version
|
||||
llvm::ConstantPointerNull::get(llvm::dyn_cast<llvm::PointerType>(
|
||||
elem_type->getElementType(1))), // next
|
||||
irData->getInitializer(), // irdata
|
||||
|
|
|
@ -186,10 +186,8 @@ public:
|
|||
llvm::sys::getHostCPUName(), getHostAttrs())),
|
||||
dataLayout(targetmachine->createDataLayout()),
|
||||
#if LDC_LLVM_VER >= 700
|
||||
execSession(stringPool),
|
||||
resolver(createResolver()),
|
||||
objectLayer(
|
||||
execSession,
|
||||
execSession(stringPool), resolver(createResolver()),
|
||||
objectLayer(execSession,
|
||||
[](llvm::orc::VModuleKey) {
|
||||
return std::make_shared<llvm::SectionMemoryManager>();
|
||||
},
|
||||
|
@ -256,14 +254,12 @@ private:
|
|||
}
|
||||
|
||||
#if LDC_LLVM_VER >= 700
|
||||
std::shared_ptr<llvm::orc::SymbolResolver>
|
||||
createResolver() {
|
||||
std::shared_ptr<llvm::orc::SymbolResolver> createResolver() {
|
||||
return llvm::orc::createLegacyLookupResolver(
|
||||
[this](const std::string &name) -> llvm::JITSymbol {
|
||||
if (auto Sym = compileLayer.findSymbol(name, false)) {
|
||||
return Sym;
|
||||
}
|
||||
else if (auto Err = Sym.takeError()) {
|
||||
} else if (auto Err = Sym.takeError()) {
|
||||
return std::move(Err);
|
||||
}
|
||||
auto it = symMap.find(name);
|
||||
|
@ -277,12 +273,12 @@ private:
|
|||
}
|
||||
return nullptr;
|
||||
},
|
||||
[](llvm::Error Err) { llvm::cantFail(std::move(Err),
|
||||
"lookupFlags failed"); });
|
||||
[](llvm::Error Err) {
|
||||
llvm::cantFail(std::move(Err), "lookupFlags failed");
|
||||
});
|
||||
}
|
||||
#else
|
||||
std::shared_ptr<llvm::JITSymbolResolver>
|
||||
createResolver() {
|
||||
std::shared_ptr<llvm::JITSymbolResolver> createResolver() {
|
||||
// Build our symbol resolver:
|
||||
// Lambda 1: Look back into the JIT itself to find symbols that are part of
|
||||
// the same "logical dylib".
|
||||
|
@ -381,8 +377,7 @@ struct JitFinaliser final {
|
|||
|
||||
template <typename F>
|
||||
void enumModules(const RtCompileModuleList *modlist_head,
|
||||
const Context& context,
|
||||
F &&fun) {
|
||||
const Context &context, F &&fun) {
|
||||
auto current = modlist_head;
|
||||
while (current != nullptr) {
|
||||
interruptPoint(context, "check version");
|
||||
|
@ -516,8 +511,8 @@ __declspec(dllexport)
|
|||
#else
|
||||
__attribute__ ((visibility ("default")))
|
||||
#endif
|
||||
void JIT_API_ENTRYPOINT(const void *modlist_head,
|
||||
const Context *context, size_t contextSize) {
|
||||
void JIT_API_ENTRYPOINT(const void *modlist_head, const Context *context,
|
||||
size_t contextSize) {
|
||||
assert(nullptr != context);
|
||||
assert(sizeof(*context) == contextSize);
|
||||
rtCompileProcessImplSoInternal(
|
||||
|
|
|
@ -23,15 +23,13 @@ enum class DumpStage : int {
|
|||
FinalAsm = 3
|
||||
};
|
||||
|
||||
enum {
|
||||
ApiVersion = LDC_DYNAMIC_COMPILE_API_VERSION
|
||||
};
|
||||
enum { ApiVersion = LDC_DYNAMIC_COMPILE_API_VERSION };
|
||||
|
||||
#define MAKE_JIT_API_CALL_IMPL(prefix, version) prefix##version
|
||||
#define MAKE_JIT_API_CALL(prefix, version) \
|
||||
MAKE_JIT_API_CALL_IMPL(prefix, version)
|
||||
#define JIT_API_ENTRYPOINT MAKE_JIT_API_CALL(rtCompileProcessImplSo, \
|
||||
LDC_DYNAMIC_COMPILE_API_VERSION)
|
||||
#define JIT_API_ENTRYPOINT \
|
||||
MAKE_JIT_API_CALL(rtCompileProcessImplSo, LDC_DYNAMIC_COMPILE_API_VERSION)
|
||||
|
||||
typedef void (*InterruptPointHandlerT)(void *, const char *action,
|
||||
const char *object);
|
||||
|
|
|
@ -200,8 +200,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void processRelocations(SymTable &symTable,
|
||||
uint64_t offset,
|
||||
void processRelocations(SymTable &symTable, uint64_t offset,
|
||||
const llvm::object::ObjectFile &object,
|
||||
const llvm::object::SectionRef &sec) {
|
||||
for (const auto &reloc : sec.relocations()) {
|
||||
|
@ -336,8 +335,7 @@ void disassemble(const llvm::TargetMachine &tm,
|
|||
}
|
||||
}
|
||||
llvm::ArrayRef<uint8_t> buff(
|
||||
reinterpret_cast<const uint8_t *>(data.data() + offset),
|
||||
size);
|
||||
reinterpret_cast<const uint8_t *>(data.data() + offset), size);
|
||||
|
||||
printFunction(*disasm, *mcia, buff, symTable, *sti, *asmStreamer);
|
||||
asmStreamer->EmitRawText("");
|
||||
|
|
|
@ -19,8 +19,8 @@ struct Context;
|
|||
#define MAKE_JIT_API_CALL_IMPL(prefix, version) prefix##version
|
||||
#define MAKE_JIT_API_CALL(prefix, version) \
|
||||
MAKE_JIT_API_CALL_IMPL(prefix, version)
|
||||
#define JIT_API_ENTRYPOINT MAKE_JIT_API_CALL(rtCompileProcessImplSo, \
|
||||
LDC_DYNAMIC_COMPILE_API_VERSION)
|
||||
#define JIT_API_ENTRYPOINT \
|
||||
MAKE_JIT_API_CALL(rtCompileProcessImplSo, LDC_DYNAMIC_COMPILE_API_VERSION)
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue