LLVM: lib/Target/AArch64/AArch64SMEAttributes.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

13#include

14

15using namespace llvm;

16

17void SMEAttrs::validate() const {

18

20 "SM_Enabled and SM_Compatible are mutually exclusive");

21

22

24 "ZA_New and SME_ABI_Routine are mutually exclusive");

25

28 "Attributes 'aarch64_new_za', 'aarch64_in_za', 'aarch64_out_za', "

29 "'aarch64_inout_za' and 'aarch64_preserves_za' are mutually exclusive");

30

31

34 1 &&

35 "Attributes 'aarch64_new_zt0', 'aarch64_in_zt0', 'aarch64_out_zt0', "

36 "'aarch64_inout_zt0' and 'aarch64_preserves_zt0' are mutually exclusive");

37

39 "Function cannot have a shared-ZA interface and an agnostic-ZA "

40 "interface");

41}

42

44 Bitmask = 0;

45 if (Attrs.hasFnAttr("aarch64_pstate_sm_enabled"))

47 if (Attrs.hasFnAttr("aarch64_pstate_sm_compatible"))

49 if (Attrs.hasFnAttr("aarch64_pstate_sm_body"))

51 if (Attrs.hasFnAttr("aarch64_za_state_agnostic"))

53 if (Attrs.hasFnAttr("aarch64_zt0_undef"))

55 if (Attrs.hasFnAttr("aarch64_in_za"))

57 if (Attrs.hasFnAttr("aarch64_out_za"))

59 if (Attrs.hasFnAttr("aarch64_inout_za"))

61 if (Attrs.hasFnAttr("aarch64_preserves_za"))

63 if (Attrs.hasFnAttr("aarch64_new_za"))

65 if (Attrs.hasFnAttr("aarch64_in_zt0"))

67 if (Attrs.hasFnAttr("aarch64_out_zt0"))

69 if (Attrs.hasFnAttr("aarch64_inout_zt0"))

71 if (Attrs.hasFnAttr("aarch64_preserves_zt0"))

73 if (Attrs.hasFnAttr("aarch64_new_zt0"))

75}

76

77void SMEAttrs::addKnownFunctionAttrs(StringRef FuncName,

80 if (Impl == RTLIB::Unsupported)

81 return;

84 switch (LC) {

85 case RTLIB::SMEABI_SME_STATE:

86 case RTLIB::SMEABI_TPIDR2_SAVE:

87 case RTLIB::SMEABI_GET_CURRENT_VG:

88 case RTLIB::SMEABI_SME_STATE_SIZE:

89 case RTLIB::SMEABI_SME_SAVE:

90 case RTLIB::SMEABI_SME_RESTORE:

92 break;

93 case RTLIB::SMEABI_ZA_DISABLE:

94 case RTLIB::SMEABI_TPIDR2_RESTORE:

97 break;

98 case RTLIB::SC_MEMCPY:

99 case RTLIB::SC_MEMMOVE:

100 case RTLIB::SC_MEMSET:

101 case RTLIB::SC_MEMCHR:

103 break;

104 default:

105 break;

106 }

107 set(KnownAttrs);

108}

109

111 if (callee().hasStreamingCompatibleInterface())

112 return false;

113

114

115 if (caller().hasNonStreamingInterfaceAndBody() &&

116 callee().hasNonStreamingInterface())

117 return false;

118

119

120 if (caller().hasStreamingInterfaceOrBody() &&

121 callee().hasStreamingInterface())

122 return false;

123

124 return true;

125}

126

130 Callsite(CB.getAttributes()), IsIndirect(CB.isIndirectCall()) {

132 CalledFn = SMEAttrs(*CalledFunction, RTLCI);

133

134

135

136 assert((IsIndirect ||

137 ((Callsite.withoutPerCallsiteFlags() | CalledFn) == CalledFn)) &&

138 "SME attributes at callsite do not match declaration");

139

140

141

142

145}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)

Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...

Function * getCalledFunction() const

Returns the function called, or null if this is an indirect function invocation or the function signa...

SMEAttrs is a utility class to parse the SME ACLE attributes on functions.

bool isPreservesZT0() const

bool hasStreamingInterface() const

static unsigned encodeZAState(StateValue S)

bool hasStreamingCompatibleInterface() const

bool hasAgnosticZAInterface() const

bool isPreservesZA() const

void set(unsigned M, bool Enable=true)

bool hasSharedZAInterface() const

static unsigned encodeZT0State(StateValue S)

bool requiresSMChange() const

Definition AArch64SMEAttributes.cpp:110

SMECallAttrs(SMEAttrs Caller, SMEAttrs Callee, SMEAttrs Callsite=SMEAttrs::Normal)

StringRef - Represent a constant reference to a string, i.e.

This is an optimization pass for GlobalISel generic memory operations.

static bool isIndirectCall(const MachineInstr &MI)

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

A simple container for information about the supported runtime calls.

LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const

Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.

static RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl)

Return the libcall provided by Impl.