Code quality: More renaming

This commit is contained in:
Philippe Tillet
2015-12-19 02:38:32 -05:00
parent bfa7504fc0
commit 5a035b91a2
11 changed files with 35 additions and 35 deletions

View File

@@ -84,11 +84,11 @@ private:
class filter_elements_fun : public traversal_functor
{
public:
filter_elements_fun(node_type subtype, std::vector<lhs_rhs_element> & out);
filter_elements_fun(node_type subtype, std::vector<tree_node> & out);
void operator()(isaac::math_expression const & math_expression, size_t root_idx, leaf_t) const;
private:
node_type subtype_;
std::vector<lhs_rhs_element> & out_;
std::vector<tree_node> & out_;
};
std::vector<size_t> filter_nodes(bool (*pred)(math_expression::node const & node),
@@ -96,7 +96,7 @@ std::vector<size_t> filter_nodes(bool (*pred)(math_expression::node const & node
size_t root,
bool inspect);
std::vector<lhs_rhs_element> filter_elements(node_type subtype,
std::vector<tree_node> filter_elements(node_type subtype,
isaac::math_expression const & math_expression);
const char * evaluate(operation_type type);
@@ -146,7 +146,7 @@ class math_expression_representation_functor : public traversal_functor{
private:
static void append_id(char * & ptr, unsigned int val);
void append(driver::Buffer const & h, numeric_type dtype, char prefix) const;
void append(lhs_rhs_element const & lhs_rhs, bool is_assigned) const;
void append(tree_node const & lhs_rhs, bool is_assigned) const;
public:
math_expression_representation_functor(symbolic_binder & binder, char *& ptr);
void append(char*& p, const char * str) const;

View File

@@ -162,9 +162,9 @@ enum node_type
FOR_LOOP_INDEX_TYPE
};
struct lhs_rhs_element
struct tree_node
{
lhs_rhs_element();
tree_node();
node_type subtype;
numeric_type dtype;
union
@@ -178,20 +178,20 @@ struct lhs_rhs_element
struct invalid_node{};
void fill(lhs_rhs_element &x, for_idx_t index);
void fill(lhs_rhs_element &x, invalid_node);
void fill(lhs_rhs_element & x, std::size_t node_index);
void fill(lhs_rhs_element & x, array_base const & a);
void fill(lhs_rhs_element & x, value_scalar const & v);
void fill(tree_node &x, for_idx_t index);
void fill(tree_node &x, invalid_node);
void fill(tree_node & x, std::size_t node_index);
void fill(tree_node & x, array_base const & a);
void fill(tree_node & x, value_scalar const & v);
class math_expression
{
public:
struct node
{
lhs_rhs_element lhs;
tree_node lhs;
op_element op;
lhs_rhs_element rhs;
tree_node rhs;
};
typedef std::vector<node> container_type;

View File

@@ -8,7 +8,7 @@ namespace isaac
{
std::string to_string(node_type const & f);
std::string to_string(lhs_rhs_element const & e);
std::string to_string(tree_node const & e);
std::ostream & operator<<(std::ostream & os, math_expression::node const & s_node);
std::string to_string(isaac::math_expression const & s);

View File

@@ -21,10 +21,10 @@ public:
{
args(): A(NULL), B(NULL), C(NULL), type(INVALID_EXPRESSION_TYPE){ }
value_scalar alpha;
lhs_rhs_element const * A;
lhs_rhs_element const * B;
tree_node const * A;
tree_node const * B;
value_scalar beta;
lhs_rhs_element const * C;
tree_node const * C;
expression_type type;
operator bool() const

View File

@@ -139,7 +139,7 @@ std::vector<size_t> filter_nodes(bool (*pred)(math_expression::node const & node
}
//
filter_elements_fun::filter_elements_fun(node_type subtype, std::vector<lhs_rhs_element> & out) :
filter_elements_fun::filter_elements_fun(node_type subtype, std::vector<tree_node> & out) :
subtype_(subtype), out_(out)
{ }
@@ -153,9 +153,9 @@ void filter_elements_fun::operator()(isaac::math_expression const & math_express
}
std::vector<lhs_rhs_element> filter_elements(node_type subtype, isaac::math_expression const & math_expression)
std::vector<tree_node> filter_elements(node_type subtype, isaac::math_expression const & math_expression)
{
std::vector<lhs_rhs_element> res;
std::vector<tree_node> res;
traverse(math_expression, math_expression.root(), filter_elements_fun(subtype, res), true);
return res;
}
@@ -415,7 +415,7 @@ void math_expression_representation_functor::append_id(char * & ptr, unsigned in
// append_id(ptr_, binder_.get(h, is_assigned));
//}
void math_expression_representation_functor::append(lhs_rhs_element const & lhs_rhs, bool is_assigned) const
void math_expression_representation_functor::append(tree_node const & lhs_rhs, bool is_assigned) const
{
if(lhs_rhs.subtype==DENSE_ARRAY_TYPE)
{

View File

@@ -79,7 +79,7 @@ public:
}
}
void set_arguments(lhs_rhs_element const & lhs_rhs, bool is_assigned) const
void set_arguments(tree_node const & lhs_rhs, bool is_assigned) const
{
switch(lhs_rhs.subtype)
{

View File

@@ -42,7 +42,7 @@ class map_functor : public traversal_functor
return std::shared_ptr<mapped_object>(new mapped_array(dtype, id, type));
}
std::shared_ptr<mapped_object> create(lhs_rhs_element const & lhs_rhs, bool is_assigned = false) const
std::shared_ptr<mapped_object> create(tree_node const & lhs_rhs, bool is_assigned = false) const
{
switch(lhs_rhs.subtype)
{

View File

@@ -13,7 +13,7 @@ namespace isaac
namespace detail
{
typedef std::vector<std::pair<expression_type, lhs_rhs_element*> > breakpoints_t;
typedef std::vector<std::pair<expression_type, tree_node*> > breakpoints_t;
inline bool is_mmprod(expression_type x)

View File

@@ -8,41 +8,41 @@
namespace isaac
{
void fill(lhs_rhs_element &x, invalid_node)
void fill(tree_node &x, invalid_node)
{
x.subtype = INVALID_SUBTYPE;
x.dtype = INVALID_NUMERIC_TYPE;
}
void fill(lhs_rhs_element & x, std::size_t node_index)
void fill(tree_node & x, std::size_t node_index)
{
x.subtype = COMPOSITE_OPERATOR_TYPE;
x.dtype = INVALID_NUMERIC_TYPE;
x.node_index = node_index;
}
void fill(lhs_rhs_element & x, for_idx_t index)
void fill(tree_node & x, for_idx_t index)
{
x.subtype = FOR_LOOP_INDEX_TYPE;
x.dtype = INVALID_NUMERIC_TYPE;
x.for_idx = index;
}
void fill(lhs_rhs_element & x, array_base const & a)
void fill(tree_node & x, array_base const & a)
{
x.subtype = DENSE_ARRAY_TYPE;
x.dtype = a.dtype();
x.array = (array_base*)&a;
}
void fill(lhs_rhs_element & x, value_scalar const & v)
void fill(tree_node & x, value_scalar const & v)
{
x.dtype = v.dtype();
x.subtype = VALUE_SCALAR_TYPE;
x.vscalar = v.values();
}
lhs_rhs_element::lhs_rhs_element(){}
tree_node::tree_node(){}
//
op_element::op_element() {}

View File

@@ -21,7 +21,7 @@ inline std::string to_string(node_type const & f)
}
}
inline std::string to_string(lhs_rhs_element const & e)
inline std::string to_string(tree_node const & e)
{
if(e.subtype==COMPOSITE_OPERATOR_TYPE)
{

View File

@@ -48,7 +48,7 @@ void matrix_product::handle_node(math_expression::container_type const & tree, s
matrix_product::args matrix_product::check(math_expression::container_type const & tree, size_t rootidx)
{
lhs_rhs_element const * assigned = &tree[rootidx].lhs;
tree_node const * assigned = &tree[rootidx].lhs;
numeric_type dtype = assigned->dtype;
matrix_product::args result ;
if(dtype==INVALID_NUMERIC_TYPE)