-} ir_life_entry_t;
-
-struct ir_function_s;
-typedef struct ir_value_s {
- char *name;
- int vtype;
- int store;
- lex_ctx_t context;
- /* even the IR knows the subtype of a field */
- int fieldtype;
- /* and the output type of a function */
- int outtype;
- /* 'const' vs 'var' qualifier */
- int cvq;
- uint32_t flags;
-
- struct ir_instr_s **reads;
- struct ir_instr_s **writes;
-
- /* constantvalues */
- bool hasvalue;
+};
+
+enum {
+ IR_FLAG_HAS_ARRAYS = 1 << 0,
+ IR_FLAG_HAS_UNINITIALIZED = 1 << 1,
+ IR_FLAG_HAS_GOTO = 1 << 2,
+ IR_FLAG_INCLUDE_DEF = 1 << 3,
+ IR_FLAG_ERASABLE = 1 << 4,
+ IR_FLAG_BLOCK_COVERAGE = 1 << 5,
+ IR_FLAG_NOREF = 1 << 6,
+ IR_FLAG_SPLIT_VECTOR = 1 << 7,
+
+ IR_FLAG_LAST,
+ IR_FLAG_MASK_NO_OVERLAP = (IR_FLAG_HAS_ARRAYS | IR_FLAG_HAS_UNINITIALIZED),
+ IR_FLAG_MASK_NO_LOCAL_TEMPS = (IR_FLAG_HAS_ARRAYS | IR_FLAG_HAS_UNINITIALIZED)
+};
+
+struct ir_value {
+ ir_value(std::string&& name, store_type storetype, qc_type vtype);
+ ir_value(ir_function *owner, std::string&& name, store_type storetype, qc_type vtype);
+ ~ir_value();
+
+ ir_value *vectorMember(unsigned int member);
+
+ bool GMQCC_WARN setFloat(float);
+ bool GMQCC_WARN setFunc(int);
+ bool GMQCC_WARN setString(const char*);
+ bool GMQCC_WARN setVector(vec3_t);
+ bool GMQCC_WARN setField(ir_value*);
+#if 0
+ bool GMQCC_WARN setInt(int);
+#endif
+
+ bool lives(size_t at);
+ void dumpLife(int (*oprintf)(const char*, ...)) const;
+
+ void setCodeAddress(int32_t gaddr);
+ int32_t codeAddress() const;
+
+ bool insertLife(size_t idx, ir_life_entry_t);
+ bool setAlive(size_t position);
+ bool mergeLife(const ir_value *other);
+
+ std::string m_name;
+
+ qc_type m_vtype;
+ store_type m_store;
+ lex_ctx_t m_context;
+ qc_type m_fieldtype; // even the IR knows the subtype of a field
+ qc_type m_outtype; // and the output type of a function
+ int m_cvq; // 'const' vs 'var' qualifier
+ ir_flag_t m_flags;
+
+ std::vector<ir_instr *> m_reads;
+ std::vector<ir_instr *> m_writes;
+
+ // constant values
+ bool m_hasvalue;