Commit 8d29e131 authored by Matthias Braun's avatar Matthias Braun
Browse files

cleanup, use C99

parent 64b92026
......@@ -9,23 +9,22 @@
* @date 14.4.2008
* @author Michael Beck
*/
#include "irgraph_t.h"
#include "iredges.h"
#include <stdbool.h>
#include "error.h"
#include "ircons.h"
#include "instrument.h"
#include "ircons.h"
#include "iredges.h"
#include "irgraph_t.h"
void instrument_initcall(ir_graph *irg, ir_entity *ent)
{
ir_node *initial_exec;
ir_node *first_block = NULL;
int i, idx, need_new_block;
assure_edges(irg);
/* find the first block */
initial_exec = get_irg_initial_exec(irg);
ir_node *initial_exec = get_irg_initial_exec(irg);
ir_node *first_block = NULL;
foreach_out_edge(initial_exec, edge) {
ir_node *succ = get_edge_src_irn(edge);
......@@ -40,9 +39,9 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent)
}
/* check if this block has only one predecessor */
idx = -1;
need_new_block = 0;
for (i = get_Block_n_cfgpreds(first_block) - 1; i >= 0; --i) {
int idx = -1;
bool need_new_block = false;
for (int i = get_Block_n_cfgpreds(first_block) - 1; i >= 0; --i) {
ir_node *p = get_Block_cfgpred(first_block, i);
if (is_Bad(p))
......@@ -50,7 +49,7 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent)
if (p == initial_exec)
idx = i;
else
need_new_block = 1;
need_new_block = true;
}
if (need_new_block) {
......@@ -62,7 +61,8 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent)
/* place the call */
ir_node *const adr = new_r_Address(irg, ent);
ir_node *const initial_mem = get_irg_initial_mem(irg);
ir_node *const call = new_r_Call(first_block, initial_mem, adr, 0, NULL, get_entity_type(ent));
ir_node *const call = new_r_Call(first_block, initial_mem, adr, 0,
NULL, get_entity_type(ent));
ir_node *const new_mem = new_r_Proj(call, mode_M, pn_Call_M);
edges_reroute_except(initial_mem, new_mem, call);
......
......@@ -10,6 +10,8 @@
#ifndef FIRM_IR_INSTRUMENT_H
#define FIRM_IR_INSTRUMENT_H
#include "firm_types.h"
/**
* Adds a Call at the beginning of the given irg.
*
......
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