summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-05-13 08:27:08 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-05-13 08:27:08 +0000
commitaba4a34ef23873e66aba9848bdbe5a6fcfbc4705 (patch)
tree61671b9f7fe934ab14545900ab7301699be96440 /llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
parent60c270764e2fe0d2e212dd859f9983fe0cc4eb66 (diff)
downloadbcm5719-llvm-aba4a34ef23873e66aba9848bdbe5a6fcfbc4705.tar.gz
bcm5719-llvm-aba4a34ef23873e66aba9848bdbe5a6fcfbc4705.zip
Use std::bitset for SubtargetFeatures
Previously, subtarget features were a bitfield with the underlying type being uint64_t. Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset. No functional change. The first two times this was committed (r229831, r233055), it caused several buildbot failures. At least some of the ARM and MIPS ones were due to gcc/binutils issues, and should now be fixed. llvm-svn: 237234
Diffstat (limited to 'llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h')
-rw-r--r--llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
index 659ea909d7d..e054ba8be38 100644
--- a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
+++ b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
@@ -22,6 +22,7 @@
#include "MCTargetDesc/AArch64MCTargetDesc.h" // For AArch64::X0 and friends.
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/ErrorHandling.h"
namespace llvm {
@@ -280,15 +281,19 @@ struct AArch64NamedImmMapper {
struct Mapping {
const char *Name;
uint32_t Value;
- uint64_t AvailableForFeatures;
+ FeatureBitset AvailableForFeatures;
// empty AvailableForFeatures means "always-on"
- bool isNameEqual(std::string Other, uint64_t FeatureBits=~0ULL) const {
- if (AvailableForFeatures && !(AvailableForFeatures & FeatureBits))
+ bool isNameEqual(std::string Other,
+ const FeatureBitset& FeatureBits) const {
+ if (AvailableForFeatures.any() &&
+ (AvailableForFeatures & FeatureBits).none())
return false;
return Name == Other;
}
- bool isValueEqual(uint32_t Other, uint64_t FeatureBits=~0ULL) const {
- if (AvailableForFeatures && !(AvailableForFeatures & FeatureBits))
+ bool isValueEqual(uint32_t Other,
+ const FeatureBitset& FeatureBits) const {
+ if (AvailableForFeatures.any() &&
+ (AvailableForFeatures & FeatureBits).none())
return false;
return Value == Other;
}
@@ -298,8 +303,10 @@ struct AArch64NamedImmMapper {
AArch64NamedImmMapper(const Mapping (&Mappings)[N], uint32_t TooBigImm)
: Mappings(&Mappings[0]), NumMappings(N), TooBigImm(TooBigImm) {}
- StringRef toString(uint32_t Value, uint64_t FeatureBits, bool &Valid) const;
- uint32_t fromString(StringRef Name, uint64_t FeatureBits, bool &Valid) const;
+ StringRef toString(uint32_t Value, const FeatureBitset& FeatureBits,
+ bool &Valid) const;
+ uint32_t fromString(StringRef Name, const FeatureBitset& FeatureBits,
+ bool &Valid) const;
/// Many of the instructions allow an alternative assembly form consisting of
/// a simple immediate. Currently the only valid forms are ranges [0, N) where
@@ -1192,8 +1199,9 @@ namespace AArch64SysReg {
size_t NumInstMappings;
SysRegMapper() { }
- uint32_t fromString(StringRef Name, uint64_t FeatureBits, bool &Valid) const;
- std::string toString(uint32_t Bits, uint64_t FeatureBits) const;
+ uint32_t fromString(StringRef Name, const FeatureBitset& FeatureBits,
+ bool &Valid) const;
+ std::string toString(uint32_t Bits, const FeatureBitset& FeatureBits) const;
};
struct MSRMapper : SysRegMapper {
OpenPOWER on IntegriCloud