[HN Gopher] Diving into GCC Internals ___________________________________________________________________ Diving into GCC Internals Author : penguin_booze Score : 65 points Date : 2022-06-13 20:12 UTC (2 hours ago) (HTM) web link (gcc-newbies-guide.readthedocs.io) (TXT) w3m dump (gcc-newbies-guide.readthedocs.io) | bragr wrote: | >What's in the GCC source tree? | | >TODO [1] | | Oh good, it's not like we'd actually want those newbies to get | involved and contribute. No, that's what LLVM is for. [2] | | [1] https://gcc-newbies-guide.readthedocs.io/en/latest/gcc- | sourc... | | [2] https://llvm.org/docs/GettingStarted.html | [deleted] | cptwunderlich wrote: | Gosh, I really wish GCC had more/better documentation. Especially | big picture stuff. E.g., I would like to know what register | allocation algorithms it uses (and how certain details are | handled), but looking at that code I noped out... | chrisseaton wrote: | It uses something they call IRA and LRA on the RTL | representation. But bottom line is: it's graph colouring. | | https://gcc.gnu.org/onlinedocs/gccint/RTL-passes.html | | There's really quite a lot of documentation and published | papers when you actually look: | | https://github.com/gcc-mirror/gcc/blob/751f306688508b08842d0... | Analemma_ wrote: | This might be less true now, but for a long time gcc's code was | terrible and undocumented on purpose. rms wanted it that way, | to make it harder for it to be forked or EEE'd by corporations. | | Whether that was a _good_ plan is up for debate, but there you | go. | astrange wrote: | You can read GCC Summit presentations for things like that. The | register allocator is called IRA/LRA. It used to have a ball of | mud called reload that isn't worth understanding because it | doesn't make much sense. | | GCC's code style is strange because the original authors wanted | to make it look like Lisp for some reason. | touisteur wrote: | Err I always thought it looked strange because it was in C | with classes before or after some holy war. | | While gcc (and in general compiler) plugins are some of the | most interesting tech enablers (be it for fuzzing,, static | analysis, or runtime checks injection) 'People competently | maintaining gcc plugins' (a sect I'm not a part anymore, | thank dog) are amongst the most patient, devoted, unsung | angels of this world. | astrange wrote: | It's in C++ now. The weird spacing and functions ending in | _p are Lispisms. | | It's also garbage collected so it's still not "normal" C++ | but neither is LLVM. | | Not sure about the plugin API, but C++ is basically | impossible to use with plugins because it's so hard to keep | ABI contracts, so it might not have changed. | [deleted] ___________________________________________________________________ (page generated 2022-06-13 23:00 UTC)