Handle ORC_CODE=emulate to force emulation
authorDavid Schleef <ds@schleef.org>
Mon, 20 Sep 2010 20:09:16 +0000 (13:09 -0700)
committerDavid Schleef <ds@schleef.org>
Mon, 20 Sep 2010 20:21:19 +0000 (13:21 -0700)
orc/orccompiler.c
orc/orcprogram.h

index 7d60eb9..7f44de0 100644 (file)
@@ -43,6 +43,7 @@ void orc_compiler_check_sizes (OrcCompiler *compiler);
 
 static char **_orc_compiler_flag_list;
 int _orc_compiler_flag_backup;
+int _orc_compiler_flag_emulate;
 int _orc_compiler_flag_debug;
 
 void
@@ -56,6 +57,7 @@ _orc_compiler_init (void)
   }
 
   _orc_compiler_flag_backup = orc_compiler_flag_check ("backup");
+  _orc_compiler_flag_emulate = orc_compiler_flag_check ("emulate");
   _orc_compiler_flag_debug = orc_compiler_flag_check ("debug");
 }
 
@@ -206,6 +208,12 @@ orc_program_compile_full (OrcProgram *program, OrcTarget *target,
     goto error;
   }
 
+  if (_orc_compiler_flag_emulate) {
+    program->code_exec = (void *)orc_executor_emulate;
+    compiler->result = ORC_COMPILE_RESULT_UNKNOWN_COMPILE;
+    goto error;
+  }
+
   if (target == NULL) {
     ORC_COMPILER_ERROR(compiler, "No target given");
     compiler->result = ORC_COMPILE_RESULT_UNKNOWN_COMPILE;
index c88ccf2..14a6949 100644 (file)
@@ -766,6 +766,7 @@ extern int _orc_cpu_stepping;
 extern const char *_orc_cpu_name;
 
 extern int _orc_compiler_flag_backup;
+extern int _orc_compiler_flag_emulate;
 extern int _orc_compiler_flag_debug;
 
 void orc_code_chunk_free (OrcCodeChunk *chunk);