From 8799c0c40a3e86e1882915d5e56efee908c52394 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 6 Jun 2005 08:29:52 +0000 Subject: [PATCH] get_tarval_minus_one() function added typos fixed [r5950] --- ir/tv/tv.c | 32 +++++++++++++++++++++++++++++++- ir/tv/tv.h | 8 ++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ir/tv/tv.c b/ir/tv/tv.c index dbbbe13da..eb4fc0e03 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -613,6 +613,36 @@ tarval *get_tarval_one(ir_mode *mode) return tarval_bad; } +tarval *get_tarval_minus_one(ir_mode *mode) +{ + ANNOUNCE(); + assert(mode); + + if (get_mode_n_vector_elems(mode) > 1) { + /* vector arithmetic not implemented yet */ + return tarval_bad; + } + + switch(get_mode_sort(mode)) + { + case irms_control_flow: + case irms_memory: + case irms_auxiliary: + case irms_internal_boolean: + case irms_reference: + assert(0); + break; + + case irms_float_number: + return mode_is_signed(mode) ? new_tarval_from_double(-1.0, mode) : tarval_bad; + + case irms_int_number: + case irms_character: + return mode_is_signed(mode) ? new_tarval_from_long(-1l, mode) : tarval_bad; + } + return tarval_bad; +} + tarval *get_tarval_nan(ir_mode *mode) { ANNOUNCE(); @@ -1581,7 +1611,7 @@ int set_tarval_mode_output_option(ir_mode *mode, const tarval_mode_info *modein /* * Returns the output options of one mode. * - * This functions returns the modinfo of a given mode. + * This functions returns the mode info of a given mode. */ const tarval_mode_info *get_tarval_mode_output_option(ir_mode *mode) { diff --git a/ir/tv/tv.h b/ir/tv/tv.h index aeff274cb..aabc2c881 100644 --- a/ir/tv/tv.h +++ b/ir/tv/tv.h @@ -311,6 +311,10 @@ tarval *get_tarval_null(ir_mode *mode); /** Returns the 1 value (multiplicative neutral) of a given mode. */ tarval *get_tarval_one(ir_mode *mode); +/** Returns the -1 value (multiplicative neutral) of a given mode. + * Returns tarval bad for unsigned modes */ +tarval *get_tarval_minus_one(ir_mode *mode); + /** Return quite nan for float_number modes. */ tarval *get_tarval_nan(ir_mode *mode); @@ -342,8 +346,8 @@ tarval_int_overflow_mode_t tarval_get_integer_overflow_mode(void); * Compares two tarvals * * Compare a with b and return a pn_Cmp describing the relation - * between a and b. This is either Uo, Lt, Eq, Gt, or False if a or b - * are symbolic pointers which can not be compared at all. + * between a and b. This is either pn_Cmp_Uo, pn_Cmp_ Lt, pn_Cmp_ Eq, pn_Cmp_Gt, + * or pn_Cmp_False if a or b are symbolic pointers which can not be compared at all. * * @param a A tarval to be compared * @param b A tarval to be compared -- 2.20.1