Commit 8e0743d5 authored by Sebastian Hack's avatar Sebastian Hack
Browse files

Constified a little bit.

[r4539]
parent 33c204f3
...@@ -238,19 +238,19 @@ set_irn_in (ir_node *node, int arity, ir_node **in) { ...@@ -238,19 +238,19 @@ set_irn_in (ir_node *node, int arity, ir_node **in) {
} }
ir_node * ir_node *
(get_irn_intra_n)(ir_node *node, int n) { (get_irn_intra_n)(const ir_node *node, int n) {
return __get_irn_intra_n (node, n); return __get_irn_intra_n (node, n);
} }
ir_node * ir_node *
(get_irn_inter_n)(ir_node *node, int n) { (get_irn_inter_n)(const ir_node *node, int n) {
return __get_irn_inter_n (node, n); return __get_irn_inter_n (node, n);
} }
ir_node *(*__get_irn_n)(ir_node *node, int n) = __get_irn_intra_n; ir_node *(*__get_irn_n)(const ir_node *node, int n) = __get_irn_intra_n;
ir_node * ir_node *
(get_irn_n)(ir_node *node, int n) { (get_irn_n)(const ir_node *node, int n) {
return __get_irn_n(node, n); return __get_irn_n(node, n);
} }
...@@ -527,7 +527,7 @@ get_irn_except_attr (ir_node *node) ...@@ -527,7 +527,7 @@ get_irn_except_attr (ir_node *node)
/* this works for all except Block */ /* this works for all except Block */
ir_node * ir_node *
get_nodes_block (ir_node *node) { get_nodes_block (const ir_node *node) {
assert (!(node->op == op_Block)); assert (!(node->op == op_Block));
return get_irn_n(node, -1); return get_irn_n(node, -1);
} }
......
...@@ -133,9 +133,9 @@ void set_irn_in (ir_node *node, int arity, ...@@ -133,9 +133,9 @@ void set_irn_in (ir_node *node, int arity,
* Get the n-th predecessor of a node. * Get the n-th predecessor of a node.
* This function removes Id predecessors. * This function removes Id predecessors.
*/ */
ir_node *get_irn_n (ir_node *node, int n); ir_node *get_irn_n (const ir_node *node, int n);
ir_node *get_irn_intra_n (ir_node *node, int n); ir_node *get_irn_intra_n (const ir_node *node, int n);
ir_node *get_irn_inter_n (ir_node *node, int n); ir_node *get_irn_inter_n (const ir_node *node, int n);
/** Replace the n-th predecessor of a node with a new one. */ /** Replace the n-th predecessor of a node with a new one. */
void set_irn_n (ir_node *node, int n, ir_node *in); void set_irn_n (ir_node *node, int n, ir_node *in);
...@@ -223,7 +223,7 @@ new_ir_node (dbg_info *db, ...@@ -223,7 +223,7 @@ new_ir_node (dbg_info *db,
* To express the difference to access routines that work for all * To express the difference to access routines that work for all
* nodes we use infix "nodes" and do not name this function * nodes we use infix "nodes" and do not name this function
* get_irn_block. */ * get_irn_block. */
ir_node *get_nodes_block (ir_node *node); ir_node *get_nodes_block (const ir_node *node);
/** Sets the Block of a node. */ /** Sets the Block of a node. */
void set_nodes_block (ir_node *node, ir_node *block); void set_nodes_block (ir_node *node, ir_node *block);
...@@ -904,7 +904,16 @@ int is_forking_op(const ir_node *node); ...@@ -904,7 +904,16 @@ int is_forking_op(const ir_node *node);
* @return A pointer of type @p type. * @return A pointer of type @p type.
*/ */
#define get_irn_data(node,type,off) \ #define get_irn_data(node,type,off) \
(assert(off > 0 && "Invalid node data offset"), (type *) ((char *) (node) - (off))) (assert(off > 0 && "Invalid node data offset"), (type *) ((char *) (node) - (off)))
/**
* Get the pointer to the node some custom data belongs to.
* @param data The pointer to the custom data.
* @param off The number as returned by register_additional_node_data().
* @return A pointer to the ir node the custom data belongs to.
*/
#define get_irn_data_base(data,off) \
(assert(off > 0 && "Invalid node data offset"), (ir_node *) ((char *) (data) + (off)))
/** /**
* Request additional data to be allocated with an ir node. * Request additional data to be allocated with an ir node.
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "entity_t.h" #include "entity_t.h"
#include "type_t.h" #include "type_t.h"
/** ir node attributes **/ /** ir node attributes **/
/** Block attributes */ /** Block attributes */
...@@ -339,7 +340,7 @@ extern int (*__get_irn_arity)(const ir_node *node); ...@@ -339,7 +340,7 @@ extern int (*__get_irn_arity)(const ir_node *node);
* Intern version for libFirm. * Intern version for libFirm.
*/ */
static INLINE ir_node * static INLINE ir_node *
__get_irn_intra_n (ir_node *node, int n) { __get_irn_intra_n (const ir_node *node, int n) {
assert(node); assert(-1 <= n && n < __get_irn_intra_arity(node)); assert(node); assert(-1 <= n && n < __get_irn_intra_arity(node));
return (node->in[n + 1] = skip_Id(node->in[n + 1])); return (node->in[n + 1] = skip_Id(node->in[n + 1]));
...@@ -349,7 +350,7 @@ __get_irn_intra_n (ir_node *node, int n) { ...@@ -349,7 +350,7 @@ __get_irn_intra_n (ir_node *node, int n) {
* Intern version for libFirm. * Intern version for libFirm.
*/ */
static INLINE ir_node* static INLINE ir_node*
__get_irn_inter_n (ir_node *node, int n) { __get_irn_inter_n (const ir_node *node, int n) {
assert(node); assert(-1 <= n && n < __get_irn_inter_arity(node)); assert(node); assert(-1 <= n && n < __get_irn_inter_arity(node));
/* handle Filter and Block specially */ /* handle Filter and Block specially */
...@@ -371,7 +372,7 @@ __get_irn_inter_n (ir_node *node, int n) { ...@@ -371,7 +372,7 @@ __get_irn_inter_n (ir_node *node, int n) {
* If it is a block, the entry -1 is NULL. * If it is a block, the entry -1 is NULL.
* Intern version for libFirm. * Intern version for libFirm.
*/ */
extern ir_node *(*__get_irn_n)(ir_node *node, int n); extern ir_node *(*__get_irn_n)(const ir_node *node, int n);
/** /**
* Gets the mode of a node. * Gets the mode of a node.
......
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