| Author |
Message |
Xianhua Liu
Guest
|
Posted:
Tue Aug 09, 2005 1:55 pm Post subject:
Change the argument passing registers in GCC? |
|
|
I wanna change the default argument passing registers in GCC from r0-r3 to
r16-r19 for my ARM cross-compiler, I have tried to modify
#define FUNCTION_ARG_REGNO_P(REGNO) ((REGNO) >= 0 && (REGNO) <= 3)
in gcc/config/arm/arm.h , line 1133, gcc version 2.95.3
but it has no effect, still using r0-r3 to pass arguments.
Are there some more modifications should be performed?
Regards,
--
Xianhua |
|
| Back to top |
|
 |
Grumble
Guest
|
Posted:
Tue Aug 09, 2005 2:15 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
Xianhua Liu wrote:
| Quote: | I wanna change the default argument passing registers in GCC from r0-r3 to
r16-r19 for my ARM cross-compiler, I have tried to modify
#define FUNCTION_ARG_REGNO_P(REGNO) ((REGNO) >= 0 && (REGNO) <= 3)
in gcc/config/arm/arm.h , line 1133, gcc version 2.95.3
but it has no effect, still using r0-r3 to pass arguments.
Are there some more modifications should be performed?
|
May I suggest http://gcc.gnu.org/lists.html ?
By the way, GCC 2.95.3 was released 4.5 years ago, it might
not be supported anymore.
http://gcc.gnu.org/releases.html |
|
| Back to top |
|
 |
Will
Guest
|
Posted:
Tue Aug 09, 2005 2:20 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
"Xianhua Liu" <lxh@mprc.pku.cn> wrote in
news:dd9s33$1e0b$1@mail.cn99.com:
| Quote: | I wanna change the default argument passing registers in
GCC from r0-r3 to r16-r19 for my ARM cross-compiler, I have
tried to modify
|
May I suggest the ARM ARM.
you might find trouble accessing R16 and higher |
|
| Back to top |
|
 |
jon@beniston.com
Guest
|
Posted:
Tue Aug 09, 2005 3:04 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
Xianhua Liu wrote:
| Quote: | I wanna change the default argument passing registers in GCC from r0-r3 to
r16-r19 for my ARM cross-compiler, I have tried to modify
#define FUNCTION_ARG_REGNO_P(REGNO) ((REGNO) >= 0 && (REGNO) <= 3)
in gcc/config/arm/arm.h , line 1133, gcc version 2.95.3
but it has no effect, still using r0-r3 to pass arguments.
Are there some more modifications should be performed?
|
Probably.
Look at: FUNCTION_ARG, INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE
Cheers,
Jon |
|
| Back to top |
|
 |
Tauno Voipio
Guest
|
Posted:
Tue Aug 09, 2005 4:16 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
Xianhua Liu wrote:
| Quote: | I wanna change the default argument passing registers in GCC from r0-r3 to
r16-r19 for my ARM cross-compiler, I have tried to modify
#define FUNCTION_ARG_REGNO_P(REGNO) ((REGNO) >= 0 && (REGNO) <= 3)
in gcc/config/arm/arm.h , line 1133, gcc version 2.95.3
but it has no effect, still using r0-r3 to pass arguments.
Are there some more modifications should be performed?
|
The ARM code generation in 2.95 is a kludge. It is
totally rewritten in current (v 3.x) compilers.
There is also version 4 available, but there are
messages that it does not handle casting correctly.
Just wondering: In my copy of ARM ARM (Architecture
Reference Manual) the last register is r15.
Why does the standard argument passing not suit?
--
Tauno Voipio
tauno voipio (at) iki fi |
|
| Back to top |
|
 |
Guest
|
Posted:
Tue Aug 09, 2005 9:26 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
| Quote: | Just wondering: In my copy of ARM ARM (Architecture
Reference Manual) the last register is r15.
|
Wonder no more, I believe Will's subtext was that you shouldn't try to
change a fundamental part of a compiler without having a detailed
understanding of the architecture the compiler is targeting.
Even if you could suceed in changing the register passing registers
when you'd then have to change the register allocator plus you'd end up
with a compiler which was not ABI compatible with any other compiler.
-p
--
Paul Gotch
CoreSight Tools
Development Systems ARM Limited.
This message is intended for the addressee(s) only and may contain
information that is the property of, and/or subject to a confidentiality
agreement between the intended recipient(s), their organisation and/or the
ARM Group of Companies. If you are not an intended recipient of this
message, you should not read, copy, forward or otherwise distribute or
further disclose the information in it; misuse of the contents of this
message may violate various laws in your state, jurisdiction or
country. If you have received this message in error, please contact
the originator of this message via email and delete all copies of
this message from your computer or network, thank you.
--------------------------------------------------------------------- |
|
| Back to top |
|
 |
