re PR target/50566 ([avr]: Add support for better logging similar to -mdeb)
PR target/50566 * config/avr/avr-protos.h (avr_log_t): Add field .builtin. * config/avr/avr-log.c (avr_log_set_avr_log): Initialize it. Don't bypass TARGET_ALL_DEBUG. Print self-info with ?. (avr_log_vadump): Support %D and %X to print double_int. (avr_double_int_pop_digit): New static function. (avr_dump_double_int_hex): New static function. From-SVN: r181718
This commit is contained in:
parent
c07e938571
commit
b5e3577030
@ -1,3 +1,13 @@
|
||||
2011-11-25 Georg-Johann Lay <avr@gjlay.de>
|
||||
|
||||
PR target/50566
|
||||
* config/avr/avr-protos.h (avr_log_t): Add field .builtin.
|
||||
* config/avr/avr-log.c (avr_log_set_avr_log): Initialize it.
|
||||
Don't bypass TARGET_ALL_DEBUG. Print self-info with ?.
|
||||
(avr_log_vadump): Support %D and %X to print double_int.
|
||||
(avr_double_int_pop_digit): New static function.
|
||||
(avr_dump_double_int_hex): New static function.
|
||||
|
||||
2011-11-24 Enkovich Ilya <ilya.enkovich@intel.com>
|
||||
|
||||
PR target/51287
|
||||
|
@ -49,6 +49,8 @@
|
||||
C: enum rtx_code
|
||||
m: enum machine_mode
|
||||
R: enum reg_class
|
||||
D: double_int (signed decimal)
|
||||
X: double_int (unsigned hex)
|
||||
L: insn list
|
||||
H: location_t
|
||||
|
||||
@ -82,7 +84,7 @@ static void avr_log_vadump (FILE*, const char*, va_list);
|
||||
|
||||
/* As we have no variadic macros, avr_edump maps to a call to
|
||||
avr_log_set_caller_e which saves __FUNCTION__ to avr_log_caller and
|
||||
returns a function pointer to avr_log_fdump_e. avr_fdump_e
|
||||
returns a function pointer to avr_log_fdump_e. avr_log_fdump_e
|
||||
gets the printf-like arguments and calls avr_log_vadump, the
|
||||
worker function. avr_fdump works the same way. */
|
||||
|
||||
@ -135,6 +137,49 @@ avr_log_set_caller_f (const char *caller)
|
||||
return avr_log_fdump_f;
|
||||
}
|
||||
|
||||
|
||||
/* Copy-paste from double-int.c:double_int_split_digit (it's static there).
|
||||
Splits last digit of *CST (taken as unsigned) in BASE and returns it. */
|
||||
|
||||
static unsigned
|
||||
avr_double_int_pop_digit (double_int *cst, unsigned base)
|
||||
{
|
||||
unsigned HOST_WIDE_INT resl, reml;
|
||||
HOST_WIDE_INT resh, remh;
|
||||
|
||||
div_and_round_double (FLOOR_DIV_EXPR, true, cst->low, cst->high, base, 0,
|
||||
&resl, &resh, &reml, &remh);
|
||||
cst->high = resh;
|
||||
cst->low = resl;
|
||||
|
||||
return reml;
|
||||
}
|
||||
|
||||
|
||||
/* Dump VAL as hex value to FILE. */
|
||||
|
||||
static void
|
||||
avr_dump_double_int_hex (FILE *file, double_int val)
|
||||
{
|
||||
unsigned digit[4];
|
||||
|
||||
digit[0] = avr_double_int_pop_digit (&val, 1 << 16);
|
||||
digit[1] = avr_double_int_pop_digit (&val, 1 << 16);
|
||||
digit[2] = avr_double_int_pop_digit (&val, 1 << 16);
|
||||
digit[3] = avr_double_int_pop_digit (&val, 1 << 16);
|
||||
|
||||
fprintf (file, "0x");
|
||||
|
||||
if (digit[3] | digit[2])
|
||||
fprintf (file, "%04x%04x", digit[3], digit[2]);
|
||||
|
||||
if (digit[3] | digit[2] | digit[1] | digit[0])
|
||||
fprintf (file, "%04x%04x", digit[1], digit[0]);
|
||||
else
|
||||
fprintf (file, "0");
|
||||
}
|
||||
|
||||
|
||||
/* Worker function implementing the %-codes and forwarding to
|
||||
respective print/dump function. */
|
||||
|
||||
@ -189,6 +234,14 @@ avr_log_vadump (FILE *file, const char *fmt, va_list ap)
|
||||
fprintf (file, "%d", va_arg (ap, int));
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
dump_double_int (file, va_arg (ap, double_int), false);
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
avr_dump_double_int_hex (file, va_arg (ap, double_int));
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
fprintf (file, "%x", va_arg (ap, int));
|
||||
break;
|
||||
@ -251,7 +304,7 @@ avr_log_vadump (FILE *file, const char *fmt, va_list ap)
|
||||
location_t loc = va_arg (ap, location_t);
|
||||
|
||||
if (BUILTINS_LOCATION == loc)
|
||||
fprintf (file, "<BUILTIN-LOCATION");
|
||||
fprintf (file, "<BUILTIN-LOCATION>");
|
||||
else if (UNKNOWN_LOCATION == loc)
|
||||
fprintf (file, "<UNKNOWN-LOCATION>");
|
||||
else
|
||||
@ -306,21 +359,33 @@ avr_log_vadump (FILE *file, const char *fmt, va_list ap)
|
||||
void
|
||||
avr_log_set_avr_log (void)
|
||||
{
|
||||
if (avr_log_details)
|
||||
bool all = TARGET_ALL_DEBUG != 0;
|
||||
|
||||
if (all || avr_log_details)
|
||||
{
|
||||
/* Adding , at beginning and end of string makes searching easier. */
|
||||
|
||||
char *str = (char*) alloca (3 + strlen (avr_log_details));
|
||||
bool info;
|
||||
|
||||
str[0] = ',';
|
||||
strcat (stpcpy (str+1, avr_log_details), ",");
|
||||
|
||||
all |= NULL != strstr (str, ",all,");
|
||||
info = NULL != strstr (str, ",?,");
|
||||
|
||||
if (info)
|
||||
fprintf (stderr, "\n-mlog=");
|
||||
|
||||
#define SET_DUMP_DETAIL(S) \
|
||||
avr_log.S = (TARGET_ALL_DEBUG \
|
||||
|| NULL != strstr (str, "," #S ",") \
|
||||
|| NULL != strstr (str, ",all,"))
|
||||
do { \
|
||||
avr_log.S = (all || NULL != strstr (str, "," #S ",")); \
|
||||
if (info) \
|
||||
fprintf (stderr, #S ","); \
|
||||
} while (0)
|
||||
|
||||
SET_DUMP_DETAIL (address_cost);
|
||||
SET_DUMP_DETAIL (builtin);
|
||||
SET_DUMP_DETAIL (constraints);
|
||||
SET_DUMP_DETAIL (legitimate_address_p);
|
||||
SET_DUMP_DETAIL (legitimize_address);
|
||||
@ -329,5 +394,8 @@ avr_log_set_avr_log (void)
|
||||
SET_DUMP_DETAIL (rtx_costs);
|
||||
|
||||
#undef SET_DUMP_DETAIL
|
||||
|
||||
if (info)
|
||||
fprintf (stderr, "?\n\n");
|
||||
}
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ extern void avr_log_set_avr_log (void);
|
||||
typedef struct
|
||||
{
|
||||
unsigned address_cost :1;
|
||||
unsigned builtin :1;
|
||||
unsigned constraints :1;
|
||||
unsigned legitimate_address_p :1;
|
||||
unsigned legitimize_address :1;
|
||||
|
Loading…
Reference in New Issue
Block a user