- type_t *const type = expression->type;
- ir_mode *const mode = get_ir_mode(expression->expression.datatype);
+ type_t *type = expression->type;
+ if(type == NULL) {
+ /* beware: if expression is a variable reference, return the
+ alignment of the variable. */
+ const expression_t *tp_expression = expression->tp_expression;
+ const declaration_t *declaration = expr_is_variable(tp_expression);
+ if (declaration != NULL) {
+ /* TODO: get the alignment of this variable. */
+ }
+ type = tp_expression->base.type;
+ assert(type != NULL);
+ }
+
+ ir_mode *const mode = get_ir_mode(expression->base.type);