summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Serrer <philipp@serrer.de>2018-01-30 14:41:26 +0100
committerPhilipp Serrer <philipp@serrer.de>2018-01-30 14:41:26 +0100
commit5a719740ec31ddb642c14a6b04aab81887adaad2 (patch)
treece6adda1829cd2f6013b74fcd3787bf0ed2c62d4
parent55fc6d09468d34f85f7b4afc5ef1969bc8dc525d (diff)
fix return type passing in lowering for calls with exceptions
-rw-r--r--ir/lower/lower_calls.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ir/lower/lower_calls.c b/ir/lower/lower_calls.c
index a3f3957..bcba74c 100644
--- a/ir/lower/lower_calls.c
+++ b/ir/lower/lower_calls.c
@@ -24,6 +24,7 @@
#include "irmode_t.h"
#include "irnode_t.h"
#include "iroptimize.h"
+#include "irouts_t.h"
#include "irprog_t.h"
#include "irtools.h"
#include "lowering.h"
@@ -750,12 +751,20 @@ static void fix_int_return(cl_entry const *const entry,
long const orig_pn, long const pn)
{
ir_node *const call = entry->call;
- ir_node *const block = get_nodes_block(call);
+ ir_node *block = get_nodes_block(call);
ir_graph *const irg = get_irn_irg(base_addr);
/* if the Call throws an exception, then we cannot add instruction
* immediately behind it as the call ends the basic block */
- assert(!is_cfop(call));
+ if (is_cfop(call)) {
+ assert(ir_throws_exception(call));
+ // Search for the x_regular nodes block and add new nodes in this block
+ foreach_irn_out(call, i, pred) {
+ if(is_x_regular_Proj(pred)) {
+ block = get_irn_out(pred, 0);
+ }
+ }
+ }
ir_mode *const mode_ref = get_irn_mode(base_addr);
ir_node *proj_mem = entry->proj_M;