Tauno Voipio
Guest
|
Posted:
Tue Aug 09, 2005 10:23 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
paul.gotch@at-arm-dot.com wrote:
| Quote: | In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
Just wondering: In my copy of ARM ARM (Architecture
Reference Manual) the last register is r15.
Wonder no more, I believe Will's subtext was that you shouldn't try to
change a fundamental part of a compiler without having a detailed
understanding of the architecture the compiler is targeting.
|
So, there are no ARMs with registers above 15, right?
| Quote: | Even if you could suceed in changing the register passing registers
when you'd then have to change the register allocator plus you'd end up
with a compiler which was not ABI compatible with any other compiler.
|
That is my message also, to the OP.
(Been there, done that. I wrote my first compiler in
1968, not for an ARM, though)
--
Tauno Voipio
tauno voipio (at) iki fi |
|
| Back to top |
|
 |
Guest
|
Posted:
Tue Aug 09, 2005 10:44 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
| Quote: | So, there are no ARMs with registers above 15, right?
|
To be precise there are 16 architecturally defined general purpose
registers, r0 to r15. However r15 is defined to be the Program Counter.
A moments thought will convince you that to change this you would need
to change the instruction set encoding.
There are infact many more registers than this physically since some of
the registers are banked depending which mode the processor is
currently in. There are also VFP registers and other special purpose
registers in most modern ARMs.
-p
--
Paul Gotch
CoreSight Tools
Development Systems ARM Limited.
This message is intended for the addressee(s) only and may contain
information that is the property of, and/or subject to a confidentiality
agreement between the intended recipient(s), their organisation and/or the
ARM Group of Companies. If you are not an intended recipient of this
message, you should not read, copy, forward or otherwise distribute or
further disclose the information in it; misuse of the contents of this
message may violate various laws in your state, jurisdiction or
country. If you have received this message in error, please contact
the originator of this message via email and delete all copies of
this message from your computer or network, thank you.
--------------------------------------------------------------------- |
|
| Back to top |
|
 |
Tauno Voipio
Guest
|
Posted:
Tue Aug 09, 2005 11:20 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
paul.gotch@at-arm-dot.com wrote:
| Quote: | In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
So, there are no ARMs with registers above 15, right?
To be precise there are 16 architecturally defined general purpose
registers, r0 to r15. However r15 is defined to be the Program Counter.
A moments thought will convince you that to change this you would need
to change the instruction set encoding.
|
That's why I was astonished to see someone addressing
a register that (AFAIK) does not exist.
| Quote: | There are infact many more registers than this physically since some of
the registers are banked depending which mode the processor is
currently in. There are also VFP registers and other special purpose
registers in most modern ARMs.
|
Yes - after making a multi-thread kernel, the registers
and banks will be intimately known.
Right, but nothing to stand in as r16 for an argument
transfer register.
For a moment I thought that the OP may have mixed up
ARM architecture with a Sparc, where r16 is a possible
selection. The windowed register bank is something
entirely different, though
--
Tauno Voipio
tauno voipio (at) iki fi |
|
| Back to top |
|
 |
Pete
Guest
|
Posted:
Wed Aug 10, 2005 4:15 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
Tauno Voipio wrote:
| Quote: | paul.gotch@at-arm-dot.com wrote:
In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
|
[snip: confusion over accessing r16]
| Quote: | That's why I was astonished to see someone addressing
a register that (AFAIK) does not exist.
|
I was kind of hoping it was some exciting university research into what
would happen if a compiler was told it had access to 32 registers, and
the code was tested on a tweaked ARM emulator which emulated 32 regs...
Cheers, Pete |
|
| Back to top |
|
 |
Tauno Voipio
Guest
|
Posted:
Wed Aug 10, 2005 9:45 pm Post subject:
Re: Change the argument passing registers in GCC? |
|
|
Pete wrote:
| Quote: | Tauno Voipio wrote:
paul.gotch@at-arm-dot.com wrote:
In comp.sys.arm Tauno Voipio <tauno.voipio@iki.fi.nospam.invalid> wrote:
[snip: confusion over accessing r16]
That's why I was astonished to see someone addressing
a register that (AFAIK) does not exist.
I was kind of hoping it was some exciting university research into what
would happen if a compiler was told it had access to 32 registers, and
the code was tested on a tweaked ARM emulator which emulated 32 regs...
|
GCC will do it happily. The initial CPU model
of GCC contains an infinite number of registers.
The compiler generates initially code for this model.
It then makes usage and lifetime analyses of each
assumed register and allocates the most used
of them to real registers of the underlying
hardware. The remaining 'registers' will then
be allocated to memory (e.g. stack frame).
The output of GCC is an assembler source file.
It will have no problems using more registers.
The problem will be in modifying the next stages
of the compilation: assembly and linking.
The essential problem will be in squeezing the extra
register select bits into the modified machine code
encodings without dropping anything essential to an ARM.
A good exercise would be to have a look at
code generated for a Sparc. It has (in each frame)
totally 32 registers: 8 frame-independent (global),
8 common with the calling frame (input), 8 private
(local) and 8 common with called frame (output).
The output registers of caller's frame are the
input registers of the called frame.
--
Tauno Voipio
tauno voipio (at) iki fi |
|
| Back to top |
|
 |
|
|
|
|