Jlm
operation.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Helge Bahmann <hcb@chaoticmind.net>
3  * Copyright 2011 2012 2014 Nico Reißmann <nico.reissmann@gmail.com>
4  * See COPYING for terms of redistribution.
5  */
6 
7 #include <jlm/rvsdg/graph.hpp>
8 
9 namespace jlm::rvsdg
10 {
11 
12 Operation::~Operation() noexcept = default;
13 
14 SimpleOperation::~SimpleOperation() noexcept = default;
15 
16 size_t
17 SimpleOperation::narguments() const noexcept
18 {
19  return operands_.size();
20 }
21 
22 const std::shared_ptr<const rvsdg::Type> &
23 SimpleOperation::argument(size_t index) const noexcept
24 {
25  JLM_ASSERT(index < narguments());
26  return operands_[index];
27 }
28 
29 size_t
30 SimpleOperation::nresults() const noexcept
31 {
32  return results_.size();
33 }
34 
35 const std::shared_ptr<const rvsdg::Type> &
36 SimpleOperation::result(size_t index) const noexcept
37 {
38  JLM_ASSERT(index < nresults());
39  return results_[index];
40 }
41 
42 bool
43 StructuralOperation::operator==(const Operation & other) const noexcept
44 {
45  return typeid(*this) == typeid(other);
46 }
47 
48 }
virtual ~Operation() noexcept
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
Definition: operation.cpp:23
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
Definition: operation.cpp:36
size_t nresults() const noexcept
Definition: operation.cpp:30
std::vector< std::shared_ptr< const rvsdg::Type > > results_
Definition: operation.hpp:82
bool operator==(const Operation &other) const noexcept override
Definition: operation.cpp:43
#define JLM_ASSERT(x)
Definition: common.hpp:16