summaryrefslogtreecommitdiffhomepage
path: root/ir/ir/irtools.h
blob: a14848852262dd52d65725d7cd25a951cf6e53fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief     Some often needed tool-functions
 * @author    Michael Beck
 */
#ifndef FIRM_COMMON_IRTOOLS_H
#define FIRM_COMMON_IRTOOLS_H

#include "firm_types.h"
#include "lc_opts.h"
#include "pset.h"

/**
 * Return root commandlineoptions for libfirm library
 */
lc_opt_entry_t *firm_opt_get_root(void);

/**
 * The famous clear_link() walker-function.
 * Sets all links fields of visited nodes to NULL.
 * Do not implement it by yourself, use this one.
 */
void firm_clear_link(ir_node *n, void *env);

/**
 * The famous clear_link_and_block_lists() walker-function.
 * Sets all links fields of visited nodes to NULL.
 * Additionally, clear all Phi-lists of visited blocks.
 * Do not implement it by yourself, use this one.
 */
void firm_clear_node_and_phi_links(ir_node *n, void *env);

/**
 * Walker function, sets all phi list heads fields of visited Blocks
 * to NULL.
 * Use in conjunction with firm_collect_block_phis().
 */
void firm_clear_block_phis(ir_node *node, void *env);

/**
 * Walker function, links all visited Phi nodes into its block links.
 * Use in conjunction with firm_clear_block_phis().
 */
void firm_collect_block_phis(ir_node *node, void *env);

/**
 * This is a helper function used by some routines copying irg graphs
 * This assumes that we have "old" nodes which have been copied to "new"
 * nodes; The inputs of the new nodes still point to old nodes.
 *
 * Given an old(!) node this function rewires the matching new_node
 * so that all its inputs point to new nodes afterwards.
 */
void irn_rewire_inputs(ir_node *node);

#endif