This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inline assembly clobbered registers


Falk Hueffner schrieb:

Christian Hildner <christian.hildner@hob.de> writes:



Falk Hueffner schrieb:


Christian Hildner <christian.hildner@hob.de> writes:


I need a temporary general register inside the inline assembly
code. The definition for a particular register is possible by for
example "eax". But how to define a general register that the
compiler is allowed to choose as it is possible with input/output
registers who are referenced by %0, %1, ... ? So simply to allow "r"
in the clobbered list and reference it by %x in the assembly code.


Why can't you just make it an output variable?



I made it an input one instead.



That will lead to wrong code, since gcc thinks you won't change it.


Inspecting the output I found that there will be no corruption of registers. But since it may not be 100% save I will switch to the usage of output registers (as you suggested).

This is possible, but it would be nicer to allow an unspecified
general register in the clobbered list.



But since the functioinality is trivially available by another way, I don't think it's worth adding complexity to the compiler for this.

I am just wondering to be at least the only one that would need that feature.

Thanks

Christian









Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]