Re: Global variables - register allocated
Waldek Hebisch <[email protected]>
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
Rajat Singh wrote:
>
> One more question. Can I get the reference of global variable in terms of
> offset from some register like a5 ( for example like move.l 8(%a5),%d0)
> instead of direct memory address or variable name ?
> 80000130: 7005 moveq #5,%d0
> 80000132: 23c0 8000 21ec movel %d0,800021ec <VAR1>
>
> move.l %d0,I
> move.l VAR1,I
>
What you mean by get? Gpc supports inline assemby, so you
can compute offset using inline assembly. How variable
are accessed is left to optimizer. You will get different
code if you say request position independent code (-fpic
flag) but that affect all code and has speed penalty.
If your "variable" is something in memory that may move,
then use pointer to access it.
--
Waldek Hebisch
[email protected]
_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc