]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.h
Stuff
[xonotic/gmqcc.git] / ast.h
diff --git a/ast.h b/ast.h
index b305dac393f82001e018cc2a0d53d7c64394ffc4..aabdfdee5c9bbde63963d50d399a7f1e05fddb61 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -62,6 +62,12 @@ enum {
     AST_FLAG_COVERAGE       = 1 << 12,
     AST_FLAG_BLOCK_COVERAGE = 1 << 13,
 
+    /*
+     * Propagates norefness to the IR so the unused (read/write) check can be
+     * more intelligently done.
+     */
+    AST_FLAG_NOREF          = 1 << 14,
+
     AST_FLAG_LAST,
     AST_FLAG_TYPE_MASK      = (AST_FLAG_VARIADIC | AST_FLAG_NORETURN),
     AST_FLAG_COVERAGE_MASK  = (AST_FLAG_BLOCK_COVERAGE)
@@ -202,9 +208,9 @@ struct ast_value : ast_expression
 
     void addParam(ast_value*);
 
-    bool generateGlobal(ir_builder*, bool isfield);
+    bool generateGlobal(ir_builder&, bool isfield);
     bool generateLocal(ir_function*, bool param);
-    bool generateAccessors(ir_builder*);
+    bool generateAccessors(ir_builder&);
 
     std::string m_name;
     std::string m_desc;
@@ -223,9 +229,6 @@ struct ast_value : ast_expression
      */
     std::vector<basic_value_t> m_initlist;
 
-    /* usecount for the parser */
-    size_t m_uses = 0;
-
     ir_value *m_ir_v = nullptr;
     std::vector<ir_value*> m_ir_values;
     size_t m_ir_value_count = 0;
@@ -237,9 +240,9 @@ struct ast_value : ast_expression
     bool m_intrinsic = false; /* true if associated with intrinsic */
 
 private:
-    bool generateGlobalFunction(ir_builder*);
-    bool generateGlobalField(ir_builder*);
-    ir_value *prepareGlobalArray(ir_builder*);
+    bool generateGlobalFunction(ir_builder&);
+    bool generateGlobalField(ir_builder&);
+    ir_value *prepareGlobalArray(ir_builder&);
     bool setGlobalArray();
     bool checkArray(const ast_value &array) const;
 };
@@ -712,7 +715,7 @@ struct ast_function : ast_node
     ~ast_function();
 
     const char* makeLabel(const char *prefix);
-    virtual bool generateFunction(ir_builder*);
+    virtual bool generateFunction(ir_builder&);
 
     ast_value  *m_function_type = nullptr;
     std::string m_name;