diff options
Diffstat (limited to 'codegen.c')
-rw-r--r-- | codegen.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -311,6 +311,14 @@ static void gen_addr(Node *node, int to_tmp) { // Generate code for a given node. static void gen_expr(Node *node, int to_tmp) { emit_line(node->tok); + if (opt_type_builtins && (node->is_sizeof || node->is_alignof)) { + decltmp(node->ty, to_tmp); + if (node->is_sizeof) printnoln("\tt%d = sizeof ( ", to_tmp); + else printnoln("\tt%d = alignof ( ", to_tmp); + print_type(node->is_sizeof); + println(" ) ;"); + return; + } switch (node->kind) { case ND_NULL_EXPR: return; |