File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
llvm/lib/Target/AArch64/Utils Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,8 @@ bool SMECallAttrs::requiresSMChange() const {
113
113
SMECallAttrs::SMECallAttrs (const CallBase &CB)
114
114
: CallerFn(*CB.getFunction()), CalledFn(SMEAttrs::Normal),
115
115
Callsite(CB.getAttributes()), IsIndirect(CB.isIndirectCall()) {
116
- if (auto *CalledFunction = CB.getCalledFunction ()) {
117
- CalledFn = SMEAttrs (*CalledFunction);
118
- CalledFn.addKnownFunctionAttrs (CalledFunction->getName ());
119
- }
116
+ if (auto *CalledFunction = CB.getCalledFunction ())
117
+ CalledFn = SMEAttrs (*CalledFunction, SMEAttrs::InferAttrsFromName::Yes);
120
118
121
119
// FIXME: We probably should not allow SME attributes on direct calls but
122
120
// clang duplicates streaming mode attributes at each callsite.
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ namespace llvm {
16
16
class Function ;
17
17
class CallBase ;
18
18
class AttributeList ;
19
- class SMECallAttrs ;
20
19
21
20
// / SMEAttrs is a utility class to parse the SME ACLE attributes on functions.
22
21
// / It helps determine a function's requirements for PSTATE.ZA and PSTATE.SM.
@@ -49,9 +48,15 @@ class SMEAttrs {
49
48
Callsite_Flags = ZT0_Undef
50
49
};
51
50
51
+ enum class InferAttrsFromName { No, Yes };
52
+
52
53
SMEAttrs () = default ;
53
54
SMEAttrs (unsigned Mask) { set (Mask); }
54
- SMEAttrs (const Function &F) : SMEAttrs(F.getAttributes()) {}
55
+ SMEAttrs (const Function &F, InferAttrsFromName Infer = InferAttrsFromName::No)
56
+ : SMEAttrs(F.getAttributes()) {
57
+ if (Infer == InferAttrsFromName::Yes)
58
+ addKnownFunctionAttrs (F.getName ());
59
+ }
55
60
SMEAttrs (const AttributeList &L);
56
61
SMEAttrs (StringRef FuncName) { addKnownFunctionAttrs (FuncName); };
57
62
@@ -140,8 +145,6 @@ class SMEAttrs {
140
145
return Bitmask == Other.Bitmask ;
141
146
}
142
147
143
- friend SMECallAttrs;
144
-
145
148
private:
146
149
void addKnownFunctionAttrs (StringRef FuncName);
147
150
};
You can’t perform that action at this time.
0 commit comments