yselkowitz / rpms / orc

Forked from rpms/orc 6 years ago
Clone
Blob Blame History Raw
Fixes http://dev.laptop.org/ticket/12463

From b4f7fcaf99a4d952e59f2a9fa9286d24cc4b3a5a Mon Sep 17 00:00:00 2001
From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= <sebastian.droege@collabora.co.uk>
Date: Thu, 10 Jan 2013 18:13:32 +0100
Subject: [PATCH] orccompiler: Allow fallback to backup/emulation if the
 target specific register allocation fails

The OrcCode of the program wouldn't be filled with all required fields
if the register allocation happens to early.
---
 orc/orccompiler.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/orc/orccompiler.c b/orc/orccompiler.c
index 68eb01e..2175206 100644
--- a/orc/orccompiler.c
+++ b/orc/orccompiler.c
@@ -254,12 +254,6 @@ orc_program_compile_full (OrcProgram *program, OrcTarget *target,
   orc_compiler_rewrite_vars (compiler);
   if (compiler->error) goto error;
 
-  if (compiler->target) {
-    orc_compiler_global_reg_alloc (compiler);
-
-    orc_compiler_rewrite_vars2 (compiler);
-  }
-
 #if 0
   {
     ORC_ERROR("variables");
@@ -285,9 +279,6 @@ orc_program_compile_full (OrcProgram *program, OrcTarget *target,
     }
   }
 #endif
-
-  if (compiler->error) goto error;
-
   program->orccode = orc_code_new ();
 
   program->orccode->is_2d = program->is_2d;
@@ -323,6 +314,13 @@ orc_program_compile_full (OrcProgram *program, OrcTarget *target,
     goto error;
   }
 
+  if (compiler->target) {
+    orc_compiler_global_reg_alloc (compiler);
+
+    orc_compiler_rewrite_vars2 (compiler);
+  }
+  if (compiler->error) goto error;
+
   orc_compiler_assign_rules (compiler);
   if (compiler->error) goto error;
 
-- 
1.7.9.5