Commit fc470718 by J"orn Rennecke Committed by Joern Rennecke

final.c (insn_last_address, [...]): New variables.

	* final.c (insn_last_address, insn_current_align, uid_align):
	New variables.
	(in_align_chain, align_fuzz, align_shrink_fuzz): New functions.
	(insn_current_reference_address): Likewise.
	(shorten_branches, final_scan_insn): Implement LABEL_ALIGN,
	LABEL_ALIGN_AFTER_BARRIER and LOOP_ALIGN target macros.
	(label_to_alignment): New function.
	* genattrtab.c (write_test_expr): If one of LABEL_ALIGN,
	LABEL_ALIGN_AFTER_BARRIER or LOOP_ALIGN is defined, call
	insn_current_reference_address instead of insn_current_address.
	(or_attr_value, write_length_unit_log): New functions.
	(main): Call write_length_unit_log.
	(write_const_num_delay_slots): Output extra '\n'.
	* alpha.h (ASM_OUTPUT_LOOP_ALIGN, ASM_OUTPUT_ALIGN_CODE):
	replace with:
	(LOOP_ALIGN, ALIGN_LABEL_AFTER_BARRIER).
	* i386.h, i386/osfrose.h, i386/svr3dbx.h, m68k.h, sparc.h: Likewise.
	* arc.h, m32r.h (ASM_OUTPUT_LOOP_ALIGN): replace with:
	(LOOP_ALIGN).
	* i960.h, m88k.h: (ASM_OUTPUT_ALIGN_CODE): Replace with:
	(LABEL_ALIGN_AFTER_BARRIER).
	* ns32k/encore.h, ns32k/merlin.h, ns32k.h, ns32k/sequent.h: Likewise.
	* ns32k/tek6000.h: Likewise.
	* i386/gas.h (ASM_OUTPUT_LOOP_ALIGN, ASM_OUTPUT_ALIGN_CODE): Delete.
	* i386.md (casesi+1): Use ASM_OUTPUT_ALIGN instead of
	ASM_OUTPUT_ALIGN_CODE.

From-SVN: r18357
parent 948edfa7
Mon Mar 2 19:51:27 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* final.c (insn_last_address, insn_current_align, uid_align):
New variables.
(in_align_chain, align_fuzz, align_shrink_fuzz): New functions.
(insn_current_reference_address): Likewise.
(shorten_branches, final_scan_insn): Implement LABEL_ALIGN,
LABEL_ALIGN_AFTER_BARRIER and LOOP_ALIGN target macros.
(label_to_alignment): New function.
* genattrtab.c (write_test_expr): If one of LABEL_ALIGN,
LABEL_ALIGN_AFTER_BARRIER or LOOP_ALIGN is defined, call
insn_current_reference_address instead of insn_current_address.
(or_attr_value, write_length_unit_log): New functions.
(main): Call write_length_unit_log.
(write_const_num_delay_slots): Output extra '\n'.
* alpha.h (ASM_OUTPUT_LOOP_ALIGN, ASM_OUTPUT_ALIGN_CODE):
replace with:
(LOOP_ALIGN, ALIGN_LABEL_AFTER_BARRIER).
* i386.h, i386/osfrose.h, i386/svr3dbx.h, m68k.h, sparc.h: Likewise.
* arc.h, m32r.h (ASM_OUTPUT_LOOP_ALIGN): replace with:
(LOOP_ALIGN).
* i960.h, m88k.h: (ASM_OUTPUT_ALIGN_CODE): Replace with:
(LABEL_ALIGN_AFTER_BARRIER).
* ns32k/encore.h, ns32k/merlin.h, ns32k.h, ns32k/sequent.h: Likewise.
* ns32k/tek6000.h: Likewise.
* i386/gas.h (ASM_OUTPUT_LOOP_ALIGN, ASM_OUTPUT_ALIGN_CODE): Delete.
* i386.md (casesi+1): Use ASM_OUTPUT_ALIGN instead of
ASM_OUTPUT_ALIGN_CODE.
Mon Mar 2 01:05:50 PST 1998 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot.
......
......@@ -387,9 +387,8 @@ extern void override_options ();
/* Aligning past 2**3 wastes insn cache lines, and doesn't buy much
issue-wise on average anyway. */
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
if (optimize > 0 && write_symbols != SDB_DEBUG) \
ASM_OUTPUT_ALIGN (FILE, 3)
#define LOOP_ALIGN(LABEL) \
(optimize > 0 && write_symbols != SDB_DEBUG ? 3 : 0)
/* This is how to align an instruction for optimal branching.
On Alpha we'll get better performance by aligning on a quadword
......@@ -397,9 +396,8 @@ extern void override_options ();
/* Aligning past 2**3 wastes insn cache lines, and doesn't buy much
issue-wise on average anyway. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
if (optimize > 0 && write_symbols != SDB_DEBUG) \
ASM_OUTPUT_ALIGN ((FILE), 3)
#define ALIGN_LABEL_AFTER_BARRIER(FILE) \
(optimize > 0 && write_symbols != SDB_DEBUG ? 3 : 0)
/* No data type wants to be aligned rounder than this. */
#define BIGGEST_ALIGNMENT 64
......
......@@ -1504,12 +1504,11 @@ do { \
fprintf (FILE, ")\n"); \
} while (0)
/* A C expression to output text to align the location counter in the way
that is desirable at the beginning of a loop. */
/* The desired alignment for the location counter at the beginning
of a loop. */
/* On the ARC, align loops to 32 byte boundaries (cache line size)
if -malign-loops. */
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
do { if (TARGET_ALIGN_LOOPS) ASM_OUTPUT_SKIP (FILE, 5); } while (0)
#define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
/* This is how to output an assembler line
that says to advance the location counter
......
......@@ -85,20 +85,6 @@ Boston, MA 02111-1307, USA. */
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
#endif
/* Align labels, etc. at 4-byte boundaries.
For the 486, align to 16-byte boundary for sake of cache. */
#undef ASM_OUTPUT_ALIGN_CODE
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
fprintf ((FILE), "\t.align %d,0x90\n", i386_align_jumps)
/* Align start of loop at 4-byte boundary. */
#undef ASM_OUTPUT_LOOP_ALIGN
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
fprintf ((FILE), "\t.align %d,0x90\n", i386_align_loops)
/* A C statement or statements which output an assembler instruction
opcode to the stdio stream STREAM. The macro-operand PTR is a
......
......@@ -446,12 +446,12 @@ extern int ix86_arch;
#define MAX_CODE_ALIGN 6 /* 64 byte alignment */
/* Align loop starts for optimal branching. */
#define ASM_OUTPUT_LOOP_ALIGN(FILE) ASM_OUTPUT_ALIGN (FILE, i386_align_loops)
#define LOOP_ALIGN(LABEL) (i386_align_loops)
/* This is how to align an instruction for optimal branching.
On i486 we'll get better performance by aligning on a
cache line (i.e. 16 byte) boundary. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) ASM_OUTPUT_ALIGN ((FILE), i386_align_jumps)
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (i386_align_jumps)
/* Standard register usage. */
......
......@@ -6193,7 +6193,7 @@ byte_xor_operation:
output_asm_insn (AS2 (mov%L2,%3,%2), xops);
output_asm_insn (\"sub%L2 %l1@GOTOFF(%3,%0,4),%2\", xops);
output_asm_insn (AS1 (jmp,%*%2), xops);
ASM_OUTPUT_ALIGN_CODE (asm_out_file);
ASM_OUTPUT_ALIGN (asm_out_file, i386_align_jumps);
RET;
}")
......
......@@ -404,10 +404,9 @@ while (0)
alignment to be done at such a time. Most machine descriptions do
not currently define the macro. */
#undef ASM_OUTPUT_ALIGN_CODE
#define ASM_OUTPUT_ALIGN_CODE(STREAM) \
fprintf (STREAM, "\t.align\t%d\n", \
(!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
#undef LABEL_ALIGN_AFTER_BARRIER
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
((!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
/* A C expression to output text to align the location counter in the
way that is desirable at the beginning of a loop.
......@@ -416,9 +415,8 @@ while (0)
alignment to be done at such a time. Most machine descriptions do
not currently define the macro. */
#undef ASM_OUTPUT_LOOP_ALIGN
#define ASM_OUTPUT_LOOP_ALIGN(STREAM) \
fprintf (STREAM, "\t.align\t%d\n", i386_align_loops)
#undef LOOP_ALIGN
#define LOOP_ALIGN(LABEL) (i386_align_loops)
/* A C statement to output to the stdio stream STREAM an assembler
command to advance the location counter to a multiple of 2 to the
......
......@@ -46,16 +46,13 @@ Boston, MA 02111-1307, USA. */
/* Align labels, etc. at 4-byte boundaries.
For the 486, align to 16-byte boundary for sake of cache. */
#undef ASM_OUTPUT_ALIGN_CODE
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
fprintf ((FILE), "\t.align %d,0x90\n", \
1 << i386_align_jumps)
#undef LABEL_ALIGN_AFTER_BARRIER
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (i386_align_jumps)
/* Align start of loop at 4-byte boundary. */
#undef ASM_OUTPUT_LOOP_ALIGN
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
fprintf ((FILE), "\t.align %d,0x90\n", 1 << i386_align_loops);
#undef LOOP_ALIGN
#define LOOP_ALIGN(LABEL) (i386_align_loops)
/* Additional overrides needed for dbx-in-coff gas, mostly taken from pbb.h */
......
......@@ -1407,8 +1407,7 @@ extern struct rtx_def *gen_compare_reg ();
/* Align code to 8 byte boundary if TARGET_CODE_ALIGN is true. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
{ if (TARGET_CODE_ALIGN) fputs("\t.align 3\n",FILE); }
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (TARGET_CODE_ALIGN ? 3 : 0)
/* Store in OUTPUT a string (made with alloca) containing
an assembler-name for a local static variable named NAME.
......
......@@ -1673,12 +1673,11 @@ do { \
fprintf (FILE, ")\n"); \
} while (0)
/* A C expression to output text to align the location counter in the way
that is desirable at the beginning of a loop. */
/* The desired alignment for the location counter at the beginning
of a loop. */
/* On the M32R, align loops to 32 byte boundaries (cache line size)
if -malign-loops. */
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
do { if (TARGET_ALIGN_LOOPS) ASM_OUTPUT_ALIGN (FILE, 5); } while (0)
#define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
/* This is how to output an assembler line
that says to advance the location counter
......
......@@ -294,10 +294,10 @@ extern int target_flags;
#define MAX_CODE_ALIGN 2 /* 4 byte alignment */
/* Align loop starts for optimal branching. */
#define ASM_OUTPUT_LOOP_ALIGN(FILE) ASM_OUTPUT_ALIGN ((FILE), m68k_align_loops)
#define LOOP_ALIGN(LABEL) (m68k_align_loops)
/* This is how to align an instruction for optimal branching. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) ASM_OUTPUT_ALIGN ((FILE), m68k_align_jumps)
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (m68k_align_jumps)
#define SELECT_RTX_SECTION(MODE, X) \
{ \
......
......@@ -198,13 +198,13 @@ extern char * reg_names[];
Redefined in sysv4.h, and luna.h. */
#define VERSION_INFO1 "m88k, "
#ifndef VERSION_INFO2
#define VERSION_INFO2 "$Revision: 1.3 $"
#define VERSION_INFO2 "$Revision: 1.4 $"
#endif
#ifndef VERSION_STRING
#define VERSION_STRING version_string
#ifdef __STDC__
#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.3 $ " __DATE__
#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.4 $ " __DATE__
#else
#define TM_RCS_ID "$What: <@(#) m88k.h,v 1.1.1.2.2.2> $"
#endif /* __STDC__ */
......@@ -2212,9 +2212,8 @@ do { \
/* On the m88100, align the text address to half a cache boundary when it
can only be reached by jumping. Pack code tightly when compiling
crtstuff.c. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
ASM_OUTPUT_ALIGN (FILE, \
(TARGET_88100 && !flag_inhibit_size_directive ? 3 : 2))
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
(TARGET_88100 && !flag_inhibit_size_directive ? 3 : 2)
/* Override svr[34].h. */
#undef ASM_OUTPUT_SKIP
......
......@@ -79,8 +79,8 @@ output_file_directive ((FILE), main_input_filename)
/* The Encore assembler doesn't seem to accept the usual second argument
and warns that .align may not work in the text section if optimization
is on. */
#undef ASM_OUTPUT_ALIGN_CODE
#define ASM_OUTPUT_ALIGN_CODE(FILE)
#undef LABEL_ALIGN_AFTER_BARRIER
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) 0
/*
* Internal labels are prefixed with a period.
......
......@@ -53,7 +53,7 @@ Boston, MA 02111-1307, USA. */
/* This is how to align the code that follows an unconditional branch.
Don't define it, since it confuses the assembler (we hear). */
#undef ASM_OUTPUT_ALIGN_CODE
#undef LABEL_ALIGN_AFTER_BARRIER
/* Assembler pseudo-op for shared data segment. */
#define SHARED_SECTION_ASM_OP ".shdata"
......
......@@ -1383,11 +1383,9 @@ do { \
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
sprintf (LABEL, "*%s%d", PREFIX, NUM)
/* This is how to align the code that follows an unconditional branch.
Note that 0xa2 is a no-op. */
/* This is how to align the code that follows an unconditional branch. */
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
fprintf (FILE, "\t.align 2,0xa2\n")
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (2)
/* This is how to output an element of a case-vector that is absolute.
(The ns32k does not use such vectors,
......
......@@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA. */
/* This is how to align the code that follows an unconditional branch.
Don't define it, since it confuses the assembler (we hear). */
#undef ASM_OUTPUT_ALIGN_CODE
#undef LABEL_ALIGN_AFTER_BARRIER
/* Assembler pseudo-op for shared data segment. */
#define SHARED_SECTION_ASM_OP ".shdata"
......
......@@ -106,7 +106,7 @@ Boston, MA 02111-1307, USA. */
/* This is how to align the code that follows an unconditional branch.
Don't define it, since it confuses the assembler (we hear). */
#undef ASM_OUTPUT_ALIGN_CODE
#undef LABEL_ALIGN_AFTER_BARRIER
/* Assembler pseudo-op for shared data segment. */
#define SHARED_SECTION_ASM_OP ".shdata"
......
......@@ -2991,11 +2991,9 @@ do { \
if ((LOG) != 0) \
fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
#define ASM_OUTPUT_ALIGN_CODE(FILE) \
ASM_OUTPUT_ALIGN (FILE, sparc_align_jumps)
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (sparc_align_jumps)
#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
ASM_OUTPUT_ALIGN (FILE, sparc_align_loops)
#define LOOP_ALIGN(LABEL) (sparc_align_loops)
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\t.skip %u\n", (SIZE))
......
......@@ -448,6 +448,7 @@ static void gen_delay PROTO((rtx));
static void gen_unit PROTO((rtx));
static void write_test_expr PROTO((rtx, int));
static int max_attr_value PROTO((rtx));
static int or_attr_value PROTO((rtx));
static void walk_attr_value PROTO((rtx));
static void write_attr_get PROTO((struct attr_desc *));
static rtx eliminate_known_true PROTO((rtx, rtx, int, int));
......@@ -2500,6 +2501,26 @@ max_fn (exp)
{
return make_numeric_value (max_attr_value (exp));
}
static void
write_length_unit_log ()
{
struct attr_desc *length_attr = find_attr ("length", 0);
struct attr_value *av;
struct insn_ent *ie;
unsigned int length_unit_log, length_or;
if (length_attr == 0)
return;
length_or = or_attr_value (length_attr->default_val->value);
for (av = length_attr->first_value; av; av = av->next)
for (ie = av->first_insn; ie; ie = ie->next)
length_or |= or_attr_value (av->value);
length_or = ~length_or;
for (length_unit_log = 0; length_or & 1; length_or >>= 1)
length_unit_log++;
printf ("int length_unit_log = %u;\n", length_unit_log);
}
/* Take a COND expression and see if any of the conditions in it can be
simplified. If any are known true or known false for the particular insn
......@@ -4639,12 +4660,13 @@ write_test_expr (exp, flags)
XINT (exp, 0), XINT (exp, 0), XINT (exp, 0));
break;
/* The address of the current insn. It would be more consistent with
other usage to make this the address of the NEXT insn, but this gets
too confusing because of the ambiguity regarding the length of the
current insn. */
case PC:
printf ("insn_current_address");
/* The address of the current insn. We implement this actually as the
address of the current insn for backward branches, but the last
address of the next insn for forward branches, and both with
adjustments that account for the worst-case possible stretching of
intervening alignments between this insn and its destination. */
printf("insn_current_reference_address (insn)");
break;
case CONST_STRING:
......@@ -4708,6 +4730,42 @@ max_attr_value (exp)
return current_max;
}
/* Given an attribute value, return the result of ORing together all
CONST_STRING arguments encountered. It is assumed that they are
all numeric. */
static int
or_attr_value (exp)
rtx exp;
{
int current_or = 0;
int i;
if (GET_CODE (exp) == CONST_STRING)
return atoi (XSTR (exp, 0));
else if (GET_CODE (exp) == COND)
{
for (i = 0; i < XVECLEN (exp, 0); i += 2)
{
current_or |= or_attr_value (XVECEXP (exp, 0, i + 1));
}
current_or |= or_attr_value (XEXP (exp, 1));
}
else if (GET_CODE (exp) == IF_THEN_ELSE)
{
current_or = or_attr_value (XEXP (exp, 1));
current_or |= or_attr_value (XEXP (exp, 2));
}
else
abort ();
return current_or;
}
/* Scan an attribute value, possibly a conditional, and record what actions
will be required to do any conditional tests in it.
......@@ -5795,7 +5853,7 @@ write_const_num_delay_slots ()
printf (" default:\n");
printf (" return 1;\n");
printf (" }\n}\n");
printf (" }\n}\n\n");
}
}
......@@ -5982,6 +6040,8 @@ from the machine description file `md'. */\n\n");
/* Write out constant delay slot info */
write_const_num_delay_slots ();
write_length_unit_log ();
fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */
......
......@@ -6154,25 +6154,30 @@ instead of inline unwinders and __unwind_function in the non-setjmp case.
This describes commands for alignment.
@table @code
@findex ASM_OUTPUT_ALIGN_CODE
@item ASM_OUTPUT_ALIGN_CODE (@var{file})
A C expression to output text to align the location counter in the way
that is desirable at a point in the code that is reached only by
jumping.
@findex LABEL_ALIGN_AFTER_BARRIER
@item LABEL_ALIGN_AFTER_BARRIER (@var{label})
The alignment (log base 2) to put in front of @var{label}, which follows
a BARRIER.
This macro need not be defined if you don't want any special alignment
to be done at such a time. Most machine descriptions do not currently
define the macro.
@findex ASM_OUTPUT_LOOP_ALIGN
@item ASM_OUTPUT_LOOP_ALIGN (@var{file})
A C expression to output text to align the location counter in the way
that is desirable at the beginning of a loop.
@findex LOOP_ALIGN
@item LOOP_ALIGN (@var{label})
The alignment (log base 2) to put in front of @var{label}, which follows
a NOTE_INSN_LOOP_BEG note.
This macro need not be defined if you don't want any special alignment
to be done at such a time. Most machine descriptions do not currently
define the macro.
@findex LABEL_ALIGN
@item LABEL_ALIGN (@var{label})
The alignment (log base 2) to put in front of @var{label}.
If LABEL_ALIGN_AFTER_BARRIER / LOOP_ALIGN specify a different alignment,
the maximum of the specified values is used.
@findex ASM_OUTPUT_SKIP
@item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
A C statement to output to the stdio stream @var{stream} an assembler
......
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