Polaris: FunctionSymbol Class Reference

FunctionSymbol Class Reference

a Symbol of class FUNCTION_CLASS More...

#include <FunctionSymbol.h>

Inheritance diagram for FunctionSymbol:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 FunctionSymbol (const char *name, const Type &type, EXTERNAL_BOOL external, INTRINSIC_BOOL intrinsic, FORMAL_BOOL formal, Statement *entry=0)
 Constructor.
 FunctionSymbol (const FunctionSymbol &fsym)
virtual Symbolclone () const
 Clone constructor -- returns base pointer to a new clone of this Symbol.
virtual Symbolclone_all () const
 Clone constructor -- returns base pointer to a new clone of this Symbol.
FunctionSymboloperator= (const FunctionSymbol &fsym)
virtual ~FunctionSymbol ()
virtual EXTERNAL_BOOL external () const
virtual void external (EXTERNAL_BOOL ourbool)
virtual INTRINSIC_BOOL intrinsic () const
virtual void intrinsic (INTRINSIC_BOOL ourbool)
virtual FORMAL_BOOL formal () const
virtual void formal (FORMAL_BOOL ourbool)
virtual const Statemententry_ref () const
virtual Statemententry_ref ()
virtual void entry (Statement *s)
virtual const Typetype () const
 Returns the type of the symbol, or else returns type VOID_TYPE if the symbol does not use a type (such as a SubroutineSymbol).
virtual void type (const Type &type)
virtual Equivalenceequivalence_ref () const
 Returns 0 if none.
virtual void equivalence (Equivalence &e, int byte_base)
virtual void clear_equivalence ()
virtual int is_entry ()
 Returns 1 if this is an alternate entry.
virtual void print (ostream &o) const
 Print onto stream 'o'.
virtual void fill_in (const BinRep &binstr, ExprTable &exprs, const Dictionary< VoidPtrDef > &stmts, const Dictionary< VoidPtrDef > &commons, const Dictionary< VoidPtrDef > &equivalences)
 Fill in all relevant info from a binstr object.
virtual void exchange_convert (VDL &vdl)
 Convert the Symbol into the exchange format.
int structures_OK () const
 Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.
virtual void relink_dptrs (ProgramUnit &p)
 Change all pointers found in a FunctionSymbol element to point into the given ProgramUnit.

Protected Attributes

Equivalence_equivalence
unsigned _external: 1
unsigned _intrinsic: 1
unsigned _formal: 1
 if both _external and _intrinsic are zero, it is the routine or program itself or an alternate ENTRY
Statement_entry
 == 0 if none
Type _type

Detailed Description

a Symbol of class FUNCTION_CLASS

Polaris C++ VDL

See also:
Symbol.h

Symbol.h

FunctionSymbol.h

Symbol.cc

Description

A FunctionSymbol is a Symbol representing the identifier for a program unit which begins with the Fortran keyword FUNCTION or an alternate entry of it.

The additional fields it adds to Symbol's fields are the entry, equivalence, external, intrinsic, formal and type fields.

The entry field is a pointer to the entry statement for this symbol.

