Skip to content

[NFC] Move non-upstreamed FuncParam decorations into internal:: #4138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions llvm-spirv/lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4316,16 +4316,17 @@ bool SPIRVToLLVM::transVectorComputeMetadata(SPIRVFunction *BF) {
std::to_string(Kind));
F->addAttribute(ArgNo + 1, Attr);
}
if (BA->hasDecorate(DecorationFuncParamKindINTEL, 0, &Kind)) {
if (BA->hasDecorate(internal::DecorationFuncParamKindINTEL, 0, &Kind)) {
Attribute Attr = Attribute::get(*Context, kVCMetadata::VCArgumentKind,
std::to_string(Kind));
F->addAttribute(ArgNo + 1, Attr);
}
if (BA->hasDecorate(DecorationSingleElementVectorINTEL))
F->addAttribute(ArgNo + 1, SEVAttr);
if (BA->hasDecorate(DecorationFuncParamDescINTEL)) {
if (BA->hasDecorate(internal::DecorationFuncParamDescINTEL)) {
auto Desc =
BA->getDecorationStringLiteral(DecorationFuncParamDescINTEL).front();
BA->getDecorationStringLiteral(internal::DecorationFuncParamDescINTEL)
.front();
Attribute Attr =
Attribute::get(*Context, kVCMetadata::VCArgumentDesc, Desc);
F->addAttribute(ArgNo + 1, Attr);
Expand Down
2 changes: 1 addition & 1 deletion llvm-spirv/lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ void LLVMToSPIRVBase::transVectorComputeMetadata(Function *F) {
Attrs.getAttribute(ArgNo + 1, kVCMetadata::VCArgumentKind)
.getValueAsString()
.getAsInteger(0, Kind);
BA->addDecorate(DecorationFuncParamKindINTEL, Kind);
BA->addDecorate(internal::DecorationFuncParamKindINTEL, Kind);
}
if (Attrs.hasAttribute(ArgNo + 1, kVCMetadata::VCArgumentDesc)) {
StringRef Desc =
Expand Down
16 changes: 8 additions & 8 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDecorate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ size_t SPIRVDecorateGeneric::getLiteralCount() const { return Literals.size(); }
void SPIRVDecorate::encode(spv_ostream &O) const {
SPIRVEncoder Encoder = getEncoder(O);
Encoder << Target << Dec;
switch (Dec) {
switch (static_cast<size_t>(Dec)) {
case DecorationLinkageAttributes:
SPIRVDecorateLinkageAttr::encodeLiterals(Encoder, Literals);
break;
Expand All @@ -114,7 +114,7 @@ void SPIRVDecorate::encode(spv_ostream &O) const {
case DecorationUserSemantic:
SPIRVDecorateUserSemanticAttr::encodeLiterals(Encoder, Literals);
break;
case DecorationFuncParamDescINTEL:
case internal::DecorationFuncParamDescINTEL:
SPIRVDecorateFuncParamDescAttr::encodeLiterals(Encoder, Literals);
break;
default:
Expand All @@ -130,7 +130,7 @@ void SPIRVDecorate::setWordCount(SPIRVWord Count) {
void SPIRVDecorate::decode(std::istream &I) {
SPIRVDecoder Decoder = getDecoder(I);
Decoder >> Target >> Dec;
switch (Dec) {
switch (static_cast<size_t>(Dec)) {
case DecorationLinkageAttributes:
SPIRVDecorateLinkageAttr::decodeLiterals(Decoder, Literals);
break;
Expand All @@ -143,7 +143,7 @@ void SPIRVDecorate::decode(std::istream &I) {
case DecorationUserSemantic:
SPIRVDecorateUserSemanticAttr::decodeLiterals(Decoder, Literals);
break;
case DecorationFuncParamDescINTEL:
case internal::DecorationFuncParamDescINTEL:
SPIRVDecorateFuncParamDescAttr::decodeLiterals(Decoder, Literals);
break;
default:
Expand Down Expand Up @@ -171,7 +171,7 @@ void SPIRVDecorateId::decode(std::istream &I) {
void SPIRVMemberDecorate::encode(spv_ostream &O) const {
SPIRVEncoder Encoder = getEncoder(O);
Encoder << Target << MemberNumber << Dec;
switch (Dec) {
switch (static_cast<size_t>(Dec)) {
case DecorationMemoryINTEL:
SPIRVDecorateMemoryINTELAttr::encodeLiterals(Encoder, Literals);
break;
Expand All @@ -181,7 +181,7 @@ void SPIRVMemberDecorate::encode(spv_ostream &O) const {
case DecorationUserSemantic:
SPIRVDecorateUserSemanticAttr::encodeLiterals(Encoder, Literals);
break;
case DecorationFuncParamDescINTEL:
case internal::DecorationFuncParamDescINTEL:
SPIRVDecorateFuncParamDescAttr::encodeLiterals(Encoder, Literals);
break;
default:
Expand All @@ -197,7 +197,7 @@ void SPIRVMemberDecorate::setWordCount(SPIRVWord Count) {
void SPIRVMemberDecorate::decode(std::istream &I) {
SPIRVDecoder Decoder = getDecoder(I);
Decoder >> Target >> MemberNumber >> Dec;
switch (Dec) {
switch (static_cast<size_t>(Dec)) {
case DecorationMemoryINTEL:
SPIRVDecorateMemoryINTELAttr::decodeLiterals(Decoder, Literals);
break;
Expand All @@ -207,7 +207,7 @@ void SPIRVMemberDecorate::decode(std::istream &I) {
case DecorationUserSemantic:
SPIRVDecorateUserSemanticAttr::decodeLiterals(Decoder, Literals);
break;
case DecorationFuncParamDescINTEL:
case internal::DecorationFuncParamDescINTEL:
SPIRVDecorateFuncParamDescAttr::decodeLiterals(Decoder, Literals);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDecorate.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class SPIRVDecorateUserSemanticAttr
};

class SPIRVDecorateFuncParamDescAttr
: public SPIRVDecorateStrAttrBase<DecorationFuncParamDescINTEL> {
: public SPIRVDecorateStrAttrBase<internal::DecorationFuncParamDescINTEL> {
public:
// Complete constructor for UserSemantic decoration
SPIRVDecorateFuncParamDescAttr(SPIRVEntry *TheTarget,
Expand Down
6 changes: 4 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,10 @@ template <> inline void SPIRVMap<Decoration, SPIRVCapVec>::init() {
ADD_VEC_INIT(DecorationFuncParamIOKindINTEL, {CapabilityVectorComputeINTEL});
ADD_VEC_INIT(DecorationStackCallINTEL, {CapabilityVectorComputeINTEL});
ADD_VEC_INIT(DecorationSIMTCallINTEL, {CapabilityVectorComputeINTEL});
ADD_VEC_INIT(DecorationFuncParamKindINTEL, {CapabilityVectorComputeINTEL});
ADD_VEC_INIT(DecorationFuncParamDescINTEL, {CapabilityVectorComputeINTEL});
ADD_VEC_INIT(internal::DecorationFuncParamKindINTEL,
{CapabilityVectorComputeINTEL});
ADD_VEC_INIT(internal::DecorationFuncParamDescINTEL,
{CapabilityVectorComputeINTEL});
ADD_VEC_INIT(DecorationBurstCoalesceINTEL,
{CapabilityFPGAMemoryAccessesINTEL});
ADD_VEC_INIT(DecorationCacheSizeINTEL, {CapabilityFPGAMemoryAccessesINTEL});
Expand Down
4 changes: 2 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ template <> inline void SPIRVMap<Decoration, std::string>::init() {
add(DecorationCacheSizeINTEL, "CacheSizeINTEL");
add(DecorationDontStaticallyCoalesceINTEL, "DontStaticallyCoalesceINTEL");
add(DecorationPrefetchINTEL, "PrefetchINTEL");
add(DecorationFuncParamKindINTEL, "FuncParamKindINTEL");
add(DecorationFuncParamDescINTEL, "FuncParamDescINTEL");
add(DecorationStallEnableINTEL, "StallEnableINTEL");
add(DecorationFuseLoopsInFunctionINTEL, "FuseLoopsInFunctionINTEL");
add(DecorationBufferLocationINTEL, "BufferLocationINTEL");
Expand All @@ -173,6 +171,8 @@ template <> inline void SPIRVMap<Decoration, std::string>::init() {
"VectorComputeCallableFunctionINTEL");

// From spirv_internal.hpp
add(internal::DecorationFuncParamKindINTEL, "FuncParamKindINTEL");
add(internal::DecorationFuncParamDescINTEL, "FuncParamDescINTEL");
add(internal::DecorationCallableFunctionINTEL, "CallableFunctionINTEL");
add(internal::DecorationMathOpDSPModeINTEL, "MathOpDSPModeINTEL");
add(internal::DecorationAliasScopeINTEL, "AliasScopeINTEL");
Expand Down
2 changes: 0 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ enum Decoration {
DecorationRestrictPointerEXT = 5355,
DecorationAliasedPointer = 5356,
DecorationAliasedPointerEXT = 5356,
DecorationFuncParamKindINTEL = 9624,
DecorationFuncParamDescINTEL = 9625,
DecorationSIMTCallINTEL = 5599,
DecorationReferencedIndirectlyINTEL = 5602,
DecorationClobberINTEL = 5607,
Expand Down
8 changes: 7 additions & 1 deletion llvm-spirv/lib/SPIRV/libSPIRV/spirv_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ enum InternalDecoration {
IDecMaxConcurrencyINTEL = 5918,
IDecPipelineEnableINTEL = 5919,
IDecRuntimeAlignedINTEL = 5940,
IDecCallableFunctionINTEL = 6087
IDecCallableFunctionINTEL = 6087,
IDecFuncParamKindINTEL = 9624,
IDecFuncParamDescINTEL = 9625
};

enum InternalCapability {
Expand Down Expand Up @@ -112,6 +114,10 @@ constexpr Decoration DecorationCallableFunctionINTEL =
static_cast<Decoration>(IDecCallableFunctionINTEL);
constexpr Decoration DecorationRuntimeAlignedINTEL =
static_cast<Decoration>(IDecRuntimeAlignedINTEL);
constexpr Decoration DecorationFuncParamKindINTEL =
static_cast<Decoration>(IDecFuncParamKindINTEL);
constexpr Decoration DecorationFuncParamDescINTEL =
static_cast<Decoration>(IDecFuncParamDescINTEL);

constexpr Capability CapabilityOptimizationHintsINTEL =
static_cast<Capability>(ICapOptimizationHintsINTEL);
Expand Down