Skip to content

Commit abd148c

Browse files
authored
[SYCL][FPGA][NFC] Update [[intel::doublepump]] and [[intel::singlepump]] attributes (#5198)
This patch returns the attribute itself instead of handleSimpleAttribute<> function and adds a separate handler function instead of common templated function to align with the community attributes for the two FPGA memory attributes below: 1. [[intel::doublepump] 2. [[intel::singlepump]] No functionality or test changes. Signed-off-by: Soumi Manna <[email protected]>
1 parent 04c18f2 commit abd148c

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6513,17 +6513,32 @@ static void handleSYCLIntelNoGlobalWorkOffsetAttr(Sema &S, Decl *D,
65136513
S.AddSYCLIntelNoGlobalWorkOffsetAttr(D, A, E);
65146514
}
65156515

6516-
/// Handle the [[intel::doublepump]] and [[intel::singlepump]]
6517-
/// attributes.
6518-
template <typename AttrType>
6519-
static void handleIntelFPGAPumpAttr(Sema &S, Decl *D, const ParsedAttr &A) {
6520-
checkForDuplicateAttribute<AttrType>(S, D, A);
6516+
/// Handle the [[intel::singlepump]] attribute.
6517+
static void handleSYCLIntelFPGASinglePumpAttr(Sema &S, Decl *D,
6518+
const ParsedAttr &AL) {
6519+
checkForDuplicateAttribute<IntelFPGASinglePumpAttr>(S, D, AL);
6520+
6521+
// If the declaration does not have an [[intel::fpga_memory]]
6522+
// attribute, this creates one as an implicit attribute.
6523+
if (!D->hasAttr<IntelFPGAMemoryAttr>())
6524+
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
6525+
S.Context, IntelFPGAMemoryAttr::Default));
6526+
6527+
D->addAttr(::new (S.Context) IntelFPGASinglePumpAttr(S.Context, AL));
6528+
}
65216529

6530+
/// Handle the [[intel::doublepump]] attribute.
6531+
static void handleSYCLIntelFPGADoublePumpAttr(Sema &S, Decl *D,
6532+
const ParsedAttr &AL) {
6533+
checkForDuplicateAttribute<IntelFPGADoublePumpAttr>(S, D, AL);
6534+
6535+
// If the declaration does not have an [[intel::fpga_memory]]
6536+
// attribute, this creates one as an implicit attribute.
65226537
if (!D->hasAttr<IntelFPGAMemoryAttr>())
65236538
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
65246539
S.Context, IntelFPGAMemoryAttr::Default));
65256540

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

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

1055910574
// Intel FPGA specific attributes
1056010575
case ParsedAttr::AT_IntelFPGADoublePump:
10561-
handleIntelFPGAPumpAttr<IntelFPGADoublePumpAttr>(S, D, AL);
10576+
handleSYCLIntelFPGADoublePumpAttr(S, D, AL);
1056210577
break;
1056310578
case ParsedAttr::AT_IntelFPGASinglePump:
10564-
handleIntelFPGAPumpAttr<IntelFPGASinglePumpAttr>(S, D, AL);
10579+
handleSYCLIntelFPGASinglePumpAttr(S, D, AL);
1056510580
break;
1056610581
case ParsedAttr::AT_IntelFPGAMemory:
1056710582
handleIntelFPGAMemoryAttr(S, D, AL);

0 commit comments

Comments
 (0)