libFirm
|
A memory disambiguator checks whether 2 given SSA values representing addresses alias. More...
Typedefs | |
typedef ir_alias_relation(* | DISAMBIGUATOR_FUNC )(const ir_node *adr1, const ir_mode *mode1, const ir_node *adr2, const ir_mode *mode2) |
A source language specific memory disambiguator function. |
Enumerations | |
enum | ir_alias_relation { ir_no_alias, ir_may_alias, ir_sure_alias } |
The alias relation of two memory addresses. More... | |
enum | ir_entity_usage_computed_state { ir_entity_usage_not_computed, ir_entity_usage_computed } |
The state of the entity usage flags. More... | |
enum | ir_disambuigator_options { aa_opt_no_opt = 0, aa_opt_type_based = 1, aa_opt_byte_type_may_alias = 2, aa_opt_no_alias_args = 4, aa_opt_no_alias_args_global = 8, aa_opt_no_alias = 16, aa_opt_inherited = 128 } |
Possible options for the memory disambiguator. More... | |
enum | ir_storage_class_class_t { ir_sc_pointer = 0x0, ir_sc_globalvar = 0x1, ir_sc_localvar = 0x2, ir_sc_tls = 0x3, ir_sc_malloced = 0x4, ir_sc_globaladdr = 0x5, ir_sc_modifier_nottaken = 0x80, ir_sc_modifier_argument = 0x40, ir_sc_modifiers = ir_sc_modifier_nottaken | ir_sc_modifier_argument } |
Classify storage locations. More... |
Functions | |
ir_storage_class_class_t | get_base_sc (ir_storage_class_class_t x) |
Returns the base storage class (ignore modifier) | |
ir_storage_class_class_t | classify_pointer (const ir_node *irn, const ir_entity *ent) |
Classify a base pointer. | |
const char * | get_ir_alias_relation_name (ir_alias_relation rel) |
Returns a human readable name for an alias relation. | |
ir_alias_relation | get_alias_relation (const ir_node *adr1, const ir_mode *mode1, const ir_node *adr2, const ir_mode *mode2) |
Determine the alias relation between two addresses. | |
void | set_language_memory_disambiguator (DISAMBIGUATOR_FUNC func) |
Sets a source language specific memory disambiguator function. | |
void | mem_disambig_init (void) |
Initialize the relation cache. | |
ir_alias_relation | get_alias_relation_ex (const ir_node *adr1, const ir_mode *mode1, const ir_node *adr2, const ir_mode *mode2) |
Determine the alias relation between two addresses and cache the result. | |
void | mem_disambig_term (void) |
Free the relation cache. | |
void | assure_irg_entity_usage_computed (ir_graph *irg) |
Assure that the entity usage flags have been computed for the given graph. | |
ir_entity_usage_computed_state | get_irp_globals_entity_usage_state (void) |
Returns the current address taken state of the globals. | |
void | set_irp_globals_entity_usage_state (ir_entity_usage_computed_state state) |
Sets the current address taken state of the globals. | |
void | assure_irp_globals_entity_usage_computed (void) |
Assure that the address taken flag is computed for the global and TLS entities (variables). | |
unsigned | get_irg_memory_disambiguator_options (const ir_graph *irg) |
Returns the memory disambiguator options for a graph. | |
void | set_irg_memory_disambiguator_options (ir_graph *irg, unsigned options) |
Sets the memory disambiguator options for a graph. | |
void | set_irp_memory_disambiguator_options (unsigned options) |
Sets the global disambiguator options for all graphs not having local options. | |
void | mark_private_methods (void) |
Mark all private methods, i.e. | |
ir_prog_pass_t * | mark_private_methods_pass (const char *name) |
Creates an ir_prog pass for mark_private_methods(). |
A memory disambiguator checks whether 2 given SSA values representing addresses alias.
typedef ir_alias_relation(* DISAMBIGUATOR_FUNC)(const ir_node *adr1, const ir_mode *mode1, const ir_node *adr2, const ir_mode *mode2) |
A source language specific memory disambiguator function.
Called by get_alias_relation().
Definition at line 93 of file irmemory.h.
enum ir_alias_relation |
The alias relation of two memory addresses.
Definition at line 42 of file irmemory.h.
Possible options for the memory disambiguator.
Definition at line 55 of file irmemory.h.
The state of the entity usage flags.
Definition at line 49 of file irmemory.h.
Classify storage locations.
Except ir_sc_pointer they are all disjoint. ir_sc_pointer potentially aliases all classes which don't have a NOTTAKEN modifier.
Definition at line 72 of file irmemory.h.
void assure_irg_entity_usage_computed | ( | ir_graph * | irg | ) |
Assure that the entity usage flags have been computed for the given graph.
This analysis computes the entity usage state for all local variables.
Even then the information is not cleaned from the variables, call assure_irg_entity_usage_computed() again for recomputation.
void assure_irp_globals_entity_usage_computed | ( | void | ) |
Assure that the address taken flag is computed for the global and TLS entities (variables).
This is an interprocedural analysis that computes the address_taken state for all global and TLS variables.
Note that this is a conservative estimation that by no Firm transformation can be invalidated, so it's only recomputed if manually triggered by calling set_irp_globals_entity_usage_state(ir_entity_usage_not_computed). Even then the information is not cleaned from the variables, call assure_irp_globals_entity_usage_computed() again for recomputation.
ir_storage_class_class_t classify_pointer | ( | const ir_node * | irn, |
const ir_entity * | ent | ||
) |
Classify a base pointer.
irn | the node representing the base address |
ent | the base entity of the base address iff any |
ir_alias_relation get_alias_relation | ( | const ir_node * | adr1, |
const ir_mode * | mode1, | ||
const ir_node * | adr2, | ||
const ir_mode * | mode2 | ||
) |
Determine the alias relation between two addresses.
adr1 | The first address. |
mode1 | The mode of the first memory access. |
adr2 | The second address. |
mode2 | The mode of the second memory access. |
The memory disambiguator tries to determine the alias state between two memory addresses. The following rules are used:
If none of these rules apply, the points-to framework must be interrogated to detect the alias relation.
ir_alias_relation get_alias_relation_ex | ( | const ir_node * | adr1, |
const ir_mode * | mode1, | ||
const ir_node * | adr2, | ||
const ir_mode * | mode2 | ||
) |
Determine the alias relation between two addresses and cache the result.
adr1 | The first address. |
mode1 | The mode of the first memory access. |
adr2 | The second address. |
mode2 | The mode of the second memory access. |
ir_storage_class_class_t get_base_sc | ( | ir_storage_class_class_t | x | ) |
Returns the base storage class (ignore modifier)
const char* get_ir_alias_relation_name | ( | ir_alias_relation | rel | ) |
Returns a human readable name for an alias relation.
unsigned get_irg_memory_disambiguator_options | ( | const ir_graph * | irg | ) |
Returns the memory disambiguator options for a graph.
irg | the graph |
ir_entity_usage_computed_state get_irp_globals_entity_usage_state | ( | void | ) |
Returns the current address taken state of the globals.
void mark_private_methods | ( | void | ) |
Mark all private methods, i.e.
those of which all call sites are known. We use a very convervative estimation yet: If the address of a method is never taken AND its visibility is visibility_local, then it's private.
ir_prog_pass_t* mark_private_methods_pass | ( | const char * | name | ) |
Creates an ir_prog pass for mark_private_methods().
name | the name of this pass or NULL |
void mem_disambig_init | ( | void | ) |
Initialize the relation cache.
void mem_disambig_term | ( | void | ) |
Free the relation cache.
void set_irg_memory_disambiguator_options | ( | ir_graph * | irg, |
unsigned | options | ||
) |
Sets the memory disambiguator options for a graph.
irg | the graph |
options | a set of options |
void set_irp_globals_entity_usage_state | ( | ir_entity_usage_computed_state | state | ) |
Sets the current address taken state of the globals.
state | the new state |
void set_irp_memory_disambiguator_options | ( | unsigned | options | ) |
Sets the global disambiguator options for all graphs not having local options.
options | a set of options |
void set_language_memory_disambiguator | ( | DISAMBIGUATOR_FUNC | func | ) |
Sets a source language specific memory disambiguator function.
func | The callback. |