/* create the method entry */
mtp = get_entity_type(ent);
- mtp = get_type_unlowered(mtp);
+ if (is_lowered_type(mtp))
+ mtp = get_associated_type(mtp);
if (get_method_n_ress(mtp) > 0)
rtp = get_method_res_type(mtp, 0);
else
int changed = 0;
ir_variadicity var;
- lowered = get_type_lowered(mtp);
+ lowered = get_associated_type(mtp);
if (lowered != NULL)
return lowered;
size_t i;
size_t j;
- ctp = get_type_unlowered(ctp);
+ if (is_lowered_type(ctp))
+ ctp = get_associated_type(ctp);
for (j = i = 0; i < get_method_n_ress(ctp); ++i) {
ir_type *rtp = get_method_res_type(ctp, i);
return tp->flags & tf_lowered_type;
}
-static inline ir_type *get_type_unlowered(const ir_type *tp)
-{
- assert (is_lowered_type(tp));
- return tp->assoc_type;
-}
-
-static inline ir_type *get_type_lowered(const ir_type *tp)
+/**
+ * Gets the lowered/unlowered type of a type or NULL if this type
+ * has no lowered/unlowered one.
+ */
+static inline ir_type *get_associated_type(const ir_type *tp)
{
- assert (tp->assoc_type == NULL || is_lowered_type(tp->assoc_type));
return tp->assoc_type;
}
{
assert (is_type(tp) && is_type(lowered_type));
lowered_type->flags |= tf_lowered_type;
- /* there might be a chain of lowerings, get to the start */
- while (is_lowered_type(tp)) {
- tp = tp->assoc_type;
- }
tp->assoc_type = lowered_type;
lowered_type->assoc_type = tp;
}