This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Created a sub-register class for the return address operand in the return instruction.
ClosedPublic

Authored by cdevadas on Jun 28 2019, 3:26 AM.

Details

Summary

Function return instruction lowering, currently uses the fixed register pair, s[30:31] for holding the return address.
It can be any SGPR pair other than the CSRs. Created an SGPR pair sub-register class exclusive of the CSRs, and used this register class while lowering the return instruction.

Diff Detail

Repository
rL LLVM

Event Timeline

cdevadas created this revision.Jun 28 2019, 3:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2019, 3:26 AM

Hi Matt,

The codegen is different now and the scheduler & RA introduce most changes in the test cases.

arsenm added inline comments.Jun 28 2019, 5:05 PM
lib/Target/AMDGPU/SOPInstructions.td
133–137 ↗(On Diff #207023)

The name doesn't match what this is for. I would rather not introduce a separate instruction class for this. You can instead parameterize the existing class with the (ins) for the instruction, defaulting to (ins SReg_64:$src0)

test/CodeGen/AMDGPU/cross-block-use-is-not-abi-copy.ll
32 ↗(On Diff #207023)

It looks like you manually added these checks instead of using update_llc_test_checks?

test/CodeGen/AMDGPU/nested-calls.ll
33 ↗(On Diff #207023)

Are the results actually better looking? Can you add explicit checks for the register s_setpc_b64 is using?

cdevadas updated this revision to Diff 207250.Jul 1 2019, 2:58 AM

Parameterized the existing operand class 'SOP1_1' to accommodate different register classes.
Added explicit check for the register pair in return instruction, 's_setpc_b64' (for nested-calls.ll test)

arsenm added inline comments.Jul 3 2019, 12:32 PM
lib/Target/AMDGPU/SIISelLowering.cpp
2237 ↗(On Diff #207250)

This line looks too long? Run clang-format?

lib/Target/AMDGPU/SIRegisterInfo.td
492 ↗(On Diff #207250)

You should bee able to use SGPR_64.RegTypes to avoid repeating the type list

493–494 ↗(On Diff #207250)

You can also avoid repeating these with SGPR_64.CopyCost, and AllocationPriority

cdevadas updated this revision to Diff 208188.Jul 5 2019, 8:27 AM

reused the existing register class' parameters for the new class.
Also ran clang-format to fix the long lines.

arsenm accepted this revision.Jul 8 2019, 9:46 AM

LGTM

This revision is now accepted and ready to land.Jul 8 2019, 9:46 AM
This revision was automatically updated to reflect the committed changes.