Commit fe780c13 by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/50566 ([avr]: Add support for better logging similar to -mdeb)

	PR target/50566
	* config/avr/avr-protos.h (avr_log_t): New field address_cost.
	* config/avr/avr.c (avr_address_cost): Use it.
	* config/avr/avr-log.c (avr_log_set_avr_log): Initialize it.
	(avr_log_vadump): Unknown %-codes finish printing.

From-SVN: r179391
parent 38384150
2011-09-30 Georg-Johann Lay <avr@gjlay.de>
PR target/50566
* config/avr/avr-protos.h (avr_log_t): New field address_cost.
* config/avr/avr.c (avr_address_cost): Use it.
* config/avr/avr-log.c (avr_log_set_avr_log): Initialize it.
(avr_log_vadump): Unknown %-codes finish printing.
2011-09-30 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/50571
......@@ -283,7 +283,12 @@ avr_log_vadump (FILE *file, const char *fmt, va_list ap)
abort();
default:
fputc (*(fmt-1), file);
/* Unknown %-code: Stop printing */
fprintf (file, "??? %%%c ???%s\n", *(fmt-1), fmt);
fmt = "";
break;
}
break; /* % */
}
......@@ -318,6 +323,7 @@ avr_log_set_avr_log (void)
SET_DUMP_DETAIL (legitimize_address);
SET_DUMP_DETAIL (legitimize_reload_address);
SET_DUMP_DETAIL (constraints);
SET_DUMP_DETAIL (address_cost);
#undef SET_DUMP_DETAIL
}
......
......@@ -129,6 +129,7 @@ typedef struct
unsigned legitimize_address :1;
unsigned legitimize_reload_address :1;
unsigned constraints :1;
unsigned address_cost :1;
} avr_log_t;
extern avr_log_t avr_log;
......@@ -6573,23 +6573,33 @@ avr_rtx_costs (rtx x, int codearg, int outer_code,
return done;
}
/* Calculate the cost of a memory address. */
/* Implement `TARGET_ADDRESS_COST'. */
static int
avr_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
{
int cost = 4;
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x,1)) == CONST_INT
&& (REG_P (XEXP (x,0)) || GET_CODE (XEXP (x,0)) == SUBREG)
&& INTVAL (XEXP (x,1)) >= 61)
return 18;
if (CONSTANT_ADDRESS_P (x))
&& CONST_INT_P (XEXP (x, 1))
&& (REG_P (XEXP (x, 0))
|| GET_CODE (XEXP (x, 0)) == SUBREG))
{
if (optimize > 0 && io_address_operand (x, QImode))
return 2;
return 4;
if (INTVAL (XEXP (x, 1)) >= 61)
cost = 18;
}
return 4;
else if (CONSTANT_ADDRESS_P (x))
{
if (optimize > 0
&& io_address_operand (x, QImode))
cost = 2;
}
if (avr_log.address_cost)
avr_edump ("\n%?: %d = %r\n", cost, x);
return cost;
}
/* Test for extra memory constraint 'Q'.
......
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