+ IR_GRAPH_CONSTRAINT_OPTIMIZE_UNREACHABLE_CODE = 1U << 3,
+ /**
+ * The graph is being constructed: We have a current_block set,
+ * and blocks contain mapping of variable numbers to current
+ * values.
+ */
+ IR_GRAPH_CONSTRAINT_CONSTRUCTION = 1U << 4,
+ /**
+ * Intermediate language constructs not supported by the backend have
+ * been lowered.
+ */
+ IR_GRAPH_CONSTRAINT_TARGET_LOWERED = 1U << 5,
+ /**
+ * We have a backend graph: all data values have register constraints
+ * annotated.
+ */
+ IR_GRAPH_CONSTRAINT_BACKEND = 1U << 6,
+} ir_graph_constraints_t;
+ENUM_BITSET(ir_graph_constraints_t)
+
+/** sets @p constraints on the graph @p irg */
+FIRM_API void add_irg_constraints(ir_graph *irg,
+ ir_graph_constraints_t constraints);
+/** clears some graph constraints */
+FIRM_API void clear_irg_constraints(ir_graph *irg,
+ ir_graph_constraints_t constraints);
+/** queries whether @p irg is at least as constrained as @p constraints. */
+FIRM_API int irg_is_constrained(const ir_graph *irg,
+ ir_graph_constraints_t constraints);
+
+/**
+ * graph state. They properties about a graph.
+ * Graph transformations may destroy these properties and have to explicitely
+ * state when they did not affect some properties and want to keep them.
+ */
+typedef enum ir_graph_properties_t {
+ IR_GRAPH_PROPERTIES_NONE = 0,
+ /** graph contains no critical edges */
+ IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES = 1U << 0,
+ /** graph contains no Bad nodes */
+ IR_GRAPH_PROPERTY_NO_BADS = 1U << 1,
+ /** No tuple nodes exist in the graph */
+ IR_GRAPH_PROPERTY_NO_TUPLES = 1U << 2,
+ /**
+ * there exists no (obviously) unreachable code in the graph.
+ * Unreachable in this context is code that you can't reach by following
+ * execution flow from the start block.
+ */
+ IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE = 1U << 3,
+ /** graph contains at most one return */
+ IR_GRAPH_PROPERTY_ONE_RETURN = 1U << 4,
+ /** dominance information about the graph is valid */
+ IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE = 1U << 5,
+ /** postdominance information about the graph is valid */
+ IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE = 1U << 6,
+ /** dominance frontiers information is calculated */
+ IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE_FRONTIERS = 1U << 7,
+ /**
+ * out edges (=iredges) are enable and there is no dead code that can be
+ * reached by following them
+ */
+ IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES = 1U << 8,
+ /** outs (irouts) are computed and up to date */
+ IR_GRAPH_PROPERTY_CONSISTENT_OUTS = 1U << 9,
+ /** loopinfo is computed and up to date */
+ IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO = 1U << 10,
+ /** entity usage information is computed and up to date */
+ IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE = 1U << 11,
+ /** graph contains as many returns as possible */
+ IR_GRAPH_PROPERTY_MANY_RETURNS = 1U << 12,
+
+ /**
+ * List of all graph properties that are only affected by control flow
+ * changes.
+ */
+ IR_GRAPH_PROPERTIES_CONTROL_FLOW =
+ IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
+ | IR_GRAPH_PROPERTY_ONE_RETURN
+ | IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE
+ | IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO
+ | IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE
+ | IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE
+ | IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE_FRONTIERS,
+
+ /**
+ * List of all graph properties.
+ */
+ IR_GRAPH_PROPERTIES_ALL =
+ IR_GRAPH_PROPERTIES_CONTROL_FLOW
+ | IR_GRAPH_PROPERTY_NO_BADS
+ | IR_GRAPH_PROPERTY_NO_TUPLES
+ | IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES
+ | IR_GRAPH_PROPERTY_CONSISTENT_OUTS
+ | IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE
+ | IR_GRAPH_PROPERTY_MANY_RETURNS,
+
+} ir_graph_properties_t;
+ENUM_BITSET(ir_graph_properties_t)
+
+/** sets some state properties on the graph */
+FIRM_API void add_irg_properties(ir_graph *irg, ir_graph_properties_t props);
+/** clears some graph properties */
+FIRM_API void clear_irg_properties(ir_graph *irg, ir_graph_properties_t props);
+/** queries whether @p irg has the @p props properties set */
+FIRM_API int irg_has_properties(const ir_graph *irg,
+ ir_graph_properties_t props);
+
+/** Sets a description for local value n. */