The equivalence field is a pointer to an Equivalence class if this Symbol is associated with any equivalences. (For FunctionSymbol's, this may happen if there is an alternate entry for the function -- essentially, and explicitly in these data structures, the various entry names for a Fortran function are equivalenced -- if any are modified, they all are affected.

The external field indicates whether or not this symbol was declared EXTERNAL.

The intrinsic field indicates whether or not this symbol was recognized as or declared INTRINSIC.

The formal field indicates whether or not this symbol is a formal parameter (i.e. dummy function) of a function or subroutine.

The type field is the type of the return value of this symbol.

The only virtual methods inherited from Symbol which are valid for this class (which will not give errors messages, with the exception of Symbol::is_array()) are those which are explicitly overridden here.

See Symbol for more information.

Note: The FunctionSymbol and SubroutineSymbol classes are both represented by the single ISETL SUBROUTINE class data structure.

Definition at line 71 of file FunctionSymbol.h.


Constructor & Destructor Documentation

FunctionSymbol::FunctionSymbol const char *  name,
const Type type,
EXTERNAL_BOOL  external,
INTRINSIC_BOOL  intrinsic,
FORMAL_BOOL  formal,
Statement entry = 0
 

Constructor.

entry should normally be 0 when external or intrinsic are true. If equivalence information is desired, this must be added separately via a call to the equivalence_ref(...) method.

Note:
Normally, external and intrinsic should be mutually exclusive. That is, an external function would normally be declared as (IS_EXTERNAL, NOT_INTRINSIC, NOT_FORMAL or IS_FORMAL) and an intrinsic function would be declared as (NOT_EXTERNAL, IS_INTRINSIC, NOT_FORMAL). However, all possibilities are intentionally left open because of possible exceptions. For instance, some compilers may allow user-defined intrinsic functions. The correct declaration for may then be (IS_EXTERNAL, IS_INTRINSIC, NOT_FORMAL).

Referenced by clone(), and clone_all().

FunctionSymbol::FunctionSymbol const FunctionSymbol fsym  ) 
 

Definition at line 855 of file Symbol.cc.

References FUNCTION_CLASS.

FunctionSymbol::~FunctionSymbol  )  [virtual]
 

... nothing to do (_entry should NOT be deleted)

Definition at line 861 of file Symbol.cc.


Member Function Documentation

Symbol * FunctionSymbol::clone  )  const [virtual]
 

Clone constructor -- returns base pointer to a new clone of this Symbol.

Implements Symbol.

Definition at line 867 of file Symbol.cc.

References _equivalence, and FunctionSymbol().

Symbol * FunctionSymbol::clone_all  )  const [virtual]
 

Clone constructor -- returns base pointer to a new clone of this Symbol.

Implements Symbol.

Definition at line 877 of file Symbol.cc.

References FunctionSymbol().

FunctionSymbol & FunctionSymbol::operator= const FunctionSymbol fsym  ) 
 

Definition at line 884 of file Symbol.cc.

References _entry, _equivalence, _external, _formal, _intrinsic, and _type.

EXTERNAL_BOOL FunctionSymbol::external  )  const [virtual]
 

Reimplemented from Symbol.

Definition at line 905 of file Symbol.cc.

References _external.

void FunctionSymbol::external EXTERNAL_BOOL  ourbool  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 911 of file Symbol.cc.

References _external.

INTRINSIC_BOOL FunctionSymbol::intrinsic  )  const [virtual]
 

Reimplemented from Symbol.

Definition at line 917 of file Symbol.cc.

References _intrinsic.

void FunctionSymbol::intrinsic INTRINSIC_BOOL  ourbool  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 923 of file Symbol.cc.

References _intrinsic.

FORMAL_BOOL FunctionSymbol::formal  )  const [virtual]
 

Reimplemented from Symbol.

Definition at line 929 of file Symbol.cc.

References _formal.

void FunctionSymbol::formal FORMAL_BOOL  ourbool  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 935 of file Symbol.cc.

References _formal.

const Statement * FunctionSymbol::entry_ref  )  const [virtual]
 

Reimplemented from Symbol.

Definition at line 941 of file Symbol.cc.

References _entry.

Statement * FunctionSymbol::entry_ref  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 947 of file Symbol.cc.

References _entry.

void FunctionSymbol::entry Statement s  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 953 of file Symbol.cc.

References _entry.

const Type & FunctionSymbol::type  )  const [virtual]
 

Returns the type of the symbol, or else returns type VOID_TYPE if the symbol does not use a type (such as a SubroutineSymbol).

... This call should never happen.

Reimplemented from Symbol.

Definition at line 959 of file Symbol.cc.

References _type.

Referenced by type().

void FunctionSymbol::type const Type type  )  [virtual]
 

Reimplemented from Symbol.

Definition at line 965 of file Symbol.cc.

References _type, and type().

Equivalence * FunctionSymbol::equivalence_ref  )  const [virtual]
 

Returns 0 if none.

