57 for (RecSet::iterator
I = Add.begin(),
E = Add.end();
I !=
E; ++
I)
73 for (RecSet::iterator
I = S1.begin(),
E = S1.end();
I !=
E; ++
I)
95 apply2(ST, Expr, Set, II->
getValue(), Elts, Loc);
100 struct ShlOp :
public SetIntBinOp {
106 if (
unsigned(N) < Set.size())
107 Elts.insert(Set.begin() +
N, Set.end());
112 struct TruncOp :
public SetIntBinOp {
118 if (
unsigned(N) > Set.size())
120 Elts.insert(Set.begin(), Set.begin() +
N);
125 struct RotOp :
public SetIntBinOp {
128 RotOp(
bool Rev) : Reverse(Rev) {}
138 N = Set.size() - (-N % Set.size());
141 Elts.insert(Set.begin() +
N, Set.end());
142 Elts.insert(Set.begin(), Set.begin() +
N);
147 struct DecimateOp :
public SetIntBinOp {
153 for (
unsigned I = 0;
I < Set.size();
I +=
N)
164 unsigned MaxSize = 0;
165 for (
unsigned i = 0, e = Expr->
getNumArgs(); i != e; ++i) {
170 for (
unsigned n = 0; n != MaxSize; ++n)
171 for (
unsigned i = 0, e = Expr->
getNumArgs(); i != e; ++i)
173 Elts.insert(
Args[i][n]);
195 Format =
SI->getValue();
204 if (From < 0 || From >= (1 << 30))
211 if (To < 0 || To >= (1 << 30))
215 cast<DefInit>(Expr->
getOperator())->getDef()->getRecords();
217 Step *= From <= To ? 1 : -1;
219 if (Step > 0 && From > To)
221 else if (Step < 0 && From < To)
231 if (
const RecVec *Result = ST.
expand(Rec))
245 FieldExpander(
StringRef fn) : FieldName(fn) {}
255 void SetTheory::Operator::anchor() {}
256 void SetTheory::Expander::anchor() {}
259 addOperator(
"add", llvm::make_unique<AddOp>());
260 addOperator(
"sub", llvm::make_unique<SubOp>());
261 addOperator(
"and", llvm::make_unique<AndOp>());
262 addOperator(
"shl", llvm::make_unique<ShlOp>());
263 addOperator(
"trunc", llvm::make_unique<TruncOp>());
264 addOperator(
"rotl", llvm::make_unique<RotOp>(
false));
265 addOperator(
"rotr", llvm::make_unique<RotOp>(
true));
266 addOperator(
"decimate", llvm::make_unique<DecimateOp>());
267 addOperator(
"interleave", llvm::make_unique<InterleaveOp>());
268 addOperator(
"sequence", llvm::make_unique<SequenceOp>());
272 Operators[
Name] = std::move(Op);
276 Expanders[ClassName] = std::move(E);
280 addExpander(ClassName, llvm::make_unique<FieldExpander>(FieldName));
287 return Elts.
insert(Result->begin(), Result->end());
293 if (
ListInit *LI = dyn_cast<ListInit>(Expr))
294 return evaluate(LI->begin(), LI->end(), Elts, Loc);
303 auto I = Operators.find(OpInit->getDef()->getName());
304 if (I == Operators.end())
306 I->second->apply(*
this, DagExpr, Elts, Loc);
311 ExpandMap::iterator
I = Expansions.find(Set);
312 if (I != Expansions.end())
317 for (
const auto &SCPair :
SC) {
319 if (!isa<StringInit>(SCPair.first->getNameInit()))
321 auto I = Expanders.find(SCPair.first->getName());
322 if (I != Expanders.end()) {
324 RecVec &EltVec = Expansions[Set];
326 I->second->expand(*
this, Set, Elts);
327 EltVec.assign(Elts.
begin(), Elts.
end());
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
Operator - A callback representing a DAG operator.
[AL, AH, CL] - Represent a list of defs
'7' - Represent an initialization by a literal integer value.
AL - Represent a reference to a 'def' in the description.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
SetTheory()
Create a SetTheory instance with only the standard operators.
Expander - A callback function that can transform a Record representing a set into a fully expanded l...
iterator end()
Get an iterator to the end of the SetVector.
Init * getArg(unsigned Num) const
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
void apply(Opt *O, const Mod &M, const Mods &... Ms)
Init * getValueInit(StringRef FieldName) const
Return the initializer for a value with the specified name, or throw an exception if the field does n...
ArrayRef< SMLoc > getLoc() const
bool insert(const value_type &X)
Insert a new element into the SetVector.
SmallSetVector< Record *, 16 > RecSet
iterator begin()
Get an iterator to the beginning of the SetVector.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Base class for operators.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
"foo" - Represent an initialization by a string value.
static Expected< BitVector > expand(StringRef S, StringRef Original)
std::string getAsString() const override
Convert this value to a string form.
void addFieldExpander(StringRef ClassName, StringRef FieldName)
addFieldExpander - Add an expander for ClassName that simply evaluates FieldName in the Record to get...
A SetVector that performs no allocations if smaller than a certain size.
void addExpander(StringRef ClassName, std::unique_ptr< Expander >)
addExpander - Add an expander for Records with the named super class.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
BlockVerifier::State From
Init * getOperator() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
CHAIN = SC CHAIN, Imm128 - System call.
unsigned getNumArgs() const
void addOperator(StringRef Name, std::unique_ptr< Operator >)
addOperator - Add a DAG operator.
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Twine &Msg)
const RecVec * expand(Record *Set)
expand - Expand a record into a set of elements if possible.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Record * getDef(StringRef Name) const
A raw_ostream that writes to an std::string.
std::vector< Record * > RecVec
(v a, b) - Represent a DAG tree value.
virtual std::string getAsString() const =0
Convert this value to a string form.
StringRef - Represent a constant reference to a string, i.e.
const_arg_iterator arg_begin() const
void evaluate(Init *Expr, RecSet &Elts, ArrayRef< SMLoc > Loc)
evaluate - Evaluate Expr and append the resulting set to Elts.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
const_arg_iterator arg_end() const