FAUST compiler  0.9.9.6b8
Public Member Functions | Private Attributes | List of all members
Node Class Reference

Class Node = (type x (int + double + Sym + void*)) More...

#include <node.hh>

Collaboration diagram for Node:
Collaboration graph
[legend]

Public Member Functions

 Node (int x)
 
 Node (double x)
 
 Node (const char *name)
 
 Node (const string &name)
 
 Node (Sym x)
 
 Node (void *x)
 
 Node (const Node &n)
 
bool operator== (const Node &n) const
 
bool operator!= (const Node &n) const
 
int type () const
 
int getInt () const
 
double getDouble () const
 
Sym getSym () const
 
void * getPointer () const
 
 operator int () const
 
 operator double () const
 
ostream & print (ostream &fout) const
 print a node on a stream More...
 

Private Attributes

int fType
 
union {
   int   i
 
   double   f
 
   Sym   s
 
   void *   p
 
   int64_t   v
 
fData
 

Detailed Description

Class Node = (type x (int + double + Sym + void*))

Definition at line 75 of file node.hh.

Constructor & Destructor Documentation

Node::Node ( int  x)
inline

Definition at line 88 of file node.hh.

88 : fType(kIntNode) { fData.f = 0; fData.i = x; }
union Node::@10 fData
Definition: node.hh:69
int fType
Definition: node.hh:77
Node::Node ( double  x)
inline

Definition at line 89 of file node.hh.

89 : fType(kDoubleNode) { fData.f = x; }
union Node::@10 fData
int fType
Definition: node.hh:77
Node::Node ( const char *  name)
inline

Definition at line 90 of file node.hh.

References symbol().

90 : fType(kSymNode) { fData.f = 0; fData.s = symbol(name); }
union Node::@10 fData
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
int fType
Definition: node.hh:77
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
Definition: symbol.hh:95
Definition: node.hh:69

Here is the call graph for this function:

Node::Node ( const string &  name)
inline

Definition at line 91 of file node.hh.

References symbol().

91 : fType(kSymNode) { fData.f = 0; fData.s = symbol(name); }
union Node::@10 fData
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
int fType
Definition: node.hh:77
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
Definition: symbol.hh:95
Definition: node.hh:69

Here is the call graph for this function:

Node::Node ( Sym  x)
inline

Definition at line 92 of file node.hh.

92 : fType(kSymNode) { fData.f = 0; fData.s = x; }
union Node::@10 fData
int fType
Definition: node.hh:77
Definition: node.hh:69
Node::Node ( void *  x)
inline

Definition at line 93 of file node.hh.

93 : fType(kPointerNode) { fData.f = 0; fData.p = x; }
union Node::@10 fData
int fType
Definition: node.hh:77
Node::Node ( const Node n)
inline

Definition at line 95 of file node.hh.

References fData.

95 : fType(n.fType) { fData = n.fData; }
union Node::@10 fData
int fType
Definition: node.hh:77

Member Function Documentation

double Node::getDouble ( ) const
inline

Definition at line 105 of file node.hh.

Referenced by property< double >::get(), isDouble(), isGEZero(), isGTZero(), isMinusOne(), isOne(), and isZero().

105 { return fData.f; }
union Node::@10 fData

Here is the caller graph for this function:

int Node::getInt ( ) const
inline
void* Node::getPointer ( ) const
inline

Definition at line 107 of file node.hh.

Referenced by property< Loop * >::access(), and isPointer().

107 { return fData.p; }
union Node::@10 fData

Here is the caller graph for this function:

Sym Node::getSym ( ) const
inline

Definition at line 106 of file node.hh.

Referenced by isSym(), merge_trans_op(), and Trans::operator<().

106 { return fData.s; }
union Node::@10 fData

Here is the caller graph for this function:

Node::operator double ( ) const
inline

Definition at line 111 of file node.hh.

References kDoubleNode, and kIntNode.

111 { return (fType == kIntNode) ? double(fData.i) : (fType == kDoubleNode) ? fData.f : 0.0 ; }
double f
Definition: node.hh:80
union Node::@10 fData
Definition: node.hh:69
int fType
Definition: node.hh:77
Node::operator int ( ) const
inline

Definition at line 110 of file node.hh.

References kDoubleNode, and kIntNode.

110 { return (fType == kIntNode) ? fData.i : (fType == kDoubleNode) ? int(fData.f) : 0 ; }
union Node::@10 fData
Definition: node.hh:69
int fType
Definition: node.hh:77
bool Node::operator!= ( const Node n) const
inline

Definition at line 99 of file node.hh.

References fData, fType, and v.

99 { return fType != n.fType || fData.v != n.fData.v; }
union Node::@10 fData
int64_t v
Definition: node.hh:83
int fType
Definition: node.hh:77
bool Node::operator== ( const Node n) const
inline

Definition at line 98 of file node.hh.

References fData, fType, and v.

98 { return fType == n.fType && fData.v == n.fData.v; }
union Node::@10 fData
int64_t v
Definition: node.hh:83
int fType
Definition: node.hh:77
ostream & Node::print ( ostream &  fout) const

print a node on a stream

< print a node on a stream

Definition at line 3 of file node.cpp.

References kDoubleNode, kIntNode, kPointerNode, and kSymNode.

Referenced by operator<<().

4 {
5  switch (fType) {
6  case kIntNode : return fout << fData.i;
7  case kDoubleNode : return fout << fData.f;
8  case kSymNode : return fout << *(fData.s);
9  case kPointerNode : return fout << "ptr:" << fData.p;
10  default : return fout << "badnode";
11  }
12 
13 // return fout;
14 }
union Node::@10 fData
Definition: node.hh:69
int fType
Definition: node.hh:77
Definition: node.hh:69

Here is the caller graph for this function:

int Node::type ( ) const
inline

Definition at line 102 of file node.hh.

Referenced by CTree::calcTreeHash(), isDouble(), isGEZero(), isGTZero(), isInt(), isMinusOne(), isOne(), isPointer(), isSym(), and isZero().

102 { return fType; }
int fType
Definition: node.hh:77

Here is the caller graph for this function:

Member Data Documentation

double Node::f

Definition at line 80 of file node.hh.

union { ... } Node::fData

Referenced by Node(), operator!=(), and operator==().

int Node::fType
private

Definition at line 77 of file node.hh.

Referenced by operator!=(), and operator==().

int Node::i

Definition at line 79 of file node.hh.

void* Node::p

Definition at line 82 of file node.hh.

Sym Node::s

Definition at line 81 of file node.hh.

int64_t Node::v

Definition at line 83 of file node.hh.

Referenced by operator!=(), and operator==().


The documentation for this class was generated from the following files: