Skip to content

[TableGen] Construct SmallVector with ArrayRef (NFC) #101870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/TableGen/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ class Record {
// Constructs a record.
explicit Record(Init *N, ArrayRef<SMLoc> locs, RecordKeeper &records,
RecordKind Kind = RK_Def)
: Name(N), Locs(locs.begin(), locs.end()), TrackedRecords(records),
: Name(N), Locs(locs), TrackedRecords(records),
ID(getNewUID(N->getRecordKeeper())), Kind(Kind) {
checkName();
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/TableGen/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ RecordRecTy *RecordRecTy::get(RecordKeeper &RK,

FoldingSet<RecordRecTy> &ThePool = RKImpl.RecordTypePool;

SmallVector<Record *, 4> Classes(UnsortedClasses.begin(),
UnsortedClasses.end());
SmallVector<Record *, 4> Classes(UnsortedClasses);
llvm::sort(Classes, [](Record *LHS, Record *RHS) {
return LHS->getNameInitAsString() < RHS->getNameInitAsString();
});
Expand Down
13 changes: 6 additions & 7 deletions llvm/utils/TableGen/Common/DAGISelMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ class EmitMergeInputChainsMatcher : public Matcher {

public:
EmitMergeInputChainsMatcher(ArrayRef<unsigned> nodes)
: Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {}
: Matcher(EmitMergeInputChains), ChainNodes(nodes) {}

unsigned getNumNodes() const { return ChainNodes.size(); }

Expand Down Expand Up @@ -1022,10 +1022,10 @@ class EmitNodeMatcherCommon : public Matcher {
ArrayRef<unsigned> operands, bool hasChain,
bool hasInGlue, bool hasOutGlue, bool hasmemrefs,
int numfixedarityoperands, bool isMorphNodeTo)
: Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), CGI(cgi),
VTs(vts.begin(), vts.end()), Operands(operands.begin(), operands.end()),
HasChain(hasChain), HasInGlue(hasInGlue), HasOutGlue(hasOutGlue),
HasMemRefs(hasmemrefs), NumFixedArityOperands(numfixedarityoperands) {}
: Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), CGI(cgi), VTs(vts),
Operands(operands), HasChain(hasChain), HasInGlue(hasInGlue),
HasOutGlue(hasOutGlue), HasMemRefs(hasmemrefs),
NumFixedArityOperands(numfixedarityoperands) {}

const CodeGenInstruction &getInstruction() const { return CGI; }

Expand Down Expand Up @@ -1110,8 +1110,7 @@ class CompleteMatchMatcher : public Matcher {
public:
CompleteMatchMatcher(ArrayRef<unsigned> results,
const PatternToMatch &pattern)
: Matcher(CompleteMatch), Results(results.begin(), results.end()),
Pattern(pattern) {}
: Matcher(CompleteMatch), Results(results), Pattern(pattern) {}

unsigned getNumResults() const { return Results.size(); }
unsigned getResult(unsigned R) const { return Results[R]; }
Expand Down
5 changes: 2 additions & 3 deletions llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,8 +1373,7 @@ class InstructionOpcodeMatcher : public InstructionPredicateMatcher {

InstructionOpcodeMatcher(unsigned InsnVarID,
ArrayRef<const CodeGenInstruction *> I)
: InstructionPredicateMatcher(IPM_Opcode, InsnVarID),
Insts(I.begin(), I.end()) {
: InstructionPredicateMatcher(IPM_Opcode, InsnVarID), Insts(I) {
assert((Insts.size() == 1 || Insts.size() == 2) &&
"unexpected number of opcode alternatives");
}
Expand Down Expand Up @@ -1553,7 +1552,7 @@ class MemoryAddressSpacePredicateMatcher : public InstructionPredicateMatcher {
MemoryAddressSpacePredicateMatcher(unsigned InsnVarID, unsigned MMOIdx,
ArrayRef<unsigned> AddrSpaces)
: InstructionPredicateMatcher(IPM_MemoryAddressSpace, InsnVarID),
MMOIdx(MMOIdx), AddrSpaces(AddrSpaces.begin(), AddrSpaces.end()) {}
MMOIdx(MMOIdx), AddrSpaces(AddrSpaces) {}

static bool classof(const PredicateMatcher *P) {
return P->getKind() == IPM_MemoryAddressSpace;
Expand Down
Loading