30 return tree_->range();
38 return tree_->tree(i);
60 TreeList::const_iterator
it;
66 tree->expect(TK_LIST);
77 return T(
tree_->trees().at(i));
83 return tree_->trees().size();
95 tree->expect(TK_OPTION);
98 return tree_->trees().size() > 0;
102 return T(
tree_->trees()[0]);
113 tree_->expect(TK_IDENT, 1);
118 const std::string&
name()
const {
119 return subtree(0)->stringValue();
138 tree_->expect(kind, 2);
158 tree_->expect(TK_BUILT_IN, 3);
160 const std::string&
name()
const {
161 return subtree(0)->stringValue();
173 const std::string&
name,
188 tree_->expect(TK_TENSOR_TYPE, 2);
195 auto scalar_type_ =
subtree(0);
196 if (scalar_type_->kind() == TK_IDENT)
198 <<
" TensorType has a symbolic ident " <<
Ident(scalar_type_).
name()
199 <<
" rather than a concrete type";
213 tree_->expect(TK_PARAM, 2);
231 return type()->kind() == TK_INFERRED;
241 tree_->expect(TK_EQUIVALENT, 2);
248 const std::string&
name()
const {
249 return subtree(0)->stringValue();
258 tree->expect(TK_RANGE_CONSTRAINT, 3);
277 tree_->expect(TK_COMPREHENSION, 7);
297 reduction_variables});
332 tree->expect(TK_DEF, 4);
355 TK_DEF, range, {
name, paramlist, retlist, stmts_list});
361 tree_->expect(
'.', 2);
367 return subtree(1)->doubleValue();
376 tree_->expect(TK_CONST, 2);
379 return subtree(0)->doubleValue();
391 tree_->expect(TK_CAST, 2);
406 tree_->expect(TK_LET, 2);
421 tree_->expect(TK_EXISTS, 1);
static TreeRef create(const SourceRange &range, TreeRef name, TreeRef paramlist, TreeRef retlist, TreeRef stmts_list)
Definition: tree_views.h:348
TreeRef name_
Definition: tree_views.h:132
static TreeRef create(const SourceRange &range, const std::string &name, TreeRef accesses)
Definition: tree_views.h:244
size_t size() const
Definition: tree_views.h:82
static TreeRef create(const SourceRange &range, TreeRef name, TreeRef index)
Definition: tree_views.h:369
TreeRef assignment() const
Definition: tree_views.h:311
ListViewIterator< T > const_iterator
Definition: tree_views.h:69
Select(const TreeRef &tree)
Definition: tree_views.h:360
const std::string & name() const
Definition: tree_views.h:118
static TreeRef create(const SourceRange &range, TreeRef ident, TreeRef type)
Definition: tree_views.h:215
TreeRef rhs() const
Definition: tree_views.h:314
TreeRef rhs() const
Definition: tree_views.h:411
Exists(const TreeRef &tree)
Definition: tree_views.h:420
Ident name() const
Definition: tree_views.h:408
Ident name() const
Definition: tree_views.h:363
static TreeRef create(const SourceRange &range, const std::string &name, TreeRef arguments, TreeRef type)
Definition: tree_views.h:171
Definition: tree_views.h:256
TreeRef start() const
Definition: tree_views.h:267
int index() const
Definition: tree_views.h:366
TreeRef type_
Definition: tree_views.h:183
void operator--()
Definition: tree_views.h:55
TreeList::const_iterator it
Definition: tree_views.h:60
ListView< Param > returns() const
Definition: tree_views.h:342
Ident name()
Definition: tree_views.h:334
Definition: tree_views.h:374
ListViewIterator(TreeList::const_iterator it)
Definition: tree_views.h:45
Ident name() const
Definition: tree_views.h:141
Ident(const TreeRef &tree)
Definition: tree_views.h:112
TensorType tensorType() const
Definition: tree_views.h:234
TreeRef tree() const
Definition: tree_views.h:26
const std::string & name() const
Definition: tree_views.h:160
Definition: tree_views.h:24
Comprehension(const TreeRef &tree)
Definition: tree_views.h:276
Param(const TreeRef &tree)
Definition: tree_views.h:212
bool typeIsInferred() const
Definition: tree_views.h:230
T operator[](size_t i) const
Definition: tree_views.h:76
TreeRef type() const
Definition: tree_views.h:227
TreeRef name_
Definition: tree_views.h:181
static TreeRef create(const SourceRange &range, TreeRef ident, TreeRef start, TreeRef end)
Definition: tree_views.h:261
TreeRef arguments_
Definition: tree_views.h:182
Definition: tree_views.h:389
Definition: tree_views.h:275
ListViewIterator< T > iterator
Definition: tree_views.h:68
static TreeRef create(const SourceRange &range, TreeRef name, TreeRef arguments)
Definition: tree_views.h:149
Definition: tree_views.h:109
Definition: tree_views.h:359
ListView< TreeRef > dims() const
Definition: tree_views.h:206
static TreeRef create(Args &&...args)
Definition: tree.h:100
RangeConstraint(const TreeRef &tree)
Definition: tree_views.h:257
static TreeRef create(const SourceRange &range, TreeRef value, TreeRef type)
Definition: tree_views.h:399
static TreeRef create(const SourceRange &range, TreeRef name, TreeRef rhs)
Definition: tree_views.h:414
static TreeRef create(const SourceRange &range, TreeRef value, TreeRef type)
Definition: tree_views.h:384
Cast(const TreeRef &tree)
Definition: tree_views.h:390
ListView< TreeRef > whereClauses() const
Definition: tree_views.h:319
Definition: tree_views.h:330
ListView< TreeRef > arguments() const
Definition: tree_views.h:144
Definition: tree_views.h:136
Definition: tree_views.h:404
Const(const TreeRef &tree)
Definition: tree_views.h:375
void operator++()
Definition: tree_views.h:52
Let(const TreeRef &tree)
Definition: tree_views.h:405
OptionView< Equivalent > equivalent() const
Definition: tree_views.h:322
Ident ident() const
Definition: tree_views.h:264
const SourceRange & range() const
Definition: tree_views.h:29
TreeRef map(std::function< TreeRef(const T &)> fn)
Definition: tree_views.h:104
static TreeRef create(const SourceRange &range, TreeRef ident, TreeRef indices, TreeRef assignment, TreeRef rhs, TreeRef range_constraints, TreeRef equivalent, TreeRef reduction_variables)
Definition: tree_views.h:279
TreeRef exp() const
Definition: tree_views.h:423
TreeRef type() const
Definition: tree_views.h:167
TreeRef type() const
Definition: tree_views.h:396
TreeRef value() const
Definition: tree_views.h:393
BuiltIn(const TreeRef &tree)
Definition: tree_views.h:157
Definition: tree_views.h:44
ListView< Comprehension > statements() const
Definition: tree_views.h:345
std::vector< TreeRef > TreeList
Definition: tree.h:45
double value() const
Definition: tree_views.h:378
OptionView(const TreeRef &tree)
Definition: tree_views.h:94
ListView< Param > params() const
Definition: tree_views.h:339
TreeRef tree_
Definition: tree_views.h:40
Equivalent(const TreeRef &tree)
Definition: tree_views.h:240
T operator*() const
Definition: tree_views.h:49
ListView< Ident > indices() const
Definition: tree_views.h:307
static TreeRef create(const SourceRange &range, const std::string &name)
Definition: tree_views.h:127
TreeRef subtree(size_t i) const
Definition: tree_views.h:37
Definition: tree_views.h:93
static TreeRef create(const SourceRange &range, TreeRef scalar_type_, TreeRef dims_)
Definition: tree_views.h:191
static TreeRef create(const SourceRange &range, TreeList elements)
Definition: tree_views.h:85
iterator end() const
Definition: tree_views.h:73
ApplyLike(const TreeRef &tree)
Definition: tree_views.h:137
Definition: tree_views.h:64
ListView(const TreeRef &tree)
Definition: tree_views.h:65
Definition: tree_views.h:186
TreeView(const TreeRef &tree_)
Definition: tree_views.h:25
ListView< TreeRef > accesses() const
Definition: tree_views.h:251
ListView< Ident > reductionVariables() const
Definition: tree_views.h:325
Definition: tree_views.h:156
int scalarType() const
Definition: tree_views.h:202
Definition: tree_views.h:239
TreeRef scalarTypeTree() const
Definition: tree_views.h:194
Definition: error_report.h:22
Definition: tree_views.h:419
bool operator!=(const ListViewIterator &rhs) const
Definition: tree_views.h:46
static TreeRef create(int kind, const SourceRange &range_, TreeList &&trees_)
Definition: tree.h:155
Definition: tree_views.h:211
ListView< TreeRef > arguments() const
Definition: tree_views.h:163
const std::string & name() const
Definition: tree_views.h:248
TensorType(const TreeRef &tree)
Definition: tree_views.h:187
static TreeRef create(const SourceRange &range, TreeRef exp)
Definition: tree_views.h:426
iterator begin() const
Definition: tree_views.h:70
std::shared_ptr< Tree > TreeRef
Definition: tree.h:44
bool present() const
Definition: tree_views.h:97
Ident ident() const
Definition: tree_views.h:223
TreeRef map(std::function< TreeRef(const T &)> fn)
Definition: tree_views.h:79
Ident ident() const
Definition: tree_views.h:304
TreeRef end() const
Definition: tree_views.h:270
#define TC_ASSERT(ctx, cond)
Definition: error_report.h:55
TreeRef type() const
Definition: tree_views.h:381
Def(const TreeRef &tree)
Definition: tree_views.h:331