Do not use exteranl storage for enableRuntimeCompile flag

This commit is contained in:
Ivan 2017-09-05 21:23:39 +03:00
parent 5bb48d84c4
commit a9f6875494
7 changed files with 18 additions and 11 deletions

View file

@ -234,8 +234,6 @@ struct Param
uint32_t hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing) uint32_t hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing)
bool outputSourceLocations; // if true, output line tables. bool outputSourceLocations; // if true, output line tables.
bool enableRuntimeCompile; // Enable dynamic compilation
#endif #endif
}; };

View file

@ -522,10 +522,9 @@ cl::list<std::string>
#endif #endif
#if defined(LDC_RUNTIME_COMPILE) #if defined(LDC_RUNTIME_COMPILE)
static cl::opt<bool, true> enableRuntimeCompile( cl::opt<bool> enableRuntimeCompile(
"enable-runtime-compile", "enable-runtime-compile",
cl::desc("Enable runtime compilation"), cl::desc("Enable runtime compilation"),
cl::location(global.params.enableRuntimeCompile),
cl::init(false)); cl::init(false));
#endif #endif

View file

@ -125,5 +125,9 @@ extern cl::opt<std::string> saveOptimizationRecord;
#if LDC_LLVM_SUPPORTED_TARGET_SPIRV || LDC_LLVM_SUPPORTED_TARGET_NVPTX #if LDC_LLVM_SUPPORTED_TARGET_SPIRV || LDC_LLVM_SUPPORTED_TARGET_NVPTX
extern cl::list<std::string> dcomputeTargets; extern cl::list<std::string> dcomputeTargets;
#endif #endif
#if defined(LDC_RUNTIME_COMPILE)
extern cl::opt<bool> enableRuntimeCompile;
#endif
} }
#endif #endif

View file

@ -340,10 +340,12 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
args.push_back("-lldc-profile-rt"); args.push_back("-lldc-profile-rt");
} }
if (global.params.enableRuntimeCompile) { #if defined(LDC_RUNTIME_COMPILE)
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) {

View file

@ -118,10 +118,12 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
args.push_back("ws2_32.lib"); args.push_back("ws2_32.lib");
} }
if (global.params.enableRuntimeCompile) { #if defined(LDC_RUNTIME_COMPILE)
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) {

View file

@ -944,9 +944,11 @@ void registerPredefinedVersions() {
VersionCondition::addPredefinedGlobalIdent("D_ObjectiveC"); VersionCondition::addPredefinedGlobalIdent("D_ObjectiveC");
} }
if (global.params.enableRuntimeCompile) { #if defined(LDC_RUNTIME_COMPILE)
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)) {

View file

@ -2,7 +2,7 @@
#if defined(LDC_RUNTIME_COMPILE) #if defined(LDC_RUNTIME_COMPILE)
#include "globals.h" #include "driver/cl_options.h"
#include "gen/irstate.h" #include "gen/irstate.h"
#include "gen/llvm.h" #include "gen/llvm.h"
@ -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 (!global.params.enableRuntimeCompile) { if (!opts::enableRuntimeCompile) {
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 (!global.params.enableRuntimeCompile) { if (!opts::enableRuntimeCompile) {
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 (!global.params.enableRuntimeCompile) { if (!opts::enableRuntimeCompile) {
return; return;
} }