@@ -652,22 +652,21 @@ SPIRVFunction *LLVMToSPIRVBase::transFunctionDecl(Function *F) {
652
652
BA->addAttr (FunctionParameterAttributeSret);
653
653
if (I->onlyReadsMemory ())
654
654
BA->addAttr (FunctionParameterAttributeNoWrite);
655
- if (Attrs.hasAttribute (ArgNo + 1 , Attribute::ZExt))
655
+ if (Attrs.hasParamAttr (ArgNo, Attribute::ZExt))
656
656
BA->addAttr (FunctionParameterAttributeZext);
657
- if (Attrs.hasAttribute (ArgNo + 1 , Attribute::SExt))
657
+ if (Attrs.hasParamAttr (ArgNo, Attribute::SExt))
658
658
BA->addAttr (FunctionParameterAttributeSext);
659
- if (Attrs.hasAttribute (ArgNo + 1 , Attribute::Alignment)) {
660
- SPIRVWord AlignmentBytes =
661
- Attrs.getAttribute (ArgNo + 1 , Attribute::Alignment)
662
- .getAlignment ()
663
- .valueOrOne ()
664
- .value ();
659
+ if (Attrs.hasParamAttr (ArgNo, Attribute::Alignment)) {
660
+ SPIRVWord AlignmentBytes = Attrs.getParamAttr (ArgNo, Attribute::Alignment)
661
+ .getAlignment ()
662
+ .valueOrOne ()
663
+ .value ();
665
664
BA->setAlignment (AlignmentBytes);
666
665
}
667
666
if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_1) &&
668
- Attrs.hasAttribute (ArgNo + 1 , Attribute::Dereferenceable))
667
+ Attrs.hasParamAttr (ArgNo, Attribute::Dereferenceable))
669
668
BA->addDecorate (DecorationMaxByteOffset,
670
- Attrs.getAttribute (ArgNo + 1 , Attribute::Dereferenceable)
669
+ Attrs.getParamAttr (ArgNo, Attribute::Dereferenceable)
671
670
.getDereferenceableBytes ());
672
671
if (BufferLocation && I->getType ()->isPointerTy ()) {
673
672
// Order of integer numbers in MD node follows the order of function
@@ -692,9 +691,9 @@ SPIRVFunction *LLVMToSPIRVBase::transFunctionDecl(Function *F) {
692
691
BA->addDecorate (internal::DecorationRuntimeAlignedINTEL, LocID);
693
692
}
694
693
}
695
- if (Attrs.hasAttribute (AttributeList::ReturnIndex, Attribute::ZExt))
694
+ if (Attrs.hasRetAttr ( Attribute::ZExt))
696
695
BF->addDecorate (DecorationFuncParamAttr, FunctionParameterAttributeZext);
697
- if (Attrs.hasAttribute (AttributeList::ReturnIndex, Attribute::SExt))
696
+ if (Attrs.hasRetAttr ( Attribute::SExt))
698
697
BF->addDecorate (DecorationFuncParamAttr, FunctionParameterAttributeSext);
699
698
if (Attrs.hasFnAttr (" referenced-indirectly" )) {
700
699
assert (!isKernel (F) &&
@@ -734,14 +733,13 @@ void LLVMToSPIRVBase::transVectorComputeMetadata(Function *F) {
734
733
735
734
if (Attrs.hasFnAttr (kVCMetadata ::VCSIMTCall)) {
736
735
SPIRVWord SIMTMode = 0 ;
737
- Attrs.getAttribute (AttributeList::FunctionIndex, kVCMetadata ::VCSIMTCall)
736
+ Attrs.getFnAttr ( kVCMetadata ::VCSIMTCall)
738
737
.getValueAsString ()
739
738
.getAsInteger (0 , SIMTMode);
740
739
BF->addDecorate (DecorationSIMTCallINTEL, SIMTMode);
741
740
}
742
741
743
- if (Attrs.hasAttribute (AttributeList::ReturnIndex,
744
- kVCMetadata ::VCSingleElementVector)) {
742
+ if (Attrs.hasRetAttr (kVCMetadata ::VCSingleElementVector)) {
745
743
auto *RT = BF->getType ();
746
744
(void )RT;
747
745
assert ((RT->isTypeBool () || RT->isTypeFloat () || RT->isTypeInt () ||
@@ -754,14 +752,14 @@ void LLVMToSPIRVBase::transVectorComputeMetadata(Function *F) {
754
752
++I) {
755
753
auto ArgNo = I->getArgNo ();
756
754
SPIRVFunctionParameter *BA = BF->getArgument (ArgNo);
757
- if (Attrs.hasAttribute (ArgNo + 1 , kVCMetadata ::VCArgumentIOKind)) {
755
+ if (Attrs.hasParamAttr (ArgNo, kVCMetadata ::VCArgumentIOKind)) {
758
756
SPIRVWord Kind = {};
759
- Attrs.getAttribute (ArgNo + 1 , kVCMetadata ::VCArgumentIOKind)
757
+ Attrs.getParamAttr (ArgNo, kVCMetadata ::VCArgumentIOKind)
760
758
.getValueAsString ()
761
759
.getAsInteger (0 , Kind);
762
760
BA->addDecorate (DecorationFuncParamIOKindINTEL, Kind);
763
761
}
764
- if (Attrs.hasAttribute (ArgNo + 1 , kVCMetadata ::VCSingleElementVector)) {
762
+ if (Attrs.hasParamAttr (ArgNo, kVCMetadata ::VCSingleElementVector)) {
765
763
auto *AT = BA->getType ();
766
764
(void )AT;
767
765
assert ((AT->isTypeBool () || AT->isTypeFloat () || AT->isTypeInt () ||
@@ -775,8 +773,7 @@ void LLVMToSPIRVBase::transVectorComputeMetadata(Function *F) {
775
773
Attrs.hasFnAttr (kVCMetadata ::VCFloatControl)) {
776
774
777
775
SPIRVWord Mode = 0 ;
778
- Attrs
779
- .getAttribute (AttributeList::FunctionIndex, kVCMetadata ::VCFloatControl)
776
+ Attrs.getFnAttr (kVCMetadata ::VCFloatControl)
780
777
.getValueAsString ()
781
778
.getAsInteger (0 , Mode);
782
779
VCFloatTypeSizeMap::foreach (
@@ -1399,7 +1396,6 @@ SPIRVEntry *addMemAliasingINTELInstructions(SPIRVModule *M,
1399
1396
return M->getOrAddAliasScopeListDeclINTELInst (ListId, AliasingListMD);
1400
1397
}
1401
1398
1402
-
1403
1399
// Translate alias.scope/noalias metadata attached to store and load
1404
1400
// instructions.
1405
1401
void transAliasingMemAccess (SPIRVModule *BM, MDNode *AliasingListMD,
0 commit comments