LLVM: include/llvm/Transforms/Vectorize/SandboxVectorizer/InstrMaps.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_PASSES_INSTRMAPS_H
10#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_PASSES_INSTRMAPS_H
11
22
24
26
38#ifndef NDEBUG
40 void dump() const;
42 A.print(OS);
43 return OS;
44 }
45#endif
46};
47
48
49
51
52
54
55
56
57
59 std::optionalContext::CallbackID EraseInstrCB;
60
61public:
64
65
67 auto It = OrigToVectorMap.find(Orig);
68 return It != OrigToVectorMap.end() ? It->second : nullptr;
69 }
70
71
73 auto It1 = VectorToOrigLaneMap.find(Vec);
74 if (It1 == VectorToOrigLaneMap.end())
75 return std::nullopt;
76 const auto &OrigToLaneMap = It1->second;
77 auto It2 = OrigToLaneMap.find(Orig);
78 if (It2 == OrigToLaneMap.end())
79 return std::nullopt;
80 return It2->second;
81 }
82
84 auto &OrigToLaneMap = VectorToOrigLaneMap[Vec];
85 unsigned Lane = 0;
86 for (Value *Orig : Origs) {
87 auto Pair = OrigToVectorMap.try_emplace(Orig, Vec);
88 assert(Pair.second && "Orig already exists in the map!");
89 (void)Pair;
90 OrigToLaneMap[Orig] = Lane;
92 }
93 }
95 OrigToVectorMap.clear();
96 VectorToOrigLaneMap.clear();
97 }
98#ifndef NDEBUG
100 OS << "OrigToVectorMap:\n";
101 for (auto [Orig, Vec] : OrigToVectorMap)
102 OS << *Orig << " : " << *Vec << "\n";
103 }
105#endif
106};
107}
108
109#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseMap class.
This file defines the SmallSet class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class implements an extremely fast bulk output stream that can only output to a stream.
std::optional< unsigned > getOrigLane(Action *Vec, Value *Orig) const
\Returns the lane of Orig before it got vectorized into Vec, or nullopt if not found.
Definition InstrMaps.h:72
void print(raw_ostream &OS) const
Definition InstrMaps.h:99
void registerVector(ArrayRef< Value * > Origs, Action *Vec)
Update the map to reflect that Origs got vectorized into Vec.
Definition InstrMaps.h:83
Action * getVectorForOrig(Value *Orig) const
\Returns the vector value that we got from vectorizing Orig, or nullptr if not found.
Definition InstrMaps.h:66
void clear()
Definition InstrMaps.h:94
LLVM_DUMP_METHOD void dump() const
The legality outcome is represented by a class rather than an enum class because in some cases the le...
A SandboxIR Value has users. This is the base class.
static unsigned getNumLanes(Type *Ty)
\Returns the number of vector lanes of Ty or 1 if not a vector.
Definition InstrMaps.h:27
Action(const LegalityResult *LR, ArrayRef< Value * > B, ArrayRef< Value * > UB, unsigned Depth)
Definition InstrMaps.h:35
SmallVector< Value * > UserBndl
Definition InstrMaps.h:31
unsigned Idx
Definition InstrMaps.h:28
SmallVector< Value *, 4 > Bndl
Definition InstrMaps.h:30
unsigned Depth
Definition InstrMaps.h:32
Value * Vec
Definition InstrMaps.h:34
SmallVector< Action * > Operands
Definition InstrMaps.h:33
void print(raw_ostream &OS) const
friend raw_ostream & operator<<(raw_ostream &OS, const Action &A)
Definition InstrMaps.h:41
const LegalityResult * LegalityRes
Definition InstrMaps.h:29