Skip to content

[SYCL][FPGA][NFC] Update [[intel::doublepump]] and [[intel::singlepump]] attributes #5198

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 5 commits into from
Dec 24, 2021
Merged
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
31 changes: 23 additions & 8 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6513,17 +6513,32 @@ static void handleSYCLIntelNoGlobalWorkOffsetAttr(Sema &S, Decl *D,
S.AddSYCLIntelNoGlobalWorkOffsetAttr(D, A, E);
}

/// Handle the [[intel::doublepump]] and [[intel::singlepump]]
/// attributes.
template <typename AttrType>
static void handleIntelFPGAPumpAttr(Sema &S, Decl *D, const ParsedAttr &A) {
checkForDuplicateAttribute<AttrType>(S, D, A);
/// Handle the [[intel::singlepump]] attribute.
static void handleSYCLIntelFPGASinglePumpAttr(Sema &S, Decl *D,
const ParsedAttr &AL) {
checkForDuplicateAttribute<IntelFPGASinglePumpAttr>(S, D, AL);

// If the declaration does not have an [[intel::fpga_memory]]
// attribute, this creates one as an implicit attribute.
if (!D->hasAttr<IntelFPGAMemoryAttr>())
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
S.Context, IntelFPGAMemoryAttr::Default));

D->addAttr(::new (S.Context) IntelFPGASinglePumpAttr(S.Context, AL));
}

/// Handle the [[intel::doublepump]] attribute.
static void handleSYCLIntelFPGADoublePumpAttr(Sema &S, Decl *D,
const ParsedAttr &AL) {
checkForDuplicateAttribute<IntelFPGADoublePumpAttr>(S, D, AL);

// If the declaration does not have an [[intel::fpga_memory]]
// attribute, this creates one as an implicit attribute.
if (!D->hasAttr<IntelFPGAMemoryAttr>())
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
S.Context, IntelFPGAMemoryAttr::Default));

handleSimpleAttribute<AttrType>(S, D, A);
D->addAttr(::new (S.Context) IntelFPGADoublePumpAttr(S.Context, AL));
}

/// Handle the [[intel::fpga_memory]] attribute.
Expand Down Expand Up @@ -10558,10 +10573,10 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,

// Intel FPGA specific attributes
case ParsedAttr::AT_IntelFPGADoublePump:
handleIntelFPGAPumpAttr<IntelFPGADoublePumpAttr>(S, D, AL);
handleSYCLIntelFPGADoublePumpAttr(S, D, AL);
break;
case ParsedAttr::AT_IntelFPGASinglePump:
handleIntelFPGAPumpAttr<IntelFPGASinglePumpAttr>(S, D, AL);
handleSYCLIntelFPGASinglePumpAttr(S, D, AL);
break;
case ParsedAttr::AT_IntelFPGAMemory:
handleIntelFPGAMemoryAttr(S, D, AL);
Expand Down