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

s/operand/operation/

parent 5c48f17f
#ifndef RTG_GUARD_BUILTIN_HPP
#define RTG_GUARD_BUILTIN_HPP
#include <rtg/operand.hpp>
#include <rtg/operation.hpp>
#include <rtg/errors.hpp>
namespace rtg {
......
......@@ -12,14 +12,14 @@ struct 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))
{
}
instruction(literal l) : op(builtin::literal{}), result(l.get_shape()), lit(std::move(l)) {}
operand op;
operation op;
shape result;
std::vector<instruction*> arguments;
literal lit;
......
......@@ -14,7 +14,7 @@ namespace rtg {
/*
* Type-erased interface for:
*
* struct operand
* struct operation
* {
* std::string name() const;
* shape compute_shape(std::vector<shape> input) const;
......@@ -23,13 +23,13 @@ namespace rtg {
*
*/
struct operand
struct operation
{
// Constructors
operand() = default;
operation() = default;
template <typename PrivateDetailTypeErasedT>
operand(PrivateDetailTypeErasedT value)
operation(PrivateDetailTypeErasedT value)
: private_detail_te_handle_mem_var(
std::make_shared<private_detail_te_handle_type<
typename std::remove_reference<PrivateDetailTypeErasedT>::type>>(
......@@ -39,7 +39,7 @@ struct operand
// Assignment
template <typename PrivateDetailTypeErasedT>
operand& operator=(PrivateDetailTypeErasedT value)
operation& operator=(PrivateDetailTypeErasedT value)
{
if(private_detail_te_handle_mem_var.unique())
*private_detail_te_handle_mem_var = std::forward<PrivateDetailTypeErasedT>(value);
......
#ifndef RTG_GUARD_OPERATORS_HPP
#define RTG_GUARD_OPERATORS_HPP
#include <rtg/operand.hpp>
#include <rtg/operation.hpp>
#include <rtg/stringutils.hpp>
#include <cmath>
......
......@@ -4,7 +4,7 @@
#include <list>
#include <unordered_map>
#include <rtg/instruction.hpp>
#include <rtg/operand.hpp>
#include <rtg/operation.hpp>
#include <rtg/builtin.hpp>
#include <algorithm>
......@@ -18,13 +18,13 @@ struct program
program& operator=(const program&) = delete;
template <class... Ts>
instruction* add_instruction(operand op, Ts*... args)
instruction* add_instruction(operation op, Ts*... args)
{
shape r = op.compute_shape({args->result...});
instructions.push_back({op, r, {args...}});
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(
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