Commit graph

28 commits

Author SHA1 Message Date
cinap_lenrek 4fd09def0f kencc: revert back to "set but not used"
The change to "assignment not used" breaks symmetry with
"used and not set" and removes the reference to the
specific warning mentioned in /sys/doc/comp.ms.

Also, the patch was half-assed as that it left some typos
in like "used an not set", which this change also fixed.
2021-06-26 13:16:36 +00:00
Noam Preil 1a09421f7d kencc: clarify warning for unused assignments 2021-06-21 03:29:58 +00:00
cinap_lenrek 9de5aac7a2 5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of OAS*, OPREINC, OPOSTINC
The expression value of the assignment operation was
returned implicitely by relying on regalloc() on the
right hand side "nod" borrowing the register from nn.

But this only works if nn is a register.

In case of 6c, it can also be a ONAME from a .safe
rathole returned by regsalloc().

This change adds explicit gmove() calls to assign the
expression value. Note that gmove() checks if source
and destination are the same register so it wont emit
redundant move operations in the common case.

The same is applied also to OPREINC and OPOSTINC operations.
2021-03-13 13:56:40 +01:00
cinap_lenrek 313216e6fb ?c: get rid of sprint(), strcpy() and strcat()/strncat(), cleanup 2020-04-19 23:51:18 +02:00
cinap_lenrek 34a1b1bb22 ?c: fix Bconv() misusage of strncat() 2020-04-19 04:33:07 +02:00
cinap_lenrek 1b8a569417 cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.

to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.
2020-04-11 05:03:49 +02:00
cinap_lenrek 63191949b9 cc: remove nullwarn() from OCAST codegen, zap void casts
implicit casts would cause spurious "result of operation not used"
warnings such as ape's stdio putc() macro.

make (void) casts non-ops when the casted expression has no
side effects. this avoid spurious warning with ape's assert()
macro.
2019-06-19 23:50:33 +02:00
cinap_lenrek 97a2f14b1c [5678vq]c: fix .safe node type for *FUNC() = *FUNC() sugen 2019-05-01 08:55:24 +02:00
cinap_lenrek dea28126ae 5c: dont substibute (destination) registers contained in MOVM reglist
this fixes the miscompilation of 6l with 5c resulting in bogus
vlong -> long conversion at the top of asmandsz():

asmandsz 0x0000aec4	MOVW.W	R14,#-0x2c(R13)
asmandsz+0x4 0x0000aec8	MOVW	rex+8(FP),R5
asmandsz+0x8 0x0000aecc	MOVW	$andptr-SB(SB),R7
asmandsz+0xc 0x0000aed0	MOVW	R0,R6
asmandsz+0x10 0x0000aed4	AND	$#0x44,R5,R8
asmandsz+0x14 0x0000aed8	MOVW	R8,rex+8(FP)
asmandsz+0x18 0x0000aedc	MOVW	R0,R4
asmandsz+0x1c 0x0000aee0	MOVM.IA	(R0),[R1,R3] <- R1 used here
asmandsz+0x20 0x0000aee4	MOVW	R8,v-4(SP) <- substituted by R8
2019-03-29 06:35:41 +01:00
spew 1ddf581f8c cc: fix result of operation not used warning for void casts 2018-05-24 19:31:55 -04:00
cinap_lenrek 9e926eeb4e 5c: do shift propagation for rotate right (ROR) 2016-09-03 19:05:28 +02:00
cinap_lenrek a5d8cd30bb 5c: format assembly constant right shift encoding 0 as >>32 2016-09-03 18:18:28 +02:00
cinap_lenrek 95524b1cdd 5c: fix int -> uvlong cast bug (thanks to qwx on his patience on a the trouble session to narrowing it down)
we used to not sign extend if the destination was unsigned
uvlong, which is wrong. we have to sign extend only based
on the signedness of the source (it gets propagated to vlong)

this bug hit in hjfs in the newentry() function, causing file
creation to fail with "create -- phase error":

newentry(...)
{
	uvlong sj;
	int si;
	...

	sj = si = -1;

	...
}
2016-07-15 21:13:35 +02:00
cinap_lenrek b2efac4687 5c: handle unused results for cgen64() 2016-06-26 16:38:46 +02:00
cinap_lenrek 5bf09937da 5c: support for bit ROL, native 64 bit arithmetic 2016-06-26 15:09:27 +02:00
cinap_lenrek 5cdabc5eb1 ?c: track ../cc/cc.h dependency and rebuild cc.a$O as neccesary 2016-06-09 23:03:30 +02:00
cinap_lenrek c184d2602d 5c: handle (rare) MULU instruction in peephole optimizer 2015-11-01 12:09:03 +01:00
cinap_lenrek 2d59b15c39 5c/6c/8c/vc: import various changes from charles forsyth
- cover more cases that have no side effects
- ensure function has complex FNX
- pull operators out of OFUNC level
- rewrite OSTRUCT lhs to avoid all side-effects, use regalloc() instead of regret()
2015-10-06 06:20:01 +02:00
cinap_lenrek 8e41723741 5c: handle 64 bit mixedmode asop 2015-10-04 20:07:34 +02:00
cinap_lenrek 03feba8cc1 [125678kqv][cl]: fix sprint() and strcpy() buffer overflows 2015-02-17 22:13:35 +01:00
cinap_lenrek d304dc8119 5a, 5l: add LDREX/STREX/CLREX instructions 2014-08-07 20:22:00 +02:00
cinap_lenrek 539fe6990f 5c: apply richard millers 5c-nan-cmp patch (from sources)
On ARM, it turns out that comparisons with NaN can be made to do the
right thing with no code penalty, by a more careful selection of
condition code values in the subsequent conditional branch.  The
meaning of the CC bits in the PSR is subtly different when they've
been copied from the floating point status register.

Suggested patch is 5c-nan-cmp (works on both vfp and emulated arm7500).
2013-09-20 14:58:43 +02:00
cinap_lenrek ce62bbb853 5c: dont emit conditional integer division instructions
the integer division instructions are emulated with _div()
function patched in by 5l which does not handle conditional
execution. so do not optimize away the branch in that case.
2013-04-29 20:15:40 +02:00
cinap_lenrek ea0f580909 add arm vfp support to compiler and linker (from sources) 2013-01-26 18:03:45 +01:00
cinap_lenrek da0638914f 5c: fix -0x80000000 comparsion bug 2013-01-02 10:10:29 +01:00
cinap_lenrek 4f33c88a51 import updated compilers from sources 2012-07-30 19:11:16 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00