Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
3e8544aa
Commit
3e8544aa
authored
Mar 02, 2009
by
Matthias Braun
Browse files
add alignment to entities
[r25588]
parent
6c71d610
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/libfirm/typerep.h
View file @
3e8544aa
...
...
@@ -279,17 +279,23 @@ void set_entity_volatility(ir_entity *ent, ir_volatility vol);
/** Return the name of the volatility. */
const
char
*
get_volatility_name
(
ir_volatility
var
);
/** Returns alignment of entity in bytes */
unsigned
get_entity_alignment
(
const
ir_entity
*
entity
);
/** Sets alignment for entity in bytes */
void
set_entity_alignment
(
ir_entity
*
entity
,
unsigned
alignment
);
/** This enumeration flags the align of Loads/Stores. */
typedef
enum
{
align_non_aligned
,
/**< The entity is not aligned. */
align_is_aligned
/**< The entity is aligned. Default */
}
ir_align
;
/** Returns
the alignment of an entit
y. */
ir_align
get_entity_align
(
const
ir_entity
*
ent
);
/** Returns
indication wether entity is aligned in memor
y. */
ir_align
get_entity_align
ed
(
const
ir_entity
*
ent
);
/** Sets
the alignment of an entity.
*/
void
set_entity_align
(
ir_entity
*
ent
,
ir_align
a
);
/** Sets
indication wether entity is aligned in memory
*/
void
set_entity_align
ed
(
ir_entity
*
ent
,
ir_align
a
);
/** Return the name of the alignment. */
const
char
*
get_align_name
(
ir_align
a
);
...
...
ir/ir/irdumptxt.c
View file @
3e8544aa
...
...
@@ -774,7 +774,8 @@ void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix, unsigned
if
(
verbosity
&
dump_verbosity_entattrs
)
{
fprintf
(
F
,
"%s volatility: %s"
,
prefix
,
get_volatility_name
(
get_entity_volatility
(
ent
)));
fprintf
(
F
,
"
\n
%s alignment: %s"
,
prefix
,
get_align_name
(
get_entity_align
(
ent
)));
fprintf
(
F
,
"
\n
%s aligned: %s"
,
prefix
,
get_align_name
(
get_entity_aligned
(
ent
)));
fprintf
(
F
,
"
\n
%s alignment: %u"
,
prefix
,
get_entity_alignment
(
ent
));
fprintf
(
F
,
"
\n
%s peculiarity: %s"
,
prefix
,
get_peculiarity_name
(
get_entity_peculiarity
(
ent
)));
fprintf
(
F
,
"
\n
%s ld_name: %s"
,
prefix
,
ent
->
ld_name
?
get_entity_ld_name
(
ent
)
:
"no yet set"
);
fprintf
(
F
,
"
\n
%s offset: %d bytes, %d rem bits"
,
prefix
,
get_entity_offset
(
ent
),
get_entity_offset_bits_remainder
(
ent
));
...
...
ir/tr/entity.c
View file @
3e8544aa
...
...
@@ -113,7 +113,7 @@ new_rd_entity(dbg_info *db, ir_type *owner, ident *name, ir_type *type)
res
->
allocation
=
allocation_automatic
;
res
->
visibility
=
visibility_local
;
res
->
volatility
=
volatility_non_volatile
;
res
->
align
=
align_is_aligned
;
res
->
align
ed
=
align_is_aligned
;
res
->
stickyness
=
stickyness_unsticky
;
res
->
peculiarity
=
peculiarity_existent
;
res
->
usage
=
ir_usage_unknown
;
...
...
@@ -122,6 +122,7 @@ new_rd_entity(dbg_info *db, ir_type *owner, ident *name, ir_type *type)
res
->
backend_marked
=
0
;
res
->
offset
=
-
1
;
res
->
offset_bit_remainder
=
0
;
res
->
alignment
=
0
;
res
->
link
=
NULL
;
res
->
repr_class
=
NULL
;
...
...
@@ -502,14 +503,14 @@ const char *get_volatility_name(ir_volatility var)
}
/* get_volatility_name */
ir_align
(
get_entity_align
)(
const
ir_entity
*
ent
)
{
return
_get_entity_align
(
ent
);
}
/* get_entity_align */
(
get_entity_align
ed
)(
const
ir_entity
*
ent
)
{
return
_get_entity_align
ed
(
ent
);
}
void
(
set_entity_align
)(
ir_entity
*
ent
,
ir_align
a
)
{
_set_entity_align
(
ent
,
a
);
}
/* set_entity_align */
(
set_entity_align
ed
)(
ir_entity
*
ent
,
ir_align
a
)
{
_set_entity_align
ed
(
ent
,
a
);
}
/* Return the name of the alignment. */
const
char
*
get_align_name
(
ir_align
a
)
...
...
ir/tr/entity_t.h
View file @
3e8544aa
...
...
@@ -140,7 +140,7 @@ struct ir_entity {
unsigned
visibility
:
3
;
/**< Specifies visibility to external program fragments. */
unsigned
variability
:
3
;
/**< Specifies variability of entities content. */
unsigned
volatility
:
1
;
/**< Specifies volatility of entities content. */
unsigned
align
:
1
;
/**< Specifies alignment of entities content. */
unsigned
align
ed
:
1
;
/**< Specifies alignment of entities content. */
unsigned
stickyness
:
2
;
/**< Specifies whether this entity is sticky. */
unsigned
peculiarity
:
3
;
/**< The peculiarity of this entity. */
unsigned
usage
:
4
;
/**< flag indicating usage types of this entity, see ir_entity_usage. */
...
...
@@ -150,6 +150,7 @@ struct ir_entity {
unsigned
has_initializer
:
1
;
/**< if set, this entity is initialized by new style initializers. */
int
offset
;
/**< Offset in bytes for this entity. Fixed when layout
of owner is determined. */
unsigned
alignment
;
/**< entity alignment in bytes */
unsigned
char
offset_bit_remainder
;
/**< If the entity is a bit field, this is the offset of
the start of the bit field within the byte specified
...
...
@@ -286,16 +287,28 @@ _set_entity_volatility(ir_entity *ent, ir_volatility vol) {
ent
->
volatility
=
vol
;
}
static
inline
unsigned
_get_entity_alignment
(
const
ir_entity
*
ent
)
{
assert
(
ent
&&
ent
->
kind
==
k_entity
);
return
ent
->
alignment
;
}
static
inline
void
_set_entity_alignment
(
ir_entity
*
ent
,
unsigned
alignment
)
{
assert
(
ent
&&
ent
->
kind
==
k_entity
);
ent
->
alignment
=
alignment
;
}
static
inline
ir_align
_get_entity_align
(
const
ir_entity
*
ent
)
{
_get_entity_align
ed
(
const
ir_entity
*
ent
)
{
assert
(
ent
&&
ent
->
kind
==
k_entity
);
return
ent
->
align
;
return
ent
->
align
ed
;
}
static
inline
void
_set_entity_align
(
ir_entity
*
ent
,
ir_align
a
)
{
_set_entity_align
ed
(
ir_entity
*
ent
,
ir_align
a
)
{
assert
(
ent
&&
ent
->
kind
==
k_entity
);
ent
->
align
=
a
;
ent
->
align
ed
=
a
;
}
static
inline
ir_peculiarity
...
...
@@ -491,6 +504,8 @@ _set_entity_dbg_info(ir_entity *ent, dbg_info *db) {
#define get_entity_variability(ent) _get_entity_variability(ent)
#define get_entity_volatility(ent) _get_entity_volatility(ent)
#define set_entity_volatility(ent, vol) _set_entity_volatility(ent, vol)
#define set_entity_alignment(ent, alignment) _set_entity_alignment(ent, alignment)
#define get_entity_alignment(ent) _get_entity_alignment(ent)
#define get_entity_align(ent) _get_entity_align(ent)
#define set_entity_align(ent, a) _set_entity_align(ent, a)
#define get_entity_peculiarity(ent) _get_entity_peculiarity(ent)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment