CGRA-ME
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
OpGraph.h File Reference
#include <CGRA/MRRG.h>
#include <CGRA/BitSetting.h>
#include <iosfwd>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  OpGraphNode
 
class  OpGraphOp
 
class  OpGraphVal
 
class  OpGraph
 
struct  OpGraph::EdgeDescriptor
 
struct  OpGraph::OpOpInsertResult
 
struct  OpGraph::VerifyMessage
 
struct  OpSchedule
 
struct  OpGraphTransformResult
 

Namespaces

 Operands
 

Typedefs

using OpGraphOpCode = signed char OpCode
 
using OperandTag = std::string
 

Enumerations

enum  OpCode : signed char {
  OpCode::NOP = -1, OpCode::SEXT = 1, OpCode::ZEXT, OpCode::TRUNC,
  OpCode::INPUT, OpCode::INPUT_PRED, OpCode::OUTPUT_PRED, OpCode::OUTPUT,
  OpCode::PHI, OpCode::CONST, OpCode::ADD, OpCode::SUB,
  OpCode::MUL, OpCode::DIV, OpCode::AND, OpCode::OR,
  OpCode::XOR, OpCode::SHL, OpCode::ASHR, OpCode::LSHR,
  OpCode::LOAD, OpCode::STORE, OpCode::GEP, OpCode::ICMP,
  OpCode::CMP, OpCode::BR, OpCode::SQRT, OpCode::FADD,
  OpCode::FMUL, OpCode::FDIV, OpCode::FP2INT, OpCode::INT2FP,
  OpCode::MULU_FULL_LO, OpCode::MULU_HALF_LO, OpCode::MULU_QUART_LO, OpCode::MULU_FULL_HI,
  OpCode::MULU_HALF_HI, OpCode::MULU_QUART_HI, OpCode::MULS_FULL_LO, OpCode::MULS_HALF_LO,
  OpCode::MULS_QUART_LO, OpCode::MULS_FULL_HI, OpCode::MULS_HALF_HI, OpCode::MULS_QUART_HI,
  OpCode::ADD_FULL, OpCode::ADD_HALF, OpCode::ADD_QUART, OpCode::SELECT
}
 
enum  EdgeKind { EdgeKind::kDataFlow, EdgeKind::kAlias }
 

Functions

std::ostream & operator<< (std::ostream &os, const OpGraphOpCode &opcode)
 
const std::string & to_string (const OpGraphOpCode &opcode)
 
OpGraphOpCode opcode_from_string (const std::string &s)
 
std::istream & operator>> (std::istream &is, OpGraphOpCode &opcode)
 
auto operator+ (const OpCode &oc)
 
bool verifyAndPrintReport (const OpGraph &opgraph, std::ostream &os, bool silent_on_no_errors, bool throw_if_errors)
 
bool analyzeOpgraphVerifyResults (std::ostream &os, const std::vector< OpGraph::VerifyMessage > &messages, const bool silent_on_no_errors)
 
OpSchedule computeASAP (const OpGraph &op_graph)
 
OpSchedule computeALAP (const OpGraph &op_graph, unsigned int max_cycles)
 
OpGraphTransformResult filter (const OpGraph &src, const std::set< OpGraph::OpDescriptor > &allowed_ops)
 
std::set< OpGraph::OpDescriptorfindNDownstreamOps (const OpGraph &opgraph, const std::vector< OpGraphOp * > &starting_points, const std::ptrdiff_t n_ops)
 
std::ostream & operator<< (std::ostream &os, const OpGraph::VerifyMessage::Type &vm_type)
 
char operator+ (const OpGraph::VerifyMessage::Type &vm_type)
 
bool operator< (const OpGraph::EdgeDescriptor &lhs, const OpGraph::EdgeDescriptor &rhs)
 
bool operator== (const OpGraph::EdgeDescriptor &lhs, const OpGraph::EdgeDescriptor &rhs)
 

Variables

static constexpr auto & Operands::UNTAGGED = ""
 
static constexpr auto & Operands::PREDICATE = "pred"
 
static constexpr auto & Operands::BINARY_LHS = "LHS"
 
static constexpr auto & Operands::BINARY_RHS = "RHS"
 
static constexpr auto & Operands::BINARY_ANY = "any2input"
 
static constexpr auto & Operands::TERNARY_ANY = "any3input"
 
static constexpr auto & Operands::MEM_ADDR = "addr"
 
static constexpr auto & Operands::MEM_DATA = "data"
 
static constexpr auto & Operands::BR_TRUE = "branch_true"
 
static constexpr auto & Operands::BR_FALSE = "branch_false"
 

Typedef Documentation

◆ OperandTag

