souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Protected Attributes
souffle::ram::SubroutineReturn Class Reference

A statement for returning from a ram subroutine. More...

#include <SubroutineReturn.h>

Inheritance diagram for souffle::ram::SubroutineReturn:
Inheritance graph
Collaboration diagram for souffle::ram::SubroutineReturn:
Collaboration graph

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
SubroutineReturnclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
std::vector< Expression * > getValues () const
 Getter for expressions. More...
 
 SubroutineReturn (VecOwn< Expression > vals)
 
- Public Member Functions inherited from souffle::ram::Node
bool operator!= (const Node &other) const
 Inequality check for two RAM nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two RAM nodes. More...
 
virtual void rewrite (const Node *oldNode, Own< Node > newNode)
 Rewrite a child node. More...
 
virtual ~Node ()=default
 

Protected Member Functions

bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::Operation
void print (std::ostream &os) const override
 Print RAM node. More...
 

Protected Attributes

VecOwn< Expressionexpressions
 Return expressions. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Operation
static void print (const Operation *operation, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 

Detailed Description

A statement for returning from a ram subroutine.

For example:

...
RETURN (t0.0, t0.1)

Definition at line 46 of file SubroutineReturn.h.

Constructor & Destructor Documentation

◆ SubroutineReturn()

souffle::ram::SubroutineReturn::SubroutineReturn ( VecOwn< Expression vals)
inline

Definition at line 48 of file SubroutineReturn.h.

51  {
52  return toPtrVector(expressions);

Member Function Documentation

◆ apply()

void souffle::ram::SubroutineReturn::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 75 of file SubroutineReturn.h.

77  :
78  void print(std::ostream& os, int tabpos) const override {
79  os << times(" ", tabpos);

◆ clone()

SubroutineReturn* souffle::ram::SubroutineReturn::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Operation.

Definition at line 67 of file SubroutineReturn.h.

71  {
72  for (auto& expr : expressions) {
73  expr = map(std::move(expr));

◆ equal()

bool souffle::ram::SubroutineReturn::equal ( const Node ) const
inlineoverrideprotectedvirtual

Equality check for two RAM nodes.

Default action is that nothing needs to be checked.

Reimplemented from souffle::ram::Node.

Definition at line 94 of file SubroutineReturn.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ram::SubroutineReturn::getChildNodes ( ) const
inlineoverridevirtual

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 59 of file SubroutineReturn.h.

63  {
64  VecOwn<Expression> newValues;
65  for (auto& expr : expressions) {

◆ getValues()

std::vector<Expression*> souffle::ram::SubroutineReturn::getValues ( ) const
inline

Getter for expressions.

Definition at line 55 of file SubroutineReturn.h.

55  {
56  std::vector<const Node*> res;
57  for (const auto& expr : expressions) {

References expressions.

◆ print()

void souffle::ram::SubroutineReturn::print ( std::ostream &  os,
int  tabpos 
) const
inlineoverrideprotectedvirtual

Pretty print with indentation.

Implements souffle::ram::Operation.

Definition at line 82 of file SubroutineReturn.h.

83  {
84  os << ", ";
85  }
86  }
87  os << ")" << std::endl;
88  }
89 
90  bool equal(const Node& node) const override {
91  const auto& other = static_cast<const SubroutineReturn&>(node);
92  return equal_targets(expressions, other.expressions);

Field Documentation

◆ expressions

VecOwn<Expression> souffle::ram::SubroutineReturn::expressions
protected

Return expressions.

Definition at line 100 of file SubroutineReturn.h.

Referenced by getValues().


The documentation for this class was generated from the following file:
souffle::ram::SubroutineReturn::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: SubroutineReturn.h:82
souffle::ram::SubroutineReturn::expressions
VecOwn< Expression > expressions
Return expressions.
Definition: SubroutineReturn.h:100
souffle::ram::SubroutineReturn::SubroutineReturn
SubroutineReturn(VecOwn< Expression > vals)
Definition: SubroutineReturn.h:48
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
souffle::equal_targets
bool equal_targets(const Container &a, const Container &b, const Comparator &comp)
A function testing whether two containers are equal with the given Comparator.
Definition: ContainerUtil.h:433
souffle::ram::SubroutineReturn::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: SubroutineReturn.h:94
souffle::toPtrVector
std::vector< T * > toPtrVector(const std::vector< std::unique_ptr< T >> &v)
A utility function enabling the creation of a vector of pointers.
Definition: ContainerUtil.h:146