@@ -160,11 +160,28 @@ bool TargetLibraryInfoImpl::isCallingConvCCompatible(Function *F) {
160
160
F->getFunctionType ());
161
161
}
162
162
163
+ static void initializeBase (TargetLibraryInfoImpl &TLI, const Triple &T) {
164
+ bool ShouldExtI32Param, ShouldExtI32Return;
165
+ bool ShouldSignExtI32Param, ShouldSignExtI32Return;
166
+ TargetLibraryInfo::initExtensionsForTriple (
167
+ ShouldExtI32Param, ShouldExtI32Return, ShouldSignExtI32Param,
168
+ ShouldSignExtI32Return, T);
169
+ TLI.setShouldExtI32Param (ShouldExtI32Param);
170
+ TLI.setShouldExtI32Return (ShouldExtI32Return);
171
+ TLI.setShouldSignExtI32Param (ShouldSignExtI32Param);
172
+ TLI.setShouldSignExtI32Return (ShouldSignExtI32Return);
173
+
174
+ // Let's assume by default that the size of int is 32 bits, unless the target
175
+ // is a 16-bit architecture because then it most likely is 16 bits. If that
176
+ // isn't true for a target those defaults should be overridden below.
177
+ TLI.setIntSize (T.isArch16Bit () ? 16 : 32 );
178
+ }
179
+
163
180
// / Initialize the set of available library functions based on the specified
164
181
// / target triple. This should be carefully written so that a missing target
165
182
// / triple gets a sane set of defaults.
166
- static void initialize (TargetLibraryInfoImpl &TLI, const Triple &T,
167
- ArrayRef<StringLiteral> StandardNames) {
183
+ static void initializeLibCalls (TargetLibraryInfoImpl &TLI, const Triple &T,
184
+ ArrayRef<StringLiteral> StandardNames) {
168
185
// Set IO unlocked variants as unavailable
169
186
// Set them as available per system below
170
187
TLI.setUnavailable (LibFunc_getc_unlocked);
@@ -178,20 +195,6 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
178
195
TLI.setUnavailable (LibFunc_fputs_unlocked);
179
196
TLI.setUnavailable (LibFunc_fgets_unlocked);
180
197
181
- bool ShouldExtI32Param, ShouldExtI32Return;
182
- bool ShouldSignExtI32Param, ShouldSignExtI32Return;
183
- TargetLibraryInfo::initExtensionsForTriple (ShouldExtI32Param,
184
- ShouldExtI32Return, ShouldSignExtI32Param, ShouldSignExtI32Return, T);
185
- TLI.setShouldExtI32Param (ShouldExtI32Param);
186
- TLI.setShouldExtI32Return (ShouldExtI32Return);
187
- TLI.setShouldSignExtI32Param (ShouldSignExtI32Param);
188
- TLI.setShouldSignExtI32Return (ShouldSignExtI32Return);
189
-
190
- // Let's assume by default that the size of int is 32 bits, unless the target
191
- // is a 16-bit architecture because then it most likely is 16 bits. If that
192
- // isn't true for a target those defaults should be overridden below.
193
- TLI.setIntSize (T.isArch16Bit () ? 16 : 32 );
194
-
195
198
// There is really no runtime library on AMDGPU, apart from
196
199
// __kmpc_alloc/free_shared.
197
200
if (T.isAMDGPU ()) {
@@ -882,11 +885,19 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
882
885
TLI.addVectorizableFunctionsFromVecLib (ClVectorLibrary, T);
883
886
}
884
887
885
- TargetLibraryInfoImpl::TargetLibraryInfoImpl () {
886
- // Default to everything being available.
887
- memset (AvailableArray, -1 , sizeof (AvailableArray));
888
+ // / Initialize the set of available library functions based on the specified
889
+ // / target triple. This should be carefully written so that a missing target
890
+ // / triple gets a sane set of defaults.
891
+ static void initialize (TargetLibraryInfoImpl &TLI, const Triple &T,
892
+ ArrayRef<StringLiteral> StandardNames) {
893
+ initializeBase (TLI, T);
894
+ initializeLibCalls (TLI, T, StandardNames);
895
+ }
888
896
889
- initialize (*this , Triple (), StandardNames);
897
+ TargetLibraryInfoImpl::TargetLibraryInfoImpl () {
898
+ // Default to nothing being available.
899
+ memset (AvailableArray, 0 , sizeof (AvailableArray));
900
+ initializeBase (*this , Triple ());
890
901
}
891
902
892
903
TargetLibraryInfoImpl::TargetLibraryInfoImpl (const Triple &T) {
0 commit comments