llvm.org GIT mirror llvm / 8b6f742
Reformat blank lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208515 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 6 years ago
5 changed file(s) with 22 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
3333 extern SourceMgr SrcMgr;
3434 extern unsigned ErrorsPrinted;
3535
36
3736 } // end namespace "llvm"
3837
3938 #endif
2222 typedef bool TableGenMainFn(raw_ostream &OS, RecordKeeper &Records);
2323
2424 int TableGenMain(char *argv0, TableGenMainFn *MainFn);
25
2625 }
2726
2827 #endif
136136 return OS;
137137 }
138138
139
140139 /// BitRecTy - 'bit' - Represent a single bit
141140 ///
142141 class BitRecTy : public RecTy {
143142 static BitRecTy Shared;
144143 BitRecTy() : RecTy(BitRecTyKind) {}
144
145145 public:
146146 static bool classof(const RecTy *RT) {
147147 return RT->getRecTyKind() == BitRecTyKind;
173173 bool baseClassOf(const RecTy*) const override;
174174 };
175175
176
177176 /// BitsRecTy - 'bits' - Represent a fixed number of bits
178177 ///
179178 class BitsRecTy : public RecTy {
180179 unsigned Size;
181180 explicit BitsRecTy(unsigned Sz) : RecTy(BitsRecTyKind), Size(Sz) {}
181
182182 public:
183183 static bool classof(const RecTy *RT) {
184184 return RT->getRecTyKind() == BitsRecTyKind;
212212 bool baseClassOf(const RecTy*) const override;
213213 };
214214
215
216215 /// IntRecTy - 'int' - Represent an integer value of no particular size
217216 ///
218217 class IntRecTy : public RecTy {
219218 static IntRecTy Shared;
220219 IntRecTy() : RecTy(IntRecTyKind) {}
220
221221 public:
222222 static bool classof(const RecTy *RT) {
223223 return RT->getRecTyKind() == IntRecTyKind;
255255 class StringRecTy : public RecTy {
256256 static StringRecTy Shared;
257257 StringRecTy() : RecTy(StringRecTyKind) {}
258
258259 public:
259260 static bool classof(const RecTy *RT) {
260261 return RT->getRecTyKind() == StringRecTyKind;
293294 RecTy *Ty;
294295 explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), Ty(T) {}
295296 friend ListRecTy *RecTy::getListTy();
297
296298 public:
297299 static bool classof(const RecTy *RT) {
298300 return RT->getRecTyKind() == ListRecTyKind;
331333 class DagRecTy : public RecTy {
332334 static DagRecTy Shared;
333335 DagRecTy() : RecTy(DagRecTyKind) {}
336
334337 public:
335338 static bool classof(const RecTy *RT) {
336339 return RT->getRecTyKind() == DagRecTyKind;
361364 }
362365 };
363366
364
365367 /// RecordRecTy - '[classname]' - Represent an instance of a class, such as:
366368 /// (R32 X = EAX).
367369 ///
369371 Record *Rec;
370372 explicit RecordRecTy(Record *R) : RecTy(RecordRecTyKind), Rec(R) {}
371373 friend class Record;
374
372375 public:
373376 static bool classof(const RecTy *RT) {
374377 return RT->getRecTyKind() == RecordRecTyKind;
588591 unsigned Elt) const = 0;
589592 };
590593
591
592594 /// UnsetInit - ? - Represents an uninitialized value
593595 ///
594596 class UnsetInit : public Init {
615617 std::string getAsString() const override { return "?"; }
616618 };
617619
618
619620 /// BitInit - true/false - Represent a concrete initializer for a bit.
620621 ///
621622 class BitInit : public Init {
693694 return Bits[Bit];
694695 }
695696 };
696
697697
698698 /// IntInit - 7 - Represent an initialization by a literal integer value.
699699 ///
735735 }
736736 };
737737
738
739738 /// StringInit - "foo" - Represent an initialization by a string value.
740739 ///
741740 class StringInit : public TypedInit {
780779 ///
781780 class ListInit : public TypedInit, public FoldingSetNode {
782781 std::vector Values;
782
783783 public:
784784 typedef std::vector::const_iterator const_iterator;
785785
842842 }
843843 };
844844
845
846845 /// OpInit - Base class for operators
847846 ///
848847 class OpInit : public TypedInit {
877876 Init *getBit(unsigned Bit) const override;
878877 };
879878
880
881879 /// UnOpInit - !op (X) - Transform an init.
882880 ///
883881 class UnOpInit : public OpInit {
884882 public:
885883 enum UnaryOp { CAST, HEAD, TAIL, EMPTY };
884
886885 private:
887886 UnaryOp Opc;
888887 Init *LHS;
982981 class TernOpInit : public OpInit {
983982 public:
984983 enum TernaryOp { SUBST, FOREACH, IF };
984
985985 private:
986986 TernaryOp Opc;
987987 Init *LHS, *MHS, *RHS;
10381038 std::string getAsString() const override;
10391039 };
10401040
1041
10421041 /// VarInit - 'Opcode' - Represent a reference to an entire variable object.
10431042 ///
10441043 class VarInit : public TypedInit {
10871086
10881087 std::string getAsString() const override { return getName(); }
10891088 };
1090
10911089
10921090 /// VarBitInit - Opcode{0} - Represent access to one bit of a variable or field.
10931091 ///
12141212 }
12151213 };
12161214
1217
12181215 /// FieldInit - X.Y - Represent a reference to a subfield of a variable
12191216 ///
12201217 class FieldInit : public TypedInit {
13411338 RecTy *Ty;
13421339 unsigned Prefix;
13431340 Init *Value;
1341
13441342 public:
13451343 RecordVal(Init *N, RecTy *T, unsigned P);
13461344 RecordVal(const std::string &N, RecTy *T, unsigned P);
13971395 void checkName();
13981396
13991397 public:
1400
14011398 // Constructs a record.
14021399 explicit Record(const std::string &N, ArrayRef locs,
14031400 RecordKeeper &records, bool Anonymous = false) :
14221419
14231420 ~Record() {}
14241421
1425
14261422 static unsigned getNewUID() { return LastID++; }
1427
14281423
14291424 unsigned getID() const { return ID; }
14301425
2020
2121 namespace llvm {
2222 class raw_ostream;
23
23
2424 /// StringMatcher - Given a list of strings and code to execute when they match,
2525 /// output a simple switch tree to classify the input string.
26 ///
26 ///
2727 /// If a match is found, the code in Vals[i].second is executed; control must
2828 /// not exit this code fragment. If nothing matches, execution falls through.
2929 ///
3030 class StringMatcher {
3131 public:
3232 typedef std::pair StringPair;
33
3334 private:
3435 StringRef StrVariableName;
3536 const std::vector &Matches;
3637 raw_ostream &OS;
37
38
3839 public:
3940 StringMatcher(StringRef strVariableName,
4041 const std::vector &matches, raw_ostream &os)
4142 : StrVariableName(strVariableName), Matches(matches), OS(os) {}
42
43
4344 void Emit(unsigned Indent = 0) const;
44
45
45
4646 private:
4747 bool EmitStringMatcherForChar(const std::vector &Matches,
4848 unsigned CharNo, unsigned IndentCount) const;
2424 class StringToOffsetTable {
2525 StringMap StringOffset;
2626 std::string AggregateString;
27
2728 public:
28
2929 unsigned GetOrAddStringOffset(StringRef Str, bool appendZero = true) {
3030 StringMapEntry &Entry = StringOffset.GetOrCreateValue(Str, -1U);
3131 if (Entry.getValue() == -1U) {
3535 if (appendZero)
3636 AggregateString += '\0';
3737 }
38
38
3939 return Entry.getValue();
4040 }
41
41
4242 void EmitString(raw_ostream &O) {
4343 // Escape the string.
4444 SmallString<256> Str;
5454 }
5555 O << AggregateString[i];
5656 ++CharsPrinted;
57
57
5858 // Print escape sequences all together.
5959 if (AggregateString[i] != '\\')
6060 continue;
61
61
6262 assert(i+1 < AggregateString.size() && "Incomplete escape sequence!");
6363 if (isdigit(AggregateString[i+1])) {
6464 assert(isdigit(AggregateString[i+2]) &&