/**
* Allocate an empty raw bitset on the stack.
*
- * @param res will contain the newly allocated bitset
* @param size number of bits in the bitset
*/
-#define rbitset_alloca(res, size) \
-do { \
- size_t size_bytes = BITSET_SIZE_BYTES(size); \
- res = (unsigned*)alloca(size_bytes); \
- memset(res, 0, size_bytes); \
-} while(0)
+#define rbitset_alloca(size) \
+ ((unsigned*)memset(alloca(BITSET_SIZE_BYTES(size)), 0, BITSET_SIZE_BYTES(size)))
/**
* Allocate an empty raw bitset on an obstack.
void be_add_missing_keeps_node(ir_node *node)
{
int n_outs, i;
- unsigned *found_projs;
ir_mode *mode = get_irn_mode(node);
ir_node *last_keep;
- ir_node **existing_projs;
if (mode != mode_T) {
if (!has_real_user(node)) {
if (n_outs <= 0)
return;
- rbitset_alloca(found_projs, n_outs);
- existing_projs = ALLOCANZ(ir_node*, n_outs);
+ unsigned *const found_projs = rbitset_alloca(n_outs);
+ ir_node **const existing_projs = ALLOCANZ(ir_node*, n_outs);
foreach_out_edge(node, edge) {
ir_node *succ = get_edge_src_irn(edge);
ir_mode *mode = get_irn_mode(succ);
ir_graph *irg = sr->co->irg;
be_ifg_t *ifg = sr->co->cenv->ifg;
unsigned n_regs = arch_register_class_n_regs(sr->co->cls);
- unsigned *possible_cols;
- unsigned *allocatable_cols;
- rbitset_alloca(allocatable_cols, n_regs);
+ unsigned *const allocatable_cols = rbitset_alloca(n_regs);
be_set_allocatable_regs(irg, sr->co->cls, allocatable_cols);
- rbitset_alloca(possible_cols, n_regs);
+ unsigned *const possible_cols = rbitset_alloca(n_regs);
neighbours_iter_t iter;
/* color the removed nodes in right order */
unsigned n_regs = arch_register_class_n_regs(ienv->co->cls);
const unsigned *allocatable_colors = lenv->allocatable_colors;
nodes_iter_t iter;
- unsigned *colors;
ir_node *irn;
char buf[32];
- rbitset_alloca(colors, n_regs);
-
+ unsigned *const colors = rbitset_alloca(n_regs);
be_ifg_foreach_node(ifg, &iter, irn) {
const arch_register_req_t *req;
unsigned col;
*/
static int co_solve_ilp2(copy_opt_t *co)
{
- unsigned *allocatable_colors;
unsigned n_regs = arch_register_class_n_regs(co->cls);
lpp_sol_state_t sol_state;
ilp_env_t *ienv;
my.last_x_var = -1;
FIRM_DBG_REGISTER(dbg, "firm.be.coilp2");
- rbitset_alloca(allocatable_colors, n_regs);
+ unsigned *const allocatable_colors = rbitset_alloca(n_regs);
be_set_allocatable_regs(co->irg, co->cls, allocatable_colors);
my.allocatable_colors = allocatable_colors;
if (! (req_->type & arch_register_req_type_limited))
continue;
if (live_through_regs == NULL) {
- rbitset_alloca(live_through_regs, n_regs);
+ live_through_regs = rbitset_alloca(n_regs);
determine_live_through_regs(live_through_regs, node);
}
rbitset_or(forbidden_regs, req_->limited, n_regs);
/* create these arrays if we haven't yet */
if (live_through_regs == NULL) {
- rbitset_alloca(live_through_regs, n_regs);
+ live_through_regs = rbitset_alloca(n_regs);
}
if (double_width) {
ir_nodeset_insert(&live_nodes, node);
}
- unsigned *forbidden_regs; /**< collects registers which must
- not be used for optimistic splits */
- rbitset_alloca(forbidden_regs, n_regs);
+ /** Collects registers which must not be used for optimistic splits. */
+ unsigned *const forbidden_regs = rbitset_alloca(n_regs);
/* handle phis... */
assign_phi_registers(block);
const ir_graph *irg = env->irg;
be_irg_t *birg = be_birg_from_irg(irg);
be_lv_t *lv = be_get_irg_liveness(irg);
- unsigned *tmp = NULL;
unsigned *def_constr = NULL;
int arity = get_irn_arity(node);
if (! (req_->type & arch_register_req_type_limited))
continue;
if (def_constr == NULL) {
- rbitset_alloca(def_constr, cls->n_regs);
+ def_constr = rbitset_alloca(cls->n_regs);
}
rbitset_or(def_constr, req_->limited, cls->n_regs);
);
* insert copies for all constrained arguments living through the node
* and being constrained to a register which also occurs in out constraints.
*/
- rbitset_alloca(tmp, cls->n_regs);
+ unsigned *const tmp = rbitset_alloca(cls->n_regs);
for (i = 0; i < arity; ++i) {
const arch_register_req_t *req;
ir_node *in;
{
size_t spillcount = ARR_LEN(env->spills);
unsigned slotcount = 0;
- unsigned *counted;
size_t s;
- rbitset_alloca(counted, spillcount);
-
+ unsigned *const counted = rbitset_alloca(spillcount);
for (s = 0; s < spillcount; ++s) {
spill_t *spill = env->spills[s];
int spillslot = spill->spillslot;
int n_rets = 0;
bool filter_dbgi = false;
dbg_info *combined_dbgi = NULL;
- unsigned *returns;
int i, j, k, n, last_idx;
ir_node **in, **retvals, **endbl_in;
ir_node *block;
return;
}
- rbitset_alloca(returns, n);
-
+ unsigned *const returns = rbitset_alloca(n);
for (i = 0; i < n; ++i) {
ir_node *node = get_Block_cfgpred(endbl, i);