================ @@ -2949,15 +2950,32 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } } +static bool isValidCodeModelAttr(Sema &S, StringRef Str) { + if (S.Context.getTargetInfo().getTriple().isLoongArch()) { + return Str == "normal" || Str == "medium" || Str == "extreme"; + } else { + assert(S.Context.getTargetInfo().getTriple().getArch() == + llvm::Triple::x86_64 && + "only loongarch/x86-64 supported"); + return Str == "small" || Str == "large"; + } +} + static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { StringRef Str; SourceLocation LiteralLoc; // Check that it is a string. if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc)) return; + // Ignore the attribute for NVPTX compiles since it only applies to host + // globals. + if (S.Context.getTargetInfo().getTriple().isNVPTX()) ---------------- aeubanks wrote:
done, PTAL. it seems really bad that we have to explicitly ignore every attribute that's not explicitly supported by the GPU targets https://github.com/llvm/llvm-project/pull/124834 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits