Commit 5dbb77d3 authored by Matthias Braun's avatar Matthias Braun
Browse files

make get_Const_XXX parameters const

parent 2d810a89
......@@ -176,7 +176,7 @@ FIRM_API ir_tarval *get_mode_max(const ir_mode *mode);
* op_pin_state_floats and ints, and references (NULL-Pointer)
* else returns tarval_bad.
*/
FIRM_API ir_tarval *get_mode_null(ir_mode *mode);
FIRM_API ir_tarval *get_mode_null(const ir_mode *mode);
/**
* Returns the value One, represented in this mode.
......@@ -185,7 +185,7 @@ FIRM_API ir_tarval *get_mode_null(ir_mode *mode);
* is defined only for modes allowing multiplication,
* i.e. ints and floats.
*/
FIRM_API ir_tarval *get_mode_one(ir_mode *mode);
FIRM_API ir_tarval *get_mode_one(const ir_mode *mode);
/**
* Returns the value Minus One, represented in this mode.
......@@ -193,7 +193,7 @@ FIRM_API ir_tarval *get_mode_one(ir_mode *mode);
* Minus One is defined only for modes allowing
* multiplication with signed values, i.e. signed ints and floats.
*/
FIRM_API ir_tarval *get_mode_minus_one(ir_mode *mode);
FIRM_API ir_tarval *get_mode_minus_one(const ir_mode *mode);
/**
* Returns the value where all bits are One, represented in this mode.
......@@ -209,7 +209,7 @@ FIRM_API ir_tarval *get_mode_all_one(const ir_mode *mode);
* There are typically multiple possible representations of infinity, don't
* compare with this value but use tarval_is_plus_inf() instead.
*/
FIRM_API ir_tarval *get_mode_infinite(ir_mode *mode);
FIRM_API ir_tarval *get_mode_infinite(const ir_mode *mode);
/**
* Returns a NAN value of a given mode.
......@@ -218,7 +218,7 @@ FIRM_API ir_tarval *get_mode_infinite(ir_mode *mode);
* There are typically multiple possible representations of NaN, don't compare
* with this value but use tarval_is_NaN() instead.
*/
FIRM_API ir_tarval *get_mode_NAN(ir_mode *mode);
FIRM_API ir_tarval *get_mode_NAN(const ir_mode *mode);
FIRM_API ir_mode *mode_M; /**< memory */
......@@ -392,7 +392,7 @@ FIRM_API int mode_wrap_around(const ir_mode *mode);
/**
* Returns the signed integer equivalent mode for an reference mode.
*/
FIRM_API ir_mode *get_reference_mode_signed_eq(ir_mode *mode);
FIRM_API ir_mode *get_reference_mode_signed_eq(const ir_mode *mode);
/**
* Sets the signed integer equivalent mode for an reference mode.
......
......@@ -64,13 +64,17 @@ static void set_mode_values(ir_mode* mode)
{
switch (get_mode_sort(mode)) {
case irms_float_number:
mode->all_one = tarval_bad;
mode->all_one = tarval_bad;
mode->infinity = get_tarval_plus_inf(mode);
mode->nan = get_tarval_nan(mode);
goto init_rest;
case irms_internal_boolean:
case irms_reference:
case irms_int_number:
mode->all_one = get_tarval_all_one(mode);
mode->infinity = tarval_bad;
mode->nan = tarval_bad;
init_rest:
mode->min = get_tarval_min(mode);
mode->max = get_tarval_max(mode);
......@@ -87,6 +91,8 @@ init_rest:
mode->null = tarval_bad;
mode->one = tarval_bad;
mode->minus_one = tarval_bad;
mode->infinity = tarval_bad;
mode->nan = tarval_bad;
break;
}
}
......@@ -309,21 +315,21 @@ ir_tarval *get_mode_max(const ir_mode *mode)
return mode->max;
}
ir_tarval *get_mode_null(ir_mode *mode)
ir_tarval *get_mode_null(const ir_mode *mode)
{
assert(mode_is_data(mode) || mode == mode_b);
return mode->null;
}
ir_tarval *get_mode_one(ir_mode *mode)
ir_tarval *get_mode_one(const ir_mode *mode)
{
assert(mode_is_data(mode) || mode == mode_b);
return mode->one;
}
ir_tarval *get_mode_minus_one(ir_mode *mode)
ir_tarval *get_mode_minus_one(const ir_mode *mode)
{
assert(mode_is_data(mode));
......@@ -336,18 +342,16 @@ ir_tarval *get_mode_all_one(const ir_mode *mode)
return mode->all_one;
}
ir_tarval *get_mode_infinite(ir_mode *mode)
ir_tarval *get_mode_infinite(const ir_mode *mode)
{
assert(mode_is_float(mode));
return get_tarval_plus_inf(mode);
return mode->infinity;
}
ir_tarval *get_mode_NAN(ir_mode *mode)
ir_tarval *get_mode_NAN(const ir_mode *mode)
{
assert(mode_is_float(mode));
return get_tarval_nan(mode);
return mode->nan;
}
int is_mode(const void *thing)
......@@ -497,7 +501,7 @@ int values_in_mode(const ir_mode *sm, const ir_mode *lm)
return false;
}
ir_mode *get_reference_mode_signed_eq(ir_mode *mode)
ir_mode *get_reference_mode_signed_eq(const ir_mode *mode)
{
assert(mode_is_reference(mode));
return mode->eq_signed;
......
......@@ -163,6 +163,8 @@ struct ir_mode {
ir_tarval *one; /**< the value 1 */
ir_tarval *minus_one; /**< the value -1 */
ir_tarval *all_one; /**< the value ~0 */
ir_tarval *infinity; /**< the infinity value */
ir_tarval *nan; /** the not a number (NaN) value */
ir_mode *eq_signed; /**< For pointer modes, the equivalent signed integer one. */
ir_mode *eq_unsigned; /**< For pointer modes, the equivalent unsigned integer one. */
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment