Commit f0679e61 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ir: Move get_block() from the backend into the middleend.

parent 7fa38f2c
......@@ -14,7 +14,6 @@
#include <stdbool.h>
#include "beinfo.h"
#include "beutil.h"
#include "irdom.h"
static sched_info_t *get_irn_sched_info(const ir_node *node)
......
......@@ -17,23 +17,6 @@
#include "be_types.h"
/**
* Convenient block getter.
* Works also, if the given node is a block.
* @param irn The node.
* @return The block of the node, or the node itself, if the node is a
* block.
*/
static inline ir_node *get_block(ir_node *irn)
{
return is_Block(irn) ? irn : get_nodes_block(irn);
}
static inline const ir_node *get_block_const(const ir_node *irn)
{
return is_Block(irn) ? irn : get_nodes_block(irn);
}
/**
* Returns an array (an ARR_F) of the programs blocks in reverse postorder
* (note: caller has to free the memory with DEL_ARR_F after use;
......
......@@ -52,6 +52,7 @@
#include "bedwarf.h"
#include "beemitter.h"
#include "begnuas.h"
#include "beutil.h"
#include "ia32_emitter.h"
#include "ia32_common_transform.h"
......
......@@ -36,6 +36,7 @@
#include "besched.h"
#include "betranshlp.h"
#include "be_t.h"
#include "beutil.h"
#include "bearch_ia32_t.h"
#include "gen_ia32_regalloc_if.h"
......
......@@ -528,6 +528,23 @@ ir_node *new_similar_node(ir_node *old, ir_node *block, ir_node **in);
*/
ir_node *get_Proj_for_pn(ir_node const *irn, unsigned pn);
/**
* Convenient block getter.
* Works also, if the given node is a block.
* @param irn The node.
* @return The block of the node, or the node itself, if the node is a
* block.
*/
static inline ir_node *get_block(ir_node *const irn)
{
return is_Block(irn) ? irn : get_nodes_block(irn);
}
static inline ir_node const *get_block_const(ir_node const *const irn)
{
return is_Block(irn) ? irn : get_nodes_block(irn);
}
#define foreach_irn_in(irn, idx, pred) \
for (bool pred##__b = true; pred##__b;) \
for (ir_node const *const pred##__irn = (irn); pred##__b; pred##__b = false) \
......
Markdown is supported
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