@@ -33,42 +33,42 @@ typedef enum {
3333 ST_ENUM_SYSOPS_OS,
3434} StreamType;
3535
36- // standalone type definitions
37- // Backend: CompressInstEmitter
36+ // standalone type definitions
37+ // Backend: CompressInstEmitter
3838struct OpData {
39- enum MapKind { Operand, Imm, Reg };
40- MapKind Kind;
41- union {
42- // Operand number mapped to.
43- unsigned Operand;
44- // Integer immediate value.
45- int64_t Imm;
46- // Physical register.
47- Record *Reg;
48- } Data;
49- // Tied operand index within the instruction.
50- int TiedOpIdx = -1 ;
39+ enum MapKind { Operand, Imm, Reg };
40+ MapKind Kind;
41+ union {
42+ // Operand number mapped to.
43+ unsigned Operand;
44+ // Integer immediate value.
45+ int64_t Imm;
46+ // Physical register.
47+ Record *Reg;
48+ } Data;
49+ // Tied operand index within the instruction.
50+ int TiedOpIdx = -1 ;
5151};
5252struct CompressPat {
53- // The source instruction definition.
54- CodeGenInstruction Source;
55- // The destination instruction to transform to.
56- CodeGenInstruction Dest;
57- // Required target features to enable pattern.
58- std::vector<Record *> PatReqFeatures;
59- // Maps operands in the Source Instruction to
60- // the corresponding Dest instruction operand.
61- IndexedMap<OpData> SourceOperandMap;
62- // Maps operands in the Dest Instruction
63- // to the corresponding Source instruction operand.
64- IndexedMap<OpData> DestOperandMap;
65-
66- bool IsCompressOnly;
67- CompressPat (CodeGenInstruction &S, CodeGenInstruction &D,
68- std::vector<Record *> RF, IndexedMap<OpData> &SourceMap,
69- IndexedMap<OpData> &DestMap, bool IsCompressOnly)
70- : Source(S), Dest(D), PatReqFeatures(RF), SourceOperandMap(SourceMap),
71- DestOperandMap (DestMap), IsCompressOnly(IsCompressOnly) {}
53+ // The source instruction definition.
54+ CodeGenInstruction Source;
55+ // The destination instruction to transform to.
56+ CodeGenInstruction Dest;
57+ // Required target features to enable pattern.
58+ std::vector<Record *> PatReqFeatures;
59+ // Maps operands in the Source Instruction to
60+ // the corresponding Dest instruction operand.
61+ IndexedMap<OpData> SourceOperandMap;
62+ // Maps operands in the Dest Instruction
63+ // to the corresponding Source instruction operand.
64+ IndexedMap<OpData> DestOperandMap;
65+
66+ bool IsCompressOnly;
67+ CompressPat (CodeGenInstruction &S, CodeGenInstruction &D,
68+ std::vector<Record *> RF, IndexedMap<OpData> &SourceMap,
69+ IndexedMap<OpData> &DestMap, bool IsCompressOnly)
70+ : Source(S), Dest(D), PatReqFeatures(RF), SourceOperandMap(SourceMap),
71+ DestOperandMap (DestMap), IsCompressOnly(IsCompressOnly) {}
7272};
7373
7474enum EmitterType { Compress, Uncompress, CheckCompress };
@@ -1037,26 +1037,21 @@ class PrinterLLVM {
10371037 // ---------------------------
10381038 // Backend: CompressInstEmitter
10391039 // ---------------------------
1040- virtual void compressInstEmitterEmitCompressInstEmitter (
1041- raw_ostream &OS, EmitterType EType,
1042- // CompressInstEmitter members (not necessarily all of them, just the
1043- // needed ones)
1044- CodeGenTarget &Target, SmallVector<CompressPat, 4 > &CompressPatterns);
1040+ virtual void compressInstEmitterEmitCompressInstEmitter (raw_ostream &OS, EmitterType EType,
1041+ // CompressInstEmitter members (not necessarily all of them, just the needed ones)
1042+ CodeGenTarget &Target, SmallVector<CompressPat, 4 > &CompressPatterns);
10451043
10461044 // static helpers
1047- static void compressInstEmitterPrintPredicates (
1048- const std::vector<const Record *> &Predicates, StringRef Name,
1049- raw_ostream &OS);
1050- static void compressInstEmitterMergeCondAndCode (raw_ostream &CombinedStream,
1051- StringRef CondStr,
1045+ static void compressInstEmitterPrintPredicates (const std::vector<const Record *> &Predicates,
1046+ StringRef Name, raw_ostream &OS);
1047+ static void compressInstEmitterMergeCondAndCode (raw_ostream &CombinedStream, StringRef CondStr,
10521048 StringRef CodeStr);
1053- static unsigned compressInstEmitterGetPredicates (
1054- DenseMap<const Record *, unsigned > &PredicateMap,
1055- std::vector<const Record *> &Predicates, Record *Rec, StringRef Name);
1056- static void compressInstEmitterGetReqFeatures (
1057- std::set<std::pair<bool , StringRef>> &FeaturesSet,
1058- std::set<std::set<std::pair<bool , StringRef>>> &AnyOfFeatureSets,
1059- const std::vector<Record *> &ReqFeatures);
1049+ static unsigned compressInstEmitterGetPredicates (DenseMap<const Record *, unsigned > &PredicateMap,
1050+ std::vector<const Record *> &Predicates,
1051+ Record *Rec, StringRef Name);
1052+ static void compressInstEmitterGetReqFeatures (std::set<std::pair<bool , StringRef>> &FeaturesSet,
1053+ std::set<std::set<std::pair<bool , StringRef>>> &AnyOfFeatureSets,
1054+ const std::vector<Record *> &ReqFeatures);
10601055};
10611056
10621057// ==============================
@@ -1922,13 +1917,10 @@ class PrinterCapstone : public PrinterLLVM {
19221917 void searchableTablesEmitMapIV (unsigned i) const override ;
19231918 void searchableTablesEmitMapV () override ;
19241919
1925- // Backend: CompressInstEmitter
1926- virtual void compressInstEmitterEmitCompressInstEmitter (
1927- raw_ostream &OS, EmitterType EType,
1928- // CompressInstEmitter members (not necessarily all of them, just the
1929- // needed ones)
1930- CodeGenTarget &Target,
1931- SmallVector<CompressPat, 4 > &CompressPatterns) override ;
1920+ // Backend: CompressInstEmitter
1921+ virtual void compressInstEmitterEmitCompressInstEmitter (raw_ostream &OS, EmitterType EType,
1922+ // CompressInstEmitter members (not necessarily all of them, just the needed ones)
1923+ CodeGenTarget &Target, SmallVector<CompressPat, 4 > &CompressPatterns) override ;
19321924};
19331925
19341926} // end namespace llvm
0 commit comments