Commit dbd58c51 authored by Matthias Braun's avatar Matthias Braun
Browse files

add missing keeps after rematerializing nodes

parent 65f2648b
......@@ -411,7 +411,7 @@ static ir_node *add_to_keep(ir_node *last_keep,
return last_keep;
}
static void add_missing_keep_walker(ir_node *node, void *data)
void be_add_missing_keeps_node(ir_node *node)
{
int n_outs, i;
unsigned *found_projs;
......@@ -419,7 +419,7 @@ static void add_missing_keep_walker(ir_node *node, void *data)
ir_mode *mode = get_irn_mode(node);
ir_node *last_keep;
ir_node **existing_projs;
(void) data;
if (mode != mode_T) {
if (!has_real_user(node)) {
const arch_register_req_t *req = arch_get_irn_register_req(node);
......@@ -483,6 +483,12 @@ static void add_missing_keep_walker(ir_node *node, void *data)
}
}
static void add_missing_keep_walker(ir_node *node, void *data)
{
(void)data;
be_add_missing_keeps_node(node);
}
void be_add_missing_keeps(ir_graph *irg)
{
irg_walk_graph(irg, add_missing_keep_walker, NULL, NULL);
......
......@@ -113,6 +113,11 @@ ir_node *be_epilog_create_return(beabi_helper_env_t *env, dbg_info *dbgi,
*/
void be_add_missing_keeps(ir_graph *irg);
/**
* Make sure all outputs of a node are used, add keeps otherwise
*/
void be_add_missing_keeps_node(ir_node *node);
/**
* In the normal firm representation some nodes like pure calls, builtins
* have no memory inputs+outputs. However in the backend these sometimes have to
......
......@@ -54,6 +54,7 @@
#include "besched.h"
#include "benode.h"
#include "belive.h"
#include "beabihelper.h"
static const arch_register_class_t *flag_class;
static const arch_register_t *flags_reg;
......@@ -161,6 +162,7 @@ static void rematerialize_or_move(ir_node *flags_needed, ir_node *node,
if (get_irn_mode(copy) == mode_T) {
ir_mode *mode = flag_class->mode;
value = new_rd_Proj(NULL, copy, mode, pn);
be_add_missing_keeps_node(copy);
} else {
value = copy;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment