diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-08-13 15:13:35 +0000 |
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-08-13 15:13:35 +0000 |
| commit | 2c6cbc8bb26aa20ad0861f066ecba8d773b17726 (patch) | |
| tree | 8e1539ed7b4200fade11fec3017db7a2dd3cc33b /llvm/utils/TableGen/PredicateExpander.h | |
| parent | cce15c76d3fc2c604827c25b50d4ccd6bd68be73 (diff) | |
| download | bcm5719-llvm-2c6cbc8bb26aa20ad0861f066ecba8d773b17726.tar.gz bcm5719-llvm-2c6cbc8bb26aa20ad0861f066ecba8d773b17726.zip | |
[Tablegen] Replace uses of formatted_raw_ostream with raw_ostream in the predicate expander. NFCI
This is a follow-up of r339552.
As pointed out by Craig in D50566, we don't need a formatted_raw_ostream to
indent strings. We can use instead raw_ostream::indent().
Internally, class PredicateExpander already keeps track of the current
indentation level. Also, the grammar for predicates is well parenthesized, and
therefore we don't need to use a formatted_raw_ostream to continuously track the
column number. Instead we can safely replace all the uses of
formatted_raw_ostream::PadToColumn() with uses of raw_ostream::indent().
By replacing formatted_raw_ostream with a simpler raw_ostream, we also avoid the
implicit check on the newline character on every print to stream.
No functional change intended.
llvm-svn: 339577
Diffstat (limited to 'llvm/utils/TableGen/PredicateExpander.h')
| -rw-r--r-- | llvm/utils/TableGen/PredicateExpander.h | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/llvm/utils/TableGen/PredicateExpander.h b/llvm/utils/TableGen/PredicateExpander.h index 31952dc690e..b39452f0fbf 100644 --- a/llvm/utils/TableGen/PredicateExpander.h +++ b/llvm/utils/TableGen/PredicateExpander.h @@ -18,12 +18,12 @@ #define LLVM_UTILS_TABLEGEN_PREDICATEEXPANDER_H #include "llvm/ADT/StringRef.h" -#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/Record.h" namespace llvm { -class formatted_raw_ostream; +class raw_ostream; class PredicateExpander { bool EmitCallsByRef; @@ -52,38 +52,33 @@ public: void setIndentLevel(unsigned Level) { IndentLevel = Level; } using RecVec = std::vector<Record *>; - void expandTrue(formatted_raw_ostream &OS); - void expandFalse(formatted_raw_ostream &OS); - void expandCheckImmOperand(formatted_raw_ostream &OS, int OpIndex, - int ImmVal); - void expandCheckImmOperand(formatted_raw_ostream &OS, int OpIndex, - StringRef ImmVal); - void expandCheckRegOperand(formatted_raw_ostream &OS, int OpIndex, - const Record *Reg); - void expandCheckSameRegOperand(formatted_raw_ostream &OS, int First, - int Second); - void expandCheckNumOperands(formatted_raw_ostream &OS, int NumOps); - void expandCheckOpcode(formatted_raw_ostream &OS, const Record *Inst); + void expandTrue(raw_ostream &OS); + void expandFalse(raw_ostream &OS); + void expandCheckImmOperand(raw_ostream &OS, int OpIndex, int ImmVal); + void expandCheckImmOperand(raw_ostream &OS, int OpIndex, StringRef ImmVal); + void expandCheckRegOperand(raw_ostream &OS, int OpIndex, const Record *Reg); + void expandCheckSameRegOperand(raw_ostream &OS, int First, int Second); + void expandCheckNumOperands(raw_ostream &OS, int NumOps); + void expandCheckOpcode(raw_ostream &OS, const Record *Inst); - void expandCheckPseudo(formatted_raw_ostream &OS, const RecVec &Opcodes); - void expandCheckOpcode(formatted_raw_ostream &OS, const RecVec &Opcodes); - void expandPredicateSequence(formatted_raw_ostream &OS, - const RecVec &Sequence, bool IsCheckAll); - void expandTIIFunctionCall(formatted_raw_ostream &OS, StringRef TargetName, + void expandCheckPseudo(raw_ostream &OS, const RecVec &Opcodes); + void expandCheckOpcode(raw_ostream &OS, const RecVec &Opcodes); + void expandPredicateSequence(raw_ostream &OS, const RecVec &Sequence, + bool IsCheckAll); + void expandTIIFunctionCall(raw_ostream &OS, StringRef TargetName, StringRef MethodName); - void expandCheckIsRegOperand(formatted_raw_ostream &OS, int OpIndex); - void expandCheckIsImmOperand(formatted_raw_ostream &OS, int OpIndex); - void expandCheckInvalidRegOperand(formatted_raw_ostream &OS, int OpIndex); - void expandCheckFunctionPredicate(formatted_raw_ostream &OS, - StringRef MCInstFn, + void expandCheckIsRegOperand(raw_ostream &OS, int OpIndex); + void expandCheckIsImmOperand(raw_ostream &OS, int OpIndex); + void expandCheckInvalidRegOperand(raw_ostream &OS, int OpIndex); + void expandCheckFunctionPredicate(raw_ostream &OS, StringRef MCInstFn, StringRef MachineInstrFn); - void expandCheckNonPortable(formatted_raw_ostream &OS, StringRef CodeBlock); - void expandPredicate(formatted_raw_ostream &OS, const Record *Rec); - void expandReturnStatement(formatted_raw_ostream &OS, const Record *Rec); - void expandOpcodeSwitchCase(formatted_raw_ostream &OS, const Record *Rec); - void expandOpcodeSwitchStatement(formatted_raw_ostream &OS, - const RecVec &Cases, const Record *Default); - void expandStatement(formatted_raw_ostream &OS, const Record *Rec); + void expandCheckNonPortable(raw_ostream &OS, StringRef CodeBlock); + void expandPredicate(raw_ostream &OS, const Record *Rec); + void expandReturnStatement(raw_ostream &OS, const Record *Rec); + void expandOpcodeSwitchCase(raw_ostream &OS, const Record *Rec); + void expandOpcodeSwitchStatement(raw_ostream &OS, const RecVec &Cases, + const Record *Default); + void expandStatement(raw_ostream &OS, const Record *Rec); }; } // namespace llvm |

