This is the mail archive of the gcc@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]

Request for clarification on an insn


Hello everybody,

After having the basic stuff working, I'm now trying to handle pointers
properly in my backend. I have to generate some special code every time
a pointer is accessed. However, I have some difficulties figuring out
when we are accessing a pointer or not. Take for example the following C
code:

int k;
static int * myptr;
static int i;

....

i = *myptr;
k = i

The insns generated for the two affectations are like:

For i = *myptr:
(insn 14 6 15 (set (reg/f:SI 19)
        (mem/f:SI (symbol_ref:SI ("myptr_1")) [0 myptr+0 S4 A8])) -1
(nil)
    (nil))

(insn 15 14 17 (set (mem/f:SI (symbol_ref:SI ("i_0")) [0 i+0 S4 A8])
        (mem:SI (reg/f:SI 19) [0 S4 A8])) -1 (nil)
    (nil))

For k = i:
(insn 17 15 19 (set (mem/f:SI (reg/f:SI 15 virtual-stack-vars) [0 k+0 S4
A32])
        (mem/f:SI (symbol_ref:SI ("i_1")) [0 val+0 S4 A8])) -1 (nil)
    (nil))

I don't really know how to figure out that we are working with a pointer
here. Nothing seems to indicate that. The documentation doesn't mention
much about pointers handling neither (unless I missed something).

The only difference I can find is that in the first insns there is a
"mem:SI" access, while everywhere else it is "mem/f:SI". I probably
missed something very basic here, but I don't know what the /f is for,
and how to check whether an insn has it or not. I guess this is the key
to my problem. Anyone could enlighten me please?

Thanks in advance! :)
Alex.
-- 
http://www.gnurou.org


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