Commit graph

31 commits

Author SHA1 Message Date
George Koehler 24abaf6a25 Enable conditional expressions in splitting coercions.
ncgg has parsed the optional conditional expression (optexpr) of each
splitting coercion since commit 72b83cc in 1985; but for almost 33
years, ncg has ignored the expression in c2_expr.

Few tables had conditional coercions (I only found them in arm and
m68020), and no tables had conditional splitting coercions, so this
only becomes a problem now as I try to add a conditional splitting
coercion to powerpc.
2017-12-18 20:39:56 -05:00
George Koehler e04166b85d More prototypes, less register in mach/proto/ncg
Files that #include "equiv.h" must do so after including "data.h", now
that a function prototype in equiv.h uses type rl_p from data.h.

Adjust style, changing some `for(...)` to `for (...)`.  The style in
mach/proto/ncg is less than consistent; the big annoyance now is that
some files want tabs at 4 spaces, others want tabs at 8 spaces.
2017-11-13 12:44:17 -05:00
George Koehler 909b0d5bf3 Add prototypes to functions in subr.c
Put the declarations in "data.h", because that header declares the
types cost_t and token_p.  Also #include <cgg_cg.h> from "data.h" to
get types c3_p and set_p, and guard <cgg_cg.h> against multiple
inclusion.
2017-11-12 16:11:05 -05:00
George Koehler ba2a45180c Prototypes for string functions. More static. 2017-11-12 11:25:18 -05:00
George Koehler 98b27dd505 Remove old "assert.h" in mach/proto/ncg
*Important:*  You must "make clean" after checking out this commit,
because the build had copied the old "assert.h" to several places in
obj/.  If you don't "make clean", then the compiler finds the old
"assert.h" before libc <assert.h>, and the build fails because this
commit removes badassertion() in subr.c.  After "make clean", the
compiler finds libc <assert.h> and the build succeeds.
2017-11-11 19:35:48 -05:00
George Koehler 2a92f9bf4d Add a few more error checks and adjustments to reglap.
In util/ncgg, add two more errors for tables using reglap:
 - "Two sizes of reg_float can't be same size"
 - "Missing reg_float of size %d to contain %s"

In mach/proto/ncg, rename macro isregvar_size() to PICK_REGVAR(), so
the macro doesn't look like a function.  This macro sometimes doesn't
evaluate its second argument.

In mach/powerpc/ncg/mach.c, change type of lfs_set to uint32_t, and
change the left shifts from 1U<<regno to (uint32_t)1<<regno, because
1U would be too small for machines with 16-bit int.
2017-10-18 22:00:12 -04:00
George Koehler 307a8b996e Add regvar_w() and regvar_d() for use with reglap.
If the ncg table uses reglap, then regvar($1, reg_float) would have
two sizes of registers.  An error from ncgg would happen if regvar()
was in a token that allows only one size.  Now one can pick a size
with regvar_w() for word size or regvar_d() for double-word size.

Add regvar_d and regvar_w as keywords in ncgg.  Modify EX_REGVAR to
include the register size.  In ncg, add some checks for the register
size.  In tables without reglap, regvar() works as before, and ncg
ignores the register size in EX_REGVAR.
2017-10-17 12:05:41 -04:00
George Koehler aa876ff4c2 Fix reglap for procedures that use both sizes of reg_float.
After the RA phase of ego, a procedure may put single-word and
double-word values in the same reg_float.  Then ncg will use both
LOCAL and DLOCAL tokens at the same offset.

I add isregvar_size() to ncg.  It receives the size of the LOCAL or
DLOCAL token, and picks the register of the correct size.  This fixes
a problem where ncg got the wrong-size register and corrupted the
stack.  This problem caused one of my test programs to segfault from
stack underflow.

Also adjust how fixregvars() handles both sizes.
2017-10-15 13:15:03 -04:00
George Koehler b342b83d28 Add function prototypes to mach/proto/ncg/regvar.c 2017-10-15 11:01:18 -04:00
George Koehler aa47f52166 Switch error() and fatal() in mach/proto/ncg to stdarg.
This is like David Given's change to util/ncgg in d89f172.  I need
this change in mach/proto/ncg to see fatal messages, because a 64-bit
pointer doesn't fit in an int.
2017-02-16 20:26:53 -05:00
David Given fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
dtrg 4c0a0e6119 Rationalised use of #includes to be more standards-compliant. 2006-07-18 17:10:29 +00:00
ceriel 1db6a3029b Header --> Id 1994-06-24 14:02:31 +00:00
ceriel 53c4951b29 Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:05:43 +00:00
ceriel f572b1fb35 some changes that may make ncg a tiny bit less inefficient 1991-01-10 18:39:36 +00:00
eck e37c249248 added casts of pointer difference to integer 1990-12-17 14:22:41 +00:00
ceriel 16ef0467a8 Fixed wrong assertion, and fixed bug in distance routine: it did not check
that each stackpattern token that does not exactly match can be made from the
stack
1990-04-04 14:52:29 +00:00
ceriel 3ecaa0b634 some fixes: fix order in which registers are allocated, make sure that
a pattern chosen by the distance routine can be made from the stack if the
fakestack does not contain enough tokens
1989-03-17 16:49:58 +00:00
ceriel f0d3a648af fixed problem with temporary DEALLOCATES: sometimes a register was
used for stacking, that was only temporarily deallocated
1988-07-15 11:12:13 +00:00
ceriel e8931fe5de make to compile on Xenix 1988-07-14 10:11:01 +00:00
ceriel ccbf4f0cf6 made to compile on Xenix 1988-07-12 14:19:03 +00:00
ceriel e64951e1d3 removed some lint complaints 1988-06-28 14:41:02 +00:00
ceriel d3723b3d38 modified distance function somewhat 1988-06-24 12:03:02 +00:00
ceriel c146e278fc distance routine improved a little; still not safe! 1988-06-22 16:22:07 +00:00
ceriel 14d7db7499 remove some of the lint complaints 1988-03-31 11:17:47 +00:00
ceriel 5537abbdfb Added copyright notice 1987-03-10 01:26:51 +00:00
ceriel 2c29e9f07c Changed an assertion that was no longer valid 1987-02-07 01:50:48 +00:00
ceriel 0b941ef495 Bug fixes 1987-01-16 13:51:45 +00:00
bal 98d06cffb2 0 / -1 confusion for properties (bug reported by sater). 1985-10-03 14:47:28 +00:00
keie c2a990768d The top of the stack, which is set aside for certain
coercions is now saved with special routines.
This allows RREMOVE to check for registers.
1985-03-01 16:20:13 +00:00
sater 4ba6e7a39c *** empty log message *** 1985-01-08 15:34:54 +00:00