Added exc.c exc.h
authorFlorian Liekweg <liekweg@ipd.info.uni-karlsruhe.de>
Mon, 22 Apr 2002 14:07:01 +0000 (14:07 +0000)
committerFlorian Liekweg <liekweg@ipd.info.uni-karlsruhe.de>
Mon, 22 Apr 2002 14:07:01 +0000 (14:07 +0000)
Updated Makefile.in to include exc.c exc.h --flo

[r357]

ir/st/Makefile.in
ir/st/exc.c
ir/st/exc.h

index aa067ae..794dd0d 100644 (file)
@@ -14,7 +14,7 @@ INSTALL_HEADERS = st.h
 
 SOURCES = $(INSTALL_HEADERS)
 
-SOURCES += Makefile.in st.c st.h
+SOURCES += Makefile.in st.c st.h exc.c exc.h
 
 
 include $(topdir)/MakeRules
index 4dc924b..8a00173 100644 (file)
 ***/
 
 # include "exc.h"
-# include "st.h"
-# include "irop.h"
-# include "irouts.h"
 
-# include <bool.h>
+static char* exc_strings [] = {
+  "Invalid",
+  "Normal",
+  "Region Entry",
+  "Handler Entry",
+  "Cont"
+};
+
 
 /*
   Return true iff (block b is a handler entry AND a dominates b) OR
@@ -118,10 +122,10 @@ bool is_handler_entry (ir_graph *graph, ir_node *block)
                  is_entry = false;
 
          if (true == is_entry)
-               set_Block_exc (block, exc_entry);
+               set_Block_exc (block, exc_handler);
        }
 
-  return (exc_entry == get_Block_exc (block));
+  return (exc_handler == get_Block_exc (block));
 }
 
 /*
@@ -228,3 +232,17 @@ bool is_cont_entry    (ir_graph *graph, ir_node *block)
 
   return (exc_cont == get_Block_exc (block));
 }
+
+/*
+  Convert a value of type exc_t to a descriptive string.
+  Returns a reference to a statically allocated, constant string.
+*/
+
+const char *exc_to_string (exc_t exc)
+{
+  int exc_val = (int) exc;
+
+  assert ((0 <= (int) exc_val) && (exc_val < (int) exc_max));
+
+  return (exc_strings [exc_val]);
+}
index 9695770..27d3ed8 100644 (file)
      $Id$
 ***/
 
-# include "irnode.h"
-
 # ifndef _EXC_H_
 # define _EXC_H_
 
+# include "irnode.h"
+
+# include "st.h"
+# include "irop.h"
+# include "irouts.h"
+
+# include <bool.h>
+
 typedef enum {
   exc_invalid,                                 /* not yet computed */
   exc_normal,                                  /* normal CF */
-  exc_entry,                                   /* handler entry */
-  exc_handler,                                 /* handler block */
+
+  // must push a new exc contrext at entry of block:
   exc_region,                                  /* region entry */
-  exc_cont                                             /* cont block */
+
+  // must pop current exc contrext at entry of block
+  exc_handler,                                 /* handler entry */
+  exc_cont,                                            /* cont block */
+
+  exc_max                                              /* maximum value of enum for 'bounds checking' */
 } exc_t;
 
+const char *exc_to_string (exc_t);
+
 bool is_handler_entry (ir_graph*, ir_node*);
 bool is_region_entry  (ir_graph*, ir_node*);
 bool is_handler_block (ir_graph*, ir_node*);
 bool is_cont_entry    (ir_graph*, ir_node*);
 
+
 # endif /* def _EXC_H_ */