From 5d8483cb581a65fb3d7519d9d2f7f65654a03fe5 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 15 Sep 2005 12:14:54 +0000 Subject: [PATCH] added function for convertion jump prediction into human readable names [r6626] --- ir/ir/irnode.c | 15 +++++++++++++-- ir/ir/irnode.h | 11 +++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 595faec27..7828fca4e 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -2264,12 +2264,23 @@ int (is_irn_constlike)(const ir_node *node) { return _is_irn_constlike(node); } -/* Returns the conditional jump predication of a Cond node. */ +/* Gets the string representation of the jump prediction .*/ +const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) +{ + switch (pred) { + default: + case COND_JMP_PRED_NONE: return "no prediction"; + case COND_JMP_PRED_TRUE: return "true taken"; + case COND_JMP_PRED_FALSE: return "false taken"; + } +} + +/* Returns the conditional jump prediction of a Cond node. */ cond_jmp_predicate (get_Cond_jmp_pred)(ir_node *cond) { return _get_Cond_jmp_pred(cond); } -/* Sets a new conditional jump predication. */ +/* Sets a new conditional jump prediction. */ void (set_Cond_jmp_pred)(ir_node *cond, cond_jmp_predicate pred) { _set_Cond_jmp_pred(cond, pred); } diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index c8bc64e85..863902667 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -998,18 +998,21 @@ type *get_irn_type(ir_node *n); int is_irn_constlike(const ir_node *node); /** - * A type for expression conditional jump predications. + * A type to express conditional jump predictions. */ typedef enum { - COND_JMP_PRED_NONE, /**< No jump predication. Default. */ + COND_JMP_PRED_NONE, /**< No jump prediction. Default. */ COND_JMP_PRED_TRUE, /**< The True case is predicted. */ COND_JMP_PRED_FALSE /**< The False case is predicted. */ } cond_jmp_predicate; -/** Returns the conditional jump predication of a Cond node. */ +/** Gets the string representation of the jump prediction .*/ +const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred); + +/** Returns the conditional jump prediction of a Cond node. */ cond_jmp_predicate get_Cond_jmp_pred(ir_node *cond); -/** Sets a new conditional jump predication. */ +/** Sets a new conditional jump prediction. */ void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred); /** -- 2.20.1