summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cc
AgeCommit message (Collapse)Author
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-05-16cc: prevent symbol buffer overflowcinap_lenrek
2016-05-16cc: use UTFmax not 4 (djc)cinap_lenrek
2016-03-01cc: populate the flag list comment in lex.cBurnZeZ
This way the various compiler flags are documented somewhere, even if not in full. Also fixed a typo. 'r' should have been 'R'
2016-03-01cc: sort the lex.c comment listing debug flagsBurnZeZ
2016-01-076c: return vlong result for pointer subtractioncinap_lenrek
2016-01-07introduce signed intptr and %z format modifier for formating uintptr and intptrcinap_lenrek
2015-10-08cc: restore side(), but do not consider OINDEX as side effect freecinap_lenrek
from charles forsuth: because the previous version thought OINDEX might have a side effect, it stopped it building a tower of them. probably the best thing is to limit that anyway, since each one consumes 2-3 registers, so towering them can keep even more active, and the x86 hasn't got that many. the quick hack is to return that case to the earlier state by treating OINDEX as a side-effect in side(). it's not a bad thing to do in the OSTRUCT case, for similar reasons: it's better to collapse the indexed pointer into a direct register, instead of repeating the indexing operation through the copying of the value. OINDEX isn't a machine-independent operation, so it doesn't affect the uses in ../cc
2015-10-07cc: back out side() change unil 8c is fixedcinap_lenrek
this change made 8c fail to build libvorbis and gs, until this is fixed we can live with non-optimal code.
2015-10-06cc: include $builtin as keywoard in pickle() (from charles forsyth)cinap_lenrek
2015-10-06cc: getflag() fmt will be terminated at end of loop (from charles forsyth)cinap_lenrek
2015-10-06cc: allow runes as macro names (from charles forsyth)cinap_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-06cc: TUSHORT -> TRUNE for lstring constats for OUSEDcinap_lenrek
2015-10-04cc: handle 64 bit mixedmode asop and type vlong <-> float/double type ↵cinap_lenrek
conversions
2015-10-04cc/6c: fix return type of mixed asop expressions, preserve type for moves so ↵cinap_lenrek
fixed<->float conversions work correctly
2015-08-17cc: improve (non-) side effect detection (thanks charle)cinap_lenrek
2015-07-28cc: provide fake realloc() for getenv()cinap_lenrek
2015-05-26cc: set unspecified elements to zero in local variable initializerscinap_lenrek
the compiler used to skip zero initialization when initializer list was given not covering unspecified elements. now we zero all non explicitely initialized elements. for example: typedef struct F F; struct F { int a; int b; int c; }; void main(void) { char a[16] = { 1, 2, 3 }; /* a[3..15] initialized to zero */ F f = { .b = 1 }; /* f.a, f.c initialized to zero */ }
2015-05-25cc: handle unaligned data in = {0} local initializercinap_lenrek
the emited code that initializes local variables did not handle unaligned data causing stack corruption, affecting code like: void main(void) { char a[9] = {0}; } this change will emit code that does byte stores for the unaligned bytes and also handles small objects (<= 16 bytes) without branches.
2015-04-23cc: fix non constant pointer initializer for other compilers than 8c/6ccinap_lenrek
i made a mistake here as this change breaks the arm and mips compilers which lack an optimiation in xcom() that folds constant pointer arithmetic into the offset. on arm, the a node is a complex expression with op OADD of type TIND but the test rejected the (valid) pointer arithmetic. instead, we now test for the operations which cannot be constant instead of using the type as a proxy.
2015-04-16cc: catch non constant pointer initializerscinap_lenrek
char FOO[] = "abc"; /* ok */ char *BAR = FOO; /* ok */ char *BAZ = BAR; /* wrong */
2014-05-06cc: fix spurious warning on comparsion with scope redeclared variable ↵cinap_lenrek
(thanks aiju) > warning: a.c:9 useless or misleading comparison: UINT < 0 the error can be observed by compiling the following code with warnings enabled: #include <u.h> #include <libc.h> uint r; void main(int argc, char *argv[]) { int r; if(r < 0){ exits(0); } } the offending code in the compiler is: - if(l->op == ONAME && l->sym->type){ - lt = l->sym->type; - if(lt->etype == TARRAY) - lt = lt->link; - } compiler handles scope by overwritin and reverting symbols while parsing. in the ccom phase, the nodes symbol (n->sym) is not in the right scope and we wrongly think r is uint instead of int. it is not clear to me what this code tried to accomplish in the first place nor could anyone answer me this question. the risk is small as this change doesnt affect the compiled program, only the warning, so removing the offending code.
2014-03-02cc: correct out-of-bounds references in funct.c (thanks charles forsyth)cinap_lenrek
2014-02-10cc: emit right acid format for addresscinap_lenrek
we could use 'A' here but then it would require the new acid.
2014-02-01fixes for new setmalloctag() prototypecinap_lenrek
2013-07-11cc: fix include array overflow handlingcinap_lenrek
2013-05-01cc: accept 24 bit numeric runescinap_lenrek
2013-02-02cc/lex: do not crash on -I without argftrvxmtrx
2012-12-31fix utf and rune handling in preparation for 32bit runescinap_lenrek
2012-10-03apply sources patch cc-cpp-c99-commcinap_lenrek
When running "?c -p ...", ensure the backend cpp recognizes C++ comments. 2c(1) states that the compilers recognize // comments, and the bare compilers do. But if you invoke the compiler with '-p', the backend cpp process doesn't handle // comments properly unless you also give ?c the undocumented '-+' option (which it passes through to cpp).
2012-07-30import updated compilers from sourcescinap_lenrek
2011-07-12have compiler error out if read failsaiju
2011-05-25fixed issue #47aiju
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen