Go to the documentation of this file.
55 for (
const auto &
I : Add)
71 for (
const auto &
I : S1)
93 apply2(
ST, Expr, Set, II->
getValue(), Elts, Loc);
98 struct ShlOp :
public SetIntBinOp {
104 if (
unsigned(
N) < Set.size())
105 Elts.insert(Set.begin() +
N, Set.end());
110 struct TruncOp :
public SetIntBinOp {
116 if (
unsigned(
N) > Set.size())
118 Elts.insert(Set.begin(), Set.begin() +
N);
123 struct RotOp :
public SetIntBinOp {
126 RotOp(
bool Rev) : Reverse(Rev) {}
136 N = Set.size() - (-
N % Set.size());
139 Elts.insert(Set.begin() +
N, Set.end());
140 Elts.insert(Set.begin(), Set.begin() +
N);
145 struct DecimateOp :
public SetIntBinOp {
151 for (
unsigned I = 0;
I < Set.size();
I +=
N)
162 unsigned MaxSize = 0;
168 for (
unsigned n = 0;
n != MaxSize; ++
n)
185 Step = II->getValue();
193 Format = std::string(
SI->getValue());
199 From = II->getValue();
202 if (From < 0 || From >= (1 << 30))
209 if (To < 0 || To >= (1 << 30))
215 Step *=
From <= To ? 1 : -1;
217 if (Step > 0 &&
From > To)
219 else if (Step < 0 &&
From < To)
229 if (
const RecVec *Result =
ST.expand(Rec))
243 FieldExpander(
StringRef fn) : FieldName(fn) {}
246 ST.evaluate(
Def->getValueInit(FieldName), Elts,
Def->getLoc());
253 void SetTheory::Operator::anchor() {}
254 void SetTheory::Expander::anchor() {}
262 addOperator(
"rotl", std::make_unique<RotOp>(
false));
263 addOperator(
"rotr", std::make_unique<RotOp>(
true));
264 addOperator(
"decimate", std::make_unique<DecimateOp>());
265 addOperator(
"interleave", std::make_unique<InterleaveOp>());
266 addOperator(
"sequence", std::make_unique<SequenceOp>());
278 addExpander(ClassName, std::make_unique<FieldExpander>(FieldName));
285 return Elts.
insert(Result->begin(), Result->end());
291 if (
ListInit *LI = dyn_cast<ListInit>(Expr))
292 return evaluate(LI->begin(), LI->end(), Elts, Loc);
295 DagInit *DagExpr = dyn_cast<DagInit>(Expr);
301 auto I = Operators.find(
OpInit->getDef()->getName());
302 if (
I == Operators.end())
304 I->second->apply(*
this, DagExpr, Elts, Loc);
309 ExpandMap::iterator
I = Expansions.find(Set);
310 if (
I != Expansions.end())
315 for (
const auto &SCPair :
SC) {
317 if (!isa<StringInit>(SCPair.first->getNameInit()))
319 auto I = Expanders.find(SCPair.first->getName());
320 if (
I != Expanders.end()) {
322 RecVec &EltVec = Expansions[Set];
324 I->second->expand(*
this, Set, Elts);
325 EltVec.assign(Elts.
begin(), Elts.
end());
Operator - A callback representing a DAG operator.
SmallSetVector< Record *, 16 > RecSet
This is an optimization pass for GlobalISel generic memory operations.
Base class for operators.
A raw_ostream that writes to an std::string.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
(v a, b) - Represent a DAG tree value.
void addExpander(StringRef ClassName, std::unique_ptr< Expander >)
addExpander - Add an expander for Records with the named super class.
std::string getAsString() const override
Convert this value to a literal form.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Init * getArg(unsigned Num) const
Init * getOperator() const
void apply(Opt *O, const Mod &M, const Mods &... Ms)
iterator begin()
Get an iterator to the beginning of the SetVector.
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void addFieldExpander(StringRef ClassName, StringRef FieldName)
addFieldExpander - Add an expander for ClassName that simply evaluates FieldName in the Record to get...
void PrintFatalError(const Twine &Msg)
Expander - A callback function that can transform a Record representing a set into a fully expanded l...
static Expected< BitVector > expand(StringRef S, StringRef Original)
'7' - Represent an initialization by a literal integer value.
[AL, AH, CL] - Represent a list of defs
AL - Represent a reference to a 'def' in the description.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
virtual std::string getAsString() const =0
Convert this value to a literal form.
bool insert(const value_type &X)
Insert a new element into the SetVector.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
"foo" - Represent an initialization by a string value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
std::vector< Record * > RecVec
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
const_arg_iterator arg_begin() const
unsigned getNumArgs() const
RecordKeeper & getRecords() const
void addOperator(StringRef Name, std::unique_ptr< Operator >)
addOperator - Add a DAG operator.
const_arg_iterator arg_end() const
iterator end()
Get an iterator to the end of the SetVector.
const RecVec * expand(Record *Set)
expand - Expand a record into a set of elements if possible.
A SetVector that performs no allocations if smaller than a certain size.
BlockVerifier::State From
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Record * getDef(StringRef Name) const
Get the concrete record with the specified name.
The same transformation can work with an even modulo with the addition of a and shrink the compare RHS by the same amount Unless the target supports that transformation probably isn t worthwhile The transformation can also easily be made to work with non zero equality for n
SetTheory()
Create a SetTheory instance with only the standard operators.
void evaluate(Init *Expr, RecSet &Elts, ArrayRef< SMLoc > Loc)
evaluate - Evaluate Expr and append the resulting set to Elts.