@@ -68,13 +68,24 @@ HostInfo::HostInfo(host::arch arch, host::os os,
6868 // If we're instantiating a compiler for the current system, then we know it
6969 // supports runtime compilation, otherwise it's a cross compiler.
7070 device_info = host_device_info;
71- supports_deferred_compilation = host_device_info->native ;
71+ deferred_compilation_enabled = host_device_info->native ;
72+ deferred_compilation_warning = nullptr ;
7273
7374 // JIT compilation is not yet supported on RISC-V
7475 if (arch == host::arch::RISCV32 || arch == host::arch::RISCV64 ) {
75- supports_deferred_compilation = false ;
76+ deferred_compilation_enabled = false ;
7677 }
7778
79+ #if !defined(NDEBUG) || defined(CA_ENABLE_DEBUG_SUPPORT)
80+ if (deferred_compilation_enabled) {
81+ if (std::getenv (" CA_HOST_DUMP_ASM" )) {
82+ deferred_compilation_warning =
83+ " CA_HOST_DUMP_ASM requires non-deferred compilation" ;
84+ deferred_compilation_enabled = false ;
85+ }
86+ }
87+ #endif
88+
7889 // If the user wants to override, let them. This may be useful for testing the
7990 // non-deferred-compilation support, or may be useful for testing future LLVM
8091 // improvements that may provide RISC-V JIT support.
@@ -83,7 +94,7 @@ HostInfo::HostInfo(host::arch arch, host::os os,
8394 char *end;
8495 const long val = std::strtol (env, &end, 10 );
8596 if (*env != ' \0 ' && (val == 0 || val == 1 ) && *end == ' \0 ' ) {
86- supports_deferred_compilation = val;
97+ deferred_compilation_enabled = val;
8798 }
8899 }
89100#endif
@@ -105,6 +116,17 @@ HostInfo::HostInfo(host::arch arch, host::os os,
105116#endif
106117}
107118
119+ bool HostInfo::supports_deferred_compilation () const {
120+ const bool enabled = deferred_compilation_enabled;
121+ if (auto *warning = deferred_compilation_warning) {
122+ (void )fprintf (stderr, " warning: %s. %s\n " , warning,
123+ enabled ? " Deferred compilation forced enabled."
124+ : " Deferred compilation disabled." );
125+ deferred_compilation_warning = nullptr ;
126+ }
127+ return enabled;
128+ }
129+
108130std::unique_ptr<compiler::Target> HostInfo::createTarget (
109131 compiler::Context *context, compiler::NotifyCallbackFn callback) const {
110132 if (!context) {
0 commit comments