Commit 7ceddc8e authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Use get_out_info_n().

Now the pos for fetching an out info is checked in all cases.
parent 369eafd2
...@@ -62,14 +62,6 @@ arch_register_req_t const arch_no_requirement = { ...@@ -62,14 +62,6 @@ arch_register_req_t const arch_no_requirement = {
.cls = &arch_none_cls, .cls = &arch_none_cls,
}; };
static reg_out_info_t *get_out_info_n(const ir_node *node, unsigned pos)
{
const backend_info_t *info = be_get_info(node);
assert(pos < (unsigned)ARR_LEN(info->out_infos));
return &info->out_infos[pos];
}
const arch_register_t *arch_get_irn_register(const ir_node *node) const arch_register_t *arch_get_irn_register(const ir_node *node)
{ {
const reg_out_info_t *out = get_out_info(node); const reg_out_info_t *out = get_out_info(node);
......
...@@ -29,6 +29,13 @@ extern arch_register_req_t const arch_memory_requirement; ...@@ -29,6 +29,13 @@ extern arch_register_req_t const arch_memory_requirement;
extern arch_register_req_t const arch_no_requirement; extern arch_register_req_t const arch_no_requirement;
#define arch_no_register_req (&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. * Get the register allocated for a value.
*/ */
...@@ -63,16 +70,15 @@ static inline const arch_register_req_t *arch_get_irn_register_req_in( ...@@ -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( static inline const arch_register_req_t *arch_get_irn_register_req_out(
const ir_node *node, unsigned pos) const ir_node *node, unsigned pos)
{ {
const backend_info_t *info = be_get_info(node); reg_out_info_t const *const out = get_out_info_n(node, pos);
return info->out_infos[pos].req; return out->req;
} }
static inline void arch_set_irn_register_req_out(ir_node *node, unsigned pos, static inline void arch_set_irn_register_req_out(ir_node *node, unsigned pos,
const arch_register_req_t *req) const arch_register_req_t *req)
{ {
backend_info_t *info = be_get_info(node); reg_out_info_t *const out = get_out_info_n(node, pos);
assert(pos < (unsigned)ARR_LEN(info->out_infos)); out->req = req;
info->out_infos[pos].req = req;
} }
static inline void arch_set_irn_register_reqs_in(ir_node *node, 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) ...@@ -98,9 +104,7 @@ static inline reg_out_info_t *get_out_info(const ir_node *node)
node = get_Proj_pred(node); node = get_Proj_pred(node);
} }
const backend_info_t *info = be_get_info(node); return get_out_info_n(node, pos);
assert(pos < ARR_LEN(info->out_infos));
return &info->out_infos[pos];
} }
static inline const arch_register_req_t *arch_get_irn_register_req(const ir_node *node) static inline const arch_register_req_t *arch_get_irn_register_req(const ir_node *node)
......
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