Commit 7a293685 authored by Matthias Braun's avatar Matthias Braun
Browse files

irmode: remove support for vector mode

There were no users and no tarval support anyway.
parent a8bc3c8f
......@@ -121,31 +121,6 @@ FIRM_API ir_mode *new_ir_mode(const char *name, ir_mode_sort sort, int bit_size,
int sign, ir_mode_arithmetic arithmetic,
unsigned int modulo_shift);
/**
* Creates a new vector mode.
*
* @param name the name of the mode to be created
* @param sort the ir_mode_sort of the mode to be created
* @param bit_size number of bits for one element of this mode
* @param num_of_elem number of elements in this vector mode
* @param sign non-zero if this is a signed mode
* @param arithmetic arithmetic operations possible with a mode
* @param modulo_shift Is ignored for modes other than integer.
*
* This function constructs a new vector mode given by the parameters.
* If the parameters match an already defined mode, this mode is returned.
* If the mode is newly allocated, a new unique mode_code is chosen.
* Also, special value tarvals will be calculated such as null,
* min, max and can be retrieved using the get_mode_* functions
*
* @return
* The new mode or NULL on error.
*/
FIRM_API ir_mode *new_ir_vector_mode(const char *name, ir_mode_sort sort,
int bit_size, unsigned num_of_elem,
int sign, ir_mode_arithmetic arithmetic,
unsigned int modulo_shift);
/**
* Checks whether a pointer points to a mode.
*
......@@ -188,14 +163,6 @@ FIRM_API ir_mode_arithmetic get_mode_arithmetic(const ir_mode *mode);
*/
FIRM_API unsigned int get_mode_modulo_shift(const ir_mode *mode);
/** Return the number of vector elements.
*
* Attribute vector_elem specifies the number of vector elements of
* a vector mode. For non-vector modes it returns 1 for data and 0
* for all other modes
*/
FIRM_API unsigned int get_mode_n_vector_elems(const ir_mode *mode);
/** Returns the stored intermediate information. */
FIRM_API void *get_mode_link(const ir_mode *mode);
......@@ -368,8 +335,6 @@ FIRM_API void set_modeP_data(ir_mode *p);
The set of "dataM" is defined as:
dataM = {data || irm_M}
Vector "int" and "float" are defined by the arithmetic and vector_elem > 1.
*/
FIRM_API int mode_is_signed (const ir_mode *mode);
......@@ -380,8 +345,6 @@ FIRM_API int mode_is_num (const ir_mode *mode);
FIRM_API int mode_is_data (const ir_mode *mode);
FIRM_API int mode_is_datab (const ir_mode *mode);
FIRM_API int mode_is_dataM (const ir_mode *mode);
FIRM_API int mode_is_float_vector (const ir_mode *mode);
FIRM_API int mode_is_int_vector (const ir_mode *mode);
/*@}*/
/**
......
......@@ -823,12 +823,11 @@ static void export_modes(io_env_t *env)
fprintf(env->file, "\tmode ");
write_string(env, get_mode_name(mode));
fprintf(env->file, "%s %u %d %s %u %u ",
fprintf(env->file, "%s %u %d %s %u ",
get_mode_sort_name(get_mode_sort(mode)),
get_mode_size_bits(mode), get_mode_sign(mode),
get_mode_arithmetic_name(get_mode_arithmetic(mode)),
get_mode_modulo_shift(mode),
get_mode_n_vector_elems(mode));
get_mode_modulo_shift(mode));
if (mode_is_reference(mode)) {
write_mode(env, get_reference_mode_signed_eq(mode));
write_mode(env, get_reference_mode_unsigned_eq(mode));
......
......@@ -60,12 +60,6 @@ const char *get_mode_arithmetic_name(ir_mode_arithmetic ari)
#undef X
}
/**
* Compare modes that don't need to have their code field
* correctly set
*
* TODO: Add other fields
**/
static inline int modes_are_equal(const ir_mode *m, const ir_mode *n)
{
if (m == n) return 1;
......@@ -73,8 +67,7 @@ static inline int modes_are_equal(const ir_mode *m, const ir_mode *n)
m->arithmetic == n->arithmetic &&
m->size == n->size &&
m->sign == n->sign &&
m->modulo_shift == n->modulo_shift &&
m->vector_elem == n->vector_elem)
m->modulo_shift == n->modulo_shift)
return 1;
return 0;
......@@ -268,7 +261,6 @@ ir_mode *new_ir_mode(const char *name, ir_mode_sort sort, int bit_size, int sign
mode_tmpl.sign = sign ? 1 : 0;
mode_tmpl.modulo_shift = (mode_tmpl.sort == irms_int_number ||
mode_tmpl.sort == irms_reference) ? modulo_shift : 0;
mode_tmpl.vector_elem = 1;
mode_tmpl.arithmetic = arithmetic;
mode_tmpl.link = NULL;
mode_tmpl.tv_priv = NULL;
......@@ -297,56 +289,6 @@ ir_mode *new_ir_mode(const char *name, ir_mode_sort sort, int bit_size, int sign
return mode;
}
/*
* Creates a new vector mode.
*/
ir_mode *new_ir_vector_mode(const char *name, ir_mode_sort sort, int bit_size, unsigned num_of_elem, int sign,
ir_mode_arithmetic arithmetic, unsigned int modulo_shift)
{
ir_mode mode_tmpl;
ir_mode *mode = NULL;
mode_tmpl.name = new_id_from_str(name);
mode_tmpl.sort = sort;
mode_tmpl.size = bit_size * num_of_elem;
mode_tmpl.sign = sign ? 1 : 0;
mode_tmpl.modulo_shift = (mode_tmpl.sort == irms_int_number) ? modulo_shift : 0;
mode_tmpl.vector_elem = num_of_elem;
mode_tmpl.arithmetic = arithmetic;
mode_tmpl.link = NULL;
mode_tmpl.tv_priv = NULL;
mode = find_mode(&mode_tmpl);
if (mode) {
hook_new_mode(&mode_tmpl, mode);
return mode;
}
if (num_of_elem <= 1) {
panic("vector modes should have at least 2 elements");
}
/* sanity checks */
switch (sort) {
case irms_auxiliary:
case irms_control_flow:
case irms_memory:
case irms_internal_boolean:
panic("internal modes cannot be user defined");
case irms_reference:
panic("only integer and floating point modes can be vectorized");
case irms_float_number:
panic("not yet implemented");
case irms_int_number:
mode = register_mode(&mode_tmpl);
}
assert(mode != NULL);
return mode;
}
/* Functions for the direct access to all attributes of an ir_mode */
ident *(get_mode_ident)(const ir_mode *mode)
{
......@@ -393,11 +335,6 @@ unsigned int (get_mode_modulo_shift)(const ir_mode *mode)
return _get_mode_modulo_shift(mode);
}
unsigned int (get_mode_n_vector_elems)(const ir_mode *mode)
{
return _get_mode_vector_elems(mode);
}
void *(get_mode_link)(const ir_mode *mode)
{
return _get_mode_link(mode);
......@@ -516,16 +453,6 @@ int (mode_is_dataM)(const ir_mode *mode)
return _mode_is_dataM(mode);
}
int (mode_is_float_vector)(const ir_mode *mode)
{
return _mode_is_float_vector(mode);
}
int (mode_is_int_vector)(const ir_mode *mode)
{
return _mode_is_int_vector(mode);
}
/* Returns true if sm can be converted to lm without loss. */
int smaller_mode(const ir_mode *sm, const ir_mode *lm)
{
......@@ -671,7 +598,6 @@ void init_mode(void)
newmode.size = 0;
newmode.sign = 0;
newmode.modulo_shift = 0;
newmode.vector_elem = 0;
newmode.eq_signed = NULL;
newmode.eq_unsigned = NULL;
newmode.link = NULL;
......@@ -717,9 +643,6 @@ void init_mode(void)
newmode.name = new_id_from_chars("b", 1);
mode_b = register_mode(&newmode);
/* Data Modes */
newmode.vector_elem = 1;
/* Float Number Modes */
newmode.sort = irms_float_number;
newmode.arithmetic = irma_ieee754;
......
......@@ -57,8 +57,6 @@ static inline ir_mode_arithmetic _get_mode_arithmetic(const ir_mode *mode) { ret
static inline unsigned int _get_mode_modulo_shift(const ir_mode *mode) { return mode->modulo_shift; }
static inline unsigned int _get_mode_vector_elems(const ir_mode *mode) { return mode->vector_elem; }
static inline void * _get_mode_link(const ir_mode *mode) { return mode->link; }
static inline void _set_mode_link(ir_mode *mode, void *l) { mode->link = l; }
......@@ -140,16 +138,6 @@ static inline int _mode_is_dataM(const ir_mode *mode)
return (_get_mode_sort(mode) & irmsh_is_dataM);
}
static inline int _mode_is_float_vector(const ir_mode *mode)
{
return (_get_mode_sort(mode) == irms_float_number) && (_get_mode_vector_elems(mode) > 1);
}
static inline int _mode_is_int_vector(const ir_mode *mode)
{
return (_get_mode_sort(mode) == irms_int_number) && (_get_mode_vector_elems(mode) > 1);
}
static inline ir_type *get_type_for_mode_(const ir_mode *mode)
{
return mode->type;
......@@ -170,7 +158,6 @@ void finish_mode(void);
#define get_mode_sign(mode) _get_mode_sign(mode)
#define get_mode_arithmetic(mode) _get_mode_arithmetic(mode)
#define get_mode_modulo_shift(mode) _get_mode_modulo_shift(mode)
#define get_mode_n_vector_elems(mode) _get_mode_vector_elems(mode)
#define get_mode_link(mode) _get_mode_link(mode)
#define set_mode_link(mode, l) _set_mode_link(mode, l)
#define mode_is_signed(mode) _mode_is_signed(mode)
......@@ -181,8 +168,6 @@ void finish_mode(void);
#define mode_is_data(mode) _mode_is_data(mode)
#define mode_is_datab(mode) _mode_is_datab(mode)
#define mode_is_dataM(mode) _mode_is_dataM(mode)
#define mode_is_float_vector(mode) _mode_is_float_vector(mode)
#define mode_is_int_vector(mode) _mode_is_int_vector(mode)
#define get_type_for_mode(mode) get_type_for_mode_(mode)
#endif
......@@ -107,9 +107,6 @@ struct ir_mode {
unsigned size; /**< size of the mode in Bits. */
unsigned sign:1; /**< signedness of this mode */
unsigned int modulo_shift; /**< number of bits a values of this mode will be shifted */
unsigned vector_elem; /**< if this is not equal 1, this is a vector mode with
vector_elem number of elements, size contains the size
of all bits and must be dividable by vector_elem */
/* ----------------------------------------------------------------------- */
ir_tarval *min; /**< the minimum value that can be expressed */
......
......@@ -571,12 +571,6 @@ ir_tarval *get_tarval_max(ir_mode *mode)
{
const ieee_descriptor_t *desc;
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:
......@@ -603,12 +597,6 @@ ir_tarval *get_tarval_min(ir_mode *mode)
{
const ieee_descriptor_t *desc;
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:
......@@ -636,13 +624,6 @@ static long _null_value = 0;
ir_tarval *get_tarval_null(ir_mode *mode)
{
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:
......@@ -664,11 +645,6 @@ ir_tarval *get_tarval_null(ir_mode *mode)
ir_tarval *get_tarval_one(ir_mode *mode)
{
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
......@@ -690,11 +666,6 @@ ir_tarval *get_tarval_one(ir_mode *mode)
ir_tarval *get_tarval_all_one(ir_mode *mode)
{
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
......@@ -724,11 +695,6 @@ int tarval_is_constant(ir_tarval *tv)
ir_tarval *get_tarval_minus_one(ir_mode *mode)
{
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
switch (get_mode_sort(mode)) {
case irms_control_flow:
case irms_memory:
......@@ -752,10 +718,6 @@ ir_tarval *get_tarval_nan(ir_mode *mode)
{
const ieee_descriptor_t *desc;
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
desc = get_descriptor(mode);
fc_get_qnan(desc, NULL);
......@@ -766,10 +728,6 @@ ir_tarval *get_tarval_nan(ir_mode *mode)
ir_tarval *get_tarval_plus_inf(ir_mode *mode)
{
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
const ieee_descriptor_t *desc = get_descriptor(mode);
fc_get_plusinf(desc, NULL);
......@@ -780,11 +738,6 @@ ir_tarval *get_tarval_plus_inf(ir_mode *mode)
ir_tarval *get_tarval_minus_inf(ir_mode *mode)
{
assert(mode);
if (get_mode_n_vector_elems(mode) > 1)
panic("vector arithmetic not implemented yet");
if (get_mode_sort(mode) == irms_float_number) {
const ieee_descriptor_t *desc = get_descriptor(mode);
fc_get_minusinf(desc, NULL);
......@@ -802,9 +755,6 @@ ir_tarval *get_tarval_minus_inf(ir_mode *mode)
*/
int tarval_is_negative(ir_tarval *a)
{
if (get_mode_n_vector_elems(a->mode) > 1)
panic("vector arithmetic not implemented yet");
switch (get_mode_sort(a->mode)) {
case irms_int_number:
if (!mode_is_signed(a->mode)) return 0;
......@@ -873,11 +823,6 @@ ir_relation tarval_cmp(ir_tarval *a, ir_tarval *b)
if (a->mode != b->mode)
return ir_relation_false;
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
panic("cmp not implemented for vector modes");
}
/* Here the two tarvals are unequal and of the same mode */
switch (get_mode_sort(a->mode)) {
case irms_control_flow:
......@@ -931,11 +876,6 @@ ir_tarval *tarval_convert_to(ir_tarval *src, ir_mode *dst_mode)
if (src->mode == dst_mode)
return src;
if (get_mode_n_vector_elems(src->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
switch (get_mode_sort(src->mode)) {
case irms_control_flow:
case irms_memory:
......@@ -1066,11 +1006,6 @@ ir_tarval *tarval_neg(ir_tarval *a)
/* note: negation is allowed even for unsigned modes. */
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
switch (get_mode_sort(a->mode)) {
case irms_int_number:
buffer = (char*) alloca(sc_get_buffer_length());
......@@ -1099,11 +1034,6 @@ ir_tarval *tarval_add(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(b->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (mode_is_reference(a->mode) && a->mode != b->mode) {
b = tarval_convert_to(b, a->mode);
} else if (mode_is_reference(b->mode) && b->mode != a->mode) {
......@@ -1142,11 +1072,6 @@ ir_tarval *tarval_sub(ir_tarval *a, ir_tarval *b, ir_mode *dst_mode)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(b->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (dst_mode != NULL) {
if (a->mode != dst_mode)
a = tarval_convert_to(a, dst_mode);
......@@ -1187,11 +1112,6 @@ ir_tarval *tarval_mul(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
switch (get_mode_sort(a->mode)) {
case irms_int_number:
/* modes of a,b are equal */
......@@ -1222,11 +1142,6 @@ ir_tarval *tarval_div(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (mode_is_int(mode)) {
/* x/0 error */
if (b == get_mode_null(mode))
......@@ -1252,11 +1167,6 @@ ir_tarval *tarval_mod(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
/* x/0 error */
if (b == get_mode_null(b->mode)) return tarval_bad;
/* modes of a,b are equal */
......@@ -1278,12 +1188,6 @@ ir_tarval *tarval_divmod(ir_tarval *a, ir_tarval *b, ir_tarval **mod)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
/* x/0 error */
if (b == get_mode_null(b->mode)) return tarval_bad;
/* modes of a,b are equal */
......@@ -1302,11 +1206,6 @@ ir_tarval *tarval_abs(ir_tarval *a)
carry_flag = -1;
assert(mode_is_num(a->mode));
if (get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
switch (get_mode_sort(a->mode)) {
case irms_int_number:
if (sc_comp(a->value, get_mode_null(a->mode)->value) == -1) {
......@@ -1434,11 +1333,6 @@ ir_tarval *tarval_shl(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (get_mode_modulo_shift(a->mode) != 0) {
temp_val = (char*) alloca(sc_get_buffer_length());
......@@ -1462,11 +1356,6 @@ ir_tarval *tarval_shr(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (get_mode_modulo_shift(a->mode) != 0) {
temp_val = (char*) alloca(sc_get_buffer_length());
......@@ -1490,11 +1379,6 @@ ir_tarval *tarval_shrs(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (get_mode_modulo_shift(a->mode) != 0) {
temp_val = (char*) alloca(sc_get_buffer_length());
......@@ -1518,11 +1402,6 @@ ir_tarval *tarval_rotl(ir_tarval *a, ir_tarval *b)
carry_flag = -1;
if (get_mode_n_vector_elems(a->mode) > 1 || get_mode_n_vector_elems(a->mode) > 1) {
/* vector arithmetic not implemented yet */
return tarval_bad;
}
if (get_mode_modulo_shift(a->mode) != 0) {
temp_val = (char*) alloca(sc_get_buffer_length());
......
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