diff options
author | Matthias Braun <matze@braunis.de> | 2016-12-05 06:41:54 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-12-05 06:41:54 +0000 |
commit | c66e75572eccf46c49260926a8d0c86f12a0c502 (patch) | |
tree | c78e8284ce2a2ac0e73e3af6a71f2777c50b57cc /llvm/lib/TableGen/TGParser.h | |
parent | 1ddb78cd5f13756cdf6718c3aa688447b6b70aeb (diff) | |
download | bcm5719-llvm-c66e75572eccf46c49260926a8d0c86f12a0c502.tar.gz bcm5719-llvm-c66e75572eccf46c49260926a8d0c86f12a0c502.zip |
TableGen/TGParser: Prefer SmallVector/ArrayRef over std::vector
llvm-svn: 288649
Diffstat (limited to 'llvm/lib/TableGen/TGParser.h')
-rw-r--r-- | llvm/lib/TableGen/TGParser.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h index 2ace763fa5d..8396e9d0695 100644 --- a/llvm/lib/TableGen/TGParser.h +++ b/llvm/lib/TableGen/TGParser.h @@ -36,7 +36,7 @@ namespace llvm { std::vector<unsigned> Bits; Init *Value; SMLoc Loc; - LetRecord(StringRef N, const std::vector<unsigned> &B, Init *V, SMLoc L) + LetRecord(StringRef N, ArrayRef<unsigned> B, Init *V, SMLoc L) : Name(N), Bits(B), Value(V), Loc(L) { } }; @@ -53,7 +53,7 @@ namespace llvm { class TGParser { TGLexer Lex; - std::vector<std::vector<LetRecord> > LetStack; + std::vector<SmallVector<LetRecord, 4>> LetStack; std::map<std::string, std::unique_ptr<MultiClass>> MultiClasses; /// Loops - Keep track of any foreach loops we are within. @@ -140,12 +140,11 @@ private: // Parser methods. Record *InstantiateMulticlassDef(MultiClass &MC, Record *DefProto, Init *&DefmPrefix, SMRange DefmPrefixRange, ArrayRef<Init *> TArgs, - std::vector<Init *> &TemplateVals); + ArrayRef<Init *> TemplateVals); bool ResolveMulticlassDefArgs(MultiClass &MC, Record *DefProto, SMLoc DefmPrefixLoc, SMLoc SubClassLoc, ArrayRef<Init *> TArgs, - std::vector<Init *> &TemplateVals, - bool DeleteArgs); + ArrayRef<Init *> TemplateVals, bool DeleteArgs); bool ResolveMulticlassDef(MultiClass &MC, Record *CurRec, Record *DefProto, @@ -154,7 +153,7 @@ private: // Parser methods. bool ParseDef(MultiClass *CurMultiClass); bool ParseForeach(MultiClass *CurMultiClass); bool ParseTopLevelLet(MultiClass *CurMultiClass); - std::vector<LetRecord> ParseLetList(); + void ParseLetList(SmallVectorImpl<LetRecord> &Result); bool ParseObjectBody(Record *CurRec); bool ParseBody(Record *CurRec); @@ -173,15 +172,15 @@ private: // Parser methods. IDParseMode Mode = ParseValueMode); Init *ParseValue(Record *CurRec, RecTy *ItemType = nullptr, IDParseMode Mode = ParseValueMode); - std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = nullptr, - RecTy *EltTy = nullptr); + void ParseValueList(SmallVectorImpl<llvm::Init*> &Result, Record *CurRec, + Record *ArgsRec = nullptr, RecTy *EltTy = nullptr); void ParseDagArgList( SmallVectorImpl<std::pair<llvm::Init*, StringInit*>> &Result, Record *CurRec); - bool ParseOptionalRangeList(std::vector<unsigned> &Ranges); - bool ParseOptionalBitList(std::vector<unsigned> &Ranges); - std::vector<unsigned> ParseRangeList(); - bool ParseRangePiece(std::vector<unsigned> &Ranges); + bool ParseOptionalRangeList(SmallVectorImpl<unsigned> &Ranges); + bool ParseOptionalBitList(SmallVectorImpl<unsigned> &Ranges); + void ParseRangeList(SmallVectorImpl<unsigned> &Result); + bool ParseRangePiece(SmallVectorImpl<unsigned> &Ranges); RecTy *ParseType(); Init *ParseOperation(Record *CurRec, RecTy *ItemType); RecTy *ParseOperatorType(); |