Make some more inline functions
[libfirm] / ir / ir / irgraph.c
index 987b08b..e079d12 100644 (file)
@@ -19,6 +19,7 @@
 # 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"
@@ -36,12 +37,24 @@ INLINE void set_current_ir_graph(ir_graph *graph) {
 }
 
 
-bool interprocedural_view = false;
-INLINE bool get_interprocedural_view(void) {
-  return interprocedural_view;
+int __interprocedural_view = false;
+
+int (get_interprocedural_view)(void) {
+  return __get_interprocedural_view();
 }
-INLINE void set_interprocedural_view(bool state) {
-  interprocedural_view = state;
+
+void (set_interprocedural_view)(int state) {
+  __interprocedural_view = state;
+
+  /* set function vectors for faster access */
+  if (state) {
+    __get_irn_arity = __get_irn_inter_arity;
+    __get_irn_n     = __get_irn_inter_n;
+  }
+  else {
+    __get_irn_arity = __get_irn_intra_arity;
+    __get_irn_n     = __get_irn_intra_n;
+  }
 }
 
 static ident* frame_type_suffix = NULL;
@@ -195,7 +208,6 @@ ir_graph *new_const_code_irg(void) {
                        iropt.c */
   res->ent = NULL;
   res->frame_type  = NULL;
-  res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
   res->start_block = new_immBlock ();
   res->end_block  = new_immBlock ();
   res->end        = new_End ();
@@ -204,6 +216,7 @@ ir_graph *new_const_code_irg(void) {
   mature_immBlock(get_cur_block());  /* mature the end block */
   res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
   res->start   = new_Start ();
+  res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
 
   /* Proj results of start node */
   projX        = new_Proj (res->start, mode_X, pn_Start_X_initial_exec);
@@ -665,3 +678,20 @@ void
 (inc_irg_block_visited)(ir_graph *irg) {
   __inc_irg_block_visited(irg);
 }
+
+/* is irg a pseudo graph for analysis? */
+int is_pseudo_ir_graph(ir_graph *irg)
+{
+  int res = false;
+  entity *ent;
+
+  assert(irg && "nothing here");
+  assert(is_ir_graph(irg) && "no ir_graph given");
+
+  ent = get_irg_entity(irg);
+  if(visibility_external_allocated == get_entity_visibility(ent)
+     && peculiarity_existent == get_entity_peculiarity(ent)) {
+    res = true;
+  }
+  return(res);
+}