Skip to content

Commit b284474

Browse files
committed
address commment and fixed compile error on -Werror=global-constructors for aix os
1 parent e10686b commit b284474

File tree

4 files changed

+37
-34
lines changed

4 files changed

+37
-34
lines changed

clang/lib/Basic/Targets/PPC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ bool PPCTargetInfo::initFeatureMap(
523523
std::optional<llvm::StringMap<bool>> FeaturesOpt =
524524
llvm::PPC::getPPCDefaultTargetFeatures(TheTriple,
525525
llvm::PPC::normalizeCPUName(CPU));
526-
if (FeaturesOpt.has_value())
526+
if (FeaturesOpt)
527527
Features = FeaturesOpt.value();
528528

529529
if (!ppcUserFeaturesCheck(Diags, FeaturesVec))

clang/test/Driver/aix-small-local-exec-dynamic-tls.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
// RUN: %clang -target powerpc64-unknown-aix -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
2-
// RUN: %clang -target powerpc-unknown-aix -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
3-
// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
4-
// RUN: %clang -target powerpc64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
1+
// RUN: %clang --target=powerpc64-unknown-aix -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
2+
// RUN: %clang --target=powerpc-unknown-aix -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
3+
// RUN: %clang --target=powerpc64le-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
4+
// RUN: %clang --target=powerpc64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
55

6-
// RUN: %clang -target powerpc64-unknown-aix -maix-small-local-exec-tls -S -emit-llvm \
6+
// RUN: %clang --target=powerpc64-unknown-aix -maix-small-local-exec-tls -S -emit-llvm \
77
// RUN: %s -o - | FileCheck %s --check-prefix=CHECK-AIX_SMALL_LOCALEXEC_TLS
88

9-
// RUN: %clang -target powerpc64-unknown-aix -maix-small-local-dynamic-tls -S -emit-llvm \
9+
// RUN: %clang --target=powerpc64-unknown-aix -maix-small-local-dynamic-tls -S -emit-llvm \
1010
// RUN: %s -o - | FileCheck %s --check-prefix=CHECK-AIX_SMALL_LOCALDYNAMIC_TLS
1111

12-
// RUN: not %clang -target powerpc-unknown-aix -maix-small-local-exec-tls \
12+
// RUN: not %clang --target=powerpc-unknown-aix -maix-small-local-exec-tls \
1313
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-AIX32 %s
14-
// RUN: not %clang -target powerpc64le-unknown-linux-gnu -maix-small-local-exec-tls \
14+
// RUN: not %clang --target=powerpc64le-unknown-linux-gnu -maix-small-local-exec-tls \
1515
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-LINUX %s
16-
// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-small-local-exec-tls \
16+
// RUN: not %clang --target=powerpc64-unknown-linux-gnu -maix-small-local-exec-tls \
1717
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-LINUX %s
18-
// RUN: not %clang -target powerpc64-unknown-aix -maix-small-local-exec-tls \
18+
// RUN: not %clang --target=powerpc64-unknown-aix -maix-small-local-exec-tls \
1919
// RUN: -fsyntax-only -fno-data-sections %s 2>&1 | \
2020
// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED-NO-DATASEC %s
21-
// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-small-local-exec-tls \
21+
// RUN: not %clang --target=powerpc64-unknown-linux-gnu -maix-small-local-exec-tls \
2222
// RUN: -fsyntax-only -fno-data-sections %s 2>&1 | \
2323
// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED-NO-DATASEC %s
2424

25-
// RUN: not %clang -target powerpc-unknown-aix -maix-small-local-dynamic-tls \
25+
// RUN: not %clang --target=powerpc-unknown-aix -maix-small-local-dynamic-tls \
2626
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-AIX32 %s
27-
// RUN: not %clang -target powerpc64le-unknown-linux-gnu -maix-small-local-dynamic-tls \
27+
// RUN: not %clang --target=powerpc64le-unknown-linux-gnu -maix-small-local-dynamic-tls \
2828
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-LINUX %s
29-
// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-small-local-dynamic-tls \
29+
// RUN: not %clang --target=powerpc64-unknown-linux-gnu -maix-small-local-dynamic-tls \
3030
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-LINUX %s
31-
// RUN: not %clang -target powerpc64-unknown-aix -maix-small-local-dynamic-tls \
31+
// RUN: not %clang --target=powerpc64-unknown-aix -maix-small-local-dynamic-tls \
3232
// RUN: -fsyntax-only -fno-data-sections %s 2>&1 | \
3333
// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED-NO-DATASEC %s
34-
// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-small-local-dynamic-tls \
34+
// RUN: not %clang --target=powerpc64-unknown-linux-gnu -maix-small-local-dynamic-tls \
3535
// RUN: -fsyntax-only -fno-data-sections %s 2>&1 | \
3636
// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED-NO-DATASEC %s
3737

llvm/include/llvm/MC/MCSubtargetInfo.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,24 @@ struct BasicSubtargetFeatureKV {
3737
const char *Key; ///< K-V key string
3838
unsigned Value; ///< K-V integer value
3939
FeatureBitArray Implies; ///< K-V bit mask
40+
};
41+
42+
/// Used to provide key value pairs for feature and CPU bit flags.
43+
struct SubtargetFeatureKV {
44+
const char *Key; ///< K-V key string
45+
const char *Desc; ///< Help descriptor
46+
unsigned Value; ///< K-V integer value
47+
FeatureBitArray Implies; ///< K-V bit mask
4048

4149
/// Compare routine for std::lower_bound
4250
bool operator<(StringRef S) const {
4351
return StringRef(Key) < S;
4452
}
4553

4654
/// Compare routine for std::is_sorted.
47-
bool operator<(const BasicSubtargetFeatureKV &Other) const {
55+
bool operator<(const SubtargetFeatureKV &Other) const {
4856
return StringRef(Key) < StringRef(Other.Key);
4957
}
50-
BasicSubtargetFeatureKV(const char *Key, unsigned Value,
51-
FeatureBitArray Implies)
52-
: Key(Key), Value(Value), Implies(Implies) {}
53-
};
54-
55-
struct SubtargetFeatureKV : BasicSubtargetFeatureKV {
56-
const char *Desc; ///< Help descriptor
57-
SubtargetFeatureKV(const char *Key, const char *Desc, unsigned Value,
58-
FeatureBitArray Implies)
59-
: BasicSubtargetFeatureKV(Key, Value, Implies), Desc(Desc) {}
6058
};
6159

6260
//===----------------------------------------------------------------------===//
@@ -70,16 +68,20 @@ struct BasicSubtargetSubTypeKV {
7068
bool operator<(StringRef S) const {
7169
return StringRef(Key) < S;
7270
}
73-
74-
/// Compare routine for std::is_sorted.
75-
bool operator<(const BasicSubtargetSubTypeKV &Other) const {
76-
return StringRef(Key) < StringRef(Other.Key);
77-
}
7871
};
7972

80-
struct SubtargetSubTypeKV : BasicSubtargetSubTypeKV {
73+
struct SubtargetSubTypeKV {
74+
const char *Key; ///< K-V key string
75+
FeatureBitArray Implies; ///< K-V bit mask
8176
FeatureBitArray TuneImplies; ///< K-V bit mask
8277
const MCSchedModel *SchedModel;
78+
79+
/// Compare routine for std::lower_bound
80+
bool operator<(StringRef S) const { return StringRef(Key) < S; }
81+
/// Compare routine for std::is_sorted.
82+
bool operator<(const SubtargetSubTypeKV &Other) const {
83+
return StringRef(Key) < StringRef(Other.Key);
84+
}
8385
};
8486

8587
std::optional<llvm::StringMap<bool>>

llvm/lib/TargetParser/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ add_llvm_component_library(LLVMTargetParser
4343

4444
LINK_COMPONENTS
4545
Support
46+
MC
4647

4748
DEPENDS
4849
ARMTargetParserTableGen

0 commit comments

Comments
 (0)