summaryrefslogtreecommitdiffhomepage
path: root/ir/common
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-09-10 09:36:28 +0200
committerMatthias Braun <matze@braunis.de>2015-09-10 09:36:32 +0200
commit43cefb2b5e3324127b19d01a96af30a92bfa0afa (patch)
tree147957e2d3a5153c32cd6f1bf849e4d2655d3e22 /ir/common
parent3e551d380ba552d7b3efca31f2971e5d91832ad9 (diff)
Move ir/common/irtools.* to ir/ir
The functions were all dealing with graphs so ir/ir is a more logical place to be.
Diffstat (limited to 'ir/common')
-rw-r--r--ir/common/irtools.c93
-rw-r--r--ir/common/irtools.h77
2 files changed, 0 insertions, 170 deletions
diff --git a/ir/common/irtools.c b/ir/common/irtools.c
deleted file mode 100644
index 3c34cbc..0000000
--- a/ir/common/irtools.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * This file is part of libFirm.
- * Copyright (C) 2012 University of Karlsruhe.
- */
-
-/**
- * @file
- * @brief Some often needed tool-functions
- * @author Michael Beck
- */
-#include <stdlib.h>
-#include "irnode_t.h"
-#include "irbackedge_t.h"
-#include "irtools.h"
-#include "irprintf.h"
-#include "iropt_t.h"
-
-void firm_clear_link(ir_node *n, void *env)
-{
- (void) env;
- set_irn_link(n, NULL);
-}
-
-void firm_clear_node_and_phi_links(ir_node *n, void *env)
-{
- (void) env;
- set_irn_link(n, NULL);
- if (is_Block(n))
- set_Block_phis(n, NULL);
- else if (is_Phi(n))
- set_Phi_next(n, NULL);
-}
-
-void firm_clear_block_phis(ir_node *node, void *env)
-{
- (void) env;
- if (is_Block(node)) {
- set_Block_phis(node, NULL);
- } else if (is_Phi(node)) {
- set_Phi_next(node, NULL);
- }
-}
-
-void firm_collect_block_phis(ir_node *node, void *env)
-{
- (void) env;
- if (is_Phi(node))
- add_Block_phi(get_nodes_block(node), node);
-}
-
-ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg)
-{
- ir_op *op = get_irn_op(node);
- ir_node *block = op != op_Block ? get_nodes_block(node) : NULL;
- dbg_info *dbgi = get_irn_dbg_info(node);
- ir_mode *mode = get_irn_mode(node);
- ir_node **ins = get_irn_in(node) + 1;
- int arity = get_irn_arity(node);
- ir_node *res = new_ir_node(dbgi, irg, block, op, mode, arity, ins);
-
- /* copy the attributes */
- copy_node_attr(irg, node, res);
-
- return res;
-}
-
-ir_node *exact_copy(const ir_node *node)
-{
- return irn_copy_into_irg(node, get_irn_irg(node));
-}
-
-static ir_node *get_new_node(const ir_node *old_node)
-{
- return (ir_node*) get_irn_link(old_node);
-}
-
-void irn_rewire_inputs(ir_node *node)
-{
- ir_node *new_node = get_new_node(node);
- if (!is_Block(node)) {
- ir_node *block = get_nodes_block(node);
- ir_node *new_block = get_new_node(block);
- set_nodes_block(new_node, new_block);
- }
-
- foreach_irn_in(node, i, in) {
- ir_node *new_in = get_new_node(in);
- set_irn_n(new_node, i, new_in);
- }
-
- /* Now the new node is complete. We can add it to the hash table for CSE. */
- add_identities(new_node);
-}
diff --git a/ir/common/irtools.h b/ir/common/irtools.h
deleted file mode 100644
index b4db9b2..0000000
--- a/ir/common/irtools.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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);
-
-/**
- * Creates an exact copy of a node with same inputs and attributes in the
- * same block. The copied node will not be optimized (so no CSE is performed).
- *
- * @param node the node to copy
- */
-ir_node *exact_copy(const ir_node *node);
-
-/**
- * Create an exact copy of a node with same inputs and attributes in the same
- * block but puts the node on a graph which might be different than the graph
- * of the original node.
- * Note: You have to fixup the inputs/block later
- */
-ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg);
-
-/**
- * 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