ir_function stores max_varargs now
authorWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 13:01:16 +0000 (14:01 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 13:01:16 +0000 (14:01 +0100)
ast.c
ir.c
ir.h

diff --git a/ast.c b/ast.c
index ef24336cc4fd684812a07d822b1bc074eb756d5b..ebded6a143c40df45716ee29ed10fd10fd3f40a6 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1582,6 +1582,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
     if (self->varargs) {
         if (!ast_local_codegen(self->varargs, self->ir_func, true))
             return false;
+        irf->max_varargs = self->varargs->expression.count;
     }
 
     if (self->builtin) {
diff --git a/ir.c b/ir.c
index f743d33ddaf61c10d0740d3dc0ffd5098c4bf21c..bd8f12fb20f79a1d2a72ec4ec6b6d9aea981fb13 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -485,6 +485,8 @@ ir_function* ir_function_new(ir_builder* owner, int outtype)
     self->values = NULL;
     self->locals = NULL;
 
+    self->max_varargs = NULL;
+
     self->code_function_def = -1;
     self->allocated_locals = 0;
     self->globaltemps      = 0;
diff --git a/ir.h b/ir.h
index b1b0ea7b0b99837dbc8b5e4628db0e69d87c2076..c2c94a1771d0f2b54c40cb83e41fb0df55d0a08b 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -273,6 +273,9 @@ typedef struct ir_function_s
     size_t run_id;
 
     struct ir_builder_s *owner;
+
+    /* vararg support: */
+    size_t max_varargs;
 } ir_function;
 #define IR_FLAG_HAS_ARRAYS        (1<<1)
 #define IR_FLAG_HAS_UNINITIALIZED (1<<2)