diff options
author | Kelvin Nilsen <kelvin@gcc.gnu.org> | 2018-02-19 14:13:27 +0000 |
---|---|---|
committer | Kelvin Nilsen <kelvin@gcc.gnu.org> | 2018-02-19 14:13:27 +0000 |
commit | 592a338de38523ec9316d947bb9fb1608d053de9 (patch) | |
tree | 16dadc2456ed455b399ef0fd4b4a889b0485d0c1 | |
parent | acb5fdce9d99194d066bdc77d94a76d9ac599812 (diff) |
initial patch application
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/better-builtin-docs@257805 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/config/rs6000/dump-builtins.c | 638 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-c.c | 168 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 13 |
3 files changed, 819 insertions, 0 deletions
diff --git a/gcc/config/rs6000/dump-builtins.c b/gcc/config/rs6000/dump-builtins.c new file mode 100644 index 00000000000..bceb7568096 --- /dev/null +++ b/gcc/config/rs6000/dump-builtins.c @@ -0,0 +1,638 @@ + +/* Include this into rs6000.c */ + +#define RS6000_BUILTIN_0(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) +#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE) \ + { MASK, ICODE, NAME, ENUM }, + +static const struct builtin_description bdesc_special[] = +{ +#include "rs6000-builtin.def" +}; + +#undef RS6000_BUILTIN_0 +#undef RS6000_BUILTIN_1 +#undef RS6000_BUILTIN_2 +#undef RS6000_BUILTIN_3 +#undef RS6000_BUILTIN_A +#undef RS6000_BUILTIN_D +#undef RS6000_BUILTIN_H +#undef RS6000_BUILTIN_P +#undef RS6000_BUILTIN_Q +#undef RS6000_BUILTIN_X + + +#define KELVIN_VERBOSE_BUFFER_LEN 512 + +static unsigned int +strcat_length (const char **names, int num_names) +{ + int total_chars = num_names - 1; /* for single-character separators */ + for (int i = 0; i < num_names; i++) + total_chars += strlen (names[i]); + total_chars++; /* for final null terminator */ + return total_chars; +} + +/* Mask to string, return string is valid only until next call to same + function. Not thread safe. */ +const char * +m2s (HOST_WIDE_INT mask) +{ + static char buffer [KELVIN_VERBOSE_BUFFER_LEN]; + char *s = buffer; + static HOST_WIDE_INT flag_values[] = { + RS6000_BTM_MODULO, + RS6000_BTM_ALTIVEC, + RS6000_BTM_CMPB, + RS6000_BTM_VSX, + RS6000_BTM_P8_VECTOR, + RS6000_BTM_P9_VECTOR, + RS6000_BTM_P9_MISC, + RS6000_BTM_CRYPTO, + RS6000_BTM_HTM, + RS6000_BTM_PAIRED, + RS6000_BTM_FRE, + RS6000_BTM_FRES, + RS6000_BTM_FRSQRTE, + RS6000_BTM_FRSQRTES, + RS6000_BTM_POPCNTD, + RS6000_BTM_CELL, + RS6000_BTM_DFP, + RS6000_BTM_HARD_FLOAT, + RS6000_BTM_LDBL128, + RS6000_BTM_64BIT, + RS6000_BTM_FLOAT128, + RS6000_BTM_FLOAT128_HW, + }; + static const char *flag_names[] = { + "RS6000_BTM_MODULO", + "RS6000_BTM_ALTIVEC", + "RS6000_BTM_CMPB", + "RS6000_BTM_VSX", + "RS6000_BTM_P8_VECTOR", + "RS6000_BTM_P9_VECTOR", + "RS6000_BTM_P9_MISC", + "RS6000_BTM_CRYPTO", + "RS6000_BTM_HTM", + "RS6000_BTM_PAIRED", + "RS6000_BTM_FRE", + "RS6000_BTM_FRES", + "RS6000_BTM_FRSQRTE", + "RS6000_BTM_FRSQRTES", + "RS6000_BTM_POPCNTD", + "RS6000_BTM_CELL", + "RS6000_BTM_DFP", + "RS6000_BTM_HARD_FLOAT", + "RS6000_BTM_LDBL128", + "RS6000_BTM_64BIT", + "RS6000_BTM_FLOAT128", + "RS6000_BTM_FLOAT128_HW", + }; + static int max_buf = + strcat_length (flag_names, + sizeof (flag_values) / sizeof (HOST_WIDE_INT)); + gcc_assert (max_buf <= KELVIN_VERBOSE_BUFFER_LEN); + + if (mask == 0) + strcpy (s, "RS6000_BTM_ALWAYS"); + else + for (unsigned int i = 0; + i < sizeof (flag_values) / sizeof (HOST_WIDE_INT); i++) { + if (mask & flag_values[i]) { + if (s > buffer) + *s++ = '|'; + strcpy (s, flag_names[i]); + s += strlen (flag_names[i]); + } + } + return buffer; +} + +const char * +a2s (unsigned int attribute) +{ + static char buffer [KELVIN_VERBOSE_BUFFER_LEN]; + char *s = buffer; + + unsigned int type_mask = attribute & RS6000_BTC_TYPE_MASK; + const char *flag_name; + + switch (type_mask) + { + case RS6000_BTC_SPECIAL: + flag_name = "RS6000_BTC_SPECIAL"; break; + case RS6000_BTC_UNARY: + flag_name = "RS6000_BTC_UNARY"; break; + case RS6000_BTC_BINARY: + flag_name = "RS6000_BTC_BINARY"; break; + case RS6000_BTC_TERNARY: + flag_name = "RS6000_BTC_TERNARY"; break; + case RS6000_BTC_PREDICATE: + flag_name = "RS6000_BTC_PREDICATE"; break; + case RS6000_BTC_ABS: + flag_name = "RS6000_BTC_ABS"; break; + case RS6000_BTC_DST: + flag_name = "RS6000_BTC_DST"; break; + default: + flag_name = "RS6000_BTC_<TYPE_UNKNOWN>"; break; + } + strcpy (s, flag_name); + s += strlen (flag_name); + + unsigned int attribute_info = attribute & RS6000_BTC_ATTR_MASK; + if (attribute_info == RS6000_BTC_MISC) + { + *s++ = '|'; + flag_name = "RS6000_BTC_MISC"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + else { + if (attribute_info & RS6000_BTC_CONST) + { + *s++ = '|'; + flag_name = "RS6000_BTC_CONST"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + if (attribute_info & RS6000_BTC_PURE) + { + *s++ = '|'; + flag_name = "RS6000_BTC_PURE"; + strcpy (s, flag_name); + s += strlen (flag_name); + + } + if (attribute_info & RS6000_BTC_FP) + { + *s++ = '|'; + flag_name = "RS6000_BTC_FP"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + } + + unsigned int misc_attribute = attribute & RS6000_BTC_MISC_MASK; + if (misc_attribute & RS6000_BTC_SPR) + { + *s++ = '|'; + flag_name = "RS6000_BTC_SPR"; + strcpy (s, flag_name); + s += strlen (flag_name); + + } + if (misc_attribute & RS6000_BTC_VOID) + { + *s++ = '|'; + flag_name = "RS6000_BTC_VOID"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + if (misc_attribute & RS6000_BTC_CR) + { + *s++ = '|'; + flag_name = "RS6000_BTC_CR"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + if (misc_attribute & RS6000_BTC_OVERLOADED) + { + *s++ = '|'; + flag_name = "RS6000_BTC_OVERLOADED"; + strcpy (s, flag_name); + s += strlen (flag_name); + } + + return buffer; +} + +const struct rs6000_builtin_info_type * +get_type (const char *name) +{ + const struct rs6000_builtin_info_type *result; + int i; + + /* The first entry in the table is not normal, so skip over that. */ + result = rs6000_builtin_info + 1; + for (i = (sizeof (rs6000_builtin_info) + / sizeof (struct rs6000_builtin_info_type)) - 1; i--; result++) { + /* fprintf (stderr, "get_type(%s), looking at { %s, %d, %lx, %x }\n", + * name, result->name, result->icode, result->mask, + * result->attr); + */ + if (!strcmp(result->name, name)) + return result; + } + return NULL; +} + +const char * +t2s (machine_mode type) { + int type_code = (int) type; + int ptr_flag; + + if (type_code < 0) { + ptr_flag = 1; + type_code *= -1; + } + else + ptr_flag = 0; + + switch (type_code) { + + case E_VOIDmode: + return ptr_flag? "void *": "void"; + + case E_BLKmode: + return ptr_flag? "blk_mode *": "blk_mode"; + + case E_CCmode: + /* condition codes? */ + return ptr_flag? "cc_mode *": "cc_mode"; + + case E_CCUNSmode: + return ptr_flag? "ccuns_mode *": "ccuns_mode"; + + case E_CCFPmode: + return ptr_flag? "ccfp_mode *": "ccfp_mode"; + + case E_CCEQmode: + return ptr_flag? "cceq_mode *": "cceq_mode"; + + case E_BImode: + /* binary digit (bit) mode? */ + return ptr_flag? "bi_mode *": "bi_mode"; + + case E_QImode: + return ptr_flag? "char *": "char"; + + case E_HImode: + return ptr_flag? "short *": "short"; + + case E_SImode: + return ptr_flag? "int *": "int"; + + case E_DImode: + return ptr_flag? "long long int *": "long long int"; + + case E_TImode: + return ptr_flag? "ti_mode *": "ti_mode"; + + case E_PTImode: + return ptr_flag? "pti_mode *": "pti_mode"; + + case E_QQmode: + return ptr_flag? "qq_mode *": "qq_mode"; + + case E_HQmode: + return ptr_flag? "hq_mode *": "hq_mode"; + + case E_SQmode: + return ptr_flag? "sq_mode *": "sq_mode"; + + case E_DQmode: + return ptr_flag? "dq_mode *": "dq_mode"; + + case E_TQmode: + return ptr_flag? "tq_mode *": "tq_mode"; + + case E_UQQmode: + return ptr_flag? "unsigned char *": "unsigned char"; + + case E_UHQmode: + return ptr_flag? "unsigned short *": "unsigned short"; + + case E_USQmode: + return ptr_flag? "unsigned int *": "unsigned int"; + + case E_UDQmode: + return ptr_flag? "udq_mode *": "udq_mode"; + + case E_UTQmode: + return ptr_flag? "utq_mode *": "utq_mode"; + + case E_HAmode: + return ptr_flag? "ha_mode *": "ha_mode"; + + case E_SAmode: + return ptr_flag? "sa_mode *": "sa_mode"; + + case E_DAmode: + return ptr_flag? "da_mode *": "da_mode"; + + case E_TAmode: + return ptr_flag? "ta_mode *": "ta_mode"; + + case E_UHAmode: + return ptr_flag? "uha_mode *": "uha_mode"; + + case E_USAmode: + return ptr_flag? "usa_mode *": "usa_mode"; + + case E_UDAmode: + return ptr_flag? "uda_mode *": "uda_mode"; + + case E_UTAmode: + return ptr_flag? "uta_mode *": "uta_mode"; + + case E_SFmode: + return ptr_flag? "sf_mode *": "sf_mode"; + + case E_DFmode: + return ptr_flag? "df_mode *": "df_mode"; + + case E_IFmode: + return ptr_flag? "__ibm128 *": "__ibm128"; + + case E_KFmode: + return ptr_flag? "__float128 *": "__float128"; + + case E_TFmode: + return ptr_flag? "tf_mode *": "tf_mode"; + + case E_SDmode: + return ptr_flag? "sd_mode *": "sd_mode"; + + case E_DDmode: + return ptr_flag? "dd_mode *": "dd_mode"; + + case E_TDmode: + return ptr_flag? "td_mode *": "td_mode"; + + case E_CQImode: + return ptr_flag? "cqi_mode *": "cqi_mode"; + + case E_CHImode: + return ptr_flag? "chi_mode *": "chi_mode"; + + case E_CSImode: + return ptr_flag? "csi_mode *": "csi_mode"; + + case E_CDImode: + return ptr_flag? "cdi_mode *": "cdi_mode"; + + case E_CTImode: + return ptr_flag? "cti_mode *": "cti_mode"; + + case E_SCmode: + return ptr_flag? "sc_mode *": "sc_mode"; + + case E_DCmode: + return ptr_flag? "dc_mode *": "dc_mode"; + + case E_ICmode: + return ptr_flag? "ic_mode *": "ic_mode"; + + case E_KCmode: + return ptr_flag? "kc_mode *": "kc_mode"; + + case E_TCmode: + return ptr_flag? "tc_mode *": "tc_mode"; + + case E_V2SImode: + return ptr_flag? "v2si_mode *": "v2si_mode"; + + case E_V16QImode: + return ptr_flag? "vector char *": "vector char"; + + case E_V8HImode: + return ptr_flag? "vector short *": "vector short"; + + case E_V4SImode: + return ptr_flag? "vector int *": "vector int"; + + case E_V2DImode: + return ptr_flag? "vector long long int *": "vector long long int"; + + case E_V1TImode: + return ptr_flag? "vector __int128_t *": "vector __int128_t"; + + case E_V32QImode: + return ptr_flag? "v32qi_mode *": "v32qi_mode"; + + case E_V16HImode: + return ptr_flag? "v16hi_mode *": "v16hi_mode"; + + case E_V8SImode: + return ptr_flag? "v8si_mode *": "v8si_mode"; + + case E_V4DImode: + return ptr_flag? "v4di_mode *": "v4di_mode"; + + case E_V2TImode: + return ptr_flag? "v2ti_mode *": "v2ti_mode"; + + case E_V2SFmode: + return ptr_flag? "v2sf_mode *": "v2sf_mode"; + + case E_V4SFmode: + return ptr_flag? "vector float *": "vector float"; + + case E_V2DFmode: + return ptr_flag? "vector double *": "vector double"; + + case E_V2IFmode: + return ptr_flag? "v2if_mode *": "v2if_mode"; + + case E_V2KFmode: + return ptr_flag? "v2kf_mode *": "v2kf_mode"; + + case E_V8SFmode: + return ptr_flag? "v8sf_mode *": "v8sf_mode"; + + case E_V4DFmode: + return ptr_flag? "v4df_mode *": "v4df_mode"; + + case E_V2TFmode: + return ptr_flag? "v2tf_mode *": "v2tf_mode"; + + default: + return ptr_flag? "unknown_mode *": "unknown_mode"; + } +} + +void +dump_special_table (const char *title, + const struct builtin_description *bidp, int num_entries) +{ + machine_mode tmode, mode0, mode1, mode2; + + fprintf (stderr, "%s [%d]\n", title, num_entries); + while (num_entries--) { + unsigned attributes = get_type (bidp->name)->attr; + unsigned type_mask = attributes & RS6000_BTC_TYPE_MASK; + +bidp has an icode and a code. which of these is the fcode? I think it is the code. + + note that ALTIVEC_BUILTIN_VMADDFP (1) and ALTIVEC_BUILTIN_STVX_V2DF (??) + are both enum rs6000_builtins + it may be neither one of these + + i think it's the code. see this line from builtins.error: + +3-Argument built-in functions [152] +vector float __builtin_altivec_vmaddfp (vector float, vector float, vector floa\ +t): icode: 2299, code: 1 + mask: RS6000_BTM_ALTIVEC + attr: RS6000_BTC_TERNARY|RS6000_BTC_FP + + + + + + + + switch (fcode) { + + } + + + if ((attributes & RS6000_BTC_OVERLOADED) == 0) + { + switch (type_mask) { + case RS6000_BTC_PREDICATE: + /* Two source values plus an integer predicate code. */ + case RS6000_BTC_DST: + /* Expect ptr operand, int length, const int configuration + operands, with void result. */ + case RS6000_BTC_TERNARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + mode1 = insn_data[bidp->icode].operand[2].mode; + mode2 = insn_data[bidp->icode].operand[3].mode; + fprintf (stderr, "%s %s (%s, %s, %s): ", t2s (tmode), + bidp->name, t2s (mode0), t2s (mode1), t2s (mode2)); + break; + + case RS6000_BTC_BINARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + mode1 = insn_data[bidp->icode].operand[2].mode; + fprintf (stderr, "%s %s (%s, %s): ", + t2s (tmode), bidp->name, t2s (mode0), t2s (mode1)); + break; + + case RS6000_BTC_ABS: /* single argument, single result */ + case RS6000_BTC_UNARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + fprintf (stderr, "%s %s (%s): ", + t2s (tmode), bidp->name, t2s (mode0)); + break; + + case RS6000_BTC_SPECIAL: + /* No args, but still a result type. */ + tmode = insn_data[bidp->icode].operand[0].mode; + fprintf (stderr, "%s %s (): ", t2s (tmode), bidp->name); + break; + } + fprintf (stderr, "icode: %d, code: %d\n", bidp->icode, bidp->code); + fprintf (stderr, " mask: %s\n", m2s (bidp->mask)); + fprintf (stderr, " attr: %s\n", a2s (attributes)); + } + bidp++; + } + fprintf (stderr, "\n"); +} + +void +dump_one_table (const char *title, + const struct builtin_description *bidp, int num_entries) +{ + machine_mode tmode, mode0, mode1, mode2; + + fprintf (stderr, "%s [%d]\n", title, num_entries); + while (num_entries--) { + unsigned attributes = get_type (bidp->name)->attr; + unsigned type_mask = attributes & RS6000_BTC_TYPE_MASK; + + if ((attributes & RS6000_BTC_OVERLOADED) == 0) + { + switch (type_mask) { + case RS6000_BTC_PREDICATE: + /* Two source values plus an integer predicate code. */ + case RS6000_BTC_DST: + /* Expect ptr operand, int length, const int configuration + operands, with void result. */ + case RS6000_BTC_TERNARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + mode1 = insn_data[bidp->icode].operand[2].mode; + mode2 = insn_data[bidp->icode].operand[3].mode; + fprintf (stderr, "%s %s (%s, %s, %s): ", t2s (tmode), + bidp->name, t2s (mode0), t2s (mode1), t2s (mode2)); + break; + + case RS6000_BTC_BINARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + mode1 = insn_data[bidp->icode].operand[2].mode; + fprintf (stderr, "%s %s (%s, %s): ", + t2s (tmode), bidp->name, t2s (mode0), t2s (mode1)); + break; + + case RS6000_BTC_ABS: /* single argument, single result */ + case RS6000_BTC_UNARY: + tmode = insn_data[bidp->icode].operand[0].mode; + mode0 = insn_data[bidp->icode].operand[1].mode; + fprintf (stderr, "%s %s (%s): ", + t2s (tmode), bidp->name, t2s (mode0)); + break; + + case RS6000_BTC_SPECIAL: + /* No args, but still a result type. */ + tmode = insn_data[bidp->icode].operand[0].mode; + fprintf (stderr, "%s %s (): ", t2s (tmode), bidp->name); + break; + } + fprintf (stderr, "icode: %d, code: %d\n", bidp->icode, bidp->code); + fprintf (stderr, " mask: %s\n", m2s (bidp->mask)); + fprintf (stderr, " attr: %s\n", a2s (attributes)); + } + bidp++; + } + fprintf (stderr, "\n"); +} + +void +dump_monomorphics () +{ + fprintf (stderr, "\n"); + dump_one_table ("0-Argument built-in functions", + bdesc_0arg, ARRAY_SIZE (bdesc_0arg)); + dump_one_table ("1-Argument built-in functions", + bdesc_1arg, ARRAY_SIZE (bdesc_1arg)); + dump_one_table ("2-Argument built-in functions", + bdesc_2arg, ARRAY_SIZE (bdesc_2arg)); + dump_one_table ("3-Argument built-in functions", + bdesc_3arg, ARRAY_SIZE (bdesc_3arg)); + + dump_one_table ("Altivec predicate built-in functions", + bdesc_altivec_preds, ARRAY_SIZE (bdesc_altivec_preds)); + dump_one_table ("Paired predicate built-in functions", + bdesc_paired_preds, ARRAY_SIZE (bdesc_paired_preds)); + dump_one_table ("Altivec/VSX Absolute Value builtin-in functions", + bdesc_abs, ARRAY_SIZE (bdesc_abs)); + dump_one_table ("Hardware Transactional Memory built-in functions", + bdesc_htm, ARRAY_SIZE (bdesc_htm)); + dump_one_table ("Data Stream Touch (cache hinting) functions", + bdesc_dst, ARRAY_SIZE (bdesc_dst)); + dump_special_table ("Special (non-standard) functions", + bdesc_special, ARRAY_SIZE (bdesc_special)); +} + +void +take_a_dump () +{ + if (TARGET_DEBUG_BUILTIN) + dump_monomorphics (); +} diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 4b6bf5325bd..23c0f54c588 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -36,6 +36,10 @@ #include "c/c-tree.h" +#define KELVIN_VERBOSE +#ifdef KELVIN_VERBOSE +extern void dump_polymorphic (); +#endif /* Handle the machine specific pragma longcall. Its syntax is @@ -794,6 +798,10 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) builtin_define ("_XFPU_DP_FULL"); } } +#ifdef KELVIN_VERBOSE + if (TARGET_DEBUG_BUILTIN) + dump_polymorphic (); +#endif } @@ -6955,3 +6963,163 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, return error_mark_node; } } + +#ifdef KELVIN_VERBOSE + +const char * +polytype2s (signed char poly_type) { + int is_ptr; + + if (poly_type < 0) + { + poly_type = ~poly_type; + is_ptr = 1; + } + else + is_ptr = 0; + + switch (poly_type) { + case RS6000_BTI_NOT_OPAQUE: + return is_ptr? "not_opaque *": "not_opaque"; + case RS6000_BTI_opaque_V2SI: + return is_ptr? "opaque_v2si *": "opaque_v2si"; + case RS6000_BTI_opaque_V2SF: + return is_ptr? "opaque_v2sf *": "opaque_v2sf"; + case RS6000_BTI_opaque_p_V2SI: + return is_ptr? "opaque_p_v2si *": "opaque_p_v2si"; + case RS6000_BTI_opaque_V4SI: + return is_ptr? "opaque_v4si *": "opaque_v4si"; + case RS6000_BTI_V16QI: + return is_ptr? "vector char *": "vector char"; + case RS6000_BTI_V1TI: + return is_ptr? "vector __int128 *": "vector __int128"; + case RS6000_BTI_V2SI: + return is_ptr? "v2si *": "v2si"; + case RS6000_BTI_V2SF: + return is_ptr? "v2sf *": "v2sf"; + case RS6000_BTI_V2DI: + return is_ptr? "vector long long int *": "vector long long int"; + case RS6000_BTI_V2DF: + return is_ptr? "vector double *": "vector double"; + case RS6000_BTI_V4HI: + return is_ptr? "v4hi *": "v4hi"; + case RS6000_BTI_V4SI: + return is_ptr? "vector int *": "vector int"; + case RS6000_BTI_V4SF: + return is_ptr? "vector float *": "vector float"; + case RS6000_BTI_V8HI: + return is_ptr? "vector short *": "vector short"; + case RS6000_BTI_unsigned_V16QI: + return is_ptr? "vector unsigned char *": "vector unsigned char"; + case RS6000_BTI_unsigned_V1TI: + return is_ptr? "vector unsigned __int128 *": "vector unsigned __int128"; + case RS6000_BTI_unsigned_V8HI: + return is_ptr? "vector unsigned short *": "vector unsigned short"; + case RS6000_BTI_unsigned_V4SI: + return is_ptr? "vector unsigned int *": "vector unsigned int"; + case RS6000_BTI_unsigned_V2DI: + return is_ptr + ? "vector unsigned long long int *": "vector unsigned long long int"; + case RS6000_BTI_bool_char: /* __bool char */ + return is_ptr? "bool char *": "bool char"; + case RS6000_BTI_bool_short: /* __bool short */ + return is_ptr? "bool short *": "bool short"; + case RS6000_BTI_bool_int: /* __bool int */ + return is_ptr? "bool int *": "bool int"; + case RS6000_BTI_bool_long: /* __bool long */ + return is_ptr? "bool long *": "bool long"; + case RS6000_BTI_pixel: /* __pixel */ + return is_ptr? "pixel *": "pixel"; + case RS6000_BTI_bool_V16QI: /* __vector bool char */ + return is_ptr? "vector bool char *": "vector bool char"; + case RS6000_BTI_bool_V8HI: /* __vector bool short */ + return is_ptr? "vector bool short *": "vector bool short"; + case RS6000_BTI_bool_V4SI: /* __vector bool int */ + return is_ptr? "vector bool int *": "vector bool int"; + case RS6000_BTI_bool_V2DI: /* __vector bool long */ + return is_ptr? "vector bool long *": "vector bool long"; + case RS6000_BTI_pixel_V8HI: /* __vector __pixel */ + return is_ptr? "vector pixel *": "vector pixel"; + case RS6000_BTI_long: /* long_integer_type_node */ + return is_ptr? "long *": "long"; + case RS6000_BTI_unsigned_long: /* long_unsigned_type_node */ + return is_ptr? "unsigned long *": "unsigned long"; + case RS6000_BTI_long_long: /* long_long_integer_type_node */ + return is_ptr? "long long *": "long long"; + case RS6000_BTI_unsigned_long_long: /* long_long_unsigned_type_node */ + return is_ptr? "unsigned long long *": "unsigned long long"; + case RS6000_BTI_INTQI: /* intQI_type_node */ + return is_ptr? "char *": "char"; + case RS6000_BTI_UINTQI: /* unsigned_intQI_type_node */ + return is_ptr? "unsigned char *": "unsigned char"; + case RS6000_BTI_INTHI: /* intHI_type_node */ + return is_ptr? "short *": "short"; + case RS6000_BTI_UINTHI: /* unsigned_intHI_type_node */ + return is_ptr? "unsigned short *": "unsigned short"; + case RS6000_BTI_INTSI: /* intSI_type_node */ + return is_ptr? "int *": "int"; + case RS6000_BTI_UINTSI: /* unsigned_intSI_type_node */ + return is_ptr? "unsigned int *": "unsigned int"; + case RS6000_BTI_INTDI: /* intDI_type_node */ + return is_ptr? "long long int *": "long long int"; + case RS6000_BTI_UINTDI: /* unsigned_intDI_type_node */ + return is_ptr? "unsigned long long int *": "unsigned long long int"; + case RS6000_BTI_INTTI: /* intTI_type_node */ + return is_ptr? "__int128 *": "__int128"; + case RS6000_BTI_UINTTI: /* unsigned_intTI_type_node */ + return is_ptr? "unsigned __int128 *": "unsigned __int128"; + case RS6000_BTI_float: /* float_type_node */ + return is_ptr? "float *": "float"; + case RS6000_BTI_double: /* double_type_node */ + return is_ptr? "double *": "double"; + case RS6000_BTI_long_double: /* long_double_type_node */ + return is_ptr? "long double *": "long double"; + case RS6000_BTI_dfloat64: /* dfloat64_type_node */ + return is_ptr? "dfloat64 *": "dfloat64"; + case RS6000_BTI_dfloat128: /* dfloat128_type_node */ + return is_ptr? "__float128 *": "__float128"; + case RS6000_BTI_void: /* void_type_node */ + return is_ptr? "void *": "void"; + case RS6000_BTI_ieee128_float: /* ieee 128-bit floating point */ + return is_ptr? "__ieee128 *": "__ieee128"; + case RS6000_BTI_ibm128_float: /* IBM 128-bit floating point */ + return is_ptr? "__ibm128 *": "__ibm128"; + case RS6000_BTI_const_str: /* pointer to const char * */ + return is_ptr? "const char **": "const char *"; + default: + return "<unknown_polymorphic_operand_type>"; + } +} + +void dump_one_polymorphic (const struct altivec_builtin_types *pp) { + enum rs6000_builtins fcode = pp->code; + const char *name = rs6000_overloaded_builtin_name (fcode); + + /* kelvin may want to look at pp->overloaded_code too, and figure + out what function name is associated with that. */ + + fprintf (stderr, "%s %s[%d] (", polytype2s (pp->ret_type), name, pp->code); + if (pp->op1) + fprintf (stderr, "%s", polytype2s (pp->op1)); + if (pp->op2) + fprintf (stderr, ", %s", polytype2s (pp->op2)); + if (pp->op3) + fprintf (stderr, ", %s", polytype2s (pp->op3)); + fprintf (stderr, ")\n"); + fprintf (stderr, " maps to: %s [%d]\n", + rs6000_overloaded_builtin_name (pp->overloaded_code), + pp->overloaded_code); +} + + +void +dump_polymorphic () { + extern void dump_one_polymorphic (const struct altivec_builtin_types *pp); + + const struct altivec_builtin_types *pp = altivec_overloaded_builtins; + while (pp->code != 0) { + dump_one_polymorphic (pp); + pp++; + } +} +#endif diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d0de4b5224d..d3e1d7e0f3b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -85,6 +85,11 @@ /* This file should be included last. */ #include "target-def.h" +#define KELVIN_VERBOSE +#ifdef KELVIN_VERBOSE +extern void take_a_dump (); +#endif + #ifndef TARGET_NO_PROTOTYPE #define TARGET_NO_PROTOTYPE 0 #endif @@ -13898,6 +13903,7 @@ static const struct builtin_description bdesc_htm[] = #undef RS6000_BUILTIN_H #undef RS6000_BUILTIN_P #undef RS6000_BUILTIN_Q +#undef RS6000_BUILTIN_X /* Return true if a builtin function is overloaded. */ bool @@ -17266,6 +17272,9 @@ rs6000_init_builtins (void) #ifdef SUBTARGET_INIT_BUILTINS SUBTARGET_INIT_BUILTINS; #endif +#ifdef KELVIN_VERBOSE + take_a_dump (); +#endif } /* Returns the rs6000 builtin decl for CODE. */ @@ -39644,3 +39653,7 @@ rs6000_starting_frame_offset (void) struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-rs6000.h" + +#ifdef KELVIN_VERBOSE +#include "dump-builtins.c" +#endif |