bool isLQFull() const { return LQSize && LQSize == UsedLQEntries; }
bool isValidGroupID(unsigned Index) const {
- return Index && (Groups.find(Index) != Groups.end());
+ return Index && Groups.contains(Index);
}
/// Check if a peviously dispatched instruction IR is now ready for execution.
// Detect collisions between string and numeric variables when the latter
// is created later than the former.
- if (Context->DefinedVariableTable.find(Name) !=
- Context->DefinedVariableTable.end())
+ if (Context->DefinedVariableTable.contains(Name))
return ErrorDiagnostic::get(
SM, Name, "string variable with name '" + Name + "' already exists");
// Detect collisions between string and numeric variables when the
// former is created later than the latter.
- if (Context->GlobalNumericVariableTable.find(Name) !=
- Context->GlobalNumericVariableTable.end()) {
+ if (Context->GlobalNumericVariableTable.contains(Name)) {
SM.PrintMessage(
SMLoc::getFromPointer(Name.data()), SourceMgr::DK_Error,
"numeric variable with name '" + Name + "' already exists");
// Detect collisions between string and numeric variables when the former
// is created later than the latter.
- if (GlobalNumericVariableTable.find(Name) !=
- GlobalNumericVariableTable.end()) {
+ if (GlobalNumericVariableTable.contains(Name)) {
Errs = joinErrors(std::move(Errs),
ErrorDiagnostic::get(SM, Name,
"numeric variable with name '" +
InstructionVerifier &Verifier);
/// Returns true for reachable and live blocks.
- bool isMapped(const BasicBlock *BB) const {
- return BlockMap.find(BB) != BlockMap.end();
- }
+ bool isMapped(const BasicBlock *BB) const { return BlockMap.contains(BB); }
private:
/// Returns true if the instruction may be safely skipped during verification.
void addDirectiveHandler(StringRef Directive,
ExtensionDirectiveHandler Handler) override {
ExtensionDirectiveMap[Directive] = Handler;
- if (DirectiveKindMap.find(Directive) == DirectiveKindMap.end()) {
+ if (!DirectiveKindMap.contains(Directive)) {
DirectiveKindMap[Directive] = DK_HANDLER_DIRECTIVE;
}
}
parseEOL())
return true;
- if (BuiltinSymbolMap.find(Name.lower()) != BuiltinSymbolMap.end()) {
+ if (BuiltinSymbolMap.contains(Name.lower())) {
is_defined = true;
- } else if (Variables.find(Name.lower()) != Variables.end()) {
+ } else if (Variables.contains(Name.lower())) {
is_defined = true;
} else {
MCSymbol *Sym = getContext().lookupSymbol(Name.lower());
parseEOL())
return true;
- if (BuiltinSymbolMap.find(Name.lower()) != BuiltinSymbolMap.end()) {
+ if (BuiltinSymbolMap.contains(Name.lower())) {
is_defined = true;
- } else if (Variables.find(Name.lower()) != Variables.end()) {
+ } else if (Variables.contains(Name.lower())) {
is_defined = true;
} else {
MCSymbol *Sym = getContext().lookupSymbol(Name);
if (check(parseIdentifier(Name), "expected identifier after '.errdef'"))
return true;
- if (BuiltinSymbolMap.find(Name.lower()) != BuiltinSymbolMap.end()) {
+ if (BuiltinSymbolMap.contains(Name.lower())) {
IsDefined = true;
- } else if (Variables.find(Name.lower()) != Variables.end()) {
+ } else if (Variables.contains(Name.lower())) {
IsDefined = true;
} else {
MCSymbol *Sym = getContext().lookupSymbol(Name);
// If we could not find the symbol directly in SymbolIndexMap, this symbol
// could either be a temporary symbol or an undefined symbol. In this case,
// we would need to have the relocation reference its csect instead.
- return SymbolIndexMap.find(Sym) != SymbolIndexMap.end()
+ return SymbolIndexMap.contains(Sym)
? SymbolIndexMap[Sym]
: SymbolIndexMap[ContainingCsect->getQualNameSymbol()];
};
unsigned CPUID = STI.getSchedModel().getProcessorID();
SchedClassID = STI.resolveVariantSchedClass(SchedClassID, &MCI, &MCII, CPUID);
auto VDKey = std::make_pair(&MCI, SchedClassID);
- if (VariantDescriptors.find(VDKey) != VariantDescriptors.end())
+ if (VariantDescriptors.contains(VDKey))
return *VariantDescriptors[VDKey];
return createInstrDescImpl(MCI, IVec);
auto Name = Other.Name;
auto Hash = Other.Hash;
Other.accumulateCounts(FuncLevelOverlap.Test);
- if (FunctionData.find(Name) == FunctionData.end()) {
+ if (!FunctionData.contains(Name)) {
Overlap.addOneUnique(FuncLevelOverlap.Test);
return;
}
bool HadErrors = false;
if (O->hasArgStr()) {
// If it's a DefaultOption, check to make sure it isn't already there.
- if (O->isDefaultOption() &&
- SC->OptionsMap.find(O->ArgStr) != SC->OptionsMap.end())
+ if (O->isDefaultOption() && SC->OptionsMap.contains(O->ArgStr))
return;
// Add argument to the argument map!
StringRef Category = SplitRegexp.second;
// Create this section if it has not been seen before.
- if (SectionsMap.find(Section) == SectionsMap.end()) {
+ if (!SectionsMap.contains(Section)) {
std::unique_ptr<Matcher> M = std::make_unique<Matcher>();
std::string REError;
if (!M->insert(std::string(Section), LineNo, REError)) {
bool isValid() const { return !FoundErrors; }
bool isRegionActive(llvm::StringRef Description) const {
- return ActiveRegions.find(Description) != ActiveRegions.end();
+ return ActiveRegions.contains(Description);
}
};
const MCProcResourceDesc &PRDesc = *SM.getProcResource(ProcResID);
for (unsigned I = 0, E = PRDesc.NumUnits; I < E; ++I) {
const User U = getResourceUser(ProcResID, I);
- if (U.second && IPI.find(U.first) != IPI.end())
+ if (U.second && IPI.contains(U.first))
Users.emplace_back(U);
}
}
}
}
- if (StaticFuncMap.find(NewName) == StaticFuncMap.end()) {
+ if (!StaticFuncMap.contains(NewName)) {
StaticFuncMap[NewName] = Name;
} else {
StaticFuncMap[NewName] = DuplicateNameStr;
}) {
bool ShouldHaveAttr = Reg.match(Attr, &Matches) && Matches[0] == Attr;
- if (ShouldHaveAttr != (Map.find(RetainedKnowledgeKey{WasOn, Attribute::getAttrKindFromName(Attr)}) != Map.end()))
+ if (ShouldHaveAttr != (Map.contains(RetainedKnowledgeKey{
+ WasOn, Attribute::getAttrKindFromName(Attr)})))
return false;
}
return true;
void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) override {
// If we've seen this module before, note that.
const std::string ModuleID = M->getModuleIdentifier();
- if (ObjMap.find(ModuleID) != ObjMap.end())
+ if (ObjMap.contains(ModuleID))
DuplicateInserted = true;
// Store a copy of the buffer in our map.
ObjMap[ModuleID] = copyBuffer(Obj);
bool wereDuplicatesInserted() { return DuplicateInserted; }
bool wasModuleLookedUp(const Module *M) {
- return ModulesLookedUp.find(M->getModuleIdentifier())
- != ModulesLookedUp.end();
+ return ModulesLookedUp.contains(M->getModuleIdentifier());
}
const MemoryBuffer* getObjectInternal(const Module* M) {
using FileCollector::Seen;
using FileCollector::VFSWriter;
- bool hasSeen(StringRef fs) {
- return Seen.find(fs) != Seen.end();
- }
+ bool hasSeen(StringRef fs) { return Seen.contains(fs); }
};
} // end anonymous namespace
if (isLeaf()) {
if (DefInit *DI = dyn_cast<DefInit>(getLeafValue())) {
if (DefInit *NDI = dyn_cast<DefInit>(N->getLeafValue())) {
- return ((DI->getDef() == NDI->getDef())
- && (DepVars.find(getName()) == DepVars.end()
- || getName() == N->getName()));
+ return ((DI->getDef() == NDI->getDef()) &&
+ (!DepVars.contains(getName()) || getName() == N->getName()));
}
}
return getLeafValue() == N->getLeafValue();
RecVec Classes = Def->getValueAsListOfDefs("Classes");
for (const Record *EC : Classes) {
const Record *Pred = EC->getValueAsDef("Predicate");
- if (Predicate2Index.find(Pred) == Predicate2Index.end())
+ if (!Predicate2Index.contains(Pred))
Predicate2Index[Pred] = NumUniquePredicates++;
RecVec Opcodes = EC->getValueAsListOfDefs("Opcodes");
for (const Record *Opcode : Opcodes) {
- if (Opcode2Index.find(Opcode) == Opcode2Index.end()) {
+ if (!Opcode2Index.contains(Opcode)) {
Opcode2Index[Opcode] = OpcodeMappings.size();
OpcodeMappings.emplace_back(Opcode, OpcodeInfo());
}
for (auto &DXILOp : DXILOps) {
OpStrings.add(DXILOp.DXILOp.str());
- if (ClassSet.find(DXILOp.DXILClass) != ClassSet.end())
+ if (ClassSet.contains(DXILOp.DXILClass))
continue;
ClassSet.insert(DXILOp.DXILClass);
OpClassStrings.add(getDXILOpClassName(DXILOp.DXILClass));
}
void RuleMatcher::defineOperand(StringRef SymbolicName, OperandMatcher &OM) {
- if (DefinedOperands.find(SymbolicName) == DefinedOperands.end()) {
+ if (!DefinedOperands.contains(SymbolicName)) {
DefinedOperands[SymbolicName] = &OM;
return;
}
}
void RuleMatcher::definePhysRegOperand(Record *Reg, OperandMatcher &OM) {
- if (PhysRegOperands.find(Reg) == PhysRegOperands.end()) {
+ if (!PhysRegOperands.contains(Reg)) {
PhysRegOperands[Reg] = &OM;
return;
}