Commit c6eb86b9 authored by Matthias Braun's avatar Matthias Braun
Browse files

entity: Introduce INVALID_OFFSET constant

The soon to be introduced spillslot entities can be at negative offset,
so the previously used -1 as convention for invalid offsets is not a
good idea anymore.
parent e9be161e
......@@ -73,7 +73,7 @@ static ir_entity *new_entity_vis(ir_type *owner, ident *name, ir_type *type,
} else if (is_compound_type(owner) && !is_segment_type(owner)) {
res = intern_new_entity(owner, IR_ENTITY_COMPOUND_MEMBER, name, type,
vis);
res->attr.compound_member.offset = -1;
res->attr.compound_member.offset = INVALID_OFFSET;
} else {
res = intern_new_entity(owner, IR_ENTITY_NORMAL, name, type, vis);
res->attr.global.jit_addr = (void*)-1;
......@@ -103,7 +103,7 @@ ir_entity *new_parameter_entity(ir_type *owner, size_t pos, ir_type *type)
ident *name = new_id_fmt("parameter.%lu", (unsigned long)pos);
ir_entity *res = intern_new_entity(owner, IR_ENTITY_PARAMETER, name, type,
ir_visibility_private);
res->attr.compound_member.offset = -1;
res->attr.compound_member.offset = INVALID_OFFSET;
res->attr.parameter.number = pos;
hook_new_entity(res);
return res;
......
......@@ -14,6 +14,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
#include "compiler.h"
#include "ident.h"
......@@ -58,6 +59,8 @@
#define get_entity_dbg_info(ent) _get_entity_dbg_info(ent)
#define set_entity_dbg_info(ent, db) _set_entity_dbg_info(ent, db)
#define INVALID_OFFSET INT_MAX
typedef struct ir_initializer_base_t {
ir_initializer_kind_t kind;
} ir_initializer_base_t;
......
......@@ -287,7 +287,7 @@ void set_type_state(ir_type *tp, ir_type_state state)
ir_entity *entity = get_compound_member(tp, i);
if (is_Method_type(get_entity_type(entity)))
continue;
assert(get_entity_offset(entity) > -1);
assert(get_entity_offset(entity) != INVALID_OFFSET);
}
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment