/** Possible options for the memory disambiguator. */
typedef enum {
- aa_opt_no_opt = 0, /**< no options: most conservative */
- aa_opt_type_based = 1, /**< use type based alias analysis: strict typed source language */
- aa_opt_byte_type_may_alias = 2, /**< if type based analysis is enabled: bytes types may alias other types */
- aa_opt_no_alias = 4, /**< two addresses NEVER alias, use with CAUTION (gcc -fno-alias) */
- aa_opt_inherited = 128 /**< only for implementation: options from a graph are inherited from global */
+ aa_opt_no_opt = 0, /**< no options: most conservative */
+ aa_opt_type_based = 1, /**< use type based alias analysis: strict typed source language */
+ aa_opt_byte_type_may_alias = 2, /**< if type based analysis is enabled: bytes types may alias other types */
+ aa_opt_no_alias_args = 4, /**< arguments do not alias each other but may alias global storage */
+ aa_opt_no_alias_args_global = 8, /**< arguments do not alias global storage */
+ aa_opt_no_alias = 16, /**< two addresses NEVER alias, use with CAUTION (gcc -fno-alias) */
+ aa_opt_inherited = 128 /**< only for implementation: options from a graph are inherited from global */
} ir_disambuigator_options;
/**
typedef enum {
ir_sc_pointer = 0x0, /**< generic pointer, may be anything */
ir_sc_globalvar = 0x1, /**< an address of a global variable */
- ir_sc_localvar = 0x2, /**< an address of a local variable */
- ir_sc_argument = 0x3, /**< an method argument */
- ir_sc_tls = 0x4, /**< an address of a thread local storage variable */
- ir_sc_malloced = 0x5, /**< an allocated heap address */
+ ir_sc_localvar = 0x2, /**< an address of a local variable or method argument */
+ ir_sc_tls = 0x3, /**< an address of a thread local storage variable */
+ ir_sc_malloced = 0x4, /**< an allocated heap address */
+ ir_sc_globaladdr = 0x5, /**< a constant address of something */
- ir_sc_modifier_nottaken = 0x80 /**< if set, the address of the variable was not taken */
+ ir_sc_modifier_nottaken = 0x80, /**< if set, the address of the variable was not taken */
+ ir_sc_modifier_argument = 0x40, /**< if set pointer was a function argument */
+ ir_sc_modifiers = ir_sc_modifier_nottaken | ir_sc_modifier_argument
} ir_storage_class_class_t;
+/** Get the base storage class (ignore modifier) */
+#define GET_BASE_SC(x) ((x) & ~ir_sc_modifiers)
+
/**
* A source language specific memory disambiguator function.
* Called by get_alias_relation().
*/
typedef ir_alias_relation (*DISAMBIGUATOR_FUNC)(
- ir_graph *irg,
- ir_node *adr1, ir_mode *mode1,
- ir_node *adr2, ir_mode *mode2);
+ const ir_graph *irg,
+ const ir_node *adr1, const ir_mode *mode1,
+ const ir_node *adr2, const ir_mode *mode2);
/**
* Classify a base pointer.
* @param irn the node representing the base address
* @param ent the base entity of the base address iff any
*/
-ir_storage_class_class_t classify_pointer(ir_graph *irg, ir_node *irn, ir_entity *ent);
+ir_storage_class_class_t classify_pointer(const ir_graph *irg, const ir_node *irn, const ir_entity *ent);
/**
* Returns a human readable name for an alias relation.
* interrogated to detect the alias relation.
*/
ir_alias_relation get_alias_relation(
- ir_graph *irg,
- ir_node *adr1, ir_mode *mode1,
- ir_node *adr2, ir_mode *mode2);
+ const ir_graph *irg,
+ const ir_node *adr1, const ir_mode *mode1,
+ const ir_node *adr2, const ir_mode *mode2);
/**
* Set a source language specific memory disambiguator function.
* @see get_alias_relation()
*/
ir_alias_relation get_alias_relation_ex(
- ir_graph *irg,
- ir_node *adr1, ir_mode *mode1,
- ir_node *adr2, ir_mode *mode2);
+ const ir_graph *irg,
+ const ir_node *adr1, const ir_mode *mode1,
+ const ir_node *adr2, const ir_mode *mode2);
/**
* Free the relation cache.
*
* @param irg the graph
*/
-unsigned get_irg_memory_disambiguator_options(ir_graph *irg);
+unsigned get_irg_memory_disambiguator_options(const ir_graph *irg);
/**
* Set the memory disambiguator options for a graph.
*
* @param irg the graph
- * @param option a set of options
+ * @param options a set of options
*/
void set_irg_memory_disambiguator_options(ir_graph *irg, unsigned options);
/**
* Set the global disambiguator options for all graphs not having local options.
*
- * @param option a set of options
+ * @param options a set of options
*/
void set_irp_memory_disambiguator_options(unsigned options);
*/
void mark_private_methods(void);
+/**
+ * Creates an ir_prog pass for mark_private_methods().
+ *
+ * @param name the name of this pass or NULL
+ *
+ * @return the newly created ir_prog pass
+ */
+ir_prog_pass_t *mark_private_methods_pass(const char *name);
+
#endif /* FIRM_ANA_IRMEMORY_H */