There were no users and no tarval support anyway.
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.
*
*/
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);
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);
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);
/*@}*/
/**
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));
#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;
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;
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;
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)
{
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);
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)
{
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;
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;
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; }
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;
#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)
#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
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 */
{
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:
{
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:
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:
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:
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:
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:
{
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);
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);
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);
*/
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;
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:
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:
/* 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());
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) {
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);
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 */
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))
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 */
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 */
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) {
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());
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());
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());
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());