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]

Clobbered registers


I wrote a function which modifies esp register through some asm
instructions (it pushes things to the stack). Everything works perfect
for now because the function takes care of restauring the content of
esp issuing an add instruction too so that it can return allright. But
reading GCC docs I found this:

"If you refer to a particular hardware register from the assembler
code, you will probably have to list the register after the third
colon to tell the compiler the register's value is modified."

Ok, so I do that. But looking at the assembler code generated by the
compiler I notice that it is exactly the same than before I did what
the docs say. So I wonder, why does the compiler needs to know if I
execute an instruction that modifies some register? And also (maybe
the answer to the former would respond this) why does the code doesn't
change?

Thanks a lot,
FaQ


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