LLVM: lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
19
20namespace llvm {
21
23
24
25
28 switch (Abi) {
30 ABIName = "ilp32s";
31 break;
33 ABIName = "ilp32f";
34 break;
36 ABIName = "ilp32d";
37 break;
39 ABIName = "lp64f";
40 break;
43 return Abi;
44 default:
46 }
47 errs() << "warning: '" << ABIName << "' has not been standardized\n";
48 return Abi;
49}
50
52 bool Is64Bit = TT.isArch64Bit();
53 ABI TripleABI;
54 switch (TT.getEnvironment()) {
57 break;
61 break;
65 break;
66
68 default:
70 break;
71 }
72 return TripleABI;
73}
74
77 bool Is64Bit = TT.isArch64Bit();
80
81 auto IsABIValidForFeature = [=](ABI Abi) {
82 switch (Abi) {
83 default:
84 return false;
86 return !Is64Bit;
88 return !Is64Bit && FeatureBits[LoongArch::FeatureBasicF];
90 return !Is64Bit && FeatureBits[LoongArch::FeatureBasicD];
92 return Is64Bit;
94 return Is64Bit && FeatureBits[LoongArch::FeatureBasicF];
96 return Is64Bit && FeatureBits[LoongArch::FeatureBasicD];
97 }
98 };
99
100
101 if (IsABIValidForFeature(ArgProvidedABI)) {
102 if (IsABIValidForFeature(TripleABI) && ArgProvidedABI != TripleABI)
104 << "warning: triple-implied ABI conflicts with provided target-abi '"
105 << ABIName << "', using target-abi\n";
107 }
108
109
110 if (IsABIValidForFeature(TripleABI)) {
111
112 if (ABIName.empty())
114
115 switch (ArgProvidedABI) {
117
118
119 errs() << "warning: the '" << ABIName
120 << "' is not a recognized ABI for this target, ignoring and "
121 "using triple-implied ABI\n";
126 if (Is64Bit) {
127 errs() << "warning: 32-bit ABIs are not supported for 64-bit targets, "
128 "ignoring and using triple-implied ABI\n";
130 }
131 break;
135 if (!Is64Bit) {
136 errs() << "warning: 64-bit ABIs are not supported for 32-bit targets, "
137 "ignoring and using triple-implied ABI\n";
139 }
140 break;
141 }
142
143 switch (ArgProvidedABI) {
146 errs() << "warning: the '" << ABIName
147 << "' ABI can't be used for a target that doesn't support the 'F' "
148 "instruction set, ignoring and using triple-implied ABI\n";
149 break;
152 errs() << "warning: the '" << ABIName
153 << "' ABI can't be used for a target that doesn't support the 'D' "
154 "instruction set, ignoring and using triple-implied ABI\n";
155 break;
156 default:
158 }
160 }
161
162
163 auto GetFeatureABI = [=]() {
164 if (FeatureBits[LoongArch::FeatureBasicD])
166 if (FeatureBits[LoongArch::FeatureBasicF])
169 };
170 if (!ABIName.empty())
171 errs() << "warning: both target-abi and the triple-implied ABI are "
172 "invalid, ignoring and using feature-implied ABI\n";
174}
175
185 return TargetABI;
186}
187
188
189
190
192
193}
194
195}
Container class for subtarget features.
Wrapper class representing physical registers. Should be passed by value.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static ABI checkABIStandardized(ABI Abi)
Definition LoongArchBaseInfo.cpp:26
MCRegister getBPReg()
Definition LoongArchBaseInfo.cpp:191
static ABI getTripleABI(const Triple &TT)
Definition LoongArchBaseInfo.cpp:51
ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName)
Definition LoongArchBaseInfo.cpp:75
ABI getTargetABI(StringRef ABIName)
Definition LoongArchBaseInfo.cpp:176
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.