summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bearch.h
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2015-08-29 00:23:45 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2015-08-29 18:48:56 +0200
commit7ceddc8e39411b72f909f79d39811d19c78afaeb (patch)
treee08617194a8509ff135ad8f5e8302e7d4ccb428e /ir/be/bearch.h
parent369eafd27990a9ac3652469bd5e9df626793ec2b (diff)
be: Use get_out_info_n().
Now the pos for fetching an out info is checked in all cases.
Diffstat (limited to 'ir/be/bearch.h')
-rw-r--r--ir/be/bearch.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/ir/be/bearch.h b/ir/be/bearch.h
index e995612..1eb52ea 100644
--- a/ir/be/bearch.h
+++ b/ir/be/bearch.h
@@ -29,6 +29,13 @@ extern arch_register_req_t const arch_memory_requirement;
extern arch_register_req_t const arch_no_requirement;
#define arch_no_register_req (&arch_no_requirement)
+static inline reg_out_info_t *get_out_info_n(ir_node const *const node, unsigned const pos)
+{
+ backend_info_t const *const info = be_get_info(node);
+ assert(pos < ARR_LEN(info->out_infos));
+ return &info->out_infos[pos];
+}
+
/**
* Get the register allocated for a value.
*/
@@ -63,16 +70,15 @@ static inline const arch_register_req_t *arch_get_irn_register_req_in(
static inline const arch_register_req_t *arch_get_irn_register_req_out(
const ir_node *node, unsigned pos)
{
- const backend_info_t *info = be_get_info(node);
- return info->out_infos[pos].req;
+ reg_out_info_t const *const out = get_out_info_n(node, pos);
+ return out->req;
}
static inline void arch_set_irn_register_req_out(ir_node *node, unsigned pos,
const arch_register_req_t *req)
{
- backend_info_t *info = be_get_info(node);
- assert(pos < (unsigned)ARR_LEN(info->out_infos));
- info->out_infos[pos].req = req;
+ reg_out_info_t *const out = get_out_info_n(node, pos);
+ out->req = req;
}
static inline void arch_set_irn_register_reqs_in(ir_node *node,
@@ -98,9 +104,7 @@ static inline reg_out_info_t *get_out_info(const ir_node *node)
node = get_Proj_pred(node);
}
- const backend_info_t *info = be_get_info(node);
- assert(pos < ARR_LEN(info->out_infos));
- return &info->out_infos[pos];
+ return get_out_info_n(node, pos);
}
static inline const arch_register_req_t *arch_get_irn_register_req(const ir_node *node)