]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
c++: ir_function::m_params
authorWolfgang Bumiller <wry.git@bumiller.com>
Sat, 3 Dec 2016 20:42:15 +0000 (21:42 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Sat, 3 Dec 2016 20:42:15 +0000 (21:42 +0100)
ast.cpp
ir.cpp
ir.h

diff --git a/ast.cpp b/ast.cpp
index eca80dee374f629805b15229a11d935e205a117c..cbc5db9657a9af3beaf6d12b5e64bb442c4f0066 100644 (file)
--- a/ast.cpp
+++ b/ast.cpp
@@ -1510,9 +1510,9 @@ bool ast_function::generateFunction(ir_builder *ir)
     /* fill the parameter list */
     for (auto &it : m_function_type->m_type_params) {
         if (it->m_vtype == TYPE_FIELD)
-            vec_push(irf->m_params, it->m_next->m_vtype);
+            irf->m_params.push_back(it->m_next->m_vtype);
         else
-            vec_push(irf->m_params, it->m_vtype);
+            irf->m_params.push_back(it->m_vtype);
         if (!m_builtin) {
             if (!it->generateLocal(m_ir_func, true))
                 return false;
diff --git a/ir.cpp b/ir.cpp
index 6484676a308d171477e977230aa26f68554239dd..5df12449362846ac36e9ca3e19a608c257c185b6 100644 (file)
--- a/ir.cpp
+++ b/ir.cpp
@@ -1885,7 +1885,7 @@ static bool ir_function_allocator_assign(ir_function *self, function_allocator *
         /* never resize parameters
          * will be required later when overlapping temps + locals
          */
-        if (a < vec_size(self->m_params) &&
+        if (a < self->m_params.size() &&
             alloc->sizes[a] < v->size())
         {
             continue;
@@ -1929,7 +1929,7 @@ bool ir_function_allocate_locals(ir_function *self)
             v->m_locked      = true;
             v->m_unique_life = true;
         }
-        else if (i >= vec_size(self->m_params))
+        else if (i >= self->m_params.size())
             break;
         else
             v->m_locked = true; /* lock parameters locals */
@@ -2314,7 +2314,7 @@ static bool ir_block_life_propagate(ir_block *self, bool *changed)
 bool ir_function_calculate_liferanges(ir_function *self)
 {
     /* parameters live at 0 */
-    for (size_t i = 0; i < vec_size(self->m_params); ++i)
+    for (size_t i = 0; i < self->m_params.size(); ++i)
         if (!self->m_locals[i].get()->setAlive(0))
             compile_error(self->m_context, "internal error: failed value-life merging");
 
@@ -3002,7 +3002,7 @@ bool ir_builder::generateGlobalFunction(ir_value *global)
     fun.name = global->m_code.name;
     fun.file = filestring(global->m_context.file);
     fun.profile = 0; /* always 0 */
-    fun.nargs = vec_size(irfun->m_params);
+    fun.nargs = irfun->m_params.size();
     if (fun.nargs > 8)
         fun.nargs = 8;
 
@@ -3067,7 +3067,7 @@ static bool gen_function_extparam_copy(code_t *code, ir_function *self)
 {
     ir_builder *ir = self->m_owner;
 
-    size_t numparams = vec_size(self->m_params);
+    size_t numparams = self->m_params.size();
     if (!numparams)
         return true;
 
@@ -3103,7 +3103,7 @@ static bool gen_function_varargs_copy(code_t *code, ir_function *self)
     ir_value   *ep;
     prog_section_statement_t stmt;
 
-    numparams = vec_size(self->m_params);
+    numparams = self->m_params.size();
     if (!numparams)
         return true;
 
diff --git a/ir.h b/ir.h
index 4f40048c2a5594a2b66ac54aa7d629475a7f854a..42f6ce578ea958bd5e4cf409da8561eef2fc91b5 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -201,11 +201,11 @@ struct ir_function {
 
     ir_builder *m_owner;
 
-    std::string m_name;
-    qc_type     m_outtype;
-    int        *m_params  = nullptr;
-    ir_flag_t   m_flags   = 0;
-    int         m_builtin = 0;
+    std::string      m_name;
+    qc_type          m_outtype;
+    std::vector<int> m_params;
+    ir_flag_t        m_flags   = 0;
+    int              m_builtin = 0;
 
     std::vector<std::unique_ptr<ir_block>> m_blocks;