using OperandTag = std::string

Definition at line 81 of file OpGraph.h.

◆ OpGraphOpCode

using OpGraphOpCode = signed char OpCode
strong

Definition at line 15 of file OpGraph.h.

Enumeration Type Documentation

◆ EdgeKind

enum EdgeKind
strong
Enumerator
kDataFlow 
kAlias 

Definition at line 99 of file OpGraph.h.

◆ OpCode

enum OpCode : signed char
strong
Enumerator
NOP 
SEXT 
ZEXT 
TRUNC 
INPUT 
INPUT_PRED 
OUTPUT_PRED 
OUTPUT 
PHI 
CONST 
ADD 
SUB 
MUL 
DIV 
AND 
OR 
XOR 
SHL 
ASHR 
LSHR 
LOAD 
STORE 
GEP 
ICMP 
CMP 
BR 
SQRT 
FADD 
FMUL 
FDIV 
FP2INT 
INT2FP 
MULU_FULL_LO 
MULU_HALF_LO 
MULU_QUART_LO 
MULU_FULL_HI 
MULU_HALF_HI 
MULU_QUART_HI 
MULS_FULL_LO 
MULS_HALF_LO 
MULS_QUART_LO 
MULS_FULL_HI 
MULS_HALF_HI 
MULS_QUART_HI 
ADD_FULL 
ADD_HALF 
ADD_QUART 
SELECT 

Definition at line 29 of file OpGraph.h.

Function Documentation

◆ analyzeOpgraphVerifyResults()

bool analyzeOpgraphVerifyResults ( std::ostream &  os,
const std::vector< OpGraph::VerifyMessage > &  messages,
const bool  silent_on_no_errors 
)

A helper for the verifyAndPrintReport function

Definition at line 800 of file OpGraph.cpp.

◆ computeALAP()

OpSchedule computeALAP ( const OpGraph op_graph,
unsigned int  max_cycles 
)

Definition at line 629 of file OpGraph.cpp.

◆ computeASAP()

OpSchedule computeASAP ( const OpGraph op_graph)

Definition at line 572 of file OpGraph.cpp.

◆ filter()

OpGraphTransformResult filter ( const OpGraph src,
const std::set< OpGraph::OpDescriptor > &  allowed_ops 
)

Return a new graph with only the allowed_ops present

Definition at line 1212 of file OpGraph.cpp.

◆ findNDownstreamOps()

std::set<OpGraph::OpDescriptor> findNDownstreamOps ( const OpGraph opgraph,
const std::vector< OpGraphOp * > &  starting_points,
const std::ptrdiff_t  n_ops 
)

Starting from starting_points, does a fanout BFS to find at least the given number of ops, including the starting points. If this function must return an op to find enough ops, then it will return all ops at that distance from the starting points. This way, it is independent of OpGraph's implementation details.

Definition at line 1246 of file OpGraph.cpp.

◆ opcode_from_string()

OpGraphOpCode opcode_from_string ( const std::string &  s)

Definition at line 113 of file OpGraph.cpp.

◆ operator+() [1/2]

auto operator+ ( const OpCode oc)
inline

Definition at line 108 of file OpGraph.h.

◆ operator+() [2/2]

char operator+ ( const OpGraph::VerifyMessage::Type vm_type)
inline

Definition at line 531 of file OpGraph.h.

◆ operator<()

bool operator< ( const OpGraph::EdgeDescriptor lhs,
const OpGraph::EdgeDescriptor rhs 
)
inline

Definition at line 533 of file OpGraph.h.

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  os,
const OpGraph::VerifyMessage::Type vm_type 
)
inline

Definition at line 1282 of file OpGraph.cpp.

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  os,
const OpGraphOpCode opcode 
)

Definition at line 100 of file OpGraph.cpp.

◆ operator==()

bool operator== ( const OpGraph::EdgeDescriptor lhs,
const OpGraph::EdgeDescriptor rhs 
)
inline

Definition at line 536 of file OpGraph.h.

◆ operator>>()

std::istream& operator>> ( std::istream &  is,
OpGraphOpCode opcode 
)

Definition at line 140 of file OpGraph.cpp.

◆ to_string()

const std::string& to_string ( const OpGraphOpCode opcode)

Definition at line 111 of file OpGraph.cpp.

◆ verifyAndPrintReport()

bool verifyAndPrintReport ( const OpGraph opgraph,
std::ostream &  os,
bool  silent_on_no_errors,
bool  throw_if_errors 
)

A routine for verifying the OpGraph. Prints out a success message, unless told not to. Can throw if errors are found. Returns true if no errors found

Definition at line 790 of file OpGraph.cpp.