OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
MIDDGNode Struct Reference

#include <MachineInstrDDG.hh>

Inheritance diagram for MIDDGNode:
Inheritance graph
Collaboration diagram for MIDDGNode:
Collaboration graph

Public Member Functions

 MIDDGNode ()
 
 MIDDGNode (const llvm::MachineInstr &mi, int sequentialAddress)
 
virtual ~MIDDGNode ()
 
bool operator< (const MIDDGNode &other) const
 
bool operator== (const MIDDGNode &other) const
 
const llvm::MachineInstr * machineInstr () const
 
int sequentialAddress () const
 
std::string dotString () const
 
TCEString osalOperationName () const
 
void setOptimalCycle (int cycle)
 
int optimalCycle () const
 
- Public Member Functions inherited from GraphNode
 GraphNode (int nodeID)
 
 GraphNode ()
 
virtual ~GraphNode ()
 
virtual GraphNodeclone () const
 
int nodeID () const
 
virtual std::string toString () const
 

Private Attributes

const llvm::MachineInstr * mi_
 
int address_
 
int optimalCycle_
 

Detailed Description

Definition at line 58 of file MachineInstrDDG.hh.

Constructor & Destructor Documentation

◆ MIDDGNode() [1/2]

MIDDGNode::MIDDGNode ( )
inline

Definition at line 59 of file MachineInstrDDG.hh.

59 : GraphNode(), mi_(NULL), address_(-1), optimalCycle_(-1) {}

◆ MIDDGNode() [2/2]

MIDDGNode::MIDDGNode ( const llvm::MachineInstr &  mi,
int  sequentialAddress 
)
inline

Definition at line 60 of file MachineInstrDDG.hh.

60  :

◆ ~MIDDGNode()

virtual MIDDGNode::~MIDDGNode ( )
inlinevirtual

Definition at line 63 of file MachineInstrDDG.hh.

63 {}

Member Function Documentation

◆ dotString()

std::string MIDDGNode::dotString ( ) const
virtual

Returns the string that should be placed in the node's properties section in the GraphViz Dot string.

This can be overridden in the derived class to add different properties (e.g., colors, etc.) to different type of nodes. The default implementation only sets the label property.

Returns
String describing the Dot properties of the Node.

Reimplemented from GraphNode.

Definition at line 606 of file MachineInstrDDG.cc.

606  {
607  return (boost::format("label=\"%s\"") % osalOperationName()).str();
608 }

References osalOperationName().

Referenced by MachineInstrDDG::dotString().

Here is the call graph for this function:

◆ machineInstr()

const llvm::MachineInstr* MIDDGNode::machineInstr ( ) const
inline

Definition at line 72 of file MachineInstrDDG.hh.

72 { return mi_; }

References mi_.

Referenced by osalOperationName(), and MachineInstrDDG::preceedingNodeUsesOrDefinesReg().

◆ operator<()

bool MIDDGNode::operator< ( const MIDDGNode other) const
inline

Definition at line 65 of file MachineInstrDDG.hh.

65  {
66  return other.sequentialAddress() < this->sequentialAddress();
67  }

References sequentialAddress().

Here is the call graph for this function:

◆ operator==()

bool MIDDGNode::operator== ( const MIDDGNode other) const
inline

Definition at line 68 of file MachineInstrDDG.hh.

68  {
69  return other.mi_ == this->mi_;
70  }

References mi_.

◆ optimalCycle()

int MIDDGNode::optimalCycle ( ) const
inline

Definition at line 79 of file MachineInstrDDG.hh.

79 { return optimalCycle_; }

References optimalCycle_.

Referenced by MachineInstrDDG::dotString().

◆ osalOperationName()

TCEString MIDDGNode::osalOperationName ( ) const

Try to figure out the name of the instruction opcode in OSAL, if available.

If the operation with the produced name is not found in OSAL, llvm: is prepended to the name string.

Definition at line 566 of file MachineInstrDDG.cc.

566  {
567  const llvm::TargetInstrInfo *TII =
568  machineInstr()->getParent()->getParent()->getTarget().
569  getSubtargetImpl(
570  machineInstr()->getParent()->getParent()->getFunction())->
571  getInstrInfo();
572  // If it's a custom operation call, try to figure out
573  // the called operation name and use it instead as the
574  // node label.
575  TCEString opName;
576  if (mi_->isInlineAsm()) {
577  unsigned numDefs = 0;
578  while (mi_->getOperand(numDefs).isReg() &&
579  mi_->getOperand(numDefs).isDef())
580  ++numDefs;
581  opName = mi_->getOperand(numDefs).getSymbolName();
582  } else {
583  opName = TII->getName(mi_->getOpcode()).str();
584  }
585 
586  // Clean up the operand type string encoded as
587  // lower case letter at the end of the string.
588  TCEString upper = opName.upper();
589  TCEString cleaned;
590  for (size_t i = 0; i < opName.size(); ++i) {
591  if (upper[i] == opName[i])
592  cleaned += opName[i];
593  else
594  break;
595  }
596 
597  OperationPool ops;
598  Operation& operation = ops.operation(cleaned.c_str());
599  if (operation.isNull())
600  return TCEString("llvm:") + opName;
601 
602  return cleaned;
603 }

References Operation::isNull(), machineInstr(), mi_, OperationPool::operation(), and TCEString::upper().

Referenced by dotString(), and MachineInstrDDG::dotString().

Here is the call graph for this function:

◆ sequentialAddress()

int MIDDGNode::sequentialAddress ( ) const
inline

◆ setOptimalCycle()

void MIDDGNode::setOptimalCycle ( int  cycle)
inline

Definition at line 78 of file MachineInstrDDG.hh.

78 { optimalCycle_ = cycle; }

References optimalCycle_.

Referenced by MachineInstrDDG::computeOptimalSchedule().

Member Data Documentation

◆ address_

int MIDDGNode::address_
private

Definition at line 82 of file MachineInstrDDG.hh.

Referenced by sequentialAddress().

◆ mi_

const llvm::MachineInstr* MIDDGNode::mi_
private

Definition at line 81 of file MachineInstrDDG.hh.

Referenced by machineInstr(), operator==(), and osalOperationName().

◆ optimalCycle_

int MIDDGNode::optimalCycle_
private

Definition at line 83 of file MachineInstrDDG.hh.

Referenced by optimalCycle(), and setOptimalCycle().


The documentation for this struct was generated from the following files:
MIDDGNode::osalOperationName
TCEString osalOperationName() const
Definition: MachineInstrDDG.cc:566
OperationPool::operation
Operation & operation(const char *name)
Definition: OperationPool.cc:99
MIDDGNode::mi_
const llvm::MachineInstr * mi_
Definition: MachineInstrDDG.hh:81
MIDDGNode::optimalCycle_
int optimalCycle_
Definition: MachineInstrDDG.hh:83
MIDDGNode::address_
int address_
Definition: MachineInstrDDG.hh:82
TCEString::upper
TCEString upper() const
Definition: TCEString.cc:86
Operation
Definition: Operation.hh:59
GraphNode::GraphNode
GraphNode()
Definition: GraphNode.cc:37
Operation::isNull
bool isNull() const
TCEString
Definition: TCEString.hh:53
OperationPool
Definition: OperationPool.hh:52
MIDDGNode::sequentialAddress
int sequentialAddress() const
Definition: MachineInstrDDG.hh:73
MIDDGNode::machineInstr
const llvm::MachineInstr * machineInstr() const
Definition: MachineInstrDDG.hh:72