summaryrefslogtreecommitdiff
path: root/sys/src/cmd/8c
AgeCommit message (Collapse)Author
2021-06-26kencc: revert back to "set but not used"cinap_lenrek
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-21kencc: clarify warning for unused assignmentsNoam Preil
2021-03-135c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for ↵cinap_lenrek
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.
2020-08-08cc: promote integer constants according to c99 spec.Ori Bernstein
C99 integer constants with no type suffix promote differently depending on the way that they're written: hex and oct consts promote as int => uint => long => ulong => vlong => uvlong. Decimal constants are always signed. We used to promote all values to uint on overflow, and never went wider. This change fixes that, and adds a warning when a decimal constant that would have been promoted to uint in the past gets promoted to int.
2020-04-19?c: get rid of sprint(), strcpy() and strcat()/strncat(), cleanupcinap_lenrek
2020-04-19?c: fix Bconv() misusage of strncat()cinap_lenrek
2020-04-11cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compatcinap_lenrek
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.
2019-06-248c, 6c: LEA x, R; MOV (R), R -> MOV x, Rcinap_lenrek
2019-06-248c, 6c: avoid allocating index registers when we don't have tocinap_lenrek
when a operation receives a chain of OINDEX nodes as its operands, each indexing step used to allocate a new index register. this is wastefull an can result in running out of fixed registers on 386 for code such as: x = a[a[a[a[i]]]]. instead we attempt to reuse the destination register of the operation as the index register if it is not otherwise referenced. this results in the index chain to use a single register for index and result and leaves registers free to be used for something usefull instead. for 6c, try to avoid R13 as well as BP index base register.
2019-06-248c: skip 64-bit regpair allocation for OINDEX nodes in cgen64()cinap_lenrek
OINDEX can only return TLONG result on 386 so give it a register instead of a regpair and let gmove() handle the conversion.
2019-06-19cc: remove nullwarn() from OCAST codegen, zap void castscinap_lenrek
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-18mergecinap_lenrek
2019-06-188c, 6c: fix INDEX node #reg calculationcinap_lenrek
2019-06-17Delete dead code.Ori Bernstein
Nothing is using (or even building) bound.[ch]
2019-05-01[5678vq]c: fix .safe node type for *FUNC() = *FUNC() sugencinap_lenrek
2018-05-286c, 8c: Fix nocast cast bug which prevents address arithmetic from being ↵spew
computed at compile time
2018-05-24cc: fix result of operation not used warning for void castsspew
2017-01-026c, 8c: fix "DI botch" evacuating DI/SI/CX registers to ".save" variablescinap_lenrek
2016-10-308c: fix double compiling FNX complex lvalue in cgen64()cinap_lenrek
sugen() calls cgen64() speculatively so that when cgen64() returns zero, it will fall back and compile 64-bit copy. the bug was that cgen64() compiled the left hand side and then recursively called cgen64() again, which didnt handle the memory copy so it returned zero and sugen() would compile the left hand side again resulting in two function calls being emited. some code that reproduced the issue: #include <u.h> #include <libc.h> typedef struct { char x[10]; vlong a; } X; X a; X *f(void) { return &a; } void main(int argc, char *argv[]) { f()->a = a.a; } producing: TEXT f+0(SB),0,$0 MOVL $a+0(SB),AX RET , RET , TEXT main+0(SB),0,$0 CALL ,f+0(SB) CALL ,f+0(SB) <- bug MOVL AX,CX LEAL a+12(SB),DX MOVL (DX),AX MOVL AX,12(CX) MOVL 4(DX),AX MOVL AX,16(CX) RET , GLOBL a+0(SB),$20 END ,
2016-06-098c, 6c: native ROL (cyclic shift) instruction support, improve peephole ↵cinap_lenrek
optimizers introduce rolor() function to subsitute (a << c) | (a >> (bits(a) - c)) with (a <<< c) where <<< is cyclic rotation and c is constant. this almost doubles the speed of chacha encryption of 386 and amd64. the peephole optimizer used to stop when it hit a shift or rol instruction when attempting to eleminate moves by register substitution. but we do not have to as long as the shift count operand is not CX (which cannot be substituted) and CX is not a subject for substitution.
2016-06-09?c: track ../cc/cc.h dependency and rebuild cc.a$O as neccesarycinap_lenrek
2015-10-065c/6c/8c/vc: import various changes from charles forsythcinap_lenrek
- 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-048c: dont abort() when running out of registers.cinap_lenrek
2015-10-048c: handle 64 bit mixedmode asop and type vlong <-> float/double type ↵cinap_lenrek
conversions
2015-10-038c: make cgen64() compile target first when it contains functoin call so ↵cinap_lenrek
final assignment wont trash the registers
2015-02-17[125678kqv][cl]: fix sprint() and strcpy() buffer overflowscinap_lenrek
2014-09-246c/8c: eleminate moves by swaping source and destination operands in ↵cinap_lenrek
peephole pass
2014-08-078c, 6c: generate enam.c file, just like 5ccinap_lenrek
2014-04-288c, 6c: fix peephole bug for eleminating CMPL $0,R after shiftcinap_lenrek
the shift instructions does not change the zero flag when the shift count is 0, so we cannot remove the compare instruction in this case. this fixes oggdec under 386.
2014-03-296c, 8c: optimize away CMPL/CMPQ reg, $0 instruction in peephole passcinap_lenrek
when the previous instruction sets the zero flag, we can remove the CMPL/CMPQ instruction. this removes compares for zero/non zero tests only. it only looks at the previous non-nop instruction to see if it sets our compare value register.
2014-03-218c, 6c: fix mulgen botch error for handling multiplication by zero constantcinap_lenrek
2013-06-018c: apply charles forsyth's 8c-cgen64-mul-savereg patch (from sources)cinap_lenrek
If 64-bit multiply has to save both AX and DX, it could load the wrong value into DX; also, biggen shouldn't allocate either AX or DX as temporaries when using the template for MUL.
2013-05-21add 6(a|l) sse support to 8(a|l)jpathy
2012-07-30import updated compilers from sourcescinap_lenrek
2011-07-12added Blethal to libbioaiju
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen