mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
opts::isRuntimeCompileEnabled() helper function
This commit is contained in:
parent
ac763b0520
commit
ccc87bdb9d
5 changed files with 9 additions and 12 deletions
|
@ -128,6 +128,9 @@ extern cl::list<std::string> dcomputeTargets;
|
||||||
|
|
||||||
#if defined(LDC_RUNTIME_COMPILE)
|
#if defined(LDC_RUNTIME_COMPILE)
|
||||||
extern cl::opt<bool> enableRuntimeCompile;
|
extern cl::opt<bool> enableRuntimeCompile;
|
||||||
|
inline bool isRuntimeCompileEnabled() { return enableRuntimeCompile; }
|
||||||
|
#else
|
||||||
|
inline bool isRuntimeCompileEnabled() { return false; }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -340,12 +340,10 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
||||||
args.push_back("-lldc-profile-rt");
|
args.push_back("-lldc-profile-rt");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LDC_RUNTIME_COMPILE)
|
if (opts::isRuntimeCompileEnabled()) {
|
||||||
if (opts::enableRuntimeCompile) {
|
|
||||||
args.push_back("-lldc-jit-rt");
|
args.push_back("-lldc-jit-rt");
|
||||||
args.push_back("-lldc-jit");
|
args.push_back("-lldc-jit");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// user libs
|
// user libs
|
||||||
for (auto libfile : *global.params.libfiles) {
|
for (auto libfile : *global.params.libfiles) {
|
||||||
|
|
|
@ -118,12 +118,10 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
|
||||||
args.push_back("ws2_32.lib");
|
args.push_back("ws2_32.lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LDC_RUNTIME_COMPILE)
|
if (opts::isRuntimeCompileEnabled()) {
|
||||||
if (opts::enableRuntimeCompile) {
|
|
||||||
args.push_back("ldc-jit-rt.lib");
|
args.push_back("ldc-jit-rt.lib");
|
||||||
args.push_back("ldc-jit.lib");
|
args.push_back("ldc-jit.lib");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// user libs
|
// user libs
|
||||||
for (auto libfile : *global.params.libfiles) {
|
for (auto libfile : *global.params.libfiles) {
|
||||||
|
|
|
@ -944,11 +944,9 @@ void registerPredefinedVersions() {
|
||||||
VersionCondition::addPredefinedGlobalIdent("D_ObjectiveC");
|
VersionCondition::addPredefinedGlobalIdent("D_ObjectiveC");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LDC_RUNTIME_COMPILE)
|
if (opts::isRuntimeCompileEnabled()) {
|
||||||
if (opts::enableRuntimeCompile) {
|
|
||||||
VersionCondition::addPredefinedGlobalIdent("LDC_RuntimeCompilation");
|
VersionCondition::addPredefinedGlobalIdent("LDC_RuntimeCompilation");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define sanitizer versions.
|
// Define sanitizer versions.
|
||||||
if (opts::isSanitizerEnabled(opts::AddressSanitizer)) {
|
if (opts::isSanitizerEnabled(opts::AddressSanitizer)) {
|
||||||
|
|
|
@ -630,7 +630,7 @@ void declareRuntimeCompiledFunction(IRState *irs, IrFunction *func) {
|
||||||
assert(nullptr != irs);
|
assert(nullptr != irs);
|
||||||
assert(nullptr != func);
|
assert(nullptr != func);
|
||||||
assert(nullptr != func->getLLVMFunc());
|
assert(nullptr != func->getLLVMFunc());
|
||||||
if (!opts::enableRuntimeCompile) {
|
if (!opts::isRuntimeCompileEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto srcFunc = func->getLLVMFunc();
|
auto srcFunc = func->getLLVMFunc();
|
||||||
|
@ -647,7 +647,7 @@ void defineRuntimeCompiledFunction(IRState *irs, IrFunction *func)
|
||||||
assert(nullptr != func);
|
assert(nullptr != func);
|
||||||
assert(nullptr != func->getLLVMFunc());
|
assert(nullptr != func->getLLVMFunc());
|
||||||
assert(nullptr != func->rtCompileFunc);
|
assert(nullptr != func->rtCompileFunc);
|
||||||
if (!opts::enableRuntimeCompile) {
|
if (!opts::isRuntimeCompileEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto srcFunc = func->getLLVMFunc();
|
auto srcFunc = func->getLLVMFunc();
|
||||||
|
@ -670,7 +670,7 @@ void addRuntimeCompiledVar(IRState *irs, IrGlobal *var) {
|
||||||
assert(nullptr != var);
|
assert(nullptr != var);
|
||||||
assert(nullptr != var->value);
|
assert(nullptr != var->value);
|
||||||
assert(nullptr != var->V);
|
assert(nullptr != var->V);
|
||||||
if (!opts::enableRuntimeCompile) {
|
if (!opts::isRuntimeCompileEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue