ir_value_set_field
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 13:41:10 +0000 (15:41 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 13:41:10 +0000 (15:41 +0200)
ir.c
ir.h

diff --git a/ir.c b/ir.c
index 05a46d4736cc4c9f171988a5ccb5f3b016450015..d007321383bb7298f90a8c4ae3262ce481745ec8 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -646,6 +646,15 @@ bool ir_value_set_vector(ir_value *self, vector v)
     return true;
 }
 
+bool ir_value_set_field(ir_value *self, ir_value *fld)
+{
+    if (self->vtype != TYPE_FIELD)
+        return false;
+    self->constval.vpointer = fld;
+    self->isconst = true;
+    return true;
+}
+
 bool ir_value_set_string(ir_value *self, const char *str)
 {
     if (self->vtype != TYPE_STRING)
diff --git a/ir.h b/ir.h
index e36aa086eb04f3d4a916d713dda275d37c6ad85f..dccc970f3a632b0dc3fc1167574905b8e78a3ee7 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -95,6 +95,7 @@ bool GMQCC_WARN ir_value_set_int(ir_value*, int i);
 #endif
 bool GMQCC_WARN ir_value_set_string(ir_value*, const char *s);
 bool GMQCC_WARN ir_value_set_vector(ir_value*, vector v);
+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);       */