#include "ia32_dbg_stat.h"
#include "ia32_util.h"
-typedef struct _ia32_place_env_t {
- ia32_code_gen_t *cg;
- bitset_t *visited;
-} ia32_place_env_t;
-
typedef enum {
IA32_AM_CAND_NONE = 0,
IA32_AM_CAND_LEFT = 1,
tenv.irn = irn;
DEBUG_ONLY(tenv.mod = cg->mod;)
+ // Matze: this stuff shouldn't be needed anymore
+ // spilling+rematerialisation does a better job for this
+#if 0
/* place const either in the smallest dominator of all its users or the original block */
if (cg->opt & IA32_OPT_PLACECNST)
tenv.block = node_users_smallest_common_dominator(irn, 1);
else
+#endif
tenv.block = get_nodes_block(irn);
switch (get_irn_opcode(irn)) {
* Transform all firm consts and assure, we visit each const only once.
*/
static void ia32_place_consts_walker(ir_node *irn, void *env) {
- ia32_place_env_t *penv = env;
- opcode opc = get_irn_opcode(irn);
+ ia32_code_gen_t *cg = env;
- /* transform only firm consts which are not already visited */
- if ((opc != iro_Const && opc != iro_SymConst) || bitset_is_set(penv->visited, get_irn_idx(irn)))
+ if(!is_Const(irn) && !is_SymConst(irn))
return;
- /* mark const visited */
- bitset_set(penv->visited, get_irn_idx(irn));
-
- ia32_transform_const(irn, penv->cg);
+ ia32_transform_const(irn, cg);
}
/**
* @param cg The ia32 codegenerator object
*/
static void ia32_transform_all_firm_consts(ia32_code_gen_t *cg) {
- ia32_place_env_t penv;
-
- penv.cg = cg;
- penv.visited = bitset_irg_malloc(cg->irg);
- irg_walk_graph(cg->irg, NULL, ia32_place_consts_walker, &penv);
- bitset_free(penv.visited);
+ irg_walk_graph(cg->irg, NULL, ia32_place_consts_walker, cg);
}
/* Place all consts and change pointer arithmetics into unsigned integer arithmetics. */
*
********************************************/
-#if 0
- /**
- * Decides in which block the transformed StackParam should be placed.
- * If the StackParam has more than one user, the dominator block of
- * the users will be returned. In case of only one user, this is either
- * the user block or, in case of a Phi, the predecessor block of the Phi.
- */
-static ir_node *get_block_transformed_stack_param(ir_node *irn) {
- ir_node *dom_bl = NULL;
-
- if (get_irn_n_edges(irn) == 1) {
- ir_node *src = get_edge_src_irn(get_irn_out_edge_first(irn));
-
- if (! is_Phi(src)) {
- dom_bl = get_nodes_block(src);
- }
- else {
- /* Determine on which in position of the Phi the irn is */
- /* and get the corresponding cfg predecessor block. */
-
- int i = get_irn_pred_pos(src, irn);
- assert(i >= 0 && "kaputt");
- dom_bl = get_Block_cfgpred_block(get_nodes_block(src), i);
- }
- }
- else {
- dom_bl = node_users_smallest_common_dominator(irn, 1);
- }
-
- assert(dom_bl && "dominator block not found");
-
- return dom_bl;
-}
-#endif
-
static ir_node *gen_be_StackParam(ia32_transform_env_t *env) {
ir_node *new_op = NULL;
ir_node *node = env->irn;
entity *ent = arch_get_frame_entity(env->cg->arch_env, node);
ir_mode *mode = env->mode;
- /* choose the block where to place the load */
- //env->block = get_block_transformed_stack_param(node);
-
if (mode_is_float(mode)) {
FP_USED(env->cg);
if (USE_SSE2(env->cg))