mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
TableGen: allow use of uint64_t for available features mask.
ARM in particular is getting dangerously close to exceeding 32 bits worth of possible subtarget features. When this happens, various parts of MC start to fail inexplicably as masks get truncated to "unsigned". Mostly just refactoring at present, and there's probably no way to test. llvm-svn: 215887
This commit is contained in:
parent
7d64c5c4b9
commit
9127b613b1
@ -93,7 +93,7 @@ protected: // Can only create subclasses.
|
||||
MCTargetAsmParser();
|
||||
|
||||
/// AvailableFeatures - The current set of available features.
|
||||
unsigned AvailableFeatures;
|
||||
uint64_t AvailableFeatures;
|
||||
|
||||
/// ParsingInlineAsm - Are we parsing ms-style inline assembly?
|
||||
bool ParsingInlineAsm;
|
||||
@ -108,8 +108,8 @@ protected: // Can only create subclasses.
|
||||
public:
|
||||
virtual ~MCTargetAsmParser();
|
||||
|
||||
unsigned getAvailableFeatures() const { return AvailableFeatures; }
|
||||
void setAvailableFeatures(unsigned Value) { AvailableFeatures = Value; }
|
||||
uint64_t getAvailableFeatures() const { return AvailableFeatures; }
|
||||
void setAvailableFeatures(uint64_t Value) { AvailableFeatures = Value; }
|
||||
|
||||
bool isParsingInlineAsm () { return ParsingInlineAsm; }
|
||||
void setParsingInlineAsm (bool Value) { ParsingInlineAsm = Value; }
|
||||
@ -161,7 +161,7 @@ public:
|
||||
/// explaining the match failure.
|
||||
virtual bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) = 0;
|
||||
|
||||
/// Allows targets to let registers opt out of clobber lists.
|
||||
|
@ -1636,7 +1636,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info) {
|
||||
|
||||
// If parsing succeeded, match the instruction.
|
||||
if (!HadError) {
|
||||
unsigned ErrorInfo;
|
||||
uint64_t ErrorInfo;
|
||||
getTargetParser().MatchAndEmitInstruction(IDLoc, Info.Opcode,
|
||||
Info.ParsedOperands, Out,
|
||||
ErrorInfo, ParsingInlineAsm);
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
bool validateInstruction(MCInst &Inst, SmallVectorImpl<SMLoc> &Loc);
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
/// @name Auto-generated Match Functions
|
||||
/// {
|
||||
@ -3562,12 +3562,12 @@ bool AArch64AsmParser::showMatchError(SMLoc Loc, unsigned ErrCode) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char *getSubtargetFeatureName(unsigned Val);
|
||||
static const char *getSubtargetFeatureName(uint64_t Val);
|
||||
|
||||
bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
assert(!Operands.empty() && "Unexpect empty operand list!");
|
||||
AArch64Operand &Op = static_cast<AArch64Operand &>(*Operands[0]);
|
||||
@ -3817,7 +3817,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
// Special case the error message for the very common case where only
|
||||
// a single subtarget feature is missing (neon, e.g.).
|
||||
std::string Msg = "instruction requires:";
|
||||
unsigned Mask = 1;
|
||||
uint64_t Mask = 1;
|
||||
for (unsigned i = 0; i < (sizeof(ErrorInfo)*8-1); ++i) {
|
||||
if (ErrorInfo & Mask) {
|
||||
Msg += " ";
|
||||
@ -3831,7 +3831,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
return showMatchError(IDLoc, MatchResult);
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
|
@ -267,7 +267,7 @@ class ARMAsmParser : public MCTargetAsmParser {
|
||||
}
|
||||
|
||||
void SwitchMode() {
|
||||
unsigned FB = ComputeAvailableFeatures(STI.ToggleFeature(ARM::ModeThumb));
|
||||
uint64_t FB = ComputeAvailableFeatures(STI.ToggleFeature(ARM::ModeThumb));
|
||||
setAvailableFeatures(FB);
|
||||
}
|
||||
bool isMClass() const {
|
||||
@ -360,7 +360,7 @@ public:
|
||||
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
void onLabelParsed(MCSymbol *Symbol) override;
|
||||
};
|
||||
@ -5363,7 +5363,7 @@ static bool isDataTypeToken(StringRef Tok) {
|
||||
static bool doesIgnoreDataTypeSuffix(StringRef Mnemonic, StringRef DT) {
|
||||
return Mnemonic.startswith("vldm") || Mnemonic.startswith("vstm");
|
||||
}
|
||||
static void applyMnemonicAliases(StringRef &Mnemonic, unsigned Features,
|
||||
static void applyMnemonicAliases(StringRef &Mnemonic, uint64_t Features,
|
||||
unsigned VariantID);
|
||||
|
||||
static bool RequiresVFPRegListValidation(StringRef Inst,
|
||||
@ -5401,7 +5401,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
// The generic tblgen'erated code does this later, at the start of
|
||||
// MatchInstructionImpl(), but that's too late for aliases that include
|
||||
// any sort of suffix.
|
||||
unsigned AvailableFeatures = getAvailableFeatures();
|
||||
uint64_t AvailableFeatures = getAvailableFeatures();
|
||||
unsigned AssemblerDialect = getParser().getAssemblerDialect();
|
||||
applyMnemonicAliases(Name, AvailableFeatures, AssemblerDialect);
|
||||
|
||||
@ -8162,10 +8162,10 @@ template <> inline bool IsCPSRDead<MCInst>(MCInst *Instr) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char *getSubtargetFeatureName(unsigned Val);
|
||||
static const char *getSubtargetFeatureName(uint64_t Val);
|
||||
bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out, unsigned &ErrorInfo,
|
||||
MCStreamer &Out, uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
MCInst Inst;
|
||||
unsigned MatchResult;
|
||||
@ -8219,7 +8219,7 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
// Special case the error message for the very common case where only
|
||||
// a single subtarget feature is missing (Thumb vs. ARM, e.g.).
|
||||
std::string Msg = "instruction requires:";
|
||||
unsigned Mask = 1;
|
||||
uint64_t Mask = 1;
|
||||
for (unsigned i = 0; i < (sizeof(ErrorInfo)*8-1); ++i) {
|
||||
if (ErrorInfo & Mask) {
|
||||
Msg += " ";
|
||||
@ -8231,7 +8231,7 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
}
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
@ -8796,7 +8796,7 @@ bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
|
||||
|
||||
// Need to toggle features that should be on but are off and that
|
||||
// should off but are on.
|
||||
unsigned Toggle = (Fpu.Enabled & ~STI.getFeatureBits()) |
|
||||
uint64_t Toggle = (Fpu.Enabled & ~STI.getFeatureBits()) |
|
||||
(Fpu.Disabled & STI.getFeatureBits());
|
||||
setAvailableFeatures(ComputeAvailableFeatures(STI.ToggleFeature(Toggle)));
|
||||
break;
|
||||
@ -9580,10 +9580,10 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned ToggleFeatures = EnableFeature
|
||||
uint64_t ToggleFeatures = EnableFeature
|
||||
? (~STI.getFeatureBits() & Extension.Features)
|
||||
: ( STI.getFeatureBits() & Extension.Features);
|
||||
unsigned Features =
|
||||
uint64_t Features =
|
||||
ComputeAvailableFeatures(STI.ToggleFeature(ToggleFeatures));
|
||||
setAvailableFeatures(Features);
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ class MipsAsmParser : public MCTargetAsmParser {
|
||||
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
|
||||
/// Parse a register as used in CFI directives
|
||||
@ -1518,7 +1518,7 @@ unsigned MipsAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
|
||||
bool MipsAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
|
||||
MCInst Inst;
|
||||
@ -1541,7 +1541,7 @@ bool MipsAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
return true;
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
|
@ -250,7 +250,7 @@ class PPCAsmParser : public MCTargetAsmParser {
|
||||
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
|
||||
void ProcessInstruction(MCInst &Inst, const OperandVector &Ops);
|
||||
@ -1053,7 +1053,7 @@ void PPCAsmParser::ProcessInstruction(MCInst &Inst,
|
||||
|
||||
bool PPCAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out, unsigned &ErrorInfo,
|
||||
MCStreamer &Out, uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
MCInst Inst;
|
||||
|
||||
@ -1071,7 +1071,7 @@ bool PPCAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
return Error(IDLoc, "unrecognized instruction mnemonic");
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
|
@ -48,7 +48,7 @@ class SparcAsmParser : public MCTargetAsmParser {
|
||||
// public interface of the MCTargetAsmParser.
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) override;
|
||||
bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
@ -386,7 +386,7 @@ public:
|
||||
bool SparcAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
MCInst Inst;
|
||||
SmallVector<MCInst, 8> Instructions;
|
||||
@ -408,7 +408,7 @@ bool SparcAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
@ -444,7 +444,7 @@ ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc)
|
||||
return Error(StartLoc, "invalid register name");
|
||||
}
|
||||
|
||||
static void applyMnemonicAliases(StringRef &Mnemonic, unsigned Features,
|
||||
static void applyMnemonicAliases(StringRef &Mnemonic, uint64_t Features,
|
||||
unsigned VariantID);
|
||||
|
||||
bool SparcAsmParser::ParseInstruction(ParseInstructionInfo &Info,
|
||||
|
@ -345,7 +345,7 @@ public:
|
||||
SMLoc NameLoc, OperandVector &Operands) override;
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
|
||||
// Used by the TableGen code to parse particular operand types.
|
||||
@ -677,7 +677,7 @@ bool SystemZAsmParser::parseOperand(OperandVector &Operands,
|
||||
bool SystemZAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
MCInst Inst;
|
||||
unsigned MatchResult;
|
||||
@ -696,7 +696,7 @@ bool SystemZAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
// Special case the error message for the very common case where only
|
||||
// a single subtarget feature is missing
|
||||
std::string Msg = "instruction requires:";
|
||||
unsigned Mask = 1;
|
||||
uint64_t Mask = 1;
|
||||
for (unsigned I = 0; I < sizeof(ErrorInfo) * 8 - 1; ++I) {
|
||||
if (ErrorInfo & Mask) {
|
||||
Msg += " ";
|
||||
@ -709,7 +709,7 @@ bool SystemZAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
|
||||
case Match_InvalidOperand: {
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
|
@ -694,7 +694,7 @@ private:
|
||||
|
||||
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands, MCStreamer &Out,
|
||||
unsigned &ErrorInfo,
|
||||
uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) override;
|
||||
|
||||
virtual bool OmitRegisterFromClobberLists(unsigned RegNo) override;
|
||||
@ -2297,7 +2297,7 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char *getSubtargetFeatureName(unsigned Val);
|
||||
static const char *getSubtargetFeatureName(uint64_t Val);
|
||||
|
||||
void X86AsmParser::EmitInstruction(MCInst &Inst, OperandVector &Operands,
|
||||
MCStreamer &Out) {
|
||||
@ -2307,7 +2307,7 @@ void X86AsmParser::EmitInstruction(MCInst &Inst, OperandVector &Operands,
|
||||
|
||||
bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
OperandVector &Operands,
|
||||
MCStreamer &Out, unsigned &ErrorInfo,
|
||||
MCStreamer &Out, uint64_t &ErrorInfo,
|
||||
bool MatchingInlineAsm) {
|
||||
assert(!Operands.empty() && "Unexpect empty operand list!");
|
||||
X86Operand &Op = static_cast<X86Operand &>(*Operands[0]);
|
||||
@ -2363,7 +2363,7 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
// Special case the error message for the very common case where only
|
||||
// a single subtarget feature is missing.
|
||||
std::string Msg = "instruction requires:";
|
||||
unsigned Mask = 1;
|
||||
uint64_t Mask = 1;
|
||||
for (unsigned i = 0; i < (sizeof(ErrorInfo)*8-1); ++i) {
|
||||
if (ErrorInfo & Mask) {
|
||||
Msg += " ";
|
||||
@ -2401,8 +2401,8 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
const char *Suffixes = Base[0] != 'f' ? "bwlq" : "slt\0";
|
||||
|
||||
// Check for the various suffix matches.
|
||||
unsigned ErrorInfoIgnore;
|
||||
unsigned ErrorInfoMissingFeature = 0; // Init suppresses compiler warnings.
|
||||
uint64_t ErrorInfoIgnore;
|
||||
uint64_t ErrorInfoMissingFeature = 0; // Init suppresses compiler warnings.
|
||||
unsigned Match[4];
|
||||
|
||||
for (unsigned I = 0, E = array_lengthof(Match); I != E; ++I) {
|
||||
@ -2469,7 +2469,7 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
}
|
||||
|
||||
// Recover location info for the operand if we know which was the problem.
|
||||
if (ErrorInfo != ~0U) {
|
||||
if (ErrorInfo != ~0ULL) {
|
||||
if (ErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction",
|
||||
EmptyRanges, MatchingInlineAsm);
|
||||
@ -2491,7 +2491,7 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
if (std::count(std::begin(Match), std::end(Match),
|
||||
Match_MissingFeature) == 1) {
|
||||
std::string Msg = "instruction requires:";
|
||||
unsigned Mask = 1;
|
||||
uint64_t Mask = 1;
|
||||
for (unsigned i = 0; i < (sizeof(ErrorInfoMissingFeature)*8-1); ++i) {
|
||||
if (ErrorInfoMissingFeature & Mask) {
|
||||
Msg += " ";
|
||||
|
@ -565,9 +565,9 @@ struct SubtargetFeatureInfo {
|
||||
Record *TheDef;
|
||||
|
||||
/// \brief An unique index assigned to represent this feature.
|
||||
unsigned Index;
|
||||
uint64_t Index;
|
||||
|
||||
SubtargetFeatureInfo(Record *D, unsigned Idx) : TheDef(D), Index(Idx) {}
|
||||
SubtargetFeatureInfo(Record *D, uint64_t Idx) : TheDef(D), Index(Idx) {}
|
||||
|
||||
/// \brief The name of the enumerated constant identifying this feature.
|
||||
std::string getEnumName() const {
|
||||
@ -1327,10 +1327,10 @@ void AsmMatcherInfo::buildInfo() {
|
||||
if (Pred->getName().empty())
|
||||
PrintFatalError(Pred->getLoc(), "Predicate has no name!");
|
||||
|
||||
unsigned FeatureNo = SubtargetFeatures.size();
|
||||
uint64_t FeatureNo = SubtargetFeatures.size();
|
||||
SubtargetFeatures[Pred] = new SubtargetFeatureInfo(Pred, FeatureNo);
|
||||
DEBUG(SubtargetFeatures[Pred]->dump());
|
||||
assert(FeatureNo < 32 && "Too many subtarget features!");
|
||||
assert(FeatureNo < 64 && "Too many subtarget features!");
|
||||
}
|
||||
|
||||
// Parse the instructions; we need to do this first so that we can gather the
|
||||
@ -2205,7 +2205,9 @@ static void emitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
|
||||
}
|
||||
|
||||
static const char *getMinimalTypeForRange(uint64_t Range) {
|
||||
assert(Range <= 0xFFFFFFFFULL && "Enum too large");
|
||||
assert(Range <= 0xFFFFFFFFFFFFFFFFULL && "Enum too large");
|
||||
if (Range > 0xFFFFFFFFULL)
|
||||
return "uint64_t";
|
||||
if (Range > 0xFFFF)
|
||||
return "uint32_t";
|
||||
if (Range > 0xFF)
|
||||
@ -2232,7 +2234,7 @@ static void emitSubtargetFeatureFlagEnumeration(AsmMatcherInfo &Info,
|
||||
it = Info.SubtargetFeatures.begin(),
|
||||
ie = Info.SubtargetFeatures.end(); it != ie; ++it) {
|
||||
SubtargetFeatureInfo &SFI = *it->second;
|
||||
OS << " " << SFI.getEnumName() << " = (1U << " << SFI.Index << "),\n";
|
||||
OS << " " << SFI.getEnumName() << " = (1ULL << " << SFI.Index << "),\n";
|
||||
}
|
||||
OS << " Feature_None = 0\n";
|
||||
OS << "};\n\n";
|
||||
@ -2263,7 +2265,7 @@ static void emitOperandDiagnosticTypes(AsmMatcherInfo &Info, raw_ostream &OS) {
|
||||
static void emitGetSubtargetFeatureName(AsmMatcherInfo &Info, raw_ostream &OS) {
|
||||
OS << "// User-level names for subtarget features that participate in\n"
|
||||
<< "// instruction matching.\n"
|
||||
<< "static const char *getSubtargetFeatureName(unsigned Val) {\n";
|
||||
<< "static const char *getSubtargetFeatureName(uint64_t Val) {\n";
|
||||
if (!Info.SubtargetFeatures.empty()) {
|
||||
OS << " switch(Val) {\n";
|
||||
typedef std::map<Record*, SubtargetFeatureInfo*, LessRecordByID> RecFeatMap;
|
||||
@ -2290,9 +2292,9 @@ static void emitComputeAvailableFeatures(AsmMatcherInfo &Info,
|
||||
std::string ClassName =
|
||||
Info.AsmParser->getValueAsString("AsmParserClassName");
|
||||
|
||||
OS << "unsigned " << Info.Target.getName() << ClassName << "::\n"
|
||||
OS << "uint64_t " << Info.Target.getName() << ClassName << "::\n"
|
||||
<< "ComputeAvailableFeatures(uint64_t FB) const {\n";
|
||||
OS << " unsigned Features = 0;\n";
|
||||
OS << " uint64_t Features = 0;\n";
|
||||
for (std::map<Record*, SubtargetFeatureInfo*, LessRecordByID>::const_iterator
|
||||
it = Info.SubtargetFeatures.begin(),
|
||||
ie = Info.SubtargetFeatures.end(); it != ie; ++it) {
|
||||
@ -2446,7 +2448,7 @@ static bool emitMnemonicAliases(raw_ostream &OS, const AsmMatcherInfo &Info,
|
||||
if (Aliases.empty()) return false;
|
||||
|
||||
OS << "static void applyMnemonicAliases(StringRef &Mnemonic, "
|
||||
"unsigned Features, unsigned VariantID) {\n";
|
||||
"uint64_t Features, unsigned VariantID) {\n";
|
||||
OS << " switch (VariantID) {\n";
|
||||
unsigned VariantCount = Target.getAsmParserVariantCount();
|
||||
for (unsigned VC = 0; VC != VariantCount; ++VC) {
|
||||
@ -2589,7 +2591,7 @@ static void emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
|
||||
|
||||
// Emit code to get the available features.
|
||||
OS << " // Get the current feature set.\n";
|
||||
OS << " unsigned AvailableFeatures = getAvailableFeatures();\n\n";
|
||||
OS << " uint64_t AvailableFeatures = getAvailableFeatures();\n\n";
|
||||
|
||||
OS << " // Get the next operand index.\n";
|
||||
OS << " unsigned NextOpNum = Operands.size()-1;\n";
|
||||
@ -2691,7 +2693,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
OS << "#undef GET_ASSEMBLER_HEADER\n";
|
||||
OS << " // This should be included into the middle of the declaration of\n";
|
||||
OS << " // your subclasses implementation of MCTargetAsmParser.\n";
|
||||
OS << " unsigned ComputeAvailableFeatures(uint64_t FeatureBits) const;\n";
|
||||
OS << " uint64_t ComputeAvailableFeatures(uint64_t FeatureBits) const;\n";
|
||||
OS << " void convertToMCInst(unsigned Kind, MCInst &Inst, "
|
||||
<< "unsigned Opcode,\n"
|
||||
<< " const OperandVector "
|
||||
@ -2703,7 +2705,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
OS.indent(27);
|
||||
OS << "const OperandVector &Operands,\n"
|
||||
<< " MCInst &Inst,\n"
|
||||
<< " unsigned &ErrorInfo,"
|
||||
<< " uint64_t &ErrorInfo,"
|
||||
<< " bool matchingInlineAsm,\n"
|
||||
<< " unsigned VariantID = 0);\n";
|
||||
|
||||
@ -2912,7 +2914,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
<< "MatchInstructionImpl(const OperandVector"
|
||||
<< " &Operands,\n";
|
||||
OS << " MCInst &Inst,\n"
|
||||
<< "unsigned &ErrorInfo, bool matchingInlineAsm, unsigned VariantID) {\n";
|
||||
<< "uint64_t &ErrorInfo, bool matchingInlineAsm, unsigned VariantID) {\n";
|
||||
|
||||
OS << " // Eliminate obvious mismatches.\n";
|
||||
OS << " if (Operands.size() > " << (MaxNumOperands+1) << ") {\n";
|
||||
@ -2922,7 +2924,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
|
||||
// Emit code to get the available features.
|
||||
OS << " // Get the current feature set.\n";
|
||||
OS << " unsigned AvailableFeatures = getAvailableFeatures();\n\n";
|
||||
OS << " uint64_t AvailableFeatures = getAvailableFeatures();\n\n";
|
||||
|
||||
OS << " // Get the instruction mnemonic, which is the first token.\n";
|
||||
OS << " StringRef Mnemonic = ((" << Target.getName()
|
||||
@ -2938,7 +2940,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
OS << " bool HadMatchOtherThanFeatures = false;\n";
|
||||
OS << " bool HadMatchOtherThanPredicate = false;\n";
|
||||
OS << " unsigned RetCode = Match_InvalidOperand;\n";
|
||||
OS << " unsigned MissingFeatures = ~0U;\n";
|
||||
OS << " uint64_t MissingFeatures = ~0ULL;\n";
|
||||
OS << " // Set ErrorInfo to the operand that mismatches if it is\n";
|
||||
OS << " // wrong for all instances of the instruction.\n";
|
||||
OS << " ErrorInfo = ~0U;\n";
|
||||
@ -3014,10 +3016,10 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
OS << " if ((AvailableFeatures & it->RequiredFeatures) "
|
||||
<< "!= it->RequiredFeatures) {\n";
|
||||
OS << " HadMatchOtherThanFeatures = true;\n";
|
||||
OS << " unsigned NewMissingFeatures = it->RequiredFeatures & "
|
||||
OS << " uint64_t NewMissingFeatures = it->RequiredFeatures & "
|
||||
"~AvailableFeatures;\n";
|
||||
OS << " if (CountPopulation_32(NewMissingFeatures) <=\n"
|
||||
" CountPopulation_32(MissingFeatures))\n";
|
||||
OS << " if (CountPopulation_64(NewMissingFeatures) <=\n"
|
||||
" CountPopulation_64(MissingFeatures))\n";
|
||||
OS << " MissingFeatures = NewMissingFeatures;\n";
|
||||
OS << " continue;\n";
|
||||
OS << " }\n";
|
||||
|
Loading…
Reference in New Issue
Block a user