Merge from default (merging in George Koehler's PowerPC changes).
This commit is contained in:
commit
a8c4dac67c
|
@ -8,7 +8,8 @@
|
||||||
program hilo(input, output);
|
program hilo(input, output);
|
||||||
|
|
||||||
type
|
type
|
||||||
string = array [0..255] of char;
|
string = packed array [0..255] of char;
|
||||||
|
charstar = packed array [0..0] of char;
|
||||||
|
|
||||||
var
|
var
|
||||||
playing : Boolean;
|
playing : Boolean;
|
||||||
|
@ -34,18 +35,18 @@ function random(range : integer) : integer;
|
||||||
that conflicts with a Pascal keyword. Luckily there's a private function
|
that conflicts with a Pascal keyword. Luckily there's a private function
|
||||||
uread() in the ACK Pascal library that we can use instead. }
|
uread() in the ACK Pascal library that we can use instead. }
|
||||||
|
|
||||||
function uread(fd : integer; var buffer : char; count : integer) : integer;
|
function uread(fd : integer; var buffer : charstar; count : integer) : integer;
|
||||||
extern;
|
extern;
|
||||||
|
|
||||||
function readchar : char;
|
function readchar : char;
|
||||||
var
|
var
|
||||||
c : char;
|
c : charstar;
|
||||||
dummy : integer;
|
dummy : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
c := chr(0);
|
c[0] := chr(0);
|
||||||
dummy := uread(0, c, 1);
|
dummy := uread(0, c, 1);
|
||||||
readchar := c;
|
readchar := c[0];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure readstring(var buffer : string; var length : integer);
|
procedure readstring(var buffer : string; var length : integer);
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#define DO_TOSTACK 23
|
#define DO_TOSTACK 23
|
||||||
#define DO_KILLREG 24
|
#define DO_KILLREG 24
|
||||||
#define DO_LABDEF 25
|
#define DO_LABDEF 25
|
||||||
#define DO_STACKADJUST 26
|
|
||||||
|
|
||||||
#ifndef MAXATT
|
#ifndef MAXATT
|
||||||
#define MAXATT TOKENSIZE
|
#define MAXATT TOKENSIZE
|
||||||
|
@ -134,7 +133,6 @@ typedef struct exprnode *node_p;
|
||||||
#define EX_ISROM 44
|
#define EX_ISROM 44
|
||||||
#define EX_TOPELTSIZE 45
|
#define EX_TOPELTSIZE 45
|
||||||
#define EX_FALLTHROUGH 46
|
#define EX_FALLTHROUGH 46
|
||||||
#define EX_STACKOFFSET 47
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct { /* to stack coercions */
|
typedef struct { /* to stack coercions */
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
%token <y_word> OP_TO_RA_SI
|
%token <y_word> OP_TO_RA_SI
|
||||||
|
|
||||||
%token <y_word> OP_LA
|
%token <y_word> OP_LA
|
||||||
|
%token <y_word> OP_LI32
|
||||||
|
|
||||||
/* Other token types */
|
/* Other token types */
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@
|
||||||
|
|
||||||
/* Special instructions */
|
/* Special instructions */
|
||||||
|
|
||||||
|
0, OP_LI32, 0, "li32",
|
||||||
0, OP_LA, 0, "la",
|
0, OP_LA, 0, "la",
|
||||||
0, OP_LA, 0, "li",
|
0, OP_LA, 0, "li",
|
||||||
0, OP_RS_RA_RA_C, 31<<26 | 444<<1, "mr",
|
0, OP_RS_RA_RA_C, 31<<26 | 444<<1, "mr",
|
||||||
|
|
|
@ -59,7 +59,7 @@ operation
|
||||||
| OP_LEV u7 { emit4($1 | ($2<<5)); }
|
| OP_LEV u7 { emit4($1 | ($2<<5)); }
|
||||||
| OP_LIA lia { emit4($1 | $2); }
|
| OP_LIA lia { emit4($1 | $2); }
|
||||||
| OP_LIL lil { emit4($1 | $2); }
|
| OP_LIL lil { emit4($1 | $2); }
|
||||||
| OP_LA la /* emitted in subrule */
|
| OP_LI32 li32 /* emitted in subrule */
|
||||||
;
|
;
|
||||||
|
|
||||||
c
|
c
|
||||||
|
@ -194,7 +194,7 @@ bda
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
la
|
li32
|
||||||
: GPR ',' expr
|
: GPR ',' expr
|
||||||
{
|
{
|
||||||
quad type = $3.typ & S_TYP;
|
quad type = $3.typ & S_TYP;
|
||||||
|
|
|
@ -13,10 +13,14 @@
|
||||||
! r3 = ptr to descriptor
|
! r3 = ptr to descriptor
|
||||||
! r4 = index
|
! r4 = index
|
||||||
! r5 = address of array
|
! r5 = address of array
|
||||||
|
! Yields:
|
||||||
|
! r3 = address of element
|
||||||
|
! r0 = size of element (used by .lar4, .sar4)
|
||||||
|
! Preserves r10 for .lar4, .sar4
|
||||||
|
|
||||||
.define .aar4
|
.define .aar4
|
||||||
.aar4:
|
.aar4:
|
||||||
la r0, .trap_earray
|
li32 r0, .trap_earray
|
||||||
mtspr ctr, r0 ! load CTR with trap address
|
mtspr ctr, r0 ! load CTR with trap address
|
||||||
|
|
||||||
lwz r0, 0(r3)
|
lwz r0, 0(r3)
|
||||||
|
|
|
@ -3,7 +3,6 @@ for _, plat in ipairs(vars.plats) do
|
||||||
name = "lib_"..plat,
|
name = "lib_"..plat,
|
||||||
srcs = {
|
srcs = {
|
||||||
"./*.s",
|
"./*.s",
|
||||||
"./*.c"
|
|
||||||
},
|
},
|
||||||
vars = { plat = plat },
|
vars = { plat = plat },
|
||||||
deps = {
|
deps = {
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
.define .cfu8
|
.define .cfu8
|
||||||
.cfu8:
|
.cfu8:
|
||||||
la r3, .fd_00000000
|
li32 r3, .fd_00000000
|
||||||
lfd f0, 0(r3) ! f0 = 0.0
|
lfd f0, 0(r3) ! f0 = 0.0
|
||||||
|
|
||||||
lfd f1, 0(sp) ! value to be converted
|
lfd f1, 0(sp) ! value to be converted
|
||||||
|
|
||||||
la r3, .fd_FFFFFFFF
|
li32 r3, .fd_FFFFFFFF
|
||||||
lfd f3, 0(r3) ! f3 = 0xFFFFFFFF
|
lfd f3, 0(r3) ! f3 = 0xFFFFFFFF
|
||||||
|
|
||||||
la r3, .fd_80000000
|
li32 r3, .fd_80000000
|
||||||
lfd f4, 0(r3) ! f4 = 0x80000000
|
lfd f4, 0(r3) ! f4 = 0x80000000
|
||||||
|
|
||||||
fsel f2, f1, f1, f0
|
fsel f2, f1, f1, f0
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
lfd f0, 0(sp) ! load value
|
lfd f0, 0(sp) ! load value
|
||||||
|
|
||||||
la r3, pivot
|
li32 r3, pivot
|
||||||
lfd f1, 0(r3) ! load pivot value
|
lfd f1, 0(r3) ! load pivot value
|
||||||
fsub f0, f0, f1 ! adjust
|
fsub f0, f0, f1 ! adjust
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
lfd f0, 0(sp) ! load value
|
lfd f0, 0(sp) ! load value
|
||||||
|
|
||||||
la r3, pivot
|
li32 r3, pivot
|
||||||
lfd f1, 0(r3) ! load pivot value
|
lfd f1, 0(r3) ! load pivot value
|
||||||
fsub f0, f0, f1 ! adjust
|
fsub f0, f0, f1 ! adjust
|
||||||
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* $Source$
|
|
||||||
* $State$
|
|
||||||
* $Revision$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* no headers allowed! */
|
|
||||||
|
|
||||||
/* Given a double, calculates the mantissa and exponent.
|
|
||||||
*
|
|
||||||
* This function is intended to be called internally by the code generator,
|
|
||||||
* so the calling convention is odd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int __fef8(double* fp)
|
|
||||||
{
|
|
||||||
double f = *fp;
|
|
||||||
int exponent, sign;
|
|
||||||
|
|
||||||
if (f == 0.0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (f < 0.0)
|
|
||||||
{
|
|
||||||
sign = -1;
|
|
||||||
f = -f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sign = 0;
|
|
||||||
|
|
||||||
exponent = 0;
|
|
||||||
while (f >= 1.0)
|
|
||||||
{
|
|
||||||
f /= 2.0;
|
|
||||||
exponent++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (f < 0.5)
|
|
||||||
{
|
|
||||||
f *= 2.0;
|
|
||||||
exponent--;
|
|
||||||
}
|
|
||||||
|
|
||||||
*fp = (sign) ? -f : f;
|
|
||||||
return exponent;
|
|
||||||
}
|
|
58
mach/powerpc/libem/fef8.s
Normal file
58
mach/powerpc/libem/fef8.s
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#include "powerpc.h"
|
||||||
|
|
||||||
|
.sect .text
|
||||||
|
|
||||||
|
! Split a double-precision float into fraction and exponent, like
|
||||||
|
! frexp(3) in C. On entry:
|
||||||
|
! r3 = float, high word (bits 0..31)
|
||||||
|
! r4 = float, low word (bits 32..63)
|
||||||
|
! Yields:
|
||||||
|
! r3 = fraction, high word (bits 0..31)
|
||||||
|
! r4 = fraction, low word (bits 32..63)
|
||||||
|
! r5 = exponent
|
||||||
|
! Kills: cr0 f0 f1 r6 r7
|
||||||
|
|
||||||
|
.define .fef8
|
||||||
|
.fef8:
|
||||||
|
! IEEE double-precision format:
|
||||||
|
! sign exponent fraction
|
||||||
|
! 0 1..11 12..63
|
||||||
|
rlwinm r6, r3, 12, 21, 31 ! r6 = IEEE exponent
|
||||||
|
addis r7, r0, 0x7ff0 ! r7 = exponent mask
|
||||||
|
addi r5, r6, -1022 ! r5 = true exponent
|
||||||
|
cmpi cr0, 0, r6, 2047
|
||||||
|
bclr IFTRUE, EQ, 0 ! return if infinity or NaN
|
||||||
|
cmpi cr0, 0, r6, 0
|
||||||
|
bc IFFALSE, EQ, 1f ! jump if normalized number
|
||||||
|
|
||||||
|
! Got denormalized number or zero, probably zero.
|
||||||
|
rlwinm r6, r3, 0, 12, 31
|
||||||
|
addi r5, r0, 0 ! r5 = true exponent = 0
|
||||||
|
or. r6, r6, r4 ! r6 = high|low fraction
|
||||||
|
bclr IFTRUE, EQ, 0 ! return if zero
|
||||||
|
|
||||||
|
! Got denormalized number, not zero.
|
||||||
|
stwu r4, -4(sp)
|
||||||
|
stwu r3, -4(sp)
|
||||||
|
li32 r6, _2_64
|
||||||
|
lfd f0, 0(sp)
|
||||||
|
lfd f1, 0(r6)
|
||||||
|
fmul f0, f0, f1 ! multiply it by 2**64
|
||||||
|
stfd f0, 0(sp)
|
||||||
|
lwz r3, 0(sp)
|
||||||
|
lwz r4, 4(sp)
|
||||||
|
rlwinm r6, r3, 12, 21, 31 ! r6 = IEEE exponent
|
||||||
|
addi sp, sp, 8
|
||||||
|
addi r5, r6, -1022 - 64 ! r5 = true exponent
|
||||||
|
1:
|
||||||
|
! Put fraction in [0.5, 1) or (-1, -0.5] by setting its
|
||||||
|
! exponent to true 0, IEEE 1022.
|
||||||
|
andc r3, r3, r7 ! clear old exponent
|
||||||
|
oris r3, r3, 1022 << 4 ! set new exponent
|
||||||
|
bclr ALWAYS, 0, 0
|
||||||
|
|
||||||
|
.sect .rom
|
||||||
|
_2_64:
|
||||||
|
! (double) 2**64
|
||||||
|
.data4 0x43f00000
|
||||||
|
.data4 0x00000000
|
|
@ -1,38 +1,71 @@
|
||||||
#
|
|
||||||
! $Source$
|
|
||||||
! $State$
|
|
||||||
! $Revision$
|
|
||||||
|
|
||||||
#include "powerpc.h"
|
#include "powerpc.h"
|
||||||
|
|
||||||
.sect .text
|
.sect .text
|
||||||
|
|
||||||
! Multiplies two floats, and returns the fraction and integer.
|
! Multiplies two double-precision floats, then splits the product into
|
||||||
|
! integer and fraction, like modf(3) in C. On entry:
|
||||||
|
! f1 = float
|
||||||
|
! f2 = other float
|
||||||
|
! Yields:
|
||||||
|
! f1 = fraction
|
||||||
|
! f2 = integer
|
||||||
|
! Kills: cr0 f1 f2 r3 r4 r5 r6
|
||||||
|
|
||||||
.define .fif8
|
.define .fif8
|
||||||
.fif8:
|
.fif8:
|
||||||
lfd f0, 8(sp)
|
fmul f1, f1, f2
|
||||||
lfd f1, 0(sp)
|
stfdu f1, -8(sp) ! push f1 = product
|
||||||
fmul f0, f0, f1
|
lwz r3, 0(sp) ! r3 = high word
|
||||||
fabs f1, f0 ! f0 = result
|
lwz r4, 4(sp) ! r4 = low word
|
||||||
|
|
||||||
! The following chunk does f1 = floor(f1). See page 158 of the book.
|
|
||||||
|
|
||||||
mtfsfi cr7, 3 ! set rounding mode to -inf.
|
|
||||||
mtfsb0 23
|
|
||||||
fctid f2, f1
|
|
||||||
fcfid f2, f2
|
|
||||||
mcrfs cr7, cr5
|
|
||||||
bc IFFALSE, 31, toobig
|
|
||||||
fmr f1, f2
|
|
||||||
toobig:
|
|
||||||
|
|
||||||
fabs f2, f1 ! f2 = fabs(f1)
|
! IEEE double-precision format:
|
||||||
fsub f2, f2, f1
|
! sign exponent fraction
|
||||||
stfd f2, 8(sp)
|
! 0 1..11 12..63
|
||||||
|
! Subtract 1023 from the IEEE exponent. If the result is from
|
||||||
fneg f2, f1
|
! 0 to 51, then the IEEE fraction has that many integer bits.
|
||||||
fsel f2, f0, f1, f2
|
! (IEEE has an implicit 1 before its fraction. If the IEEE
|
||||||
stfd f2, 0(sp)
|
! fraction has 0 integer bits, we still have an integer.)
|
||||||
|
rlwinm r5, r3, 12, 21, 31 ! r5 = IEEE exponent
|
||||||
|
addic. r5, r5, -1023 ! r5 = nr of integer bits
|
||||||
|
bc IFTRUE, LT, no_int
|
||||||
|
cmpi cr0, 0, r5, 21
|
||||||
|
bc IFTRUE, LT, small_int
|
||||||
|
cmpi cr0, 0, r5, 52
|
||||||
|
bc IFTRUE, LT, big_int
|
||||||
|
|
||||||
|
! f1 is an integer without fraction. Jump to calculate
|
||||||
|
! fraction f1 = f2 - f1. It will be zero (or perhaps NaN).
|
||||||
|
fmr f2, f1
|
||||||
|
b subtract
|
||||||
|
|
||||||
|
no_int:
|
||||||
|
! f1 is a fraction without integer.
|
||||||
|
fsub f2, f1, f1 ! integer = zero
|
||||||
|
b done
|
||||||
|
|
||||||
|
small_int:
|
||||||
|
! f1 has r5 = 0 to 20 integer bits in the IEEE fraction.
|
||||||
|
! High word has 20 - r5 fraction bits.
|
||||||
|
addi r6, r0, 20
|
||||||
|
subf r6, r5, r6
|
||||||
|
srw r3, r3, r6
|
||||||
|
addi r4, r0, 0 ! clear low word
|
||||||
|
slw r3, r3, r6 ! clear fraction in high word
|
||||||
|
b move_int
|
||||||
|
|
||||||
|
big_int:
|
||||||
|
! f1 has r5 = 21 to 51 to integer bits.
|
||||||
|
! Low word has 52 - r5 fraction bits.
|
||||||
|
addi r6, r0, 52
|
||||||
|
subf r6, r5, r6
|
||||||
|
srw r4, r4, r6
|
||||||
|
slw r4, r4, r6 ! clear fraction in low word
|
||||||
|
move_int:
|
||||||
|
stw r3, 0(sp)
|
||||||
|
stw r4, 4(sp)
|
||||||
|
lfd f2, 0(sp) ! f2 = integer
|
||||||
|
subtract:
|
||||||
|
fsub f1, f1, f2 ! fraction = value - integer
|
||||||
|
done:
|
||||||
|
addi sp, sp, 8 ! restore stack pointer
|
||||||
bclr ALWAYS, 0, 0
|
bclr ALWAYS, 0, 0
|
||||||
|
|
43
mach/powerpc/libem/lar4.s
Normal file
43
mach/powerpc/libem/lar4.s
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#
|
||||||
|
#include "powerpc.h"
|
||||||
|
|
||||||
|
.sect .text
|
||||||
|
|
||||||
|
! Load from bounds-checked array.
|
||||||
|
!
|
||||||
|
! On entry:
|
||||||
|
! r3 = ptr to descriptor
|
||||||
|
! r4 = index
|
||||||
|
! r5 = address of array
|
||||||
|
|
||||||
|
.define .lar4
|
||||||
|
.lar4:
|
||||||
|
mfspr r10, lr
|
||||||
|
bl .aar4
|
||||||
|
mtspr lr, r10
|
||||||
|
! r3 = ptr to element
|
||||||
|
! r0 = size of element
|
||||||
|
|
||||||
|
cmpi cr0, 0, r0, 1
|
||||||
|
bc IFFALSE, EQ, 1f
|
||||||
|
! Load 1 byte.
|
||||||
|
lbz r4, 0(r3)
|
||||||
|
stwu r4, -4(sp)
|
||||||
|
bclr ALWAYS, 0, 0
|
||||||
|
1:
|
||||||
|
cmpi cr0, 0, r0, 2
|
||||||
|
bc IFFALSE, EQ, 2f
|
||||||
|
! Load 2 bytes.
|
||||||
|
lhz r4, 0(r3)
|
||||||
|
stwu r4, -4(sp)
|
||||||
|
bclr ALWAYS, 0, 0
|
||||||
|
2:
|
||||||
|
! Load r0 bytes, where r0 must be a positive multiple of 4.
|
||||||
|
subf sp, r0, sp ! move stack pointer down
|
||||||
|
or r5, r0, r0 ! index r5 = length r0
|
||||||
|
3:
|
||||||
|
addic. r5, r5, -4 ! r5 -= 4
|
||||||
|
lwzx r4, r5, r3
|
||||||
|
stwx r4, r5, sp
|
||||||
|
bc IFTRUE, GT, 3b ! loop if r5 > 0
|
||||||
|
bclr ALWAYS, 0, 0
|
45
mach/powerpc/libem/sar4.s
Normal file
45
mach/powerpc/libem/sar4.s
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#
|
||||||
|
#include "powerpc.h"
|
||||||
|
|
||||||
|
.sect .text
|
||||||
|
|
||||||
|
! Store to bounds-checked array.
|
||||||
|
!
|
||||||
|
! On entry:
|
||||||
|
! r3 = ptr to descriptor
|
||||||
|
! r4 = index
|
||||||
|
! r5 = address of array
|
||||||
|
|
||||||
|
.define .sar4
|
||||||
|
.sar4:
|
||||||
|
mfspr r10, lr
|
||||||
|
bl .aar4
|
||||||
|
mtspr lr, r10
|
||||||
|
! r3 = ptr to element
|
||||||
|
! r0 = size of element
|
||||||
|
|
||||||
|
cmpi cr0, 0, r0, 1
|
||||||
|
bc IFFALSE, EQ, 1f
|
||||||
|
! Store 1 byte.
|
||||||
|
lwz r4, 0(sp)
|
||||||
|
addi sp, sp, 4
|
||||||
|
stb r4, 0(r3)
|
||||||
|
bclr ALWAYS, 0, 0
|
||||||
|
1:
|
||||||
|
cmpi cr0, 0, r0, 2
|
||||||
|
bc IFFALSE, EQ, 2f
|
||||||
|
! Store 2 bytes.
|
||||||
|
lwz r4, 0(sp)
|
||||||
|
addi sp, sp, 4
|
||||||
|
sth r4, 0(r3)
|
||||||
|
bclr ALWAYS, 0, 0
|
||||||
|
2:
|
||||||
|
! Store r0 bytes, where r0 must be a positive multiple of 4.
|
||||||
|
or r5, r0, r0 ! index r5 = length r0
|
||||||
|
3:
|
||||||
|
addic. r5, r5, -4 ! r5 -= 4
|
||||||
|
lwzx r4, r5, sp
|
||||||
|
stwx r4, r5, r3
|
||||||
|
bc IFTRUE, GT, 3b ! loop if r5 > 0
|
||||||
|
add sp, r0, sp ! move stack pointer up
|
||||||
|
bclr ALWAYS, 0, 0
|
|
@ -389,7 +389,7 @@ PATTERNS
|
||||||
|
|
||||||
out:(long)reg = FROMUI.L(in:(int)reg)
|
out:(long)reg = FROMUI.L(in:(int)reg)
|
||||||
emit "mr %out.0, %in"
|
emit "mr %out.0, %in"
|
||||||
emit "li %out.1, 0"
|
emit "li32 %out.1, 0"
|
||||||
cost 8;
|
cost 8;
|
||||||
|
|
||||||
out:(ret)reg = FROMF.I(in:(dret)reg)
|
out:(ret)reg = FROMF.I(in:(dret)reg)
|
||||||
|
@ -661,15 +661,15 @@ PATTERNS
|
||||||
ALUCC(EOR.I, "xori")
|
ALUCC(EOR.I, "xori")
|
||||||
|
|
||||||
out:(int)reg = value:LABEL.I
|
out:(int)reg = value:LABEL.I
|
||||||
emit "la %out, $value"
|
emit "li32 %out, $value"
|
||||||
cost 4;
|
cost 4;
|
||||||
|
|
||||||
out:(int)reg = value:BLOCK.I
|
out:(int)reg = value:BLOCK.I
|
||||||
emit "la %out, $value"
|
emit "li32 %out, $value"
|
||||||
cost 4;
|
cost 4;
|
||||||
|
|
||||||
out:(int)reg = value:CONST.I
|
out:(int)reg = value:CONST.I
|
||||||
emit "li %out, $value"
|
emit "li32 %out, $value"
|
||||||
cost 8;
|
cost 8;
|
||||||
|
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ PATTERNS
|
||||||
|
|
||||||
out:(float)reg = in:CONST.F
|
out:(float)reg = in:CONST.F
|
||||||
when specific_constant(%in, 0)
|
when specific_constant(%in, 0)
|
||||||
emit "la r0, .fd_00000000"
|
emit "li32 r0, .fd_00000000"
|
||||||
emit "lfs %out, 0(r0)"
|
emit "lfs %out, 0(r0)"
|
||||||
cost 12;
|
cost 12;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -909,23 +909,6 @@ normalfailed: if (stackpad!=tokpatlen) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef USE_NOFRAMEPOINTER
|
|
||||||
case DO_STACKADJUST: {
|
|
||||||
result_t result;
|
|
||||||
int nodeno;
|
|
||||||
|
|
||||||
DEBUG("STACKADJUST");
|
|
||||||
/* The offset is an expression, which we need to evaluate. */
|
|
||||||
|
|
||||||
getint(nodeno,codep);
|
|
||||||
compute(&enodes[nodeno], &result);
|
|
||||||
assert(result.e_typ==EV_INT);
|
|
||||||
|
|
||||||
if (toplevel)
|
|
||||||
stackoffset += result.e_v.e_con;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,6 @@ extern rl_p curreglist; /* side effect of findcoerc() */
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
extern int Debug; /* on/off debug printout */
|
extern int Debug; /* on/off debug printout */
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_NOFRAMEPOINTER
|
|
||||||
extern int stackoffset; /* offset from localbase to sp */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Next descriptions are external declarations for tables created
|
* Next descriptions are external declarations for tables created
|
||||||
|
|
|
@ -41,7 +41,14 @@ begtext:
|
||||||
stwu r3, -4(sp)
|
stwu r3, -4(sp)
|
||||||
|
|
||||||
b __m_a_i_n
|
b __m_a_i_n
|
||||||
|
|
||||||
|
! Define symbols at the beginning of our various segments, so that we can find
|
||||||
|
! them. (Except .text, which has already been done.)
|
||||||
|
|
||||||
|
.sect .data; begdata:
|
||||||
|
.sect .rom; begrom:
|
||||||
|
.sect .bss; begbss:
|
||||||
|
|
||||||
! Some magic data. All EM systems need these.
|
! Some magic data. All EM systems need these.
|
||||||
|
|
||||||
.define _errno
|
.define _errno
|
||||||
|
@ -50,7 +57,3 @@ begtext:
|
||||||
.define .trppc, .ignmask
|
.define .trppc, .ignmask
|
||||||
.comm .trppc, 4 ! ptr to user trap handler
|
.comm .trppc, 4 ! ptr to user trap handler
|
||||||
.comm .ignmask, 4 ! user trap ignore mask
|
.comm .ignmask, 4 ! user trap ignore mask
|
||||||
|
|
||||||
.define .linenumber, .filename
|
|
||||||
.comm .linenumber, 4 ! current linenumber (used for debugging)
|
|
||||||
.comm .filename, 4 ! ptr to current filename (used for debugging)
|
|
||||||
|
|
|
@ -10,10 +10,16 @@ build_mcg {
|
||||||
arch = "powerpc",
|
arch = "powerpc",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_ncg {
|
||||||
|
name = "ncg",
|
||||||
|
arch = "powerpc",
|
||||||
|
}
|
||||||
|
|
||||||
return installable {
|
return installable {
|
||||||
name = "tools",
|
name = "tools",
|
||||||
map = {
|
map = {
|
||||||
["$(PLATDEP)/linuxppc/as"] = "+as",
|
["$(PLATDEP)/linuxppc/as"] = "+as",
|
||||||
|
["$(PLATDEP)/linuxppc/ncg"] = "+ncg",
|
||||||
["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
|
["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
|
||||||
["$(PLATIND)/descr/linuxppc"] = "./descr",
|
["$(PLATIND)/descr/linuxppc"] = "./descr",
|
||||||
"util/opt+pkg",
|
"util/opt+pkg",
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# $Source: /cvsroot/tack/Ack/plat/linux386/descr,v $
|
# plat/linuxppc/descr
|
||||||
# $State: Exp $
|
|
||||||
# $Revision: 1.1 $
|
|
||||||
|
|
||||||
var w=4
|
var w=4
|
||||||
var wa=4
|
var wa=4
|
||||||
|
@ -19,8 +17,8 @@ var xa={x}
|
||||||
var ARCH=powerpc
|
var ARCH=powerpc
|
||||||
var PLATFORM=linuxppc
|
var PLATFORM=linuxppc
|
||||||
var PLATFORMDIR={EM}/share/ack/{PLATFORM}
|
var PLATFORMDIR={EM}/share/ack/{PLATFORM}
|
||||||
var CPP_F=-D__unix -D__POWERPC
|
var CPP_F=-D__unix
|
||||||
var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x80000054
|
var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x10000054
|
||||||
var C_LIB={PLATFORMDIR}/libc-ansi.a
|
var C_LIB={PLATFORMDIR}/libc-ansi.a
|
||||||
# bitfields reversed for compatibility with (g)cc.
|
# bitfields reversed for compatibility with (g)cc.
|
||||||
var CC_ALIGN=-Vr
|
var CC_ALIGN=-Vr
|
||||||
|
@ -35,6 +33,7 @@ var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi
|
||||||
name be
|
name be
|
||||||
from .m.g
|
from .m.g
|
||||||
to .s
|
to .s
|
||||||
|
# Change this back to ncg to revert to the old code generator
|
||||||
program {EM}/lib/ack/{PLATFORM}/mcg
|
program {EM}/lib/ack/{PLATFORM}/mcg
|
||||||
mapflag -gdb GF=-gdb
|
mapflag -gdb GF=-gdb
|
||||||
args {GF?} <
|
args {GF?} <
|
||||||
|
@ -65,8 +64,9 @@ name led
|
||||||
mapflag -l* LNAME={PLATFORMDIR}/lib*
|
mapflag -l* LNAME={PLATFORMDIR}/lib*
|
||||||
mapflag -fp FLOATS={EM}/{LIB}fp
|
mapflag -fp FLOATS={EM}/{LIB}fp
|
||||||
args {ALIGN} {SEPID?} \
|
args {ALIGN} {SEPID?} \
|
||||||
{PLATFORMDIR}/boot.o \
|
(.e:{HEAD}={PLATFORMDIR}/boot.o) \
|
||||||
({RTS}:.ocm.b.c={PLATFORMDIR}/c-ansi.o) \
|
({RTS}:.ocm.b={PLATFORMDIR}/c-ansi.o) \
|
||||||
|
({RTS}:.c={PLATFORMDIR}/c-ansi.o) \
|
||||||
({RTS}:.mod={PLATFORMDIR}/modula2.o) \
|
({RTS}:.mod={PLATFORMDIR}/modula2.o) \
|
||||||
({RTS}:.p={PLATFORMDIR}/pascal.o) \
|
({RTS}:.p={PLATFORMDIR}/pascal.o) \
|
||||||
-o > < \
|
-o > < \
|
||||||
|
@ -75,9 +75,10 @@ name led
|
||||||
(.mod:{TAIL}={PLATFORMDIR}/libmodula2.a) \
|
(.mod:{TAIL}={PLATFORMDIR}/libmodula2.a) \
|
||||||
(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \
|
(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \
|
||||||
(.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \
|
(.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \
|
||||||
{PLATFORMDIR}/libem.a \
|
{FLOATS?} \
|
||||||
{PLATFORMDIR}/libsys.a \
|
(.e:{TAIL}={PLATFORMDIR}/libem.a \
|
||||||
{PLATFORMDIR}/libend.a
|
{PLATFORMDIR}/libsys.a \
|
||||||
|
{PLATFORMDIR}/libend.a)
|
||||||
linker
|
linker
|
||||||
end
|
end
|
||||||
name cv
|
name cv
|
||||||
|
|
|
@ -42,7 +42,7 @@ __syscall:
|
||||||
bc IFTRUE, GT, 2f
|
bc IFTRUE, GT, 2f
|
||||||
|
|
||||||
3:
|
3:
|
||||||
la r4, _errno
|
li32 r4, _errno
|
||||||
stw r3, 0(r4)
|
stw r3, 0(r4)
|
||||||
addi r3, r0, -1
|
addi r3, r0, -1
|
||||||
bclr ALWAYS, 0, 0
|
bclr ALWAYS, 0, 0
|
||||||
|
|
|
@ -65,13 +65,13 @@ EUNIMPL = 63 ! unimplemented em-instruction called
|
||||||
|
|
||||||
addi r4, r0, 1
|
addi r4, r0, 1
|
||||||
rlwnm r4, r4, r3, 0, 31 ! calculate trap bit
|
rlwnm r4, r4, r3, 0, 31 ! calculate trap bit
|
||||||
la r5, .ignmask
|
li32 r5, .ignmask
|
||||||
lwz r5, 0(r5) ! load ignore mask
|
lwz r5, 0(r5) ! load ignore mask
|
||||||
and. r4, r4, r5 ! compare
|
and. r4, r4, r5 ! compare
|
||||||
bclr IFFALSE, EQ, 0 ! return if non-zero
|
bclr IFFALSE, EQ, 0 ! return if non-zero
|
||||||
|
|
||||||
1:
|
1:
|
||||||
la r4, .trppc
|
li32 r4, .trppc
|
||||||
lwz r5, 0(r4) ! load user trap routine
|
lwz r5, 0(r4) ! load user trap routine
|
||||||
or. r5, r5, r5 ! test
|
or. r5, r5, r5 ! test
|
||||||
bc IFTRUE, EQ, fatal ! if no user trap routine, bail out
|
bc IFTRUE, EQ, fatal ! if no user trap routine, bail out
|
||||||
|
@ -92,7 +92,7 @@ EUNIMPL = 63 ! unimplemented em-instruction called
|
||||||
|
|
||||||
fatal:
|
fatal:
|
||||||
addi r3, r0, 1
|
addi r3, r0, 1
|
||||||
la r4, message
|
li32 r4, message
|
||||||
addi r5, r0, 6
|
addi r5, r0, 6
|
||||||
addi r0, r0, 4 ! write()
|
addi r0, r0, 4 ! write()
|
||||||
sc 0
|
sc 0
|
||||||
|
|
|
@ -38,7 +38,7 @@ int Xstackflag=0; /* set in coercions, moves, and tests. %1 means something
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct varinfo *gen_inst(),*gen_move(),*gen_test(),*gen_preturn(),*gen_tlab();
|
struct varinfo *gen_inst(),*gen_move(),*gen_test(),*gen_preturn(),*gen_tlab();
|
||||||
struct varinfo *gen_label(), *gen_stackadjust(), *make_erase();
|
struct varinfo *gen_label(), *make_erase();
|
||||||
expr_t make_expr(),ident_expr(),subreg_expr(),tokm_expr(),all_expr();
|
expr_t make_expr(),ident_expr(),subreg_expr(),tokm_expr(),all_expr();
|
||||||
expr_t perc_ident_expr(),sum_expr(),regvar_expr();
|
expr_t perc_ident_expr(),sum_expr(),regvar_expr();
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ iocc_t iops[20];
|
||||||
%token TOPELTSIZE FALLTHROUGH LABELDEF
|
%token TOPELTSIZE FALLTHROUGH LABELDEF
|
||||||
%token PROC CALL EXAMPLE
|
%token PROC CALL EXAMPLE
|
||||||
%token FROM TO
|
%token FROM TO
|
||||||
%token TEST MOVE STACK RETURN STACKADJUST
|
%token TEST MOVE STACK RETURN
|
||||||
%token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING
|
%token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING
|
||||||
%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM STACKOFFSET
|
%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM
|
||||||
%token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP
|
%token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP
|
||||||
%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
|
%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
|
||||||
%token <yy_int> ADORNACCESS
|
%token <yy_int> ADORNACCESS
|
||||||
|
@ -635,8 +635,8 @@ coderule
|
||||||
maxempatlen=empatlen;
|
maxempatlen=empatlen;
|
||||||
}
|
}
|
||||||
patterns
|
patterns
|
||||||
{ /* if (!saferulefound)
|
{ if (!saferulefound)
|
||||||
error("Previous rule impossible on empty stack"); */
|
error("Previous rule impossible on empty stack");
|
||||||
outpatterns();
|
outpatterns();
|
||||||
}
|
}
|
||||||
| PROC IDENT example
|
| PROC IDENT example
|
||||||
|
@ -849,8 +849,6 @@ gen_instruction
|
||||||
{ $$ = gen_label($2-1); use_tes++; }
|
{ $$ = gen_label($2-1); use_tes++; }
|
||||||
| RETURN
|
| RETURN
|
||||||
{ $$ = gen_preturn(); }
|
{ $$ = gen_preturn(); }
|
||||||
| STACKADJUST expr
|
|
||||||
{ $$ = gen_stackadjust($2.ex_index); use_noframepointer++; }
|
|
||||||
;
|
;
|
||||||
optstar
|
optstar
|
||||||
: /* empty */
|
: /* empty */
|
||||||
|
@ -1030,8 +1028,6 @@ expr
|
||||||
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
|
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
|
||||||
| HIGHW '(' emarg ')'
|
| HIGHW '(' emarg ')'
|
||||||
{ $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); }
|
{ $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); }
|
||||||
| STACKOFFSET '(' ')'
|
|
||||||
{ $$ = make_expr(TYPINT,EX_STACKOFFSET, 0, 0); }
|
|
||||||
/* Excluded, because it causes a shift-reduce conflict
|
/* Excluded, because it causes a shift-reduce conflict
|
||||||
(problems with a tokenset_no followed by an optexpr)
|
(problems with a tokenset_no followed by an optexpr)
|
||||||
| '-' expr %prec UMINUS
|
| '-' expr %prec UMINUS
|
||||||
|
|
|
@ -127,15 +127,6 @@ struct varinfo *gen_preturn() {
|
||||||
return(vp);
|
return(vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct varinfo *gen_stackadjust(int expr) {
|
|
||||||
register struct varinfo *vp;
|
|
||||||
|
|
||||||
NEW(vp,struct varinfo);
|
|
||||||
vp->vi_int[0] = INSSTACKADJUST;
|
|
||||||
vp->vi_int[1] = expr;
|
|
||||||
return(vp);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct varinfo *gen_tlab(n) {
|
struct varinfo *gen_tlab(n) {
|
||||||
register struct varinfo *vp;
|
register struct varinfo *vp;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern int regclass;
|
||||||
extern int maxtokensize;
|
extern int maxtokensize;
|
||||||
extern int nprocargs, maxprocargs;
|
extern int nprocargs, maxprocargs;
|
||||||
extern int use_tes;
|
extern int use_tes;
|
||||||
extern int use_noframepointer;
|
|
||||||
|
|
||||||
extern char *mystrcpy();
|
extern char *mystrcpy();
|
||||||
extern char *myalloc();
|
extern char *myalloc();
|
||||||
|
|
|
@ -43,8 +43,6 @@ reusing REUSING
|
||||||
rom ROM
|
rom ROM
|
||||||
samesign SAMESIGN
|
samesign SAMESIGN
|
||||||
sfit SFIT
|
sfit SFIT
|
||||||
stackadjust STACKADJUST
|
|
||||||
stackoffset STACKOFFSET
|
|
||||||
topeltsize TOPELTSIZE
|
topeltsize TOPELTSIZE
|
||||||
test TEST
|
test TEST
|
||||||
to TO
|
to TO
|
||||||
|
|
|
@ -12,8 +12,6 @@ int tabledebug=0; /* do not generate code for table debugging */
|
||||||
#endif
|
#endif
|
||||||
int verbose=0; /* print all statistics */
|
int verbose=0; /* print all statistics */
|
||||||
int use_tes; /* use top element size information */
|
int use_tes; /* use top element size information */
|
||||||
int use_noframepointer; /* use stackadjust mechanism to remove requirement
|
|
||||||
for frame pointer */
|
|
||||||
char *c_file= "tables.c";
|
char *c_file= "tables.c";
|
||||||
char *h_file= "tables.H";
|
char *h_file= "tables.H";
|
||||||
char *cd_file= "code";
|
char *cd_file= "code";
|
||||||
|
@ -614,8 +612,6 @@ outdefs() {
|
||||||
cdef("TABLEDEBUG",1);
|
cdef("TABLEDEBUG",1);
|
||||||
if (use_tes)
|
if (use_tes)
|
||||||
cdef("USE_TES",1);
|
cdef("USE_TES",1);
|
||||||
if (use_noframepointer)
|
|
||||||
cdef("USE_NOFRAMEPOINTER",1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outars() {
|
outars() {
|
||||||
|
@ -856,11 +852,6 @@ varinfo *kills,*allocates,*generates,*yields,*leaving;
|
||||||
codeint(vp->vi_int[1]);
|
codeint(vp->vi_int[1]);
|
||||||
codenl();
|
codenl();
|
||||||
break;
|
break;
|
||||||
case INSSTACKADJUST:
|
|
||||||
code8(DO_STACKADJUST);
|
|
||||||
codeint(vp->vi_int[1]);
|
|
||||||
codenl();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
codecoco(cocono);
|
codecoco(cocono);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#define BORS(x,y) y
|
#define BORS(x,y) y
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXREGS BORS(80,30)
|
#define MAXREGS BORS(200,30)
|
||||||
#define MAXPROPS BORS(120,20)
|
#define MAXPROPS BORS(120,20)
|
||||||
#define MAXTOKENS BORS(100,60)
|
#define MAXTOKENS BORS(100,60)
|
||||||
#define MAXATT 6
|
#define MAXATT 6
|
||||||
|
|
|
@ -12,4 +12,3 @@
|
||||||
#define INSERASE (-6)
|
#define INSERASE (-6)
|
||||||
#define INSREMOVE (-7)
|
#define INSREMOVE (-7)
|
||||||
#define INSLABDEF (-8)
|
#define INSLABDEF (-8)
|
||||||
#define INSSTACKADJUST (-9)
|
|
||||||
|
|
Loading…
Reference in a new issue