[PATCH] D62911: WIP: AMDGPU: Use fixup for local linkage functions

Dmitry Preobrazhensky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 11:39:08 PDT 2019


dp added a comment.

I contemplate if adding a 'proxy' instruction like s_add_u64 would help.
Code emitter would expand it into s_add+s_addc and handle relocations.
Assembly output would look like this:

  s_add_u64 s[0:1], s[2:3], func
  func:
    ...
  
  encoding: [0x02,0xff,0x00,0x80,A,A,A,A,0x03,0xff,0x01,0x82,B,B,B,B]
            ;   fixup A - offset: 4, value: func, kind: FK_PCRel_4
            ;   fixup B - offset: 12, value: func, kind: fixup_si_pcrel_hi32
            ; <MCInst #10668 S_ADD_U64_gfx10
            ;  <MCOperand Reg:1832>
            ;  <MCOperand Reg:1833>
            ;  <MCOperand Expr:(func)>>

The code after relocation would be:

  s_add_u32 s0, s2, 12              // 000000000028: 8000FF02 0000000C
  s_addc_u32 s1, s3, 0              // 000000000030: 8201FF03 00000000
  0000000000000038 func:
  ...

Advantages:

- AMDGPUMCExpr.* are not needed;
- no needsPCRel changes;
- cleaner relocation handling;
- cleaner codegen logic.

Disadvantages:

- some hacks in SIMCCodeEmitter for proxy replacement.

Would this be useful?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62911/new/

https://reviews.llvm.org/D62911





More information about the llvm-commits mailing list