LYU YH via llvm-dev
2019-Dec-04 18:30 UTC
[llvm-dev] PC relative load/store in LLVM Target?
Hello, Is there any exist LLVM Target (backend) that support PC relative load and store? If so, what exactly is the instruction? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191204/c345ac5c/attachment.html>
Tim Northover via llvm-dev
2019-Dec-04 19:19 UTC
[llvm-dev] PC relative load/store in LLVM Target?
Hi, On Wed, 4 Dec 2019 at 18:31, LYU YH via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Is there any exist LLVM Target (backend) that support PC relative load and store? If so, what exactly is the instruction?It's pretty common, with diverse uses too (direct/GOT/jump-table spring to mind). You'll see it in x86 (mov in https://godbolt.org/z/qZwSS5), AArch64 (ldr in https://godbolt.org/z/BThYU7) and I'm sure many others. What do you really want to know about the usage and/or instruction? Cheers. Tim.
LYU YH via llvm-dev
2019-Dec-06 15:44 UTC
[llvm-dev] PC relative load/store in LLVM Target?
Hello Tim,
Thanks for your reply. Sorry about that I was not explain my question
clearly in previous email. I am looking for a target that has both
pc-relative load and store and use them for constant pool[1], function
pointer[2], {global|static} variable and pointer access[3][4][5]. I am
wondering how do they handle different cases in backend. Do you have any
target in mind that I should look into?
Thanks,
Yi-Hong
------------------------------
[1] constant_pool.c
double ConstantPool() {
return 3.14159;
}
------------------------------
[2] func_ptr.c
extern void function( );
extern void (*ptrfunc) ( );
void FuncPtr() {
ptrfunc=function;
(*ptrfunc) ( );
}
------------------------------
[3] {global|static}dst_eq{global|static}_src.c
{extern|static} int dst;
{extern|static} int src;
void {global|static}_dst_eq_{global|static}_src() {
dst = src;
}
------------------------------
[4] {global|static}ptr_eq{global|static}_dst.c
{extern|static} int *ptr;
{extern|static} int dst;
void {global|static}_ptr_eq_{global|static}_dst() {
ptr = &dst;
}
------------------------------
[5] {global|static}ptr_eq{global|static}_src.c
{extern|static} int *ptr;
{extern|static} int src;
void {global|static}_ptr_eq_{global|static}_src() {
*ptr = src;
}
------------------------------
On Wed, Dec 4, 2019 at 2:19 PM Tim Northover <t.p.northover at gmail.com>
wrote:
> Hi,
>
> On Wed, 4 Dec 2019 at 18:31, LYU YH via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > Is there any exist LLVM Target (backend) that support PC relative load
> and store? If so, what exactly is the instruction?
>
> It's pretty common, with diverse uses too (direct/GOT/jump-table
> spring to mind). You'll see it in x86 (mov in
> https://godbolt.org/z/qZwSS5), AArch64 (ldr in
> https://godbolt.org/z/BThYU7) and I'm sure many others.
>
> What do you really want to know about the usage and/or instruction?
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20191206/e6a49f55/attachment.html>