summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-05-26 10:47:10 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-05-26 10:47:10 +0000
commitdb0712f986521e586aaff87da3db56f0ce33f20f (patch)
treeb4e9c54fc70bf89956ea142ffcdd2f5938428bd1 /llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
parent02fc0b1d645436dbe3dd8256ae232939af3e9ada (diff)
downloadbcm5719-llvm-db0712f986521e586aaff87da3db56f0ce33f20f.tar.gz
bcm5719-llvm-db0712f986521e586aaff87da3db56f0ce33f20f.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 several times this was committed (e.g. r229831, r233055), it caused several buildbot failures. Apparently the reason for most failures was both clang and gcc's inability to deal with large numbers (> 10K) of bitset constructor calls in tablegen-generated initializers of instruction info tables. This should now be fixed. llvm-svn: 238192
Diffstat (limited to 'llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h')
-rw-r--r--llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
index 15350e762ad..7125f14f1a2 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,16 +281,22 @@ struct AArch64NamedImmMapper {
struct Mapping {
const char *Name;
uint32_t Value;
- uint64_t FeatureBitSet; // Set of features this mapping is available for
+ // Set of features this mapping is available for
// Zero value of FeatureBitSet means the mapping is always available
+ FeatureBitset FeatureBitSet;
- bool isNameEqual(std::string Other, uint64_t FeatureBits=~0ULL) const {
- if (FeatureBitSet && !(FeatureBitSet & FeatureBits))
+ bool isNameEqual(std::string Other,
+ const FeatureBitset& FeatureBits) const {
+ if (FeatureBitSet.any() &&
+ (FeatureBitSet & FeatureBits).none())
return false;
return Name == Other;
}
- bool isValueEqual(uint32_t Other, uint64_t FeatureBits=~0ULL) const {
- if (FeatureBitSet && !(FeatureBitSet & FeatureBits))
+
+ bool isValueEqual(uint32_t Other,
+ const FeatureBitset& FeatureBits) const {
+ if (FeatureBitSet.any() &&
+ (FeatureBitSet & FeatureBits).none())
return false;
return Value == Other;
}
@@ -300,9 +307,11 @@ struct AArch64NamedImmMapper {
: Mappings(&Mappings[0]), NumMappings(N), TooBigImm(TooBigImm) {}
// Maps value to string, depending on availability for FeatureBits given
- StringRef toString(uint32_t Value, uint64_t FeatureBits, bool &Valid) const;
+ StringRef toString(uint32_t Value, const FeatureBitset& FeatureBits,
+ bool &Valid) const;
// Maps string to value, depending on availability for FeatureBits given
- uint32_t fromString(StringRef Name, uint64_t 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
@@ -1195,8 +1204,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