Re: [Tack-devel] Assembler and linker
Moved to https://github.com/davidgiven/ack
Brought to you by:
dtrg
From: Sorav B. <sb...@ii...> - 2022-10-29 15:09:59
|
Again, thanks a lot George and David for the detailed and helpful responses! Yes I was able to access the man page and it was helpful! One more question: as far as I can tell, the ACK implements and respects the cdecl calling convention on the "linux386" machine, is that correct? However I also see that ACK does not align the stack to a 16-byte boundary, as required by the cdecl calling conventions on Linux (since GCC-4.5). Is there any documentation on the calling conventions supported/implemented? Sorav On Sat, Oct 29, 2022 at 8:26 AM George Koehler <ke...@gm...> wrote: > On Sat, 29 Oct 2022 01:26:48 +0200 > David Given <dg...@co...> wrote: > > > The main optimiser is a tool called ego, which is described in detail in > > the whitepaper here: https://tack.sourceforge.net/olddocs.html Which > > optimisations are invoked are described the man page for ack itself ('man > > ack' from your command line, assuming it's been installed properly). > > 'man ack' describes the -O option and the PROGRAMS opt, ego, top. > > -O and -O0 are the same as -O1 (util/ack/main.c:218). -O5 and higher > are the same as -O04, which is almost the same as -O4, except for a > quirk about "multiplication" (lib/fe/descr:197). ack without -O > disables top, but some code generators force opt to run, which makes > some optimizations unless you "ack -Ropt-n" (-n in 'man em_opt'). > > On Fri, 28 Oct 2022 23:01:52 +0530 > Sorav Bansal <sb...@ii...> wrote: > > > Does ACK support inter-procedural optimizations? > > ack -O4 enables IL, which might inline one procedure into another. > I don't know any other optimization that crosses procedures. > > The ACK's old design prevents some optimizations. > This C code can't put "char c;" in a register, > > $ cat simple.c > #include <stdio.h> > int main(int argc, char **argv) { > char x; > for (x = 1; x < argc; x++) > puts(argv[x]); > } > $ ack -mosxppc -O4 -c.so simple.c > > The only variables that can go in registers are integers or floats > with a size of 1 or 2 words. We have r30 = argv and r31 = argc, but > the byte "char x;" is smaller than a word, so "char x;" gets stuck in > memory. "struct { int i; } s;" would also get stuck in memory. > > Each "for" iteration loads x with "lbz r4,-1(fp)" to do argv[x]; then > a 2nd load "lbz r4,-1(fp)" and a store "stb r1,-1(fp)" to do x++; then > a 3rd load "lbz r4,-1(fp)" to check x < argc. If we change "char x;" > to "int x;", then these 3 loads and 1 store disappear. > CAUTION: This email originated from outside of IIT Delhi. Do not click > links or open attachments unless you recognize the sender and know the > content is safe. > > CAUTION: This email originated from outside of IIT Delhi. Do not click > links or open attachments unless you recognize the sender and know the > content is safe. > |