Commit bc84c86d authored by Matthias Braun's avatar Matthias Braun
Browse files

remove duality of mode_P_data and mode_P_code and just use mode_P

parent f5733374
......@@ -225,14 +225,7 @@ FIRM_API ir_mode *mode_Is; /**< int32 */
FIRM_API ir_mode *mode_Iu; /**< uint32 */
FIRM_API ir_mode *mode_Ls; /**< int64 */
FIRM_API ir_mode *mode_Lu; /**< uint64 */
FIRM_API ir_mode *mode_P; /**< pointer */
FIRM_API ir_mode *mode_P_code; /**< A pointer mode that is set by the client of libfirm. This mode
represents the pointer size of the target machine code addresses. Is initialized
to mode_P. */
FIRM_API ir_mode *mode_P_data; /**< A pointer mode that is set by the client of libfirm. This mode
represents the pointer size of the target machine data addresses. Is initialized
to mode_P. */
/**
* This mode represents (parts of) the processor status flag queried in
......@@ -288,23 +281,8 @@ FIRM_API ir_mode *get_modeANY(void);
/** Returns BAD mode */
FIRM_API ir_mode *get_modeBAD(void);
/** Returns the machine specific pointer mode for code addresses. */
FIRM_API ir_mode *get_modeP_code(void);
/** Returns the machine specific pointer mode for data addresses. */
FIRM_API ir_mode *get_modeP_data(void);
/**
* Sets the machine specific pointer mode for code addresses.
* If not set, the predefined mode mode_P will be used.
*/
FIRM_API void set_modeP_code(ir_mode *p);
/**
* Sets the machine specific pointer mode for data addresses.
* If not set, the predefined mode mode_P will be used.
*/
FIRM_API void set_modeP_data(ir_mode *p);
/** Sets the machine specific pointer mode. */
FIRM_API void set_modeP(ir_mode *p);
/** Returns 1 if @p mode is signed, 0 otherwise */
FIRM_API int mode_is_signed (const ir_mode *mode);
......
......@@ -1620,7 +1620,7 @@ static void ia32_get_call_abi(ir_type *method_type, be_abi_call_t *abi)
/* we have to pop the shadow parameter ourself for compound calls */
if ( (get_method_calling_convention(method_type) & cc_compound_ret)
&& !(cc & cc_reg_param)) {
pop_amount += get_mode_size_bytes(mode_P_data);
pop_amount += get_mode_size_bytes(mode_P);
}
n = get_method_n_params(method_type);
......
......@@ -146,9 +146,9 @@ static ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
/* Proj results of start node */
projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
set_irg_initial_exec (res, projX);
set_irg_frame (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base));
set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args));
set_irg_initial_exec(res, projX);
set_irg_frame (res, new_r_Proj(start, mode_P, pn_Start_P_frame_base));
set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args));
initial_mem = new_r_Proj(start, mode_M, pn_Start_M);
set_irg_initial_mem(res, initial_mem);
......
......@@ -2159,10 +2159,8 @@ static void read_modes(read_env_t *env)
ir_mode *mode = new_reference_mode(name, arith, size, modulo_shift);
set_reference_mode_unsigned_eq(mode, read_mode_ref(env));
int is_mode_P = read_int(env);
if (is_mode_P) {
set_modeP_data(mode);
set_modeP_code(mode);
}
if (is_mode_P)
set_modeP(mode);
break;
}
case kw_float_mode: {
......
......@@ -79,9 +79,6 @@ ir_mode *mode_Lu;
ir_mode *mode_b;
ir_mode *mode_P;
ir_mode *mode_P_code;
ir_mode *mode_P_data;
ir_mode *get_modeT(void) { return mode_T; }
ir_mode *get_modeF(void) { return mode_F; }
ir_mode *get_modeD(void) { return mode_D; }
......@@ -101,27 +98,9 @@ ir_mode *get_modeBB(void) { return mode_BB; }
ir_mode *get_modeANY(void) { return mode_ANY; }
ir_mode *get_modeBAD(void) { return mode_BAD; }
ir_mode *(get_modeP_code)(void)
{
return get_modeP_code_();
}
ir_mode *(get_modeP_data)(void)
{
return get_modeP_data_();
}
void set_modeP_code(ir_mode *p)
{
assert(mode_is_reference(p));
mode_P_code = p;
}
void set_modeP_data(ir_mode *p)
void set_modeP(ir_mode *p)
{
assert(mode_is_reference(p));
mode_P_data = p;
mode_P = p;
}
......@@ -504,10 +483,6 @@ void init_mode(void)
mode_Lu = new_int_mode("Lu", irma_twos_complement, 64, 0, 64);
mode_P = new_reference_mode("P", irma_twos_complement, 32, 32);
/* set the machine specific modes to the predefined ones */
mode_P_code = mode_P;
mode_P_data = mode_P;
}
ir_mode *find_unsigned_mode(const ir_mode *mode)
......@@ -639,7 +614,5 @@ void finish_mode(void)
mode_b = NULL;
mode_P = NULL;
mode_P_code = NULL;
mode_P_data = NULL;
mode_P = NULL;
}
......@@ -15,8 +15,6 @@
#include "irtypes.h"
#include "irmode.h"
#define get_modeP_code() get_modeP_code_()
#define get_modeP_data() get_modeP_data_()
#define get_mode_ident(mode) get_mode_ident_(mode)
#define get_mode_sort(mode) get_mode_sort_(mode)
#define get_mode_size_bits(mode) get_mode_size_bits_(mode)
......@@ -34,10 +32,6 @@
#define get_mode_mantissa_size(mode) get_mode_mantissa_size_(mode)
#define get_mode_exponent_size(mode) get_mode_exponent_size_(mode)
static inline ir_mode *get_modeP_code_(void) { return mode_P_code; }
static inline ir_mode *get_modeP_data_(void) { return mode_P_data; }
static inline ident *get_mode_ident_(const ir_mode *mode) { return mode->name; }
static inline ir_mode_sort get_mode_sort_(const ir_mode *mode) { return mode->sort; }
......
......@@ -224,7 +224,7 @@ static void instrument_block(ir_node *const bb, ir_node *const address, unsigned
ir_node *const unknown = new_r_Unknown(irg, mode_M);
ir_node *const cnst = new_r_Const_long(irg, mode_Iu, get_mode_size_bytes(mode_Iu) * id);
ir_node *const offset = new_r_Add(bb, address, cnst, get_modeP_data());
ir_node *const offset = new_r_Add(bb, address, cnst, mode_P);
ir_node *const load = new_r_Load(bb, unknown, offset, mode_Iu, cons_none);
ir_node *const lmem = new_r_Proj(load, mode_M, pn_Load_M);
ir_node *const proji = new_r_Proj(load, mode_Iu, pn_Load_res);
......
......@@ -519,8 +519,7 @@ static int mode_is_datab(const ir_mode *mode)
static int verify_node_Address(const ir_node *n)
{
ir_entity *ent = get_Address_entity(n);
ir_type *type = get_entity_type(ent);
bool fine = check_mode(n, get_type_pointer_mode(type));
bool fine = check_mode_func(n, mode_is_reference, "reference");
if (!(get_entity_owner(ent)->flags & tf_segment) && !is_method_entity(ent)) {
warn(n, "entity of %+F is not in a segment type but %+F", ent, get_entity_owner(ent));
fine = false;
......
......@@ -812,7 +812,7 @@ static void transform_return(ir_node *ret, size_t n_ret_com, wlk_env *env)
continue;
}
ir_node *arg = new_r_Proj(args, mode_P_data, k++);
ir_node *arg = new_r_Proj(args, mode_P, k++);
if (env->flags & LF_RETURN_HIDDEN)
new_in[n_in++] = arg;
......
......@@ -225,7 +225,7 @@ int i_mapper_alloca(ir_node *call)
irn = new_rd_Alloc(dbg, block, mem, op, 1);
mem = new_rd_Proj(dbg, irn, mode_M, pn_Alloc_M);
irn = new_rd_Proj(dbg, irn, get_modeP_data(), pn_Alloc_res);
irn = new_rd_Proj(dbg, irn, mode_P, pn_Alloc_res);
assert(!ir_throws_exception(call));
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_ALLOCA);
......
......@@ -533,7 +533,7 @@ static bool inline_method(ir_node *const call, ir_graph *called_graph)
for (int j = 0; j < n_res; j++) {
ir_type *res_type = get_method_res_type(ctp, j);
bool is_aggregate = is_aggregate_type(res_type);
ir_mode *res_mode = is_aggregate ? mode_P_data
ir_mode *res_mode = is_aggregate ? mode_P
: get_type_mode(res_type);
int n_ret = 0;
for (int i = 0; i < arity; i++) {
......
......@@ -679,9 +679,9 @@ void set_struct_mode(ir_type *tp, ir_mode *mode)
ir_type *new_type_method(size_t n_param, size_t n_res)
{
ir_type *res = new_type(type_method, mode_P_code);
ir_type *res = new_type(type_method, mode_P);
res->flags |= tf_layout_fixed;
res->size = get_mode_size_bytes(mode_P_code);
res->size = get_mode_size_bytes(mode_P);
res->attr.ma.n_params = n_param;
res->attr.ma.params = XMALLOCNZ(ir_type*, n_param);
res->attr.ma.n_res = n_res;
......@@ -1000,7 +1000,7 @@ int (is_Array_type)(const ir_type *array)
ir_type *new_type_pointer(ir_type *points_to)
{
ir_mode *const mode = get_type_pointer_mode(points_to);
ir_mode *const mode = mode_P;
ir_type *const res = new_type(type_pointer, mode);
res->attr.pa.points_to = points_to;
unsigned size = get_mode_size_bytes(mode);
......
......@@ -419,10 +419,4 @@ static inline bool is_aggregate_type(const ir_type *type)
ir_type *new_type_segment(ident *name, type_flags flags);
static inline ir_mode *get_type_pointer_mode(ir_type *const type)
{
return is_Method_type(type)
|| is_code_type(type) ? mode_P_code : mode_P_data;
}
#endif /* FIRM_TR_TYPE_T_H */
......@@ -57,7 +57,7 @@ class Add(Binop):
@op
class Address(EntConst):
"""Symbolic constant that represents the address of an entity (variable or method)"""
mode = "get_type_pointer_mode(get_entity_type(entity))"
mode = "mode_P"
@op
class Align(TypeConst):
......@@ -723,7 +723,7 @@ class Sel:
("index", "index to select"),
]
flags = []
mode = "mode_P_data"
mode = "mode_P"
pinned = "no"
attrs = [
Attribute("type", type="ir_type*",
......@@ -741,7 +741,7 @@ class Member:
("ptr", "pointer to object to select from"),
]
flags = []
mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
mode = "mode_P"
pinned = "no"
attrs = [
Attribute("entity", type="ir_entity*",
......
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