float vfloat;
int vint;
vector vvec;
+ int32_t ivec[3];
char *vstring;
struct ir_value_s *vpointer;
struct ir_function_s *vfunc;
- quaternion vquat;
- matrix vmat;
} constval;
struct {
/* for acessing vectors */
struct ir_value_s *members[3];
+ struct ir_value_s *memberof;
/* For the temp allocator */
MEM_VECTOR_MAKE(ir_life_entry_t, life);
*/
ir_value* ir_value_out(struct ir_function_s *owner, const char *name, int st, int vtype);
void ir_value_delete(ir_value*);
-void ir_value_set_name(ir_value*, const char *name);
+bool ir_value_set_name(ir_value*, const char *name);
ir_value* ir_value_vector_member(ir_value*, unsigned int member);
MEM_VECTOR_PROTO_ALL(ir_value, struct ir_instr_s*, reads);
bool GMQCC_WARN ir_value_set_field(ir_value*, ir_value *fld);
/*bool ir_value_set_pointer_v(ir_value*, ir_value* p); */
/*bool ir_value_set_pointer_i(ir_value*, int i); */
-bool GMQCC_WARN ir_value_set_quaternion(ir_value*, quaternion v);
-bool GMQCC_WARN ir_value_set_matrix(ir_value*, matrix v);
MEM_VECTOR_PROTO(ir_value, ir_life_entry_t, life);
/* merge an instruction into the life-range */
bool ir_values_overlap(const ir_value*, const ir_value*);
void ir_value_dump(ir_value*, int (*oprintf)(const char*,...));
-void ir_value_dump_life(ir_value *self, int (*oprintf)(const char*,...));
+void ir_value_dump_life(const ir_value *self, int (*oprintf)(const char*,...));
/* A vector of IR values */
typedef struct {
lex_ctx context;
+ /* for prototypes - first we generate all the
+ * globals, and we remember teh function-defs
+ * so we can later fill in the entry pos
+ *
+ * remember the ID:
+ */
+ qcint code_function_def;
+
/* for temp allocation */
size_t run_id;
MEM_VECTOR_MAKE(ir_function*, functions);
MEM_VECTOR_MAKE(ir_value*, globals);
MEM_VECTOR_MAKE(ir_value*, fields);
+
+ MEM_VECTOR_MAKE(const char*, filenames);
+ MEM_VECTOR_MAKE(qcint, filestrings);
+ /* we cache the #IMMEDIATE string here */
+ qcint str_immediate;
} ir_builder;
ir_builder* ir_builder_new(const char *modulename);
bool ir_builder_set_name(ir_builder *self, const char *name);
MEM_VECTOR_PROTO(ir_builder, ir_function*, functions);
-MEM_VECTOR_PROTO(ir_builder, ir_value*, globals);
-MEM_VECTOR_PROTO(ir_builder, ir_value*, fields);
+MEM_VECTOR_PROTO(ir_builder, ir_value*, globals);
+MEM_VECTOR_PROTO(ir_builder, ir_value*, fields);
+MEM_VECTOR_PROTO(ir_builder, const char*, filenames);
+MEM_VECTOR_PROTO(ir_builder, qcint, filestrings);
ir_function* ir_builder_get_function(ir_builder*, const char *fun);
ir_function* ir_builder_create_function(ir_builder*, const char *name, int outtype);
/* This code assumes 32 bit floats while generating binary */
extern int check_int_and_float_size
-[ (sizeof(int32_t) == sizeof(( (ir_value*)(NULL) )->constval.vvec.x)) ? 1 : -1 ];
+[ (sizeof(int32_t) == sizeof(qcfloat)) ? 1 : -1 ];
#endif