SOURCES = $(INSTALL_HEADERS)
-SOURCES += Makefile.in st.c st.h
+SOURCES += Makefile.in st.c st.h exc.c exc.h
include $(topdir)/MakeRules
***/
# 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
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));
}
/*
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]);
+}
$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_ */