# include <config.h>
#endif
+# include "irprog.h"
# include "irgraph_t.h"
# include "irvrfy.h"
# include "irgwalk.h"
#else
#define ASSERT_AND_RET(expr, string, ret) \
do { \
- bad_msg = #expr " && " string; \
if (opt_do_node_verification == NODE_VERIFICATION_ON) \
assert((expr) && string); \
if (!(expr)) { \
if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
fprintf(stderr, #expr " : " string "\n"); \
+ bad_msg = #expr " && " string; \
return (ret); \
} \
} while(0)
static node_verification_t opt_do_node_verification = NODE_VERIFICATION_ON;
static const char *bad_msg;
-
-/** Borrowed from interprete.c
-static entity *hunt_for_entity (ir_node *addr, ir_node *load) {
- ir_op *op = get_irn_op(addr);
- if (op == op_Sel)
- return get_Sel_entity(addr);
- if (op == op_Const) {
- tarval *tv = get_Const_tarval(addr);
- assert(tarval_is_entity(tv));
- return get_tarval_entity(tv);
- }
-
- if(get_irn_opcode(load) == iro_Load)
- return(NULL);
- assert(0 && "unexpected address expression.");
- return NULL;
-}
-*/
/**
* little helper for NULL modes
*/
int proj;
pred = skip_nop(get_Proj_pred(p));
- assert(get_irn_mode(pred) == mode_T);
+ ASSERT_AND_RET(get_irn_mode(pred) == mode_T, "mode of a 'projed' node is not Tuple", 0);
mode = get_irn_mode(p);
proj = get_Proj_proj(p);
case iro_Proj:
{
type *mt; /* A method type */
- long nr = get_Proj_proj(pred);
+ long nr = get_Proj_proj(pred);
pred = skip_nop(get_Proj_pred(pred));
ASSERT_AND_RET((get_irn_mode(pred) == mode_T), "Proj from something not a tuple", 0);
);
break;
- case iro_Const:
- ASSERT_AND_RET(
- /* Const: BB --> data */
- (mode_is_data (mymode) ||
- mymode == mode_b) /* we want boolean constants for static evaluation */
- ,"Const node", 0 /* of Cmp. */
- );
- break;
+ case iro_Const: {
+ tarval *tv = get_Const_tarval(n);
+ if (tarval_is_entity(tv))
+ ASSERT_AND_RET(
+ (get_irn_irg(n) == get_const_code_irg()) ||
+ (get_entity_peculiarity(tarval_to_entity(tv)) != peculiarity_description),
+ "descriptions have no address", 0);
+ ASSERT_AND_RET(
+ /* Const: BB --> data */
+ (mode_is_data (mymode) ||
+ mymode == mode_b) /* we want boolean constants for static evaluation */
+ ,"Const node", 0 /* of Cmp. */
+ );
+ } break;
case iro_SymConst:
ASSERT_AND_RET(