[clang] [clang][X86] Support __attribute__((model("small"/"large"))) (PR #124834)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 14:35:55 PST 2025
================
@@ -2964,20 +2963,36 @@ static bool isValidCodeModelAttr(Sema &S, StringRef Str) {
static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
StringRef Str;
SourceLocation LiteralLoc;
+ auto IsTripleSupported = [](const llvm::Triple Triple) {
+ return Triple.getArch() == llvm::Triple::ArchType::x86_64 ||
+ Triple.isLoongArch();
+ };
+
// Check that it is a string.
if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc))
return;
- // Ignore the attribute for GPU device compiles since it only applies to host
- // globals.
- if (S.Context.getTargetInfo().getTriple().isNVPTX() ||
- S.Context.getTargetInfo().getTriple().isAMDGPU() ||
- S.Context.getTargetInfo().getTriple().isSPIRV())
+ SmallVector<llvm::Triple, 2> Triples = {
+ S.Context.getTargetInfo().getTriple()};
+ if (auto *aux = S.Context.getAuxTargetInfo()) {
+ Triples.push_back(aux->getTriple());
+ } else if (S.Context.getTargetInfo().getTriple().isNVPTX() ||
----------------
rnk wrote:
This is not actionable in this patch, but this points to the need for some kind of `isGPU` / `isVirtualISA` predicate.
https://github.com/llvm/llvm-project/pull/124834
More information about the cfe-commits
mailing list