* Default implementation for finding a pointer type for a given element type.
* Simple create a new one.
*/
-static ir_type *def_find_pointer_type(ir_type *e_type, int alignment)
+static ir_type *def_find_pointer_type(ir_type *e_type, ir_mode *mode, int alignment)
{
ir_type *res;
pmap_entry *e;
/* Mode and alignment are always identical in all calls to def_find_pointer_type(), so
we simply can use a map from the element type to the pointer type. */
e = pmap_find(type_map, e_type);
- if (e)
+ if (e && get_type_mode(e->value) == mode)
res = e->value;
else {
res = new_type_pointer(e_type);
+ set_type_mode(res, mode);
set_type_alignment_bytes(res, alignment);
pmap_insert(type_map, e_type, res);
}
else {
/* this compound will be allocated on callers stack and its
address will be transmitted as a hidden parameter. */
- ptr_tp = lp->find_pointer_type(res_tp, lp->def_ptr_alignment);
+ ptr_tp = lp->find_pointer_type(res_tp, get_modeP_data(), lp->def_ptr_alignment);
params[nn_params] = ptr_tp;
param_map[nn_params] = -1 - i;
++nn_params;
res_tp = get_method_res_type(mtp, i);
if (is_compound_type(res_tp)) {
- params[nn_params] = lp->find_pointer_type(res_tp, lp->def_ptr_alignment);
+ params[nn_params] = lp->find_pointer_type(res_tp, get_modeP_data(), lp->def_ptr_alignment);
param_map[nn_params] = -1 - i;
++nn_params;
} else {