Commit 468b10f9 authored by Matthias Braun's avatar Matthias Braun
Browse files

- remove modecode concept which is pointless nowadays

[r26093]
parent 939bdc66
......@@ -39,34 +39,6 @@
/* ********** Predefined modes ********** */
/**
* Predefined mode according to tech report 1999-14.
*/
typedef enum ir_modecode { /* irm is short for `ir mode' */
irm_BB, /**< basic block */
irm_X, /**< execution */
irm_F, /**< float(32) */
irm_D, /**< double(64) */
irm_E, /**< extended(80) */
irm_Bs, /**< signed byte(8) */
irm_Bu, /**< unsigned byte(8) */
irm_Hs, /**< signed short(16) */
irm_Hu, /**< unsigned short(16) */
irm_Is, /**< signed int(32) */
irm_Iu, /**< unsigned int(32) */
irm_Ls, /**< signed long(64) */
irm_Lu, /**< unsigned long(64) */
irm_LLs, /**< signed long long(128) */
irm_LLu, /**< unsigned long long(128) */
irm_P, /**< pointer */
irm_b, /**< internal boolean */
irm_M, /**< memory */
irm_T, /**< tuple */
irm_ANY, /**< undefined mode */
irm_BAD, /**< bad mode */
irm_max /**< maximum value for ir_modecode */
} ir_modecode;
/** Helper values for ir_mode_sort. */
enum ir_mode_sort_helper {
irmsh_is_num = 0x10, /**< mode represents a number */
......@@ -189,9 +161,6 @@ int is_mode(const void *thing);
/* ********** Access methods to read mode information *********** */
/** Returns the classification of the mode */
ir_modecode get_mode_modecode(const ir_mode *mode);
/** Returns the ident* of the mode */
ident *get_mode_ident(const ir_mode *mode);
......@@ -383,7 +352,7 @@ void set_modeP_data(ir_mode *p);
/*@{*/
/**
Functions to check, whether a ir_modecode is signed, float, int, character,
Functions to check, whether a mode is signed, float, int, character,
reference, num, data, datab or dataM.
For more exact definitions read the corresponding pages
......
......@@ -185,8 +185,6 @@ void del_Sync_n(ir_node *n, int i);
void set_irn_mode(ir_node *node, ir_mode *mode);
/** Gets the mode struct of a node. */
ir_mode *get_irn_mode(const ir_node *node);
/** Gets the mode-enum ir_modecode. */
ir_modecode get_irn_modecode(const ir_node *node);
/** Gets the ident for a string representation of the mode .*/
ident *get_irn_modeident(const ir_node *node);
/** Gets the string representation of the mode .*/
......
......@@ -81,11 +81,11 @@ ir_mode *get_ppc32_mode_Cond(void) {
}
/**
* Calculates the ir_modecode with size, sort and signed attributes
* Calculates the ppc32_modecode with size, sort and signed attributes
*/
ir_modecode get_nice_modecode(ir_mode *irmode)
ppc32_modecode get_nice_modecode(ir_mode *irmode)
{
ir_modecode mode = irm_max;
ppc32_modecode mode = irm_max;
int sign = mode_is_signed(irmode);
int bits = get_mode_size_bits(irmode);
if(mode_is_int(irmode))
......@@ -768,8 +768,8 @@ static ir_node *own_gen_Andi_dot_lo16(ppc32_transform_env_t *env, ir_node *op, i
*/
static ir_node *gen_Conv(ppc32_transform_env_t *env) {
ir_node *op = get_Conv_op(env->irn);
ir_modecode from_mode=get_nice_modecode(get_irn_mode(op));
ir_modecode to_mode=get_nice_modecode(env->mode);
ppc32_modecode from_mode=get_nice_modecode(get_irn_mode(op));
ppc32_modecode to_mode=get_nice_modecode(env->mode);
#define SKIP return op
......
......@@ -30,4 +30,19 @@ void ppc32_register_transformers(void);
void ppc32_transform_node(ir_node *node, void *env);
void ppc32_transform_const(ir_node *node, void *env);
typedef enum {
irm_Bs,
irm_Bu,
irm_Hs,
irm_Hu,
irm_Is,
irm_Iu,
irm_F,
irm_D,
irm_P,
irm_max
} ppc32_modecode;
ppc32_modecode get_nice_modecode(ir_mode *irmode);
#endif
......@@ -43,6 +43,7 @@
#include "ppc32_nodes_attr.h"
//#include "../arch/archop.h" /* we need this for Min and Max nodes */
#include "ppc32_transform_conv.h"
#include "ppc32_transform.h"
#include "ppc32_new_nodes.h"
#include "ppc32_map_regs.h"
......@@ -107,8 +108,8 @@ static ir_node *own_gen_convert_call(ppc32_transform_env_t *env, ir_node *op, co
static ir_node *gen_Conv(ppc32_transform_env_t *env, ir_node *op) {
ir_mode *from_mode = get_irn_mode(get_irn_n(env->irn,0));
ir_mode *to_mode = env->mode;
ir_modecode from_modecode=get_mode_modecode(from_mode);
ir_modecode to_modecode=get_mode_modecode(to_mode);
ppc32_modecode from_modecode=get_nice_modecode(from_mode);
ppc32_modecode to_modecode=get_nice_modecode(to_mode);
switch(from_modecode){
case irm_F:
......@@ -382,8 +383,8 @@ void ppc32_conv_walk(ir_node *node, void *env) {
if (code == iro_Conv)
{
ir_modecode from_mode=get_mode_modecode(get_irn_mode(get_irn_n(node,0)));
ir_modecode to_mode=get_mode_modecode(get_irn_mode(node));
ppc32_modecode from_mode=get_nice_modecode(get_irn_mode(get_irn_n(node,0)));
ppc32_modecode to_mode=get_nice_modecode(get_irn_mode(node));
cw_block_attr *attr;
if(from_mode == to_mode) return;
......
......@@ -241,7 +241,7 @@ static int dump_pattern(grgen_dumpinfo_t *dump_info, FILE *fp)
ir_node *n = (ir_node *) entry->key;
// Dump node
if(get_irn_opcode(n) == iro_Proj && get_irn_modecode(n) == irm_M)
if(get_irn_opcode(n) == iro_Proj && get_irn_mode(n) == mode_M)
uses_memory = 1;
dump_grg_node(n, dump_info, fp);
dump_grgen_mode(n, dump_info, fp, NULL);
......@@ -391,22 +391,21 @@ static void dump_grgen_mode(ir_node *n, grgen_dumpinfo_t *dump_info, FILE *fp, i
static char *dump_grgen_mode_node(ir_mode *irn_mode, grgen_dumpinfo_t *dump_info, FILE *fp)
{
ir_modecode mode_code = get_mode_modecode(irn_mode);
const char *mode_name = get_mode_name(irn_mode);
char *mode_node_name;
if(!pmap_contains(dump_info -> mode_name_map, (void *) mode_code))
if(!pmap_contains(dump_info -> mode_name_map, irn_mode))
{
// No, create a new mode-node
mode_node_name = obstack_alloc(&(dump_info -> mode_names), MAX_NODENAME_LEN);
sprintf(mode_node_name, "mode_%s_node", mode_name);
pmap_insert(dump_info -> mode_name_map, (void *) mode_code, mode_node_name);
pmap_insert(dump_info -> mode_name_map, irn_mode, mode_node_name);
fprintf(fp, "%s%s : Mode_%s;\n", indent, mode_node_name, mode_name);
return(mode_node_name);
}
else
{
return((char *) pmap_get(dump_info -> mode_name_map, (void *) mode_code));
return((char *) pmap_get(dump_info -> mode_name_map, irn_mode));
}
}
......
......@@ -43,9 +43,6 @@
/** Obstack to hold all modes. */
static struct obstack modes;
/** Number of defined modes. */
static int num_modes = 0;
/** The list of all currently existing modes. */
static ir_mode **mode_list;
......@@ -258,10 +255,6 @@ static ir_mode *register_mode(const ir_mode *new_mode) {
ARR_APP1(ir_mode*, mode_list, mode);
mode->kind = k_ir_mode;
if (num_modes >= irm_max) {
mode->code = num_modes;
}
num_modes++;
/* add the new mode to the irp list of modes */
add_irp_mode(mode);
......@@ -367,10 +360,6 @@ ir_mode *new_ir_vector_mode(const char *name, ir_mode_sort sort, int bit_size, u
}
/* Functions for the direct access to all attributes of an ir_mode */
ir_modecode (get_mode_modecode)(const ir_mode *mode) {
return _get_mode_modecode(mode);
}
ident *(get_mode_ident)(const ir_mode *mode) {
return _get_mode_ident(mode);
}
......@@ -422,7 +411,6 @@ void (set_mode_link)(ir_mode *mode, void *l) {
tarval *get_mode_min(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_data(mode));
return mode->min;
......@@ -430,7 +418,6 @@ tarval *get_mode_min(ir_mode *mode) {
tarval *get_mode_max(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_data(mode));
return mode->max;
......@@ -438,7 +425,6 @@ tarval *get_mode_max(ir_mode *mode) {
tarval *get_mode_null(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_datab(mode));
return mode->null;
......@@ -446,7 +432,6 @@ tarval *get_mode_null(ir_mode *mode) {
tarval *get_mode_one(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_datab(mode));
return mode->one;
......@@ -454,7 +439,6 @@ tarval *get_mode_one(ir_mode *mode) {
tarval *get_mode_minus_one(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_data(mode));
return mode->minus_one;
......@@ -462,14 +446,12 @@ tarval *get_mode_minus_one(ir_mode *mode) {
tarval *get_mode_all_one(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_datab(mode));
return mode->all_one;
}
tarval *get_mode_infinite(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_float(mode));
return get_tarval_plus_inf(mode);
......@@ -477,7 +459,6 @@ tarval *get_mode_infinite(ir_mode *mode) {
tarval *get_mode_NAN(ir_mode *mode) {
assert(mode);
assert(get_mode_modecode(mode) < (ir_modecode) num_modes);
assert(mode_is_float(mode));
return get_tarval_nan(mode);
......@@ -663,7 +644,6 @@ void init_mode(void) {
obstack_init(&modes);
mode_list = NEW_ARR_F(ir_mode*, 0);
num_modes = 0;
/* initialize predefined modes */
/* Internal Modes */
......@@ -682,54 +662,40 @@ void init_mode(void) {
/* Basic Block */
newmode.name = new_id_from_chars("BB", 2);
newmode.code = irm_BB;
mode_BB = register_mode(&newmode);
mode_BB = register_mode(&newmode);
/* eXecution */
newmode.name = new_id_from_chars("X", 1);
newmode.code = irm_X;
mode_X = register_mode(&newmode);
mode_X = register_mode(&newmode);
/* Memory Modes */
newmode.sort = irms_memory;
/* Memory */
newmode.name = new_id_from_chars("M", 1);
newmode.code = irm_M;
mode_M = register_mode(&newmode);
mode_M = register_mode(&newmode);
/* Auxiliary Modes */
newmode.sort = irms_auxiliary,
/* Tuple */
newmode.name = new_id_from_chars("T", 1);
newmode.code = irm_T;
mode_T = register_mode(&newmode);
mode_T = register_mode(&newmode);
/* ANY */
newmode.name = new_id_from_chars("ANY", 3);
newmode.code = irm_ANY;
mode_ANY = register_mode(&newmode);
mode_ANY = register_mode(&newmode);
/* BAD */
newmode.name = new_id_from_chars("BAD", 3);
newmode.code = irm_BAD;
mode_BAD = register_mode(&newmode);
mode_BAD = register_mode(&newmode);
/* Internal Boolean Modes */
newmode.sort = irms_internal_boolean;
/* boolean */
newmode.name = new_id_from_chars("b", 1);
newmode.code = irm_b;
mode_b = register_mode(&newmode);
mode_b = register_mode(&newmode);
/* Data Modes */
newmode.vector_elem = 1;
......@@ -740,29 +706,23 @@ void init_mode(void) {
/* float */
newmode.name = new_id_from_chars("F", 1);
newmode.code = irm_F;
newmode.sign = 1;
newmode.size = 32;
mode_F = register_mode(&newmode);
mode_F = register_mode(&newmode);
/* double */
newmode.name = new_id_from_chars("D", 1);
newmode.code = irm_D;
newmode.sign = 1;
newmode.size = 64;
mode_D = register_mode(&newmode);
mode_D = register_mode(&newmode);
/* extended */
newmode.name = new_id_from_chars("E", 1);
newmode.code = irm_E;
newmode.sign = 1;
/* note that the tarval module is calculating with 80 bits, but we use
* 96 bits, as that is what will be stored to memory by most hardware */
newmode.size = 96;
mode_E = register_mode(&newmode);
mode_E = register_mode(&newmode);
/* Integer Number Modes */
newmode.sort = irms_int_number;
......@@ -770,94 +730,74 @@ void init_mode(void) {
/* signed byte */
newmode.name = new_id_from_chars("Bs", 2);
newmode.code = irm_Bs;
newmode.sign = 1;
newmode.size = 8;
newmode.modulo_shift = 32;
mode_Bs = register_mode(&newmode);
mode_Bs = register_mode(&newmode);
/* unsigned byte */
newmode.name = new_id_from_chars("Bu", 2);
newmode.code = irm_Bu;
newmode.arithmetic = irma_twos_complement;
newmode.sign = 0;
newmode.size = 8;
newmode.modulo_shift = 32;
mode_Bu = register_mode(&newmode);
mode_Bu = register_mode(&newmode);
/* signed short integer */
newmode.name = new_id_from_chars("Hs", 2);
newmode.code = irm_Hs;
newmode.sign = 1;
newmode.size = 16;
newmode.modulo_shift = 32;
mode_Hs = register_mode(&newmode);
mode_Hs = register_mode(&newmode);
/* unsigned short integer */
newmode.name = new_id_from_chars("Hu", 2);
newmode.code = irm_Hu;
newmode.sign = 0;
newmode.size = 16;
newmode.modulo_shift = 32;
mode_Hu = register_mode(&newmode);
mode_Hu = register_mode(&newmode);
/* signed integer */
newmode.name = new_id_from_chars("Is", 2);
newmode.code = irm_Is;
newmode.sign = 1;
newmode.size = 32;
newmode.modulo_shift = 32;
mode_Is = register_mode(&newmode);
mode_Is = register_mode(&newmode);
/* unsigned integer */
newmode.name = new_id_from_chars("Iu", 2);
newmode.code = irm_Iu;
newmode.sign = 0;
newmode.size = 32;
newmode.modulo_shift = 32;
mode_Iu = register_mode(&newmode);
mode_Iu = register_mode(&newmode);
/* signed long integer */
newmode.name = new_id_from_chars("Ls", 2);
newmode.code = irm_Ls;
newmode.sign = 1;
newmode.size = 64;
newmode.modulo_shift = 64;
mode_Ls = register_mode(&newmode);
mode_Ls = register_mode(&newmode);
/* unsigned long integer */
newmode.name = new_id_from_chars("Lu", 2);
newmode.code = irm_Lu;
newmode.sign = 0;
newmode.size = 64;
newmode.modulo_shift = 64;
mode_Lu = register_mode(&newmode);
mode_Lu = register_mode(&newmode);
/* signed long long integer */
newmode.name = new_id_from_chars("LLs", 3);
newmode.code = irm_LLs;
newmode.sign = 1;
newmode.size = 128;
newmode.modulo_shift = 128;
mode_LLs = register_mode(&newmode);
mode_LLs = register_mode(&newmode);
/* unsigned long long integer */
newmode.name = new_id_from_chars("LLu", 3);
newmode.code = irm_LLu;
newmode.sign = 0;
newmode.size = 128;
newmode.modulo_shift = 128;
mode_LLu = register_mode(&newmode);
mode_LLu = register_mode(&newmode);
/* Reference Mode */
newmode.sort = irms_reference;
......@@ -865,14 +805,12 @@ void init_mode(void) {
/* pointer */
newmode.name = new_id_from_chars("P", 1);
newmode.code = irm_P;
newmode.sign = 0;
newmode.size = 32;
newmode.modulo_shift = 0;
newmode.eq_signed = mode_Is;
newmode.eq_unsigned = mode_Iu;
mode_P = register_mode(&newmode);
mode_P = register_mode(&newmode);
/* set the machine specific modes to the predefined ones */
mode_P_code = mode_P;
......
......@@ -42,9 +42,6 @@ _get_modeP_code(void) { return mode_P_code; }
static inline ir_mode *
_get_modeP_data(void) { return mode_P_data; }
static inline ir_modecode
_get_mode_modecode(const ir_mode *mode) { return mode->code; }
static inline ident *
_get_mode_ident(const ir_mode *mode) { return mode->name; }
......@@ -79,7 +76,7 @@ _get_mode_link(const ir_mode *mode) { return mode->link; }
static inline void
_set_mode_link(ir_mode *mode, void *l) { mode->link = l; }
/* Functions to check, whether a ir_modecode is signed, float, int, num, data,
/* Functions to check, whether a mode is signed, float, int, num, data,
datab or dataM. For more exact definitions read the corresponding pages
in the firm documentation or the following enumeration
......@@ -174,7 +171,6 @@ void finish_mode(void);
#define get_modeP_code() _get_modeP_code()
#define get_modeP_data() _get_modeP_data()
#define get_mode_modecode(mode) _get_mode_modecode(mode)
#define get_mode_ident(mode) _get_mode_ident(mode)
#define get_mode_sort(mode) _get_mode_sort(mode)
#define get_mode_size_bits(mode) _get_mode_size_bits(mode)
......
......@@ -404,11 +404,6 @@ void (set_irn_mode)(ir_node *node, ir_mode *mode) {
_set_irn_mode(node, mode);
}
ir_modecode get_irn_modecode(const ir_node *node) {
assert(node);
return node->mode->code;
}
/** Gets the string representation of the mode .*/
const char *get_irn_modename(const ir_node *node) {
assert(node);
......
......@@ -72,7 +72,6 @@ struct ir_op {
* and comparisons of values of a such described mode.
*
* ATTRIBUTES:
* - ir_modecode code: An unambiguous int (enum) for the mode
* - ident *name: Name of this mode. Two modes are different if the name is different.
* - ir_mode_sort sort: sort of mode specifying possible usage categories
* - int size: size of the mode in Bits.
......@@ -87,7 +86,6 @@ struct ir_op {
*/
struct ir_mode {
firm_kind kind; /**< distinguishes this node from others */
ir_modecode code; /**< unambiguous identifier of a mode */
ident *name; /**< Name ident of this mode */
/* ----------------------------------------------------------------------- */
......
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