regno_reg_rtx and related macros
Bernd Schmidt
bernds@balti.cygnus.co.uk
Fri Dec 31 23:54:00 GMT 1999
>
> and I don't think it's worth *in this case* obfuscating the code in
> GCC.
>
> The issue is what "obfuscating" means.
We were able to eliminate a lot of code by moving all the global variables
into a structure. We have one "struct function" now for every function we
compile, and we can switch them around by just putting a different pointer
into current_function. This allowed us to delete the following immediately:
- code to save/restore global variables when parsing a nested function
- code to add gc roots for all the globals; we only need to walk the
function structures and have no globals to worry about
- the INLINE_HEADER rtx and all the gross code dealing with it
Subsequently, this also made it possible to simplify integrate.c a whole lot.
No need to save and restore constants anymore, we just keep the constant pool
for each function.
> The point is that if I see the expression:
>
> regno_reg_rtx[i] != 0
>
> and I'm in the debugger and want to see what the value is, the most natural
> thing to do is
>
> print regno_reg_rtx[i]
>
> That doesn't work and there's no way to get it to work.
True, but that's also the case for almost everything in gcc - simple things
like "REGNO (x)" or "NEXT_INSN (insn)" aren't debuggable either.
But in principle I agree with you that these accessor macros are bad. If you
look into function.h you'll even find a comment to that effect. As I said,
doing it this way kept the patches small. Actually doing the search and
replace simply has fallen through the cracks in the last two or three months,
but I'll try to get it cleaned up quickly.
Bernd
More information about the Gcc
mailing list