libFirm
Memory Disambiguator

A memory disambiguator checks whether 2 given SSA values representing addresses alias. More...

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_disambiguator_options {
  aa_opt_none = 0, aa_opt_always_alias = 1u << 0, aa_opt_type_based = 1u << 1, aa_opt_byte_type_may_alias = 1u << 2,
  aa_opt_no_alias = 1u << 3, aa_opt_inherited = 1u << 4
}
 Possible options for the memory disambiguator. More...
 

Functions

const char * get_ir_alias_relation_name (ir_alias_relation rel)
 Returns a human readable name for an alias relation. More...
 
ir_alias_relation get_alias_relation (const ir_node *addr1, const ir_type *type1, unsigned size1, const ir_node *addr2, const ir_type *type2, unsigned size2)
 Determine if two memory addresses may point to the same memory location. More...
 
void assure_irg_entity_usage_computed (ir_graph *irg)
 Assure that the entity usage flags have been computed for the given graph. More...
 
ir_entity_usage_computed_state get_irp_globals_entity_usage_state (void)
 Returns the current address taken state of the globals. More...
 
void set_irp_globals_entity_usage_state (ir_entity_usage_computed_state state)
 Sets the current address taken state of the globals. More...
 
void assure_irp_globals_entity_usage_computed (void)
 Assure that the address taken flag is computed for the global and TLS entities (variables). More...
 
ir_disambiguator_options get_irg_memory_disambiguator_options (const ir_graph *irg)
 Returns the memory disambiguator options for a graph. More...
 
void set_irg_memory_disambiguator_options (ir_graph *irg, ir_disambiguator_options options)
 Sets the memory disambiguator options for a graph. More...
 
void set_irp_memory_disambiguator_options (ir_disambiguator_options options)
 Sets the global disambiguator options for all graphs not having local options. More...
 
void mark_private_methods (void)
 Mark all private methods, i.e. More...
 

Detailed Description

A memory disambiguator checks whether 2 given SSA values representing addresses alias.

Enumeration Type Documentation

◆ ir_alias_relation

The alias relation of two memory addresses.

Enumerator
ir_no_alias 

No alias.

ir_may_alias 

Unknown state, may alias.

ir_sure_alias 

Sure alias.

Definition at line 29 of file irmemory.h.

◆ ir_disambiguator_options

Possible options for the memory disambiguator.

Enumerator
aa_opt_none 

no options, use defaults

aa_opt_always_alias 

always assume aliasing

use type based alias analysis: strictly typed source language

aa_opt_type_based 

if type based analysis is enabled bytes types may alias other types

aa_opt_byte_type_may_alias 
aa_opt_no_alias 

different addresses NEVER alias

internal flag: options from a graph are inherited from global

aa_opt_inherited 

Definition at line 42 of file irmemory.h.

◆ ir_entity_usage_computed_state

The state of the entity usage flags.

Enumerator
ir_entity_usage_not_computed 
ir_entity_usage_computed 

Definition at line 36 of file irmemory.h.

Function Documentation

◆ assure_irg_entity_usage_computed()

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.

◆ assure_irp_globals_entity_usage_computed()

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.

◆ get_alias_relation()

ir_alias_relation get_alias_relation ( const ir_node addr1,
const ir_type type1,
unsigned  size1,
const ir_node addr2,
const ir_type type2,
unsigned  size2 
)

Determine if two memory addresses may point to the same memory location.

This is determined by looking at the structure of the values or language rules determined by looking at the object types accessed.

Parameters
addr1The first address.
type1The type of the object found at addr1 ("object type").
size1The size in bytes of the first memory access.
addr2The second address.
type2The type of the object found at addr2 ("object type").
size2The size in bytes of the second memory access.

◆ get_ir_alias_relation_name()

const char* get_ir_alias_relation_name ( ir_alias_relation  rel)

Returns a human readable name for an alias relation.

◆ get_irg_memory_disambiguator_options()

ir_disambiguator_options get_irg_memory_disambiguator_options ( const ir_graph irg)

Returns the memory disambiguator options for a graph.

Parameters
irgthe graph

◆ get_irp_globals_entity_usage_state()

ir_entity_usage_computed_state get_irp_globals_entity_usage_state ( void  )

Returns the current address taken state of the globals.

◆ mark_private_methods()

void mark_private_methods ( void  )

Mark all private methods, i.e.

those of which all call sites are known. We use a very conservative estimation yet: If the address of a method is never taken AND its visibility is visibility_local, then it's private.

◆ set_irg_memory_disambiguator_options()

void set_irg_memory_disambiguator_options ( ir_graph irg,
ir_disambiguator_options  options 
)

Sets the memory disambiguator options for a graph.

Parameters
irgthe graph
optionsa set of options

◆ set_irp_globals_entity_usage_state()

void set_irp_globals_entity_usage_state ( ir_entity_usage_computed_state  state)

Sets the current address taken state of the globals.

Parameters
statethe new state

◆ set_irp_memory_disambiguator_options()

void set_irp_memory_disambiguator_options ( ir_disambiguator_options  options)

Sets the global disambiguator options for all graphs not having local options.

Parameters
optionsa set of options