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
4dcca4dc
Commit
4dcca4dc
authored
Nov 08, 2005
by
Michael Beck
Browse files
calling conventions are now stored in the method type
additional properties automatically inherit from the method type [r6887]
parent
3168c700
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/tr/entity.c
View file @
4dcca4dc
...
...
@@ -123,7 +123,7 @@ new_rd_entity (dbg_info *db, type *owner, ident *name, type *type)
res
->
value
=
new_SymConst
(
sym
,
symconst_addr_ent
);
current_ir_graph
=
rem
;
res
->
variability
=
variability_constant
;
res
->
irg_add_properties
=
irg_no
_property
;
res
->
irg_add_properties
=
mtp
_property
_inherited
;
res
->
param_access
=
NULL
;
res
->
param_weight
=
NULL
;
}
...
...
@@ -1305,26 +1305,63 @@ int (entity_not_visited)(entity *ent) {
return
_entity_not_visited
(
ent
);
}
unsigned
(
get_entity_
additional
_
properties
)(
const
entity
*
ent
)
{
return
_
get_entity_additional_properties
(
ent
);
}
/* Returns the mask of the
additional
entity
properties
. */
unsigned
get_entity_additional_properties
(
ent
ity
*
ent
)
{
ir_graph
*
irg
;
void
(
set_entity_additional_properties
)(
entity
*
ent
,
unsigned
property_mask
)
{
_set_entity_additional_properties
(
ent
,
property_mask
);
}
assert
(
is_Method_type
(
get_entity_type
(
ent
)));
/* first check, if the graph has additional properties */
irg
=
get_entity_irg
(
ent
);
if
(
irg
)
return
get_irg_additional_properties
(
irg
);
if
(
ent
->
irg_add_properties
&
mtp_property_inherited
)
return
get_method_additional_properties
(
get_entity_type
(
ent
));
void
(
set_entity_additional_property
)(
entity
*
ent
,
unsigned
flag
)
{
_set_entity_additional_property
(
ent
,
(
irg_additional_property
)
flag
);
return
ent
->
irg_add_properties
;
}
/* Returns the calling convention of an entities graph. */
unsigned
(
get_entity_calling_convention
)(
const
entity
*
ent
)
{
return
_get_entity_calling_convention
(
ent
);
/* Sets the mask of the additional graph properties. */
void
set_entity_additional_properties
(
entity
*
ent
,
unsigned
property_mask
)
{
ir_graph
*
irg
;
assert
(
is_Method_type
(
get_entity_type
(
ent
)));
/* first check, if the graph exists */
irg
=
get_entity_irg
(
ent
);
if
(
irg
)
set_irg_additional_properties
(
irg
,
property_mask
);
else
{
/* do not allow to set the mtp_property_inherited flag or
* the automatic inheritance of flags will not work */
ent
->
irg_add_properties
=
property_mask
&
~
mtp_property_inherited
;
}
}
/* Sets the calling convention of an entities graph. */
void
(
set_entity_calling_convention
)(
entity
*
ent
,
unsigned
cc_mask
)
{
_set_entity_calling_convention
(
ent
,
cc_mask
);
/* Sets one additional graph property. */
void
set_entity_additional_property
(
entity
*
ent
,
mtp_additional_property
flag
)
{
ir_graph
*
irg
;
assert
(
is_Method_type
(
get_entity_type
(
ent
)));
/* first check, if the graph exists */
irg
=
get_entity_irg
(
ent
);
if
(
irg
)
set_irg_additional_property
(
irg
,
flag
);
else
{
unsigned
mask
=
ent
->
irg_add_properties
;
if
(
mask
&
mtp_property_inherited
)
mask
=
get_method_additional_properties
(
get_entity_type
(
ent
));
/* do not allow to set the mtp_property_inherited flag or
* the automatic inheritance of flags will not work */
ent
->
irg_add_properties
=
mask
|
(
flag
&
~
mtp_property_inherited
);
}
}
void
firm_init_entity
(
void
)
...
...
ir/tr/entity.h
View file @
4dcca4dc
...
...
@@ -530,20 +530,20 @@ int entity_visited(entity *ent);
/** Returns true if this entity was not visited. */
int
entity_not_visited
(
entity
*
ent
);
/** Returns the mask of the additional graph properties. */
unsigned
get_entity_additional_properties
(
const
entity
*
ent
);
/**
* Returns the mask of the additional entity properties.
* The properties are automatically inherited from the irg if available
* or from the method type if they were not set using
* set_entity_additional_properties() or
* set_entity_additional_property().
*/
unsigned
get_entity_additional_properties
(
entity
*
ent
);
/** Sets the mask of the additional graph properties. */
void
set_entity_additional_properties
(
entity
*
ent
,
unsigned
property_mask
);
/** Sets one additional graph property. */
void
set_entity_additional_property
(
entity
*
ent
,
unsigned
flag
);
/** Returns the calling convention of an entities graph. */
unsigned
get_entity_calling_convention
(
const
entity
*
ent
);
/** Sets the calling convention of an entities graph. */
void
set_entity_calling_convention
(
entity
*
ent
,
unsigned
cc_mask
);
void
set_entity_additional_property
(
entity
*
ent
,
mtp_additional_property
flag
);
/**
* @page unknown_entity
...
...
ir/tr/entity_t.h
View file @
4dcca4dc
...
...
@@ -79,11 +79,12 @@ struct entity {
ent_variability
variability
;
/**< Specifies variability of entities content */
ent_volatility
volatility
;
/**< Specifies volatility of entities content */
ent_stickyness
stickyness
;
/**< Specifies whether this entity is sticky */
int
offset
;
/**< Offset in bits for this entity. Fixed when layout
int
offset
;
/**< Offset in bits for this entity. Fixed when layout
of owner is determined. */
void
*
link
;
/**<
To store some intermediate information
*/
peculiarity
peculiarity
;
/**<
peculiarity of this entity
*/
unsigned
long
visit
;
/**< visited counter for walks of the type information */
struct
dbg_info
*
dbi
;
/**< A pointer to information for debug support. */
void
*
link
;
/**< To store some intermediate information */
/* ------------- fields for atomic entities ---------------*/
...
...
@@ -105,14 +106,12 @@ struct entity {
/* ------------- fields for methods ---------------*/
enum
peculiarity
peculiarity
;
ir_graph
*
irg
;
/**< If (type == method_type) this is the corresponding irg.
The ir_graph constructor automatically sets this field.
Yes, it must be here. */
unsigned
irg_add_properties
;
/**< If (type == method_type) this is a set of additional.
graph flags if the irg of an entity is not known. */
unsigned
irg_calling_conv
;
/**< If (type == method_type) this is a set of calling.
convention flags if the irg of an entity is not known. */
unsigned
irg_add_properties
;
/**< Additional graph properties can be
stored in a entity if no irg is available. */
ptr_access_kind
*
param_access
;
/**< the parameter access */
float
*
param_weight
;
/**< The weight of method's parameters. Parameters
with a high weight are good for procedure cloning.*/
...
...
@@ -332,65 +331,6 @@ _entity_not_visited(entity *ent) {
return
_get_entity_visited
(
ent
)
<
firm_type_visited
;
}
static
INLINE
unsigned
_get_entity_additional_properties
(
const
entity
*
ent
)
{
ir_graph
*
irg
;
assert
(
ent
&&
ent
->
kind
==
k_entity
);
assert
(
ent
==
unknown_entity
||
is_Method_type
(
ent
->
type
));
irg
=
_get_entity_irg
(
ent
);
return
irg
?
get_irg_additional_properties
(
irg
)
:
ent
->
irg_add_properties
;
}
static
INLINE
void
_set_entity_additional_properties
(
entity
*
ent
,
unsigned
mask
)
{
ir_graph
*
irg
;
assert
(
ent
&&
ent
->
kind
==
k_entity
);
assert
(
ent
==
unknown_entity
||
is_Method_type
(
ent
->
type
));
irg
=
_get_entity_irg
(
ent
);
if
(
irg
)
set_irg_additional_properties
(
irg
,
mask
);
else
ent
->
irg_add_properties
=
mask
;
}
static
INLINE
void
_set_entity_additional_property
(
entity
*
ent
,
irg_additional_property
flag
)
{
ir_graph
*
irg
;
assert
(
ent
&&
ent
->
kind
==
k_entity
);
assert
(
ent
==
unknown_entity
||
is_Method_type
(
ent
->
type
));
irg
=
_get_entity_irg
(
ent
);
if
(
irg
)
set_irg_additional_property
(
irg
,
flag
);
else
ent
->
irg_add_properties
|=
flag
;
}
static
INLINE
unsigned
_get_entity_calling_convention
(
const
entity
*
ent
)
{
ir_graph
*
irg
;
assert
(
ent
&&
ent
->
kind
==
k_entity
);
assert
(
ent
==
unknown_entity
||
is_Method_type
(
ent
->
type
));
irg
=
_get_entity_irg
(
ent
);
if
(
irg
)
return
get_irg_calling_convention
(
irg
);
else
return
ent
->
irg_calling_conv
;
}
static
INLINE
void
_set_entity_calling_convention
(
entity
*
ent
,
unsigned
cc_mask
)
{
ir_graph
*
irg
;
assert
(
ent
&&
ent
->
kind
==
k_entity
);
assert
(
ent
==
unknown_entity
||
is_Method_type
(
ent
->
type
));
irg
=
_get_entity_irg
(
ent
);
if
(
irg
)
set_irg_calling_convention
(
irg
,
cc_mask
);
else
ent
->
irg_calling_conv
=
cc_mask
;
}
#define is_entity(thing) _is_entity(thing)
#define get_entity_name(ent) _get_entity_name(ent)
#define get_entity_ident(ent) _get_entity_ident(ent)
...
...
@@ -422,10 +362,5 @@ _set_entity_calling_convention(entity *ent, unsigned cc_mask) {
#define mark_entity_visited(ent) _mark_entity_visited(ent)
#define entity_visited(ent) _entity_visited(ent)
#define entity_not_visited(ent) _entity_not_visited(ent)
#define get_entity_additional_properties(ent) _get_entity_additional_properties(ent)
#define set_entity_additional_properties(ent, m) _set_entity_additional_properties(ent, m)
#define set_entity_additional_property(ent, f) _set_entity_additional_property(ent, f)
#define get_entity_calling_convention(ent) _get_entity_calling_convention(ent)
#define set_entity_calling_convention(ent, cc) _set_entity_calling_convention(ent, cc)
# endif
/* _ENTITY_T_H_ */
Write
Preview
Supports
Markdown
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