This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][llvm-mc] Predefined symbols to access register counts (.kernel.{v|s}gpr_count)
ClosedPublic

Authored by artem.tamazov on Dec 16 2016, 1:11 PM.

Details

Summary

The feature allows for conditional assembly, filling the entries
of .amd_kernel_code_t etc.

Symbols are defined with value 0 at the beginning of each kernel scope.
After each register usage, the respective symbol is set to:
value = max( value, ( register index + 1 ) )
Thus, at the end of scope the value represents a count of used registers.

Kernel scopes begin at .amdgpu_hsa_kernel directive, end at the
next .amdgpu_hsa_kernel (or EOF, whichever comes first). There is also
dummy scope that lies from the beginning of source file til the
first .amdgpu_hsa_kernel.

Test added.

Diff Detail

Repository
rL LLVM

Event Timeline

artem.tamazov retitled this revision from to [AMDGPU][llvm-mc] Predefined symbols to access register counts (.kernel_scope.{v|s}gpr_index_unused_min).
artem.tamazov updated this object.
artem.tamazov added a reviewer: vpykhtin.
artem.tamazov set the repository for this revision to rL LLVM.
artem.tamazov added a subscriber: Restricted Project.
artem.tamazov retitled this revision from [AMDGPU][llvm-mc] Predefined symbols to access register counts (.kernel_scope.{v|s}gpr_index_unused_min) to [AMDGPU][llvm-mc] Predefined symbols to access register counts (.kernel.{v|s}gpr_count).
artem.tamazov updated this object.
artem.tamazov edited edge metadata.

Symbols renamed. Dummy scope introduced. More tests added.

vpykhtin accepted this revision.Dec 27 2016, 4:22 AM
vpykhtin edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Dec 27 2016, 4:22 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/MC/AMDGPU/sym_option.s