[llvm-dev] PC relative load/store in LLVM Target?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] PC relative load/store in LLVM Target?

Jimmy Zhongduo Lin via llvm-dev
Hello,

Is there any exist LLVM Target (backend) that support PC relative load and store? If so, what exactly is the instruction?

Thanks

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] PC relative load/store in LLVM Target?

Jimmy Zhongduo Lin via llvm-dev
Hi,

On Wed, 4 Dec 2019 at 18:31, LYU YH via llvm-dev
<[hidden email]> 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.
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] PC relative load/store in LLVM Target?

Jimmy Zhongduo Lin via llvm-dev
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 <[hidden email]> wrote:
Hi,

On Wed, 4 Dec 2019 at 18:31, LYU YH via llvm-dev
<[hidden email]> 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.

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev