From c50eb075eb29f37f383a08284b8ea4c8ee75150b Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 17 Sep 2006 21:07:48 +0000 Subject: [PATCH] SymConst(ofs_ent) added to represent the offset of an entity. fixed SymConst handling [r8262] --- ir/ir/irnode.c | 18 ++++++------------ ir/ir/irnode.h | 12 +++++++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 79133e4d7..260ff0e82 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -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; } diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index a655855cd..1fb20efc4 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -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. */ -- 2.20.1