Reimplemented from Symbol.

Definition at line 971 of file Symbol.cc.

References _equivalence.

void FunctionSymbol::equivalence Equivalence e,
int  byte_base
[virtual]
 

... Return if no change to be made

... Delete from old equivalence if it was in one

... Add to new equivalence class ... Insert into equivalence's list

... Point to the equivalence

Reimplemented from Symbol.

Definition at line 977 of file Symbol.cc.

References _equivalence, clear_equivalence(), and e.

void FunctionSymbol::clear_equivalence  )  [virtual]
 

... Delete from old equivalence if it was in one

Reimplemented from Symbol.

Definition at line 995 of file Symbol.cc.

References _equivalence, Equivalence::_members, List< T >::del(), and Equivalence::find_ref().

Referenced by equivalence().

int FunctionSymbol::is_entry  )  [virtual]
 

Returns 1 if this is an alternate entry.

Reimplemented from Symbol.

Definition at line 1022 of file Symbol.cc.

References _external, and _intrinsic.

void FunctionSymbol::print ostream &  o  )  const [virtual]
 

Print onto stream 'o'.

... the _intrinsic field

... the _external field

... the _formal field

... the _entry field

... _equivalence field

... the _overflow field

Implements Symbol.

Definition at line 1028 of file Symbol.cc.

References _entry, _equivalence, _external, _formal, _intrinsic, _type, Type::format(), Equivalence::name_ref(), and Statement::tag().

virtual void FunctionSymbol::fill_in const BinRep binstr,
ExprTable exprs,
const Dictionary< VoidPtrDef > &  stmts,
const Dictionary< VoidPtrDef > &  commons,
const Dictionary< VoidPtrDef > &  equivalences
[virtual]
 

Fill in all relevant info from a binstr object.

Implements Symbol.

void FunctionSymbol::exchange_convert VDL vdl  )  [virtual]
 

Convert the Symbol into the exchange format.

Reimplemented from Symbol.

Definition at line 1069 of file Symbol.cc.

References Symbol::exchange_convert(), BinRep::find_ref(), Set< T >::ins(), List< T >::ins_last(), Symbol::name_ref(), BinRep::to_set(), and BinRep::to_tuple().

int FunctionSymbol::structures_OK  )  const [virtual]
 

Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.

Reimplemented from Symbol.

Definition at line 1178 of file Symbol.cc.

References _entry, _equivalence, and _type.

void FunctionSymbol::relink_dptrs ProgramUnit p  )  [virtual]
 

Change all pointers found in a FunctionSymbol element to point into the given ProgramUnit.

Implements RelinkableDef.

Definition at line 1191 of file Symbol.cc.

References _entry, and Statement::tag().


Member Data Documentation

Equivalence* FunctionSymbol::_equivalence [protected]
 

Definition at line 73 of file FunctionSymbol.h.

Referenced by clear_equivalence(), clone(), equivalence(), equivalence_ref(), operator=(), print(), and structures_OK().

unsigned FunctionSymbol::_external [protected]
 

Definition at line 75 of file FunctionSymbol.h.

Referenced by external(), is_entry(), operator=(), and print().

unsigned FunctionSymbol::_intrinsic [protected]
 

Definition at line 75 of file FunctionSymbol.h.

Referenced by intrinsic(), is_entry(), operator=(), and print().

unsigned FunctionSymbol::_formal [protected]
 

if both _external and _intrinsic are zero, it is the routine or program itself or an alternate ENTRY

Definition at line 75 of file FunctionSymbol.h.

Referenced by formal(), operator=(), and print().

Statement* FunctionSymbol::_entry [protected]
 

== 0 if none

Definition at line 80 of file FunctionSymbol.h.

Referenced by entry(), entry_ref(), operator=(), print(), relink_dptrs(), and structures_OK().

Type FunctionSymbol::_type [protected]
 

Definition at line 81 of file FunctionSymbol.h.

Referenced by operator=(), print(), structures_OK(), and type().


The documentation for this class was generated from the following files:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:07:26 2005