added top element size computation information
This commit is contained in:
parent
5c85d84228
commit
6dc5c01551
3 changed files with 114 additions and 47 deletions
|
@ -49,7 +49,7 @@ occam.X:
|
||||||
cd occam; make "PIC="$(PIC) "TBL="$(TBL) "EQN="$(EQN) "TARGET="$(TARGET)
|
cd occam; make "PIC="$(PIC) "TBL="$(TBL) "EQN="$(EQN) "TARGET="$(TARGET)
|
||||||
ego.doc: ego.X
|
ego.doc: ego.X
|
||||||
ego.X:
|
ego.X:
|
||||||
cd ego; make "REFER="$(REFER) "TARGET="$(TARGET)
|
cd ego; make "REFER="$(REFER) "TARGET="$(TARGET) "TBL="$(TBL)
|
||||||
em.$(SUF): em.X
|
em.$(SUF): em.X
|
||||||
em.X:
|
em.X:
|
||||||
cd em; make "TBL="$(TBL) "NROFF="$(NROFF) "SUF="$(SUF) "TARGET="$(TARGET)
|
cd em; make "TBL="$(TBL) "NROFF="$(NROFF) "SUF="$(SUF) "TARGET="$(TARGET)
|
||||||
|
|
|
@ -98,8 +98,8 @@ Truncation is always to the nearest floating-point number that can
|
||||||
be represented.
|
be represented.
|
||||||
.NS A.6.3.7
|
.NS A.6.3.7
|
||||||
.IP -
|
.IP -
|
||||||
The type returned by the sizeof-operator is 'unsigned int'. This is done
|
The type returned by the sizeof-operator (also known as size_t)
|
||||||
for backward compatibility reasons.
|
is 'unsigned int'. This is done for backward compatibility reasons.
|
||||||
.IP -
|
.IP -
|
||||||
Casting an integer to a pointer or vice versa has no effect in
|
Casting an integer to a pointer or vice versa has no effect in
|
||||||
bit-pattern when the sizes are equal. Otherwise the value will be
|
bit-pattern when the sizes are equal. Otherwise the value will be
|
||||||
|
|
87
doc/ncg.doc
87
doc/ncg.doc
|
@ -301,16 +301,17 @@ Here is a list of reserved words; all of these are unavailable as identifiers.
|
||||||
.TS
|
.TS
|
||||||
box;
|
box;
|
||||||
l l l l l.
|
l l l l l.
|
||||||
ADDR STACK from proc sfit
|
ADDR STACKINGRULES gen proc test
|
||||||
COERCIONS STACKINGRULES gen reg_any test
|
COERCIONS TESTS highw reg_any to
|
||||||
INSTRUCTIONS TESTS highw reg_float to
|
INSTRUCTIONS TIMEFACTOR inreg reg_float topeltsize
|
||||||
INT TIMEFACTOR inreg reg_loop ufit
|
INT TOKENS is_rom reg_loop ufit
|
||||||
MOVES TOKENS is_rom reg_pointer uses
|
MOVES call kills reg_pointer uses
|
||||||
PATTERNS call kills regvar with
|
PATTERNS cost lab regvar with
|
||||||
PROPERTIES cost leaving return yields
|
PROPERTIES defined labeldef return yields
|
||||||
REGISTERS defined loww reusing
|
REGISTERS exact leaving reusing
|
||||||
SETS exact move rom
|
SETS example loww rom
|
||||||
SIZEFACTOR example pat samesign
|
SIZEFACTOR fallthrough move samesign
|
||||||
|
STACK from pat sfit
|
||||||
.TE
|
.TE
|
||||||
C style comments are accepted.
|
C style comments are accepted.
|
||||||
.DS
|
.DS
|
||||||
|
@ -928,6 +929,17 @@ If
|
||||||
.I t
|
.I t
|
||||||
is omitted reg_any is assumed.
|
is omitted reg_any is assumed.
|
||||||
Undefined if inreg(\fIe\fP)<=0 .
|
Undefined if inreg(\fIe\fP)<=0 .
|
||||||
|
.LP
|
||||||
|
The next two `functions' are only needed in a table that
|
||||||
|
uses the top element size information.
|
||||||
|
.IP topeltsize($a) 16
|
||||||
|
Returns the size of the element on top of the EM-stack at the label
|
||||||
|
identified by $a. This can be used to put the top of the stack in a
|
||||||
|
register at the moment of an unconditional jump. At an unconditional jump,
|
||||||
|
the size of the top-element will always look 0.
|
||||||
|
.IP fallthrough($a)
|
||||||
|
Returns 1 if the label identified by $a can be reached via fallthrough, 0
|
||||||
|
otherwise.
|
||||||
.NH 2
|
.NH 2
|
||||||
Token descriptions
|
Token descriptions
|
||||||
.PP
|
.PP
|
||||||
|
@ -1017,6 +1029,13 @@ This rule of three is an unfortunate implementation dependent restriction,
|
||||||
but patterns longer than three EM instructions are luckily not needed
|
but patterns longer than three EM instructions are luckily not needed
|
||||||
too often.
|
too often.
|
||||||
.PP
|
.PP
|
||||||
|
The EM mnemonic may also be the pseudo-instruction \fBlab\fP, which matches
|
||||||
|
a label. Its argument can be used in testing on topeltsize and
|
||||||
|
fallthrough. When this pattern is specified, the label should be defined
|
||||||
|
explicitly with a
|
||||||
|
.I labeldef
|
||||||
|
statement.
|
||||||
|
.PP
|
||||||
Following the EM-pattern there may be more than one code
|
Following the EM-pattern there may be more than one code
|
||||||
rule,
|
rule,
|
||||||
.I cg
|
.I cg
|
||||||
|
@ -1308,6 +1327,16 @@ C-routine
|
||||||
Explanation of this must wait for the description of the
|
Explanation of this must wait for the description of the
|
||||||
file mach.c below.
|
file mach.c below.
|
||||||
.IP 5)
|
.IP 5)
|
||||||
|
The
|
||||||
|
.I labeldef
|
||||||
|
statement. Its only argument should be that of the
|
||||||
|
.I lab
|
||||||
|
pseudo-instruction. This is needed to generate local labels when the
|
||||||
|
top element size information is used. It takes the form
|
||||||
|
.DS
|
||||||
|
labeldef $i
|
||||||
|
.DE
|
||||||
|
.IP 6)
|
||||||
A temporary label of the form <digit>: may be placed here.
|
A temporary label of the form <digit>: may be placed here.
|
||||||
Expressions of the form [0-9][bf] in this code rule
|
Expressions of the form [0-9][bf] in this code rule
|
||||||
generate the same string as is used for this label.
|
generate the same string as is used for this label.
|
||||||
|
@ -1552,6 +1581,35 @@ A simple jump.
|
||||||
The stack pattern guarantees that everything will be stacked
|
The stack pattern guarantees that everything will be stacked
|
||||||
before the jump is taken.
|
before the jump is taken.
|
||||||
.DS
|
.DS
|
||||||
|
pat lab topeltsize($1)==2 && !fallthrough($1)
|
||||||
|
gen labeldef $1 yields r0
|
||||||
|
|
||||||
|
pat lab topeltsize($1)==2 && fallthrough($1)
|
||||||
|
with src2
|
||||||
|
gen move %1,r0
|
||||||
|
labeldef $1 yields r0
|
||||||
|
|
||||||
|
pat lab topeltsize($1)!=2
|
||||||
|
with STACK
|
||||||
|
kills all
|
||||||
|
gen labeldef $1
|
||||||
|
|
||||||
|
pat bra topeltsize($1)==2
|
||||||
|
with src2 STACK
|
||||||
|
gen move %1,d0
|
||||||
|
jbr {label, $1}
|
||||||
|
|
||||||
|
pat bra topeltsize($1)!=2
|
||||||
|
with STACK
|
||||||
|
gen jbr {label, $1}
|
||||||
|
.DE
|
||||||
|
The combination of these patterns make sure that the top of the EM-stack will
|
||||||
|
be in register r0 whenever necessary. The top element size mechanism will
|
||||||
|
also show a size of 0 whenever a conditional branch to a label
|
||||||
|
occurs. This saves a lot of patterns and hardly decreases performance.
|
||||||
|
When the same register is used to return function results, this can save
|
||||||
|
many moves to and from the stack.
|
||||||
|
.DS
|
||||||
.ta 7.5c
|
.ta 7.5c
|
||||||
pat cal
|
pat cal
|
||||||
with STACK
|
with STACK
|
||||||
|
@ -2738,6 +2796,11 @@ DO_RETURN
|
||||||
Returns from this level of codegen().
|
Returns from this level of codegen().
|
||||||
Is used at the end of coercions,
|
Is used at the end of coercions,
|
||||||
move rules etc..
|
move rules etc..
|
||||||
|
.NH 4
|
||||||
|
DO_LABDEF
|
||||||
|
.PP
|
||||||
|
This prints a label when the top element size mechanism is used. Only done on
|
||||||
|
toplevel.
|
||||||
.NH 3
|
.NH 3
|
||||||
compute.c
|
compute.c
|
||||||
.PP
|
.PP
|
||||||
|
@ -2803,6 +2866,10 @@ This module maintains a list of global symbols that have a
|
||||||
pseudo associated.
|
pseudo associated.
|
||||||
There are functions to enter a symbol and to find a symbol.
|
There are functions to enter a symbol and to find a symbol.
|
||||||
.NH 3
|
.NH 3
|
||||||
|
label.c
|
||||||
|
.PP
|
||||||
|
This module contains routines to handle the top element size messages.
|
||||||
|
.NH 3
|
||||||
main.c
|
main.c
|
||||||
.PP
|
.PP
|
||||||
Main routine of the code generator.
|
Main routine of the code generator.
|
||||||
|
|
Loading…
Reference in a new issue