Commit 87446fc4 authored by Paul's avatar Paul
Browse files

s/operand/operation/

parent 5c48f17f
#ifndef RTG_GUARD_BUILTIN_HPP #ifndef RTG_GUARD_BUILTIN_HPP
#define RTG_GUARD_BUILTIN_HPP #define RTG_GUARD_BUILTIN_HPP
#include <rtg/operand.hpp> #include <rtg/operation.hpp>
#include <rtg/errors.hpp> #include <rtg/errors.hpp>
namespace rtg { namespace rtg {
......
...@@ -12,14 +12,14 @@ struct instruction ...@@ -12,14 +12,14 @@ struct instruction
{ {
instruction() {} instruction() {}
instruction(operand o, shape r, std::vector<instruction*> args) instruction(operation o, shape r, std::vector<instruction*> args)
: op(std::move(o)), result(std::move(r)), arguments(std::move(args)) : op(std::move(o)), result(std::move(r)), arguments(std::move(args))
{ {
} }
instruction(literal l) : op(builtin::literal{}), result(l.get_shape()), lit(std::move(l)) {} instruction(literal l) : op(builtin::literal{}), result(l.get_shape()), lit(std::move(l)) {}
operand op; operation op;
shape result; shape result;
std::vector<instruction*> arguments; std::vector<instruction*> arguments;
literal lit; literal lit;
......
...@@ -14,7 +14,7 @@ namespace rtg { ...@@ -14,7 +14,7 @@ namespace rtg {
/* /*
* Type-erased interface for: * Type-erased interface for:
* *
* struct operand * struct operation
* { * {
* std::string name() const; * std::string name() const;
* shape compute_shape(std::vector<shape> input) const; * shape compute_shape(std::vector<shape> input) const;
...@@ -23,13 +23,13 @@ namespace rtg { ...@@ -23,13 +23,13 @@ namespace rtg {
* *
*/ */
struct operand struct operation
{ {
// Constructors // Constructors
operand() = default; operation() = default;
template <typename PrivateDetailTypeErasedT> template <typename PrivateDetailTypeErasedT>
operand(PrivateDetailTypeErasedT value) operation(PrivateDetailTypeErasedT value)
: private_detail_te_handle_mem_var( : private_detail_te_handle_mem_var(
std::make_shared<private_detail_te_handle_type< std::make_shared<private_detail_te_handle_type<
typename std::remove_reference<PrivateDetailTypeErasedT>::type>>( typename std::remove_reference<PrivateDetailTypeErasedT>::type>>(
...@@ -39,7 +39,7 @@ struct operand ...@@ -39,7 +39,7 @@ struct operand
// Assignment // Assignment
template <typename PrivateDetailTypeErasedT> template <typename PrivateDetailTypeErasedT>
operand& operator=(PrivateDetailTypeErasedT value) operation& operator=(PrivateDetailTypeErasedT value)
{ {
if(private_detail_te_handle_mem_var.unique()) if(private_detail_te_handle_mem_var.unique())
*private_detail_te_handle_mem_var = std::forward<PrivateDetailTypeErasedT>(value); *private_detail_te_handle_mem_var = std::forward<PrivateDetailTypeErasedT>(value);
......
#ifndef RTG_GUARD_OPERATORS_HPP #ifndef RTG_GUARD_OPERATORS_HPP
#define RTG_GUARD_OPERATORS_HPP #define RTG_GUARD_OPERATORS_HPP
#include <rtg/operand.hpp> #include <rtg/operation.hpp>
#include <rtg/stringutils.hpp> #include <rtg/stringutils.hpp>
#include <cmath> #include <cmath>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <list> #include <list>
#include <unordered_map> #include <unordered_map>
#include <rtg/instruction.hpp> #include <rtg/instruction.hpp>
#include <rtg/operand.hpp> #include <rtg/operation.hpp>
#include <rtg/builtin.hpp> #include <rtg/builtin.hpp>
#include <algorithm> #include <algorithm>
...@@ -18,13 +18,13 @@ struct program ...@@ -18,13 +18,13 @@ struct program
program& operator=(const program&) = delete; program& operator=(const program&) = delete;
template <class... Ts> template <class... Ts>
instruction* add_instruction(operand op, Ts*... args) instruction* add_instruction(operation op, Ts*... args)
{ {
shape r = op.compute_shape({args->result...}); shape r = op.compute_shape({args->result...});
instructions.push_back({op, r, {args...}}); instructions.push_back({op, r, {args...}});
return std::addressof(instructions.back()); return std::addressof(instructions.back());
} }
instruction* add_instruction(operand op, std::vector<instruction*> args) instruction* add_instruction(operation op, std::vector<instruction*> args)
{ {
assert(std::all_of( assert(std::all_of(
args.begin(), args.end(), [&](instruction* x) { return has_instruction(x); }) && args.begin(), args.end(), [&](instruction* x) { return has_instruction(x); }) &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment