summaryrefslogtreecommitdiff
path: root/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'codegen.c')
-rw-r--r--codegen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/codegen.c b/codegen.c
index 7acd2c9..b56a8b9 100644
--- a/codegen.c
+++ b/codegen.c
@@ -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;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback