Add test functions for machine, machine_operand and machine_user bits
[libfirm] / ir / ir / irgraph.c
index ab3ad64..c24cc1a 100644 (file)
 
 #include <stddef.h>
 
-# include "xmalloc.h"
-# include "ircons.h"
-# include "irgraph_t.h"
-# include "irprog_t.h"
-# include "irnode_t.h"
-# include "iropt_t.h"
-# include "irflag_t.h"
-# include "array.h"
-# include "irgmod.h"
-# include "mangle.h"
-# include "irouts.h"
-# include "irhooks.h"
-# include "irgwalk.h"
-# include "iredges_t.h"
+#include "xmalloc.h"
+#include "ircons.h"
+#include "irgraph_t.h"
+#include "irprog_t.h"
+#include "irnode_t.h"
+#include "iropt_t.h"
+#include "irflag_t.h"
+#include "array.h"
+#include "irgmod.h"
+#include "mangle.h"
+#include "irouts.h"
+#include "irhooks.h"
+#include "irtools.h"
+#include "irgwalk.h"
+#include "iredges_t.h"
+#include "type_t.h"
 
 /**
  * Indicates, whether additional data can be registered to graphs.
@@ -56,14 +58,14 @@ void set_current_ir_graph(ir_graph *graph) {
 }
 
 
-int __interprocedural_view = false;
+int firm_interprocedural_view = 0;
 
 int (get_interprocedural_view)(void) {
   return _get_interprocedural_view();
 }
 
 void (set_interprocedural_view)(int state) {
-  __interprocedural_view = state;
+  firm_interprocedural_view = state;
 
   /* set function vectors for faster access */
   if (state) {
@@ -79,24 +81,10 @@ void (set_interprocedural_view)(int state) {
 /** contains the suffix for frame type names */
 static ident *frame_type_suffix = NULL;
 
-/** The default firm calling convention mask. */
-static unsigned firm_default_cc_mask = 0;
-
 /* initialize the IR graph module */
-void firm_init_irgraph(unsigned default_cc_mask) {
+void firm_init_irgraph(void) {
   frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
-       forbid_new_data   = 1;
-  firm_default_cc_mask = default_cc_mask;
-}
-
-/* Gets the default calling convention for new constructed graphs. */
-unsigned get_firm_default_calling_convention(void) {
-  return firm_default_cc_mask;
-}
-
-/* Sets the default calling convention for new constructed graphs. */
-void set_firm_default_calling_convention(unsigned cc_mask) {
-  firm_default_cc_mask = cc_mask;
+  forbid_new_data   = 1;
 }
 
 /**
@@ -191,12 +179,13 @@ new_r_ir_graph (entity *ent, int n_loc)
   res->outs = NULL;
 
   res->inline_property       = irg_inline_any;
-  res->additional_properties = 0;
+  res->additional_properties = mtp_property_inherited;  /* inherited from type */
 
   res->phase_state         = phase_building;
-  res->op_pin_state_pinned = op_pin_state_pinned;
+  res->irg_pinned_state    = op_pin_state_pinned;
   res->outs_state          = outs_none;
   res->dom_state           = dom_none;
+  res->pdom_state          = dom_none;
   res->typeinfo_state      = ir_typeinfo_none;
   set_irp_typeinfo_inconsistent();           /* there is a new graph with typeinfo_none. */
   res->callee_info_state   = irg_callee_info_none;
@@ -204,7 +193,6 @@ new_r_ir_graph (entity *ent, int n_loc)
   res->execfreq_state      = exec_freq_none;
   res->class_cast_state    = ir_class_casts_transitive;
   res->extblk_state        = ir_extblk_info_none;
-  res->calling_conv        = get_firm_default_calling_convention();
 
   /*-- Type information for the procedure of the graph --*/
   res->ent = ent;
@@ -250,6 +238,7 @@ new_r_ir_graph (entity *ent, int n_loc)
   add_immBlock_pred (first_block, projX);
 
   res->method_execution_frequency = -1;
+  res->estimated_node_count       = 0;
 
   return res;
 }
@@ -286,9 +275,9 @@ ir_graph *new_const_code_irg(void) {
   obstack_init (res->obst);
   res->extbb_obst = NULL;
 
-  res->phase_state = phase_building;
-  res->op_pin_state_pinned = op_pin_state_pinned;
-  res->extblk_state = ir_extblk_info_none;
+  res->phase_state      = phase_building;
+  res->irg_pinned_state = op_pin_state_pinned;
+  res->extblk_state     = ir_extblk_info_none;
 
   res->value_table = new_identities (); /* value table for global value
                        numbering for optimizing use in
@@ -377,14 +366,12 @@ int
 }
 
 /* Outputs a unique number for this node */
-
-long
-get_irg_graph_nr(ir_graph *irg) {
+long get_irg_graph_nr(ir_graph *irg) {
   assert(irg);
 #ifdef DEBUG_libfirm
   return irg->graph_nr;
 #else
-  return (long)irg;
+  return (long)PTR_TO_INT(irg);
 #endif
 }
 
@@ -548,13 +535,13 @@ void
   _set_irg_entity(irg, ent);
 }
 
-type *
+ir_type *
 (get_irg_frame_type)(ir_graph *irg) {
   return _get_irg_frame_type(irg);
 }
 
 void
-(set_irg_frame_type)(ir_graph *irg, type *ftp) {
+(set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
   _set_irg_frame_type(irg, ftp);
 }
 
@@ -630,14 +617,29 @@ void
   _set_irg_outs_inconsistent(irg);
 }
 
+irg_extblk_state
+(get_irg_extblk_state)(const ir_graph *irg) {
+  return _get_irg_extblk_state(irg);
+}
+
+void
+(set_irg_extblk_inconsistent)(ir_graph *irg) {
+  _set_irg_extblk_inconsistent(irg);
+}
+
 irg_dom_state
 (get_irg_dom_state)(const ir_graph *irg) {
   return _get_irg_dom_state(irg);
 }
 
+irg_dom_state
+(get_irg_postdom_state)(const ir_graph *irg) {
+  return _get_irg_postdom_state(irg);
+}
+
 void
-(set_irg_dom_inconsistent)(ir_graph *irg) {
-  _set_irg_dom_inconsistent(irg);
+(set_irg_doms_inconsistent)(ir_graph *irg) {
+  _set_irg_doms_inconsistent(irg);
 }
 
 irg_loopinfo_state
@@ -700,22 +702,10 @@ void
 }
 
 void
-(set_irg_additional_property)(ir_graph *irg, irg_additional_property flag) {
+(set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
   _set_irg_additional_property(irg, flag);
 }
 
-/* Returns the calling convention of a graph. */
-unsigned
-(get_irg_calling_convention)(const ir_graph *irg) {
-  return _get_irg_calling_convention(irg);
-}
-
-/* Sets the calling convention of a graph. */
-void
-(set_irg_calling_convention)(ir_graph *irg, unsigned cc_mask) {
-  _set_irg_calling_convention(irg, cc_mask);
-}
-
 void
 (set_irg_link)(ir_graph *irg, void *thing) {
   _set_irg_link(irg, thing);
@@ -836,6 +826,11 @@ void *get_irg_loc_description(ir_graph *irg, int n)
   return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
 }
 
+/* Returns a estimated node count of the irg. */
+unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
+  return _get_irg_estimated_node_cnt(irg);
+}
+
 /* register additional space in an IR graph */
 size_t register_additional_graph_data(size_t size)
 {