SymConst(ofs_ent) added to represent the offset of an entity.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 17 Sep 2006 21:07:48 +0000 (21:07 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 17 Sep 2006 21:07:48 +0000 (21:07 +0000)
fixed SymConst handling

[r8262]

ir/ir/irnode.c
ir/ir/irnode.h

index 79133e4..260ff0e 100644 (file)
@@ -1083,41 +1083,35 @@ set_SymConst_type (ir_node *node, ir_type *tp) {
 
 ident *
 get_SymConst_name (ir_node *node) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind(node) == symconst_addr_name));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ID(get_SymConst_kind(node)));
   return node->attr.symc.sym.ident_p;
 }
 
 void
 set_SymConst_name (ir_node *node, ident *name) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind(node) == symconst_addr_name));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ID(get_SymConst_kind(node)));
   node->attr.symc.sym.ident_p = name;
 }
 
 
 /* Only to access SymConst of kind symconst_addr_ent.  Else assertion: */
 entity   *get_SymConst_entity (ir_node *node) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind (node) == symconst_addr_ent));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
   return node->attr.symc.sym.entity_p;
 }
 
 void     set_SymConst_entity (ir_node *node, entity *ent) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind(node) == symconst_addr_ent));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
   node->attr.symc.sym.entity_p  = ent;
 }
 
 ir_enum_const *get_SymConst_enum (ir_node *node) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind (node) == symconst_enum_const));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
   return node->attr.symc.sym.enum_p;
 }
 
 void           set_SymConst_enum (ir_node *node, ir_enum_const *ec) {
-  assert(   (node->op == op_SymConst)
-          && (get_SymConst_kind(node) == symconst_enum_const));
+  assert(node->op == op_SymConst && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
   node->attr.symc.sym.enum_p  = ec;
 }
 
index a655855..1fb20ef 100644 (file)
@@ -494,6 +494,8 @@ typedef enum {
   symconst_addr_ent,    /**< The SymConst is a symbolic pointer to be filled in
                              by the linker.  The pointer is represented by an entity.
                              symconst_symbol is entity *. */
+  symconst_ofs_ent,     /**< The SymConst is the offset of its entity in the entities
+                             owner type. */
   symconst_enum_const   /**< The SymConst is a enumeration constant of an
                              enumeration type. */
 } symconst_kind;
@@ -505,7 +507,7 @@ typedef enum {
 #define SYMCONST_HAS_ID(kind) ((kind) == symconst_addr_name)
 
 /** Returns non-zero if s symconst kind has an entity attribute */
-#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent)
+#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent)
 
 /** Returns non-zero if s symconst kind has an enum_const attribute */
 #define SYMCONST_HAS_ENUM(kind) ((kind) == symconst_enum_const)
@@ -515,10 +517,10 @@ typedef enum {
  *  This union contains the symbolic information represented by the node.
  */
 typedef union symconst_symbol {
-  ir_type       *type_p;
-  ident         *ident_p;
-  entity        *entity_p;
-  ir_enum_const *enum_p;
+  ir_type       *type_p;    /**< the type of a symconst */
+  ident         *ident_p;   /**< the ident of a symconst */
+  entity        *entity_p;  /**< the entity of a symconst */
+  ir_enum_const *enum_p;    /**< the enumeration constant of a symconst */
 } symconst_symbol;
 
 /** Get the kind of the SymConst. */