;; Attributes of nodes, and their types.  -*-Lisp-*-

;;   (defattr NAME-OF-ATTRIBUTE C++-TYPE INITIALIZER)

(defattr text "string16" "string16()")
(defattr ident "const string*" "NULL")
(defattr flags "Common::Modifiers" "(Common::Modifiers)0")
(defattr decl "Decl*" "NULL")
(defattr decl:class "ClassDecl*" "NULL")
(defattr-default valid "bool" "true")
(defattr isinline "bool" "false")
(defattr isfinal "bool" "false")
(defattr appearsOnEveryIter "bool" "false")
(defattr literal "Literal" "Literal((int32)0)")
(defattr destination TreeNode "NULL")
(defattr theClass TreeNode "NULL")
(defattr codeString "string" "\"\"")
(defattr offsetString "string" "\"\"")
(defattr cleanups "llist<TreeNode *> *" "NULL")
(defattr fetcher "MonitorFetchNode *" "NULL")
(defattr WRTloop "TreeNode *" "NULL")
(defattr rfrs "llist< pair<TreeNode *, TreeNode *> > *" " NULL")
(defattr sirs "llist< pair<TreeNode *, TreeNode *> > *" " NULL")
(defattr urs "llist< pair<TreeNode *, TreeNode *> > *" " NULL")
(defattr pointValues "string **" "NULL")
(defattr requests "Pragma::Request" "(Pragma::Request) 0")
(defattr environ "Environ *" "NULL")
(defattr stmtsToDelete "set<StatementNode *> *" "NULL")
(defattr declsToDelete "treeSet *" "NULL")
(defattr remap "map<TreeNode *, TreeNode *> *" "NULL")

(deflist CatchListNode CatchNode)
(deflist TreeListNode TreeNode)
(deflist TypeListNode TypeNode)


;; Internal state variables of nodes.

;;   (defstate NAME-OF-VARIABLE C++-TYPE [INITIALIZER-EXPRESSION])

(defstate generator "static UniqueId")
(defstate thePackage "Decl *" "NULL")
(defstate importedPackages "llist<Decl *> *" "NULL")
(defstate _cfgBeg "CfgNode *" "NULL")
(defstate _cfgEnd "CfgNode *" "NULL")
(defstate _cfgContinueNode "CfgNode *")
(defstate _cfgCatch "CfgNode *")
(defstate _cfgFinally "CfgNode *")
(defstate _invariants "treeSet *" "NULL")
(defstate _lifted_invariants "treeSet *" "NULL")
(defstate _lo "ExprNode *" "NULL")
(defstate _hi "ExprNode *" "NULL")
(defstate _stride "ExprNode *" "NULL")
(defstate _ordered "bool" "false")
(defstate _tentative "bool" "false")
(defstate _junk_pre "llist<TreeNode *> *" "NULL")
(defstate _junk_post "llist<TreeNode *> *" "NULL")
(defstate _defs "Defs *" "NULL")
(defstate bblockRoot "Bblock *" "NULL")
(defstate nodeStorage "NodeStorage *" "NULL")
(defstate _holder "mutable string")
(defstate popState "static CodeLiteralNode")
(defstate _needPoint "bool" "false")
(defstate _parallel "bool" "false")
(defstate _saveSRinfo "bool" "false")
(defstate _shouldDeclare "bool" "true")
(defstate _valuesAreDeltas "bool" "false")
(defstate _partialDomain "bool" "false")
(defstate _numLifted "int" "0")
(defstate _cannotBeEmpty "TreeNode *" "NULL")
(defstate _blockContext "CodeContext *" "NULL")
(defstate _declContainer "bool" "false")
(defstate SR "map_tree_to_cMIVElist *" "NULL")
(defstate arrayAccesses "ArrayAccessSet *" "NULL")
(defstate _methodStatics "MethodStatics*" "NULL")
(defstate _modifiesValues "Bitset*" "NULL")
(defstate _inlineInfo "void*" "NULL")
(defstate _isRewrittenSFAN "bool" "false")
(defstate ranLazyStaticSemantics "bool" "false")
(defstate _mangledIdent "const string *" "NULL")

;; Children of nodes, and their types (all derived from TreeNode)

;;   (defchild NAME-OF-CHILD TYPE)

(defchild args TreeListNode)
(defchild array TreeNode)
(defchild block TreeNode)
(defchild body TreeNode)
(defchild cases TreeListNode)
(defchild catches CatchListNode)
(defchild members TreeListNode)
(defchild condition TreeNode)
(defchild constructorCall TreeNode)
(defchild dimExprs TreeListNode)
(defchild elementType TypeNode)
(defchild elseOpnd TreeNode)
(defchild elsePart TreeNode)
(defchild expr TreeNode)
(defchild finally TreeNode)
(defchild imports TreeListNode)
(defchild index TreeNode)
(defchild init TreeListNode)
(defchild initExpr TreeNode)
(defchild initializers TreeListNode)
(defchild interfaces TypeListNode)
(defchild label TreeNode)
(defchild method TreeNode)
(defchild name TreeNode)
(defchild simpName TreeNode)
(defchild object TreeNode)
(defchild opnd0 TreeNode)
(defchild opnd1 TreeNode)
(defchild package TreeNode)
(defchild param TreeNode)
(defchild params TreeListNode)
(defchild paramTypes TypeListNode)
(defchild proc TreeNode)
(defchild qualifier TreeNode)
(defchild returnType TypeNode)
(defchild addends TreeListNode)
(defchild stmt TreeNode)
(defchild stmts TreeListNode)
(defchild superClass TreeNode)
(defchild switchBlocks TreeListNode)
(defchild test TreeNode)
(defchild thenOpnd TreeNode)
(defchild thenPart TreeNode)
(defchild throws TypeListNode)
(defchild dtype TypeNode)
(defchild ftype TypeNode)
(defchild types TreeNode)
(defchild update TreeListNode)
(defchild vars TreeListNode)
(defchild region TreeNode)
(defchild overlaps TreeListNode)
(defchild arrayspecifiers TreeListNode)
(defchild basis TypeDeclNode)
(defchild instance TypeDeclNode)

;; Methods applicable to some nodes

;;  (defmethod NAME-OF-METHOD C++-HEADER)

(defmethod destructor nil)

(defmethod loaded "void loaded()")
(defmethod free "void free()")
(defmethod pseudoprint "void pseudoprint(ostream &os, unsigned depth) const")
(defmethod type "TypeNode* type ()")
(defmethod packageResolution "void packageResolution()")
(defmethod resolvePackage "void resolvePackage (Decl* package, Environ *fileEnv)")
(defmethod resolveImports "void resolveImports(CompileUnitNode *file, Environ *fileEnv)")
(defmethod importOnDemand "void importOnDemand(Decl *importedPackage)")
(defmethod importOnDemand2 "void importOnDemand(const string *s1, const string *s2)")
(defmethod resolveTypes "TreeNode *resolveTypes(Decl *package, Environ *fileEnv, Environ *typeEnv)")
(defmethod resolveInheritance "void resolveInheritance()")
(defmethod verifyCircularity "bool verifyCircularity() const")
(defmethod reportCircularity "void reportCircularity() const")
(defmethod resolveClass "void resolveClass (Decl *package, ClassDecl *cclass, Environ *fileEnv)")
(defmethod resolveName "TreeNode* resolveName (const NameContext &ctx)")
(defmethod resolveField "TreeNode *resolveField(FieldContext *ctx, bool *inAssignment)")
(defmethod resolveConcat "TreeNode *resolveConcat()")
(defmethod lookForMain "void lookForMain() const")
(defmethod collapseTrivialBlocks "TreeNode * collapseTrivialBlocks()")
(defmethod applyReordering "TreeNode * applyReordering()")
(defmethod lower "TreeNode *lower(llist<TreeNode *> *&decls, llist<TreeNode *> *&stmts)")
(defmethod lower:expr "ExprNode *lower(llist<TreeNode *> *&decls, llist<TreeNode *> *&stmts)")
(defmethod makeCfg "CfgExtent makeCfg()")
(defmethod getCfgExtent "CfgExtent getCfgExtent()")
(defmethod getContinueTarget "CfgNode *getContinueTarget()")
(defmethod getExceptionCfg "CfgExtent getExceptionCfg()")
(defmethod resolveRequires "void resolveRequires(ClassDecl *)")
(defmethod fixParent "int fixParent()")
(defmethod cloneSharedSubtrees "TreeNode *cloneSharedSubtrees()")
(defmethod checkIF "bool checkIF(bool serious) const")
(defmethod isPragma "bool isPragma(Pragma::Request r) const")
(defmethod __type "TypeNode* __type ()")
(defmethod checkAssignable "void checkAssignable(TreeNode *with, bool allowFinalAssign)")
(defmethod checkFieldAssignment "void checkFieldAssignment(TreeNode &)")
(defmethod checkFinalFieldAssignment "void checkFinalFieldAssignment(bool)")
(defmethod isAssignableFromConstant "bool isAssignableFromConstant(const TreeNode *with) const")
(defmethod isIntConstant "bool isIntConstant(int from, int to) const")
(defmethod constantType "Common::Kind constantType() const")
(defmethod typeIdent "bool typeIdent(const TreeNode*) const")
(defmethod typeIdentNM "bool typeIdentNM(const TreeNode*) const")
(defmethod decl "Decl* decl () const")
(defmethod decl:class "ClassDecl* decl () const")
(defmethod decl:member "MemberDecl* decl () const")
(defmethod decl:method "MethodDecl* decl () const")
(defmethod decl:type "TypeDecl* decl () const")
(defmethod kind "TypeNode::Kind kind () const")
(defmethod kindsAssignableTo "TypeNode::Kind kindsAssignableTo () const")
(defmethod kindsCastableTo "TypeNode::Kind kindsCastableTo () const")
(defmethod isCastableFrom "bool isCastableFrom (const TypeNode* T1) const")
(defmethod isCallableWith "bool isCallableWith (Modifiers, const TreeNode* T1) const")
(defmethod commonSubExpr "void *commonSubExpr()")
(defmethod loopAnal "void loopAnal(TreeNode *enclosingLoop)")
(defmethod computeForeachDominators "void computeForeachDominators(bool ignoreNSE)")
(defmethod liftInvariantExprs "TreeNode * liftInvariantExprs()")
(defmethod isSharedAccess "bool isSharedAccess() const")
(defmethod strengthReduce "TreeNode * strengthReduce()")
(defmethod deleteStmts "TreeNode * deleteStmts(treeSet *s)")
(defmethod loopInvariant "bool loopInvariant(TreeNode *WRTloop, treeSet *loopContents, void action(TreeNode *, TreeNode *))")
(defmethod invariants "treeSet *& invariants()")
(defmethod lifted_invariants "treeSet *& lifted_invariants()")
(defmethod junk_pre "llist<TreeNode *> *& junk_pre()")
(defmethod junk_post "llist<TreeNode *> *& junk_post()")
(defmethod isSideEffectFree "bool isSideEffectFree() const")
(defmethod isPureFunction "bool isPureFunction() const")
(defmethod findDefs "void findDefs(Defs *)")
(defmethod findMayMustReadWrite "void findMayMustReadWrite(bool r, bool w)")
(defmethod defs "Defs * defs()")
(defmethod accessedObjectType "TypeNode* accessedObjectType () const")
(defmethod selectedForCodeGen "bool selectedForCodeGen(bool) const")
(defmethod isMain "bool isMain() const")
(defmethod defaultMIVE "MIVE * defaultMIVE(MIVEcontext *) const")
(defmethod computeMIVE "void computeMIVE(TreeNode *WRTloop, void action(TreeNode *, TreeNode *, MIVE *))")
(defmethod lazyOptimize "TreeNode * lazyOptimize ()")
(defmethod codeGen "void codeGen ( CodeContext & )")
(defmethod codeGen:void "void codeGen ()")
(defmethod codeGen:source "void codeGen ( CfSource & )")
(defmethod signature "string signature () const")
(defmethod formalSignature "string formalSignature () const")
(defmethod hasFormalSignature "bool hasFormalSignature () const")
(defmethod ident "const string* ident () const")
(defmethod returnType "TypeNode* returnType () const")
(defmethod simpName "TreeNode* simpName () const")
(defmethod typecheck "bool typecheck(TypeContext *ctx)")
(defmethod _typecheck "bool _typecheck(TypeContext *ctx)")
(defmethod checkQualifiers "void checkQualifiers() const")
(defmethod checkEmbeddedLocals "void checkEmbeddedLocals()")
(defmethod fieldChainEnd "bool fieldChainEnd() const")
(defmethod fieldChainParent "bool fieldChainParent() const")
(defmethod widen "void widen()")
(defmethod _widen "void _widen()")
(defmethod findAllocateNode "AllocateNode *findAllocateNode()")
(defmethod foldFields "void foldFields()")
(defmethod foldConstants "TreeNode *foldConstants()")
(defmethod _fold "TreeNode *_fold()")
(defmethod foldMask "Common::Kind foldMask()")
(defmethod instantiate "TreeNode *instantiate(Subst *args)")
(defmethod isNullType "bool isNullType () const")
(defmethod isPointType "bool isPointType () const")
(defmethod isDomainType "bool isDomainType () const")
(defmethod isRectDomainType "bool isRectDomainType () const")
(defmethod hasReference "bool hasReference() const")
(defmethod typeName "string typeName() const")
(defmethod unqualifiedTypeName "string unqualifiedTypeName() const")
(defmethod buildArrayTypeName "void buildArrayTypeName( string & ) const")
(defmethod dimensionTypeName "string dimensionTypeName() const")
(defmethod dimensionTypeName:0 "virtual string dimensionTypeName() const = 0")
(defmethod indexType "TypeNode *indexType() const")
(defmethod isArrayType "bool isArrayType () const")
(defmethod isAtomic "bool isAtomic () const")
(defmethod isSharedField "bool isSharedField() const")
(defmethod isTitaniumArrayType "bool isTitaniumArrayType () const")
(defmethod isJavaArrayType "bool isJavaArrayType () const")
(defmethod isWriteableArrayType "bool isWriteableArrayType () const")
(defmethod isArrayAccessNode "bool isArrayAccessNode () const")
(defmethod isExprNode "bool isExprNode () const")
(defmethod isLitNode "bool isLitNode () const")
(defmethod elementType "TypeNode* elementType () const")
(defmethod tiArity "int tiArity() const")
(defmethod updateConstructorValidity "bool updateConstructorValidity()")
(defmethod constructorValid "bool constructorValid() const")
(defmethod single "SingleState single(SingleContext *ctx)")
(defmethod singleAssign "SingleState singleAssign(const SingleState &from, SingleContext *ctx)")
(defmethod sglobalData "void sglobalData()")
(defmethod sglobalDataAssign "void sglobalDataAssign()")
(defmethod sglobalCall "void sglobalCall()")
(defmethod modifiers "Modifiers modifiers () const")
(defmethod valid "bool valid() const")
(defmethod _resolveOperators "TreeNode *_resolveOperators()")
(defmethod operatorName "const char *operatorName() const")
(defmethod widenSource "TypeNode *widenSource()")
(defmethod castResult "TypeNode *castResult()")
(defmethod isLoop "bool isLoop() const")
(defmethod canCastStatically "bool canCastStatically() const")
(defmethod canCallStatically "bool canCallStatically() const")
(defmethod rewrite "TreeNode *rewrite( const FieldContext * )")
(defmethod emitDebugInfo "void emitDebugInfo( ofstream &, StringTable & )")
(defmethod defaultInitExpr "ExprNode *defaultInitExpr( const SourcePosn & ) const")
(defmethod defaultInitLiteral "virtual Literal defaultInitLiteral() const")
(defmethod singleArgsIdent "bool singleArgsIdent(const TreeNode* T1) const")

(defmethod buildMethodCall "MethodCallNode * buildMethodCall( ExprNode &, const string *, llist<TreeNode *> * ) const")
(defmethod buildToStringCall "MethodCallNode * buildToStringCall( ExprNode & ) const")
(defmethod buildConcatTree "ExprNode * buildConcatTree( llist<TreeNode *> *, const FieldContext & ) const")
(defmethod cArrayHandler "virtual const string cArrayHandler( const char [], bool )")
(defmethod emitBinOp "const string emitBinOp( CodeContext &, const char [] )")
(defmethod emitCatchTable "virtual void emitCatchTable( ostream & ) const")
(defmethod holder "const string &holder() const")
(defmethod declareHolder "void declareHolder( CodeContext & ) const")
(defmethod superfluous "bool superfluous() const")
(defmethod superfluous:0 "virtual bool superfluous() const = 0")
(defmethod optimizeMonitors "TreeNode *optimizeMonitors( MonitorStats & )")
(defmethod simpleVar "virtual const string simpleVar( CodeContext & )")
(defmethod emitExpression "virtual const string emitExpression( CodeContext & )")
(defmethod emitGlobalize "const string emitGlobalize( CodeContext &, const string &, const string & ) const")
(defmethod emitLocalize "const string emitLocalize( CodeContext &, const string & ) const")
(defmethod emitBumpExpr "const string emitBumpExpr( CodeContext &, bool, bool )")
(defmethod isLocalLvalue "virtual bool isLocalLvalue()")
(defmethod isSimpleLvalue "virtual bool isSimpleLvalue()")
(defmethod isStrengthReduced "virtual bool isStrengthReduced() const")
(defmethod getLvalue "virtual const string getLvalue( CodeContext & )")
(defmethod emitMethodCall "virtual const string emitMethodCall( CodeContext &, TreeListNode & )")
(defmethod emitNullifyLocal "void emitNullifyLocal( ostream &, const string & ) const")
(defmethod emitStatement "virtual void emitStatement( CodeContext & )")
(defmethod emitSetup "void emitSetup( CodeContext & )")
(defmethod emitTypeCheck "const string emitTypeCheck( const string & )")
(defmethod emitUse "virtual const string emitUse( LocalVars &, const ObjectNode & ) const")
(defmethod prepareBreak "virtual void prepareBreak()")
(defmethod receiveAssign "void receiveAssign( ostream &, const string &, const string &, AssignKind, const TypeNode * )")
(defmethod resetGenerator "static void resetGenerator()")
(defmethod continueLabel "const string continueLabel() const")
(defmethod collectCleanups "virtual void collectCleanups()")
(defmethod unwindSelf "void unwindSelf( CleanupList & ) const")
(defmethod unwindTree "void unwindTree( CleanupList &, const TreeNode * ) const")
(defmethod unwindTry "void unwindTry( CleanupList & ) const")
(defmethod unwindUntil "void unwindUntil( const TreeNode * )")
(defmethod setBblockRoot "virtual void setBblockRoot(Bblock *bblock)")
(defmethod getBblockRoot "virtual Bblock *getBblockRoot(void)")
(defmethod setNodeStorage "virtual void setNodeStorage(NodeStorage *ns)")
(defmethod getNodeStorage "virtual NodeStorage *getNodeStorage(void)")
(defmethod getDefs "llist <TreeNode *> *getDefs(void) const")
(defmethod setDefs "void setDefs(llist <TreeNode *> *)")
(defmethod methodStatics "MethodStatics *methodStatics() const")
(defmethod setMethodStatics  "void setMethodStatics(MethodStatics *ms)")
(defmethod setMethodASTToValueMap "virtual void setMethodASTToValueMap(TreeNodeToIntMap *tm)")
(defmethod handleAssignment "bool handleAssignment(AliasInfos *ai, Bitset* values)")
(defmethod getValues "Bitset *getValues(AliasInfos *ai)")
(defmethod modifiesValues "Bitset *modifiesValues()")
(defmethod setModifiesValues "void setModifiesValues(Bitset *b)")
(defmethod getUses "llist <TreeNode *> *getUses(void) const")
(defmethod setUses "void setUses(llist <TreeNode *> *)")
(defmethod isStatementNode "virtual bool isStatementNode(void) const")
(defmethod hasLval "virtual bool hasLval(void) const")
(defmethod isFieldOfImmutable "bool isFieldOfImmutable() const")

(defmethod conservative "void conservative( QualSolver & ) const")
(defmethod enact "void enact( const EnactContext & )" )
(defmethod enactDimension "bool enactDimension( const EnactContext & )" )
(defmethod enactType "bool enactType( const EnactContext & )" )
(defmethod identicalTo "void identicalTo( const TypeNode &, QualSolver & ) const")
(defmethod identicalToList "void identicalTo( TypeListNode &, QualSolver & ) const")
(defmethod infer "void infer( const InferContext & )")
(defmethod isExported "bool isExported() const")
(defmethod isInferable "bool isInferable() const")
(defmethod needsProtection "bool needsProtection() const")
(defmethod protect "void protect( QualSolver & ) const")
(defmethod rebind "void rebind() const")
(defmethod receiveAssign:qual "void receiveAssign( const TypeNode &, QualSolver & ) const")
(defmethod reportChange "void reportChange( const char * ) const")
(defmethod stronglySubsumedBy "void stronglySubsumedBy( const TypeNode &, QualSolver & ) const")
(defmethod subcastTo "void subcastTo( const TypeNode &, QualSolver & ) const")
(defmethod unshareNode "TypeNode *unshareNode( const TreeNode * )")
(defmethod unshareType "void unshareType()")
(defmethod unshareTypeTree "void unshareTypeTree()")
(defmethod weaklySubsumedBy "void weaklySubsumedBy( const TypeNode &, QualSolver & ) const")
(defmethod similarTo "void similarTo( const TypeNode &, QualSolver & ) const")
(defmethod subsimilarTo "void subsimilarTo( const TypeNode &, QualSolver & ) const")

(defmethod inferLocal "void inferLocal( const LocalContext & )")
(defmethod inferLocalChildren "void inferLocalChildren( const LocalContext & ) const")
(defmethod inferLocalTree "void inferLocalTree( const LocalContext & )")
(defmethod localCastTo "void localCastTo( const TypeNode &, LocalSolver &solver ) const")
(defmethod localEnactChildren "void localEnactChildren( const LocalEnactContext & ) const" )
(defmethod localEnactTree "void localEnactTree( const LocalEnactContext & )" )
(defmethod localReceiveAssign "void localReceiveAssign( const TypeNode &, LocalSolver & ) const")

(defmethod inferSharingLate "void inferSharingLate( const SharingContext & )")
(defmethod inferSharingLateChildren "void inferSharingLateChildren( const SharingContext & ) const")
(defmethod inferSharingLateTree "void inferSharingLateTree( const SharingContext & )")
(defmethod inferSharingEarly "void inferSharingEarly( SharingSolver & ) const")
(defmethod inferSharingEarlyChildren "void inferSharingEarlyChildren( SharingSolver & ) const")
(defmethod inferSharingEarlyTree "void inferSharingEarlyTree( SharingSolver & ) const")
(defmethod sharingCastTo "void sharingCastTo( const TypeNode &, SharingSolver &solver ) const")
(defmethod sharingEnact "void sharingEnact( const SharingEnactContext & )")
(defmethod sharingEnactChildren "void sharingEnactChildren( const SharingEnactContext & ) const" )
(defmethod sharingEnactTree "void sharingEnactTree( const SharingEnactContext & )" )

(defmethod cPrimitiveTypeName "const char *cPrimitiveTypeName() const")
(defmethod cPrimitiveTypeName:0 "virtual const char *cPrimitiveTypeName() const = 0")
(defmethod cTypeCreateBoxed "const CtType &cTypeCreateBoxed() const")
(defmethod cTypeCreateUnboxed "const CtType &cTypeCreateUnboxed() const")
(defmethod cDescriptorTypeCreate "const CtType &cDescriptorTypeCreate() const")
(defmethod asExpr "TreeNode *asExpr()")
(defmethod asType "TypeNode *asType()")
(defmethod asExpr2 "TreeNode *asExpr2(TreeNode *array)")
(defmethod asType2 "TypeNode *asType2(TypeNode *base)")
(defmethod isd "bool isd() const")
(defmethod isNamedType "bool isNamedType() const")
(defmethod resolveNewArray "bool resolveNewArray(Decl *package, Environ *fileEnv, bool exprOnly, llist<TreeNode *> **dims, TypeNode **base)")
(defmethod isArraySpecifier "bool isArraySpecifier(Decl *package, Environ *fileEnv)")
(defmethod isPrimitive "bool isPrimitive() const")

(defmethod bindPseudonym "PseudonymDecl *bindPseudonym( TreeNode & ) const")
(defmethod mangle "string mangle()")
(defmethod mangle:0 "string mangle() = 0")
(defmethod checkTemplateUse "ClassDecl *checkTemplateUse() const")
(defmethod checkTemplateFormal "void checkTemplateFormal( IdentSet &, IdentSet & ) const")
(defmethod checkTemplateActual:parm "void checkTemplateActual( TemplateCheckContext &, TreeNode & ) const")
(defmethod checkTemplateActual:expr "void checkTemplateActual( TemplateCheckContext &, const string &, TypeNode & )")
(defmethod fixTemplateActual:parm "TreeNode *fixTemplateActual( TreeNode & ) const")
(defmethod fixTemplateActual:type "TypeNode *fixTemplateActual( const string & )")
(defmethod fixTemplateActual:expr "ExprNode *fixTemplateActual( const string &, TypeNode & )")
(defmethod resolveInstantiation "void resolveInstantiation( Environ &, TypeDeclNode & )")
(defmethod resolveTemplate "void resolveTemplate( const TemplateContext & )")
(defmethod resolveTemplate:decl "ClassDecl *resolveTemplate( bool )")
(defmethod templateDepth "int templateDepth() const")

(defmethod getInlineInfo "void *inlineInfo() const")
(defmethod setInlineInfo "void inlineInfo(void *)")
(defmethod lazyStaticSemantics "CompileUnitNode *lazyStaticSemantics()")
(defmethod partialDomain "bool partialDomain() const")
(defmethod cannotBeEmpty "TreeNode *& cannotBeEmpty()")
(defmethod getCannotBeEmpty "TreeNode *cannotBeEmpty() const")
(defmethod useOfArray "TreeNode *useOfArray(TreeNode *vardecl) const")
(defmethod mangledIdent "const string *& mangledIdent()")
(defmethod needPoint "bool & needPoint()")
(defmethod getParallel "bool getParallel() const")
(defmethod setParallel "bool setParallel(bool)")
(defmethod saveSRinfo "bool & saveSRinfo()")
(defmethod shouldDeclare "bool & shouldDeclare()")
(defmethod valuesAreDeltas "bool & valuesAreDeltas()")
(defmethod numLifted "int & numLifted()")
(defmethod ordered "bool & ordered()")
(defmethod tentative "bool & tentative()")
(defmethod lo "ExprNode *& lo()")
(defmethod hi "ExprNode *& hi()")
(defmethod stride "ExprNode *& stride()")
(defmethod getOrdered "bool ordered() const")
(defmethod getTentative "bool tentative() const")
(defmethod getLo "ExprNode *lo() const")
(defmethod getHi "ExprNode *hi() const")
(defmethod getStride "ExprNode *stride() const")
(defmethod blockContext "CodeContext *& blockContext()")
(defmethod declContainer "bool & declContainer()")
(defmethod getIsRewrittenSFAN "bool isRewrittenSFAN() const")
(defmethod setIsRewrittenSFAN "void isRewrittenSFAN(bool)")


;; Base Node Types

;;  (defbasenode NAME-OF-CLASS (BASE-CLASSES)
;;     PRODUCE-DECLARATIONS-P
;;     "DOCUMENTATION"
;;     (METHODS)
;;     [(STATE-VARIABLES)])

(defbasenode TreeNode () nil
  "The base type for all ASTs.  This class is declared in AST.h.")

(defbasenode TreeListNode () nil
  "A TreeListNode encapsulates list of TreeNode*s.  We wrap lists in this 
type in order to be able to define member functions, like print or resolve, 
to lists of nodes, rather than making them a special case in each TreeNode 
derivate that takes a list of nodes as one of its children.  This class is
defined in AST.h.")

(defbasenode StatementNode () t
  "The base type for all statements.  Statements are untyped, may be
the jump target of a \"break\" statement or goto.  Statements have several
responsibilities at code-generation time:

  1. A statement that may generate code consisting of multiple C
statements is responsible for emitting its own curly braces to
encapsulate these multiple C statemtents as a single C block.

  2. A statement that generates code consisting of a single C
statement is responsible for emitting a semicolon to properly
terminate that single C statement.

  3. A compound statement that could potentially be the jump target of
a \"break\" statement should *not* implement codeGen().  Instead, it
should implement emitStatement().  StatementNode will generate code by
calling the subclass's emitStatement() but will append a \"break\"
jump target if necessary.

  4. A non-compound statement which can never be the jump target of a
\"break\" statement can simply implement codeGen() itself.  [The only
non-compound statement which *can* be the target of a \"break\"
statement is \"break\" itself.]"
  (codeGen emitStatement getCfgExtent pseudoprint makeCfg
	   isStatementNode deleteStmts
	   unwindTree unwindUntil)
  (_cfgBeg _cfgEnd))

(defbasenode IterationNode (StatementNode) t
  "The base type for all iteration statements, including \"while\",
\"do\", and \"for\".  Iteration statements are precisely those
statements which can be the jump target of a \"continue\" statement."
  (isLoop
   getContinueTarget)
  (_cfgContinueNode))

(defbasenode LoopNode (IterationNode) t
  "The base type for \"while\" and \"do\" loops, having one test and
one substatement."
  (resolveName single))

(defbasenode MonitorFetchNode (StatementNode) t
  "The base type for nodes that fetch monitor locks.  Different
subclasses fetch these locks from different places, such as from
instances versus classes.  During code generation, attribute HOLDER
names a C variable into which a global pointer to the monitor is
placed for subsequent locking and unlocking.  See also
MonitorUseNode."
  (checkIF
   makeCfg
   holder
   declareHolder
   resetGenerator
   superfluous:0)
  (generator _holder))

(defbasenode MonitorUseNode (StatementNode) t
  "The base type for nodes that acquire or release monitor locks.
Every subclass has an attribute, FETCHER, which designates the
MonitorFetchNode that will have already retrieved the lock."
  (checkIF
   makeCfg
   superfluous
   optimizeMonitors))

(defbasenode MethodNode () t
  "The base type for method declarations."
  (resolveClass
   decl:method
   foldFields
   instantiate
   typecheck
   unshareType
   infer
   enact
   reportChange
   inferLocalTree
   inferSharingLateTree
   inferSharingEarly
   checkIF))

(defbasenode DataDeclNode () t
  "The base type for data storage declarations, such as fields and
local variables."
  (typecheck
   unshareType
   infer
   enact))

(defbasenode TypeDeclNode () t
  "The base type for class and interface declarations."
  (decl:class
   resolveName
   verifyCircularity
   reportCircularity
   resolveField
   resolveRequires
   single
   inferLocalTree
   inferLocalChildren
   localEnactChildren
   inferSharingLateChildren
   inferSharingLateTree
   inferSharingEarlyChildren
   sharingEnactChildren))

(defbasenode TypeNode () nil
  "The base type for all ASTs that represent types. This class is declared in types.h.")

(defbasenode PrimitiveTypeNode (TypeNode) t
  "The common base class for nodes representing primitive types."
  (isAtomic defaultInitExpr defaultInitLiteral
	    emitNullifyLocal
	    cPrimitiveTypeName:0
	    cDescriptorTypeCreate
	    cTypeCreateUnboxed))

(defbasenode ArrayTypeNode (TypeNode) t
  "The common base class for nodes representing array types."
  (isArrayType
   hasReference
   modifiers
   checkQualifiers
   typeName
   buildArrayTypeName
   dimensionTypeName:0
   templateDepth
   unshareNode
   conservative
   enactType
   identicalTo
   protect
   similarTo
   stronglySubsumedBy
   weaklySubsumedBy
   subcastTo
   localCastTo
   sharingCastTo
   inferSharingEarly))

(deflistnode TypeListNode
  "A list of TypeNodes."
  (signature typeIdentNM singleArgsIdent typeName
	     conservative
	     enactType
	     identicalToList
	     checkIF))

(defbasenode ExprNode () nil
  "The base type for all expressions.  This class is declared in AST.h.")

(defbasenode FieldAccessNode (ExprNode) t
  "The base type for all field access nodes"
  (__type
   decl:member
   single
   singleAssign
   checkAssignable
   checkFieldAssignment
   checkFinalFieldAssignment
   _typecheck
   fieldChainEnd
   checkEmbeddedLocals
   sglobalDataAssign
   receiveAssign:qual
   isFieldOfImmutable
   findDefs
   resolveRequires
   getDefs getUses
   setDefs setUses
   hasLval))
  
(defbasenode IncrDecrNode (ExprNode) t
  "The common base type for pre/post increment/decrement expressions"
  (__type _typecheck single
	  lower:expr
	  emitBumpExpr
	  sglobalData))

(defbasenode UnaryArithNode (ExprNode) t
  "The common base type for unary +/-"
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant))

(defbasenode BinaryArithNode (ExprNode) t
  "Base class for binary arithmetic operators"
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant))

(defbasenode BinaryArithAssignNode (ExprNode) t
  "Base class for assignment nodes -=, *=, /=, %="
  (__type _widen _typecheck single _resolveOperators widenSource
	  castResult
	  lower:expr
	  sglobalData))

(defbasenode ShiftNode (ExprNode) t
  "Base class for binary shift operators"
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant))

(defbasenode ShiftAssignNode (ExprNode) t
  "Base class for <<=, >>=, >>>="
  (__type _widen _typecheck single _resolveOperators widenSource
	  castResult
	  lower:expr
	  sglobalData))

(defbasenode RelationNode (ExprNode) t
  "Base class for relations  (i.e., < > <= >=)"
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant))

(defbasenode EqualityNode (ExprNode) t
  "Base class for equality relations, == !="
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant
	  infer
	  inferSharingLate))

(defbasenode BitwiseNode (ExprNode) t
  "Base class for bitwise operations."
  (__type _widen _typecheck single _resolveOperators
	  lower:expr
	  loopInvariant))

(defbasenode BitwiseAssignNode (ExprNode) t
  "Base class for &=, |=, ^=."
  (__type _widen _typecheck single _resolveOperators widenSource
	  castResult
	  lower:expr
	  sglobalData))

(defbasenode LogCondNode (ExprNode) t
  "Base class for && and ||"
  (__type _typecheck single loopInvariant))

(defbasenode DynamicTypeNode (ExprNode) t
  "Base class for dynamic type checks."
  (_typecheck
   emitTypeCheck
   loopInvariant
   resolveRequires
   canCastStatically
   infer
   inferLocal
   inferSharingLate))

(defbasenode LitNode (ExprNode) t
  "Base class for literal expressions."
  (single
   isLitNode
   checkTemplateActual:expr
   templateDepth
   mangle:0))

;; Node Types

;;  (defnode NAME-OF-CLASS (BASE-CLASSES) (INSTANTIATION-PARAMETERS)
;;     "DOCUMENTATION"
;;     (METHODS) [(STATE-VARIABLES)])


(defnode NameNode () (qualifier ident decl)
  "A name of the form QUALIFIER.IDENT, or, if QUALIFIER is NameNode::omitted, 
the name IDENT.  DECL, if present, is the resolved Decl* node corresponding 
to this instance of the name."
  (signature
   simpName
   instantiate
   computeMIVE
   makeCfg
   pseudoprint
   loopInvariant
   checkIF))

(defnode PrimitiveLitNode (LitNode) (literal)
  "A literal constant of one of the primitive types, value in LITERAL"
  (__type emitExpression isIntConstant constantType pseudoprint
	  typeIdentNM
	  unqualifiedTypeName
	  loopInvariant defaultMIVE
	  asType2 isArraySpecifier getValues
	  mangle))

(defnode StringLitNode (LitNode) (text)
  "A literal constant of type char whose external (written) representation
is TEXT (a string of 0 or more characters)."
  (__type emitExpression
	  resolveRequires pseudoprint
	  infer
	  getValues
	  mangle))

(defnode BoolTypeNode (PrimitiveTypeNode) ()
  "The type bool."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	unqualifiedTypeName
	decl:type
	defaultInitLiteral
	cPrimitiveTypeName))

(defnode CharTypeNode (PrimitiveTypeNode) ()
  "The type char."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature isAssignableFromConstant
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode ByteTypeNode (PrimitiveTypeNode) ()
  "The type byte."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature isAssignableFromConstant
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode ShortTypeNode (PrimitiveTypeNode) ()
  "The type short."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature isAssignableFromConstant
        unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode IntTypeNode (PrimitiveTypeNode) ()
  "The type int."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode FloatTypeNode (PrimitiveTypeNode) ()
  "The type float."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode LongTypeNode (PrimitiveTypeNode) ()
  "The type long."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode DoubleTypeNode (PrimitiveTypeNode) ()
  "The type double."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	unqualifiedTypeName
	decl:type
	cPrimitiveTypeName))

(defnode TypeNameNode (TypeNode) (name)
  "A type denoted by the NAME."
  (kind typeIdentNM
	isAssignableFromConstant
	hasReference
	decl:class signature instantiate
	isSharedField
	templateDepth
	isAtomic resolveTypes isNamedType
	emitNullifyLocal
	needsProtection
	subcastTo
	localCastTo
	sharingCastTo
	inferSharingEarly
	cDescriptorTypeCreate
	cTypeCreateUnboxed))

(defnode JavaArrayTypeNode (ArrayTypeNode) (elementType)
  "The type ELEMENTTYPE []."
  (kind signature decl:type
	dimensionTypeName
	isJavaArrayType
	indexType
	subsimilarTo
	cTypeCreateUnboxed))


(defnode CompileUnitNode () (ident package imports types environ)
  "The compilation unit 
    package PACKAGE;   -- NameNode::omitted if absent 
    IMPORTS            -- See ImportNode and ImportOnDemandNode 
    TYPES	       -- See ClassDeclNode"
  (loaded
   resolvePackage resolveTypes resolveClass resolveName foldConstants
   resolveInstantiation
   lookForMain
   verifyCircularity reportCircularity
   resolveField typecheck widen single rewrite
   resolveInheritance packageResolution
   importOnDemand importOnDemand2
   selectedForCodeGen isExported
   codeGen:void pseudoprint
   inferLocalTree
   localEnactChildren
   inferSharingLateTree
   sharingEnactChildren
   emitDebugInfo checkIF 
   lazyStaticSemantics
   optimizeMonitors)
  (thePackage importedPackages ranLazyStaticSemantics))

(defnode ImportNode () (name)
  "The type or package import declaration
    import NAME;"
  (resolveImports checkIF))

(defnode ImportOnDemandNode () (name)
  "The declaration
    import NAME.*;"
  (resolveImports checkIF))

(defnode ClassDeclNode (TypeDeclNode) (flags simpName superClass interfaces members)
  "The class declaration
    FLAGS class SIMPNAME extends SUPERCLASS implements INTERFACES {
	BODY
    }
FLAGS is a combination (logical or) of values of type Common::Modifiers.
SUPERCLASS is TypeNameNode::omitted if the 'extends' clause is absent.
MEMBERS is a list of declarations of fields (see FieldDeclNode), methods
(see MethodDeclNode), constructors (see ConstructorDeclNode), and
 static initializers (see StaticInitNode).  By convention, the first entry
in MEMBERS is initially TreeNode::omitted, and is available for replacement
by a compiler-constructed default constructor, if needed."
  (resolvePackage resolveClass resolveField
   resolveInheritance codeGen:void
   rewrite
   lookForMain
   inferSharingEarly
   emitDebugInfo
   selectedForCodeGen
   optimizeMonitors
   checkIF
   pseudoprint))

(defnode FieldDeclNode (DataDeclNode) (dtype simpName flags initExpr)
  "A declaration of a field in a class or interface declaration of the
form 
    FLAGS DTYPE SIMPNAME = INITEXPR;
or
    FLAGS DTYPE SIMPNAME;         -- Here, INITEXPR is ExprNode::omitted.
FLAGS is a combination (logical or) of values of type Common::Modifiers."
  (resolveClass resolveName resolveField codeGen decl _widen
		foldConstants typecheck single foldFields
		instantiate lower makeCfg
		infer
		enact
		inferLocal
		inferLocalTree
		localEnactChildren
		inferSharingLateTree
		inferSharingEarly
		emitDebugInfo
		sglobalData sglobalCall checkIF pseudoprint
		resolveRequires
		lookForMain))

(defnode VarDeclNode (DataDeclNode) (isfinal dtype simpName initExpr)
  "A declaration of a local variable in a method body of the form
    FLAGS DTYPE SIMPNAME = INITEXPR;
or
    FLAGS DTYPE SIMPNAME;         -- Here, INITEXPR is ExprNode::omitted.
FLAGS is a combination (logical or) of values of type Common::Modifiers.
ISFINAL is true if the variable was declared final."
  (destructor free
   resolveName codeGen decl _widen single
   resolveRequires lazyOptimize pseudoprint findDefs
   mangledIdent
   emitUse instantiate makeCfg rewrite checkIF)
  (_mangledIdent))

(defnode MethodDeclNode (MethodNode)
  (flags params returnType simpName throws overlaps body)
  "A method declaration of the form
    FLAGS RETURNTYPE SIMPNAME (PARAMS) throws THROWS OVERLAPS
    BODY 
FLAGS is a combination (logical or) of values of type Common::Modifiers.
RETURNTYPE is a type (any []s that follow the formal parameter list
must be incorporated into the RETURNTYPE).
PARAMS is a list of formal parameters (see ParameterNode).
THROWS is a list of type names (see TypeNameNode).
OVERLAPS is a list of overlap declations (see OverlapNode).
BODY is a block (see BlockNode).  If Common::Abstract is one of the
FLAGS, then BODY may be StmtNode::omitted."
  (resolveClass resolveName resolveField codeGen:source
		typecheck lazyOptimize collapseTrivialBlocks
		widen single unwindTree emitUse lower makeCfg
                setBblockRoot getBblockRoot isMain sglobalData sglobalCall
		setNodeStorage getNodeStorage
		infer
		inferLocalChildren
		localEnactChildren
		localEnactTree
		inferSharingLateChildren
		sharingEnactTree
		emitDebugInfo pseudoprint
		methodStatics setMethodStatics isSideEffectFree isPureFunction
		lookForMain getInlineInfo setInlineInfo)
  (bblockRoot nodeStorage _methodStatics _inlineInfo))

(defnode MethodSignatureNode (MethodNode)
  (flags params returnType simpName throws)
  "A method signature declaration of the form
    FLAGS RETURNTYPE SIMPNAME (PARAMS) throws THROWS 
FLAGS is a combination (logical or) of values of type Common::Modifiers.
RETURNTYPE is a type (any []s that follow the formal parameter list
must be incorporated into the RETURNTYPE).
PARAMS is a list of formal parameters (see ParameterNode).
THROWS is a list of type names (see TypeNameNode)."
  (resolveName codeGen
	       single sglobalData sglobalCall
	       methodStatics setMethodStatics isSideEffectFree isPureFunction
	       lookForMain)
  (_methodStatics))

(defnode OverlapNode ()
  (opnd0 opnd1)
  "A declaration that OPND0 may overlap OPND1. OPND0 and OPND1 are parameter names"
  (resolveName checkIF)
)

(defnode VoidTypeNode (PrimitiveTypeNode) ()   
  "The type void."
  (kind kindsAssignableTo kindsCastableTo signature formalSignature
	hasFormalSignature
	decl:type
	unqualifiedTypeName
	typeName
	modifiers
	cPrimitiveTypeName))

(defnode ConstructorDeclNode () (flags params simpName throws constructorCall body)
  "A declaration of a constructor of the form
    FLAGS SIMPNAME ( PARAMS ) throws THROWS
    {
        CONSTRUCTORCALL;
        BODY
    }
FLAGS is a combination (logical or) of values of type Common::Modifiers.
PARAMS is a list of formal parameters (see ParameterNode).
THROWS is a list of type names (see TypeNameNode).
CONSTRUCTORCALL is an explicit call to a constructor in this class or
the superclass (see ThisConstructorCallNode and SuperConstructorCallNode).
BODY is a block (see BlockNode).
VALID is used to detect circular constructor calls."
  (resolveClass resolveName resolveField codeGen:source returnType rewrite
		decl:method single valid updateConstructorValidity
		typecheck emitUse unwindTree foldFields lazyOptimize
		instantiate lower makeCfg sglobalData sglobalCall
		collapseTrivialBlocks
		infer
		inferLocalChildren
		inferLocalTree
		localEnactChildren
		inferSharingLateChildren
		inferSharingLateTree
		inferSharingLate
		sharingEnact
 		setBblockRoot
		setNodeStorage getNodeStorage
		unshareType emitDebugInfo checkIF getBblockRoot pseudoprint
		setMethodStatics methodStatics isSideEffectFree isPureFunction
		lookForMain getInlineInfo setInlineInfo)
   (bblockRoot nodeStorage _methodStatics _inlineInfo))

(defnode ThisConstructorCallNode () (args decl valid)
  "An explict call to a constructor:
    this(ARGS);
where ARGS is a list of argument expressions."
  (resolveField _widen single sglobalCall
   infer
   inferSharingLate
   lower
   isSideEffectFree isPureFunction))

(defnode SuperConstructorCallNode () (args decl)
  "An explict call to a constructor in the superclass:
    super(ARGS);
where ARGS is a list of argument expressions."
  (resolveField _widen single sglobalCall
   infer
   inferSharingLate
   lower
   isSideEffectFree isPureFunction))

(defnode StaticInitNode () (block)
  "A static initializer of the form
    static BLOCK
BLOCK is a block (see BlockStmt).  (Note: This node has a 'createDecl' for
convenience, but it should return NULL)."
  (resolveClass resolveField codeGen typecheck single foldFields pseudoprint
		collapseTrivialBlocks sglobalData sglobalCall checkIF
		lookForMain))

(defnode InterfaceDeclNode (TypeDeclNode) (flags simpName interfaces members)
  "The interface declaration
    FLAGS interface SIMPNAME extends INTERFACES {
	BODY
    }
FLAGS is a combination (logical or) of values of type Common::Modifiers.
INTERFACES is a list of TypeNameNode::omitted if the 'extends' 
clause is absent.
BODY is a list of declarations of fields (see FieldDeclNode), and method
signatures (see MethodSignatureNode)."
  (resolvePackage resolveClass
		  lookForMain
		  codeGen:void resolveInheritance
		  emitDebugInfo checkIF))

(defnode ArrayInitNode (ExprNode) (initializers)
  "An expression of the form
    { INITIALIZERS }
used to initialize an array.  
INITIALIZERS is a list of expressions (possibly including other
ArrayInitNodes)."
  (__type typecheck _widen emitExpression single checkIF
	  infer
	  getValues))

(defnode BlockNode (StatementNode) (stmts)
  "A statement of the form
    { STMTS }
STMTS is a list of statements."
  (resolveName single emitStatement lower makeCfg checkIF pseudoprint
	       declContainer blockContext
	       deleteStmts collapseTrivialBlocks)
  (_declContainer _blockContext))

(defnode EmptyStmtNode (StatementNode) ()
  "The empty statement (;)" 
  (emitStatement single makeCfg checkIF pseudoprint))

(defnode GotoNode (StatementNode) (destination)
  "A goto.  Used in IF and backend only."
  (emitStatement makeCfg checkIF pseudoprint))

(defnode LabeledStmtNode (StatementNode) (label stmt)
  "A statement of the form
    LABEL: STMT"
  (resolveName single emitStatement instantiate makeCfg checkIF
	       lower pseudoprint))

(defnode IfStmtNode (StatementNode) (condition thenPart elsePart)
  "A statement of the form
    if (CONDITION) THENPART else ELSEPART
ELSEPART may be StmtNode::omitted if absent."
  (emitStatement foldConstants typecheck single operatorName lower makeCfg
		 collapseTrivialBlocks
		 checkIF pseudoprint))

(defnode SwitchNode (StatementNode) (expr switchBlocks)
  "A statement of the form
    switch (EXPR) {
        SWITCHBLOCKS
    }
SWITCHBLOCKS is a list of SwitchBranchNodes."
  (resolveName emitStatement typecheck _widen single operatorName lower
	       makeCfg checkIF))

(defnode CaseNode () (expr)
  "A clause of the form
    case EXPR:
in a branch of a switch statement. Represents a 'default:' entry if
EXPR is ExprNode::omitted." 
  (codeGen checkIF))

(defnode SwitchBranchNode () (cases stmts)
  "A portion of a switch statement of the form
    CASES 
      STMTS
where CASES is a non-empty list of CaseNodes (representing case and default 
labels in a switch statement) and STMTS is a list of following statements."
  (operatorName checkIF))

(defnode WhileNode (LoopNode) (test stmt)
  "A \"while\" loop of the form
     while (TEST)
       STMT
where TEST is a boolean expression and STMT is any statement."
  (typecheck operatorName lower makeCfg
	     pseudoprint))

(defnode DoNode (LoopNode) (stmt test)
  "A \"while\" loop of the form
     do
       STMT
     while (TEST);
where STMT is any statement and TEST is a boolean expression."
  (typecheck operatorName lower makeCfg
	     pseudoprint))

(defnode ForNode (IterationNode) (init test update stmt)
  "A loop of the form
      for (INIT; TEST; UPDATE) STMT
INIT is a list of declarations or statement expressions.
TEST is a boolean expression.
UPDATE is a list of statement expressions."
  (resolveName typecheck single operatorName lower makeCfg
	       pseudoprint))

(defnode BreakNode (StatementNode) (label destination cleanups)
  "The statement 
    break LABEL;
LABEL is NameNode::omitted when absent.  CLEANUPS is a sequence of
finalization or cleanup operations to be performed before control is
transfered."
  (resolveName single makeCfg
	       collectCleanups))

(defnode ContinueNode (StatementNode) (label destination cleanups)
  "The statement 
    continue LABEL;
LABEL is NameNode::omitted when absent.  CLEANUPS is a sequence of
finalization or cleanup operations to be performed before control is
transfered."
  (resolveName single makeCfg
	       collectCleanups))

(defnode ReturnNode (StatementNode) (expr cleanups)
  "The statement 
    return EXPR;
EXPR is ExprNode::omitted when absent.  CLEANUPS is a sequence of
finalization or cleanup operations to be performed before the value is
returned."
  (codeGen _typecheck _widen single operatorName lower makeCfg rewrite
	   collectCleanups
	   infer
	   checkIF pseudoprint))

(defnode ThrowNode (StatementNode) (expr)
  "The statement 
    throw EXPR;"
  (_typecheck single _widen operatorName emitStatement lower makeCfg
	      inferSharingLate
	      checkIF pseudoprint))

(defnode SynchronizedNode (StatementNode) (expr stmt)
  "The statement
    synchronized (EXPR) STMT
STMT is a block (see BlockNode).  The rewrite phase replaces these
nodes with more primitive monitor manipulating operations; see
MonitorFetchNode and MonitorUseNode."
  (_typecheck operatorName single rewrite collapseTrivialBlocks
	      pseudoprint))

(defnode CatchNode () (param block)
  "The clause
    catch (PARAM) BLOCK
PARAM is a parameter (see ParameterNode).  BLOCK is a block (see BlockNode)."
  (resolveName operatorName emitCatchTable emitUse
	       inferLocal
	       inferSharingLate
	       checkIF
	       resolveRequires pseudoprint))

(defnode TryNode () (block)
  "The clause
    try 
      BLOCK
BLOCK is a block (see BlockNode)."
  (single unwindSelf checkIF pseudoprint))

(deflistnode CatchListNode
  "A sequence of catch clauses.  LIST is a list of catch clauses."
  (codeGen unwindSelf makeCfg checkIF))

(defnode FinallyNode () (block)
  "The clause
    finally BLOCK
BLOCK is a block (see BlockNode)."
  (operatorName single checkIF pseudoprint))

(defnode TryStmtNode (StatementNode) (block catches finally)
  "The statement
    try 
      BLOCK
    CATCHES
    finally FINALLY
BLOCK is a TryNode; CATCHES is a CatchListNode; FINALLY is either a
FinallyNode or omitted."
  (typecheck single operatorName emitStatement checkIF
	     makeCfg
	     getExceptionCfg
	     unwindTry pseudoprint)
  (_cfgCatch _cfgFinally popState))

(defnode ExpressionStmtNode (StatementNode) (expr)
  "A statement consisting only of an expression.  Presumably the
expression is to be evaluated for its side effects (e.g. assignment)."
  (emitStatement single lower makeCfg checkIF pseudoprint deleteStmts))

(defnode DummyNode (StatementNode) (expr)
  "A dummy statement consisting only of an expression.  Code will
   not be generated for this statement.  Its purpose is only to
   enforce constraints within the optimizer.  For example, we may
   want to tell the optimizer that a certain variable is being used
   even if it looks like it isn't."
  (emitStatement checkIF makeCfg pseudoprint findMayMustReadWrite))

(defnode ParameterNode () (isfinal dtype simpName)
  "A formal parameter:
    DTYPE SIMPNAME
(Note: any []s that follow NAME in the concrete syntax are folded into
DTYPE here.) ISFINAL is true if the parameter was declared final."
  (resolveName
   findDefs
   _typecheck
   decl
   instantiate
   unshareType
   infer
   enact
   checkIF getUses setUses pseudoprint))

(defnode NullPntrNode (LitNode) ()
  "The null pointer, null."
  (__type emitExpression checkIF loopInvariant
	  getValues
	  infer
	  pseudoprint
	  mangle))

(defnode ThisNode (ExprNode) (theClass flags)
  "The expression `this' (could also be `super' in the backend)."
  (__type emitExpression resolveName resolveField single
	  simpleVar loopInvariant getValues
	  findMayMustReadWrite
	  infer
	  enact
	  inferSharingLate
	  checkIF pseudoprint 
	  setUses getUses setDefs getDefs hasLval isSimpleLvalue))

(defnode ArrayAccessNode (ExprNode) (array index)
  "The expression
    ARRAY[INDEX]"
  (__type emitExpression checkAssignable resolveField _widen typecheck single 
	  singleAssign operatorName rewrite sglobalDataAssign loopInvariant
	  isStrengthReduced cArrayHandler
	  isArrayAccessNode isLocalLvalue
	  isSharedAccess
	  getLvalue
	  receiveAssign
	  receiveAssign:qual
	  inferLocal
	  localReceiveAssign
	  inferSharingLate
	  lower:expr
	  computeMIVE
	  hasLval getDefs setDefs getUses setUses pseudoprint findDefs
	  findMayMustReadWrite
	  getValues handleAssignment))

(defnode JavaArrayAccessNode (ArrayAccessNode) (array index)
  "The expression
    ARRAY[INDEX]
where ARRAY is a Java array."
  (cArrayHandler
   getLvalue))

(defnode TitaniumArrayAccessNode (ArrayAccessNode) (array index)
  "The expression
    ARRAY[INDEX]
where ARRAY is a Titanium array."
  (cArrayHandler
   resolveRequires))

(defnode PointArrayAccessNode (ArrayAccessNode) (array index)
  "The expression
    ARRAY[INDEX]
where ARRAY is a point."
  (isSimpleLvalue
   isLocalLvalue
   isSharedAccess
   emitExpression
   receiveAssign:qual))

(defnode ObjectNode (ExprNode) (name)
  "A reference to variable NAME in an expression.  (Note: the concrete
grammar cannot distinguish between a field access and qualified
variable name reference.  This node may therefore get replaced later.)"
  (__type resolveName decl
	  checkAssignable single singleAssign isd
	  emitExpression getLvalue isLocalLvalue
	  sglobalDataAssign  isSimpleLvalue computeMIVE
	  simpleVar
	  findMayMustReadWrite
	  infer
	  receiveAssign:qual
	  loopInvariant
	  getValues handleAssignment 
	  setUses getUses setDefs getDefs hasLval pseudoprint))

(defnode ObjectFieldAccessNode (FieldAccessNode) (object simpName)
  "A reference to a field of a general object of the form
    OBJECT.SIMPNAME
   (Note: see the node for ObjectNode.)
   isRewrittenSFAN flags a ObjectFieldAccessNode that used to be a SuperFieldAccessNode"
  (resolveName resolveField accessedObjectType single checkAssignable
	       fieldChainParent
               emitExpression emitMethodCall loopInvariant
	       receiveAssign getLvalue isLocalLvalue
	       findMayMustReadWrite
               makeCfg
	       inferLocal
	       localReceiveAssign
	       inferSharingLate
	       canCallStatically
	       lower:expr
	       pseudoprint
               getValues handleAssignment
	       getIsRewrittenSFAN setIsRewrittenSFAN
	       isSharedAccess)
  (_isRewrittenSFAN))

(defnode TypeFieldAccessNode (FieldAccessNode) (ftype simpName)
  "A reference to a field of a type of the form
    FTYPE.SIMPNAME"
  (resolveField foldConstants accessedObjectType instantiate 
		emitExpression emitMethodCall receiveAssign loopInvariant
		getLvalue isLocalLvalue
		makeCfg
		findMayMustReadWrite
		inferLocal
		inferSharingLate
		inferSharingEarlyChildren
		resolveName pseudoprint
		isSharedAccess
		getValues handleAssignment))

(defnode ThisFieldAccessNode (FieldAccessNode) (theClass flags simpName)
  "A reference to a field or method named SIMPNAME in 'this'.
   This type of node is rewritten to a ObjectFieldAccessNode later."
  (resolveName foldConstants resolveField accessedObjectType singleAssign
	       pseudoprint
	       checkAssignable
	       rewrite
	       makeCfg
	       sglobalDataAssign
	       isSharedAccess))

(defnode SuperFieldAccessNode (FieldAccessNode) (theClass flags simpName)
  "A reference to a field or method in the superclass of the form
    super.SIMPNAME
   This type of node is rewritten to a ObjectFieldAccessNode later."
  (resolveName
   resolveField
   accessedObjectType
   rewrite
   pseudoprint
   makeCfg))

(defnode MethodCallNode (ExprNode) (method args)
  "A method call of the form
    METHOD (ARGS)
METHOD is a field access (type xxxFieldAccessNode*).
ARGS is a list of expressions."
  (destructor
   __type resolveName resolveField emitExpression _widen
   _typecheck
   fieldChainParent
   decl:method
   single isPureFunction loopInvariant computeMIVE
   isSideEffectFree
   lower:expr
   makeCfg
   resolveRequires findDefs
   infer
   inferLocal
   inferSharingLate
   rebind
   sglobalCall pseudoprint
   findMayMustReadWrite
   getValues modifiesValues setModifiesValues)
  (_modifiesValues))

(defnode MethodCallAssignNode (ExprNode) (method args)
  "An expression of the form
    o = o.f (ARGS) where METHOD = o.f
METHOD is a field access (type ObjectFieldAccessNode*).
ARGS is a list of expressions.
In other words, this is a method call followed by an assignment, but the
target is evaluated only once. This is generated after resolution of
overloaded op= operators."
  (__type
   _typecheck
   fieldChainParent
   _widen
   decl:method
   single
   widenSource
   castResult
   lower:expr
   infer
   sglobalData sglobalCall))

(defnode AllocateNode (ExprNode) (region dtype args decl)
  "An expression of the form
    new (REGION) DTYPE (ARGS).
REGION may be an ommitted node.
DECL is the resolved declaration of the appropriate constructor."
  (__type resolveField emitExpression
	  _widen single resolveRequires
	  typecheck _typecheck
	  lower:expr
	  sglobalCall
	  infer
	  enact
	  findAllocateNode
	  pseudoprint getValues isSideEffectFree isPureFunction
	  modifiesValues setModifiesValues)
  (_modifiesValues))

(defnode AllocateSpaceNode (ExprNode) (region dtype)
  "The lowered form of AllocateNode for most types.
	 Inserted by lowering, Used in IF and backend only.
   This node simply returns a pointer to memory space
   of the correct size for the given type (essentially just a malloc()).
   Constructor calls get lowered into a separate MethodCallNode."
  (__type emitExpression resolveRequires
	  lower:expr
	  pseudoprint))

(defnode AllocateArrayNode (ExprNode) (region dtype dimExprs)
  "An expression of the form
    new (REGION) DTYPE DIMEXPRS ARRAYSPECIFIERS ...
REGION may be an ommitted node.
DTYPE is the DTYPE ARRAYSPECIFIERS type."
  (__type emitExpression _widen
	  typecheck _typecheck
	  single resolveTypes
	  lower:expr
	  resolveRequires
	  infer
	  enact
	  pseudoprint getValues))

(defnode PostIncrNode (IncrDecrNode) (opnd0)
  "The expression 
    OPND0 ++"
  (operatorName pseudoprint))

(defnode PostDecrNode (IncrDecrNode) (opnd0)
  "The expression 
    OPND0 --"
  (operatorName pseudoprint))

(defnode UnaryPlusNode (UnaryArithNode) (opnd0)
  "The expression 
    + OPND0"
  (emitExpression computeMIVE foldMask _fold operatorName pseudoprint))

(defnode UnaryMinusNode (UnaryArithNode) (opnd0)
  "The expression 
    - OPND0"
  (emitExpression computeMIVE foldMask _fold operatorName pseudoprint))

(defnode PreIncrNode (IncrDecrNode) (opnd0)
  "The expression 
    ++ OPND0"
  (operatorName pseudoprint))

(defnode PreDecrNode (IncrDecrNode) (opnd0)
  "The expression 
    -- OPND0"
  (operatorName pseudoprint))

(defnode ComplementNode (ExprNode) (opnd0)
  "The expression 
    ~ OPND0"
  (__type emitExpression _widen _typecheck foldMask _fold single
	  _resolveOperators operatorName
	  lower:expr
	  pseudoprint loopInvariant))

(defnode NotNode (ExprNode) (opnd0)
  "The expression 
    ! OPND0"
  (__type emitExpression _typecheck foldMask _fold single _resolveOperators
	  operatorName
	  lower:expr
	  pseudoprint loopInvariant))

(defnode CastNode (DynamicTypeNode) (opnd0 dtype)
  "The expression 
    (DTYPE) OPND0"
  (__type
   emitExpression
   foldMask _fold computeMIVE
   lower:expr
   single operatorName asType2 isArraySpecifier
   unshareType
   enact
   pseudoprint getValues))

(defnode MultNode (BinaryArithNode) (opnd0 opnd1)
  "The expression
    OPND0 * OPND1"
  (emitExpression computeMIVE foldMask _fold operatorName pseudoprint))

(defnode DivNode (BinaryArithNode) (opnd0 opnd1)
  "The expression
    OPND0 / OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode RemNode (BinaryArithNode) (opnd0 opnd1)
  "The expression
    OPND0 % OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode PlusNode (BinaryArithNode) (opnd0 opnd1)
  "The expression
    OPND0 + OPND1"
  (__type emitExpression _widen _typecheck foldMask _fold computeMIVE
	  resolveConcat _resolveOperators operatorName pseudoprint))

(defnode StringConcatNode (ExprNode) (addends)
  "The expression
    OPND0 + OPND1 + ... + OPNDn
when used to concatenate strings."
  (__type single operatorName
	  rewrite
	  buildConcatTree
	  buildMethodCall
	  buildToStringCall
	  infer))

(defnode StringConcatAssignNode (StringConcatNode) (opnd0 addends)
  "The expression
    OPND0 += OPND1 + ... + OPNDn
when used to concatenate strings."
  (single
   operatorName
   rewrite
   sglobalData))

(defnode MinusNode (BinaryArithNode) (opnd0 opnd1)
  "The expression
    OPND0 - OPND1"
  (emitExpression computeMIVE foldMask _fold operatorName pseudoprint))

(defnode LeftShiftLogNode (ShiftNode) (opnd0 opnd1)
  "The expression
    OPND0 << OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode RightShiftLogNode (ShiftNode) (opnd0 opnd1)
  "The expression
    OPND0 >> OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode RightShiftArithNode (ShiftNode) (opnd0 opnd1)
  "The expression
    OPND0 >>> OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode LTNode (RelationNode) (opnd0 opnd1)
  "The expression
    OPND0 < OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode GTNode (RelationNode) (opnd0 opnd1)
  "The expression
    OPND0 > OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode LENode (RelationNode) (opnd0 opnd1)
  "The expression
    OPND0 <= OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode GENode (RelationNode) (opnd0 opnd1)
  "The expression
    OPND0 >= OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode InstanceOfNode (DynamicTypeNode) (opnd0 dtype)
  "The expression
    OPND0 instanceof DTYPE"
  (__type emitExpression _typecheck single operatorName
	  lower:expr
	  unshareType
	  enact
	  pseudoprint))

(defnode EQNode (EqualityNode) (opnd0 opnd1)
  "The expression
    OPND0 == OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode TitaniumArrayEQNode (EqualityNode) (opnd0 opnd1)
  "The expression OPND0 == OPND1 for Titanium arrays only.  This type of node
    may be created by the backend.  Normally the comparison of Titanium arrays
    is done in an EQNode and will generate a compile-time error unless one
    of the operands is null."
  (emitExpression operatorName pseudoprint))

(defnode NENode (EqualityNode) (opnd0 opnd1)
  "The expression
    OPND0 != OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode BitAndNode (BitwiseNode) (opnd0 opnd1)
  "The expression
    OPND0 & OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode BitOrNode (BitwiseNode) (opnd0 opnd1)
  "The expression
    OPND0 | OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode BitXorNode (BitwiseNode) (opnd0 opnd1)
  "The expression
    OPND0 ^ OPND1"
  (emitExpression foldMask _fold operatorName pseudoprint))

(defnode CandNode (LogCondNode) (opnd0 opnd1)
  "The expression
    OPND0 && OPND1"
  (foldMask _fold operatorName
	    lower:expr
	    pseudoprint))

(defnode CorNode (LogCondNode) (opnd0 opnd1)
  "The expression
    OPND0 || OPND1"
  (foldMask _fold operatorName
	    lower:expr
	    pseudoprint))

(defnode IfExprNode (ExprNode) (condition thenOpnd elseOpnd)
  "The expression
    COND ? THENOPND : ELSEOPND"
  (__type _widen _typecheck foldConstants single
	  operatorName
	  lower:expr	  
	  infer
	  inferSharingLate))

(defnode AssignNode (ExprNode) (opnd0 opnd1)
  "The expression
    OPND0 = OPND1"
  (__type _widen _typecheck single resolveField operatorName
	  findMayMustReadWrite
	  lower:expr
	  sglobalData findDefs
	  emitExpression loopInvariant computeMIVE
	  infer
	  inferLocal
	  inferSharingLate
	  checkIF pseudoprint))

(defnode MultAssignNode (BinaryArithAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 *= OPND1"
  (operatorName pseudoprint))

(defnode DivAssignNode (BinaryArithAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 /= OPND1"
  (operatorName pseudoprint))

(defnode RemAssignNode (BinaryArithAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 %= OPND1"
  (operatorName pseudoprint))

(defnode PlusAssignNode (BinaryArithAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 += OPND1"
  (_widen _typecheck resolveConcat
		   operatorName pseudoprint widenSource castResult))

(defnode MinusAssignNode (BinaryArithAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 -= OPND1"
  (operatorName pseudoprint))

(defnode LeftShiftLogAssignNode (ShiftAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 <<= OPND1"
  (operatorName pseudoprint))

(defnode RightShiftLogAssignNode (ShiftAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 >>= OPND1"
  (operatorName pseudoprint))

(defnode RightShiftArithAssignNode (ShiftAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 >>>= OPND1"
  (operatorName pseudoprint))

(defnode BitAndAssignNode (BitwiseAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 &= OPND1"
  (operatorName pseudoprint))

(defnode BitXorAssignNode (BitwiseAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 ^= OPND1"
  (operatorName pseudoprint))

(defnode BitOrAssignNode (BitwiseAssignNode) (opnd0 opnd1)
  "The expression
    OPND0 |= OPND1"
  (operatorName pseudoprint))

;;; Titanium Nodes

(defnode PointTypeNode (TypeNode) (expr)
  "The type Point<EXPR>"
  (kind decl:class signature formalSignature hasFormalSignature
	isAtomic isPointType
	isArrayType indexType
	isWriteableArrayType elementType tiArity _typecheck
	emitNullifyLocal
	cDescriptorTypeCreate
	cTypeCreateUnboxed pseudoprint))

(defnode RectDomainTypeNode (TypeNode) (expr)
  "The type RectDomain<EXPR>"
  (kind decl:class signature formalSignature hasFormalSignature isAtomic
	isDomainType isRectDomainType
	tiArity _typecheck
	emitNullifyLocal
	cDescriptorTypeCreate
	cTypeCreateUnboxed pseudoprint))

(defnode DomainTypeNode (TypeNode) (expr)
  "The type Domain<EXPR>"
  (kind decl:class signature formalSignature hasFormalSignature
	isDomainType
	tiArity _typecheck
	needsProtection
	localCastTo
	sharingCastTo
	cDescriptorTypeCreate
	cTypeCreateUnboxed pseudoprint))

(defnode TitaniumArrayTypeNode (ArrayTypeNode) (elementType expr)
  "The type ELEMENTTYPE array<EXPR>."
  (kind decl:class signature
	selectedForCodeGen
	dimensionTypeName
	isTitaniumArrayType
	indexType tiArity _typecheck
	emitGlobalize emitLocalize
	emitNullifyLocal
	subsimilarTo
	cTypeCreateBoxed
	cTypeCreateUnboxed pseudoprint))

(defnode ForEachPairNode () (simpName initExpr)
  "A pair of the form SIMPNAME in INITEXPR in a foreach statement"
  (checkIF lower pseudoprint findDefs))

(defnode ForEachSetupNode (StatementNode) (WRTloop)
  "Create the pointers and increments necessary for strength reduction."
  (emitStatement checkIF))

(defnode StrippedForEachNode (StatementNode) (stmt)
  "Execute the loop but don't setup SR pointers or declare variables
   that have already been declared by the matching ForEachSetupNode.
   stmt is a ForEachStmtNode."
  (emitStatement checkIF))

(defnode UpdatePointBeforeStmtNode (StatementNode)
  (stmt pointValues rfrs sirs urs WRTloop)
  "Update the iteration point---and SR pointers, if any---before executing
   stmt.  Created by loop reordering optimizations."
  (emitStatement valuesAreDeltas checkIF applyReordering)
  (_valuesAreDeltas))

(defnode ForEachStmtNode (StatementNode) (vars stmt isinline)
  "A statement of the form 'foreach (VARS) INLINE STMT'
INLINE is true if the inline keyword was included in the foreach"
  (destructor
   setParallel
   getParallel
   resolveName resolveField typecheck checkIF strengthReduce
   emitStatement single operatorName liftInvariantExprs
   invariants loopAnal defs computeForeachDominators
   lifted_invariants
   lower makeCfg pseudoprint needPoint
   saveSRinfo
   shouldDeclare
   emitSetup
   cannotBeEmpty getCannotBeEmpty
   useOfArray
   tiArity
   partialDomain
   numLifted
   lo hi stride ordered tentative
   getLo getHi getStride getOrdered getTentative
   junk_pre
   junk_post
   blockContext
   isLoop)
  (_defs _needPoint _numLifted
	 _lo _hi _stride _ordered _tentative
	 _parallel
	 _junk_pre
	 _junk_post
	 _lifted_invariants
	 _invariants
	 _saveSRinfo
	 _shouldDeclare
	 _blockContext
	 _cannotBeEmpty
	 arrayAccesses SR _partialDomain))

(defnode ReorderNode (StatementNode) (stmt stmtsToDelete declsToDelete remap)
  "A node introduced by stoptifu that will be removed before codegen."
  (checkIF makeCfg applyReordering destructor pseudoprint))

(defnode PartitionStmtNode (StatementNode) (simpName cases)
  "A statement of the form 'partition SIMPNAME { CASES }'"
  (resolveName typecheck emitStatement single))

(defnode PartitionClauseNode () (condition stmt)
  "One clause of the form COND => STMT in a partition statement"
  (resolveName operatorName))

(defnode BroadcastNode (ExprNode) (expr proc)
  "An expression, used in the frontend only, of the form
   broadcast EXPR from PROC"
  (__type
   _widen
   _typecheck
   checkEmbeddedLocals
   single
   operatorName
   lower:expr
   infer
   inferLocal
   inferSharingEarly
   pseudoprint))

(defnode PointNode (ExprNode) (args)
  "A point constructor [ ARGS ]"
  (__type _typecheck _widen emitExpression single operatorName loopInvariant
	  lower:expr
	  computeMIVE pseudoprint asType2 isArraySpecifier))

(defnode DomainNode (ExprNode) (args)
  "A domain constructor [ ARGS ]
the element of ARGS are either all 2 expressions or 3 expressions
(using TreeListNode)"
  (__type _typecheck rewrite _widen emitExpression single operatorName
          resolveRequires pseudoprint
lower:expr
 loopInvariant))

;;; Special nodes used to parse [ stuff ] (due to ambiguity between
;;; [...] in array access/type declaration/new

(defnode EmptyArrayNode () (flags) 
  "Represents [ ] FLAGS"
  (asExpr2 asType2 resolveNewArray))

(defnode ExpressionArrayNode () (expr flags)
  "Represents [ EXPR ] FLAGS"
  (asExpr2 asType2 resolveNewArray))

(defnode TitaniumArrayNode () (expr flags)
  "Represents [ EXPR d ] FLAGS"
  (asExpr2 asType2 resolveNewArray))

(defnode AllocateArrayDimensionNode () (expr flags)
  "One of the DIMEXPRS in a NEW DTYPE DIMEXPRS expression. The FLAGS are the
qualifiers added after the dimension"
  (single lower checkIF resolveNewArray
   isInferable
   enactDimension
   pseudoprint))

(defnode ArrayNameNode () (name flags arrayspecifiers)
  "Represents NAME FLAGS ARRAYSPECIFIERS (a list of 
Empty/Expression/TitaniumArrayNode)."
  (fixTemplateActual:expr
   fixTemplateActual:type
   asExpr asType))
 
;;; Nodes that don't arise during parsing.

(defnode PragmaNode (StatementNode) (stmt requests)
  "Represents pragmas."
  (checkIF isPragma makeCfg findDefs emitStatement pseudoprint))

(defnode HasNoOverlapNode (ExprNode) (opnd0 opnd1)
  "An expression that is true iff grid OPND0 does not overlap grid OPND1.
   Generated in the backend."
  (__type emitExpression pseudoprint))

(defnode SRArrayAccessNode (ArrayAccessNode) (array index WRTloop codeString
						    appearsOnEveryIter)
  "A strength-reduced array access.  Originally ARRAY[INDEX], but will be
   handled specially by the backend."
  (cArrayHandler isStrengthReduced makeCfg pseudoprint))

(defnode OSRArrayAccessNode (ArrayAccessNode) (array index WRTloop codeString
						     offsetString
						     appearsOnEveryIter)
  "A strength-reduced array access.  Originally ARRAY[INDEX], but will be
   handled specially by the backend."
  (cArrayHandler isStrengthReduced makeCfg pseudoprint))

(defnode IBroadcastNode (ExprNode) (expr proc)
  "An expression of the form
   broadcast v1 from v2
   where v2 is the evaluation PROC and v1 is the evaluation of EXPR
   on the appropriate proc.  Used in the IF and backend only."
  (__type emitExpression pseudoprint getValues))

(defnode StringConcatAssignPreLoweringNode (ExprNode) (opnd0)
  "OPND0 must be an assignment statement generated by
    StringConcatAssignNode::rewrite."
  (__type
   lower:expr
   infer))

(defnode MethodTypeNode (TypeNode) (paramTypes returnType throws)
  "A tree representing the type of a method.  
PARAMTYPES is a list of TypeNodes that represent the types of the formal
parameters (not including the implicit parameter 'this').  
RETURNTYPE is the type of the returned value.
THROWS is the exceptions thrown by this method."
  (kind
   hasReference
   isCallableWith signature modifiers
   unqualifiedTypeName
   typeName
   isMain
   conservative identicalTo
   weaklySubsumedBy))

(defnode NullTypeNode (PrimitiveTypeNode) ()
  "A tree representing the 'type' of null."
  (kind
   unqualifiedTypeName
   typeName
   isNullType modifiers
   decl:type
   cPrimitiveTypeName))

(defnode ArrayInitializerTypeNode (TypeNode) ()
  "A tree representing the 'type' of array initializers."
  (kind
   unqualifiedTypeName))

(defnode CodeLiteralNode (StatementNode) (codeString)
  "Used for generating literal C code"
  (emitStatement checkIF makeCfg pseudoprint))

(defnode CodeLiteralExprNode (ExprNode) (codeString)
	 "Used for generating literal C code.  Used for some side-effect
          free exprs in IF (e.g., MYPROC)."
	 (__type emitExpression pseudoprint))

(defnode CodeLiteralFieldAccessNode (ExprNode) (opnd0 codeString)
	 "Used for generating literal C code to access a field."
	 (__type emitExpression pseudoprint checkIF))

(defnode LazyOptimizeNode () (body)
  "In the backend, this is used to indicate that body should be
   optimized before code generation." 
  (codeGen emitExpression pseudoprint))

(defnode MonitorFetchClassNode (MonitorFetchNode) (decl)
  "The act of fetching the monitor lock associated with a class.  This
is used to implement static synchronized blocks and methods.
Attribute DECL identifies the class whose lock is to be retrieved."
  (superfluous
   optimizeMonitors
   emitStatement))

(defnode MonitorFetchInstanceNode (MonitorFetchNode) (expr)
  "The act of fetching the monitor lock associated with an Object
instance given by EXPR.  This is used to implement nonstatic
synchronized blocks and methods."
  (lower
   inferSharingLate
   superfluous
   optimizeMonitors
   emitStatement))

(defnode MonitorLockNode (MonitorUseNode) (fetcher)
  "Acquires the monitor lock previously fetched by FETCHER."
  (emitStatement))

(defnode MonitorUnlockNode (MonitorUseNode) (fetcher)
  "Releases the monitor lock previously fetched by FETCHER."
  (emitStatement))

(defnode CheckNullNode (StatementNode) (expr)
  "Throw a NullPointerException if EXPR evaluates to null."
  (checkIF
   makeCfg
   emitStatement))

;; Templates

(defnode TemplateInstanceTypeNode (TypeNode) (dtype args decl:class)
  "A specific template instance DTYPE < ARGS >, where DTYPE identifies
the template and ARGS is a list of type and expression nodes.
Attribute DECL represents a fully instantiated class or interface
declaration, or is null if the template has not yet been instantiated."
  (resolveTypes
   checkTemplateUse
   resolveTemplate
   resolveTemplate:decl
   templateDepth
   kind
   isPrimitive
   unqualifiedTypeName
   typeIdentNM
   checkIF))

(defnode TemplateDeclNode () (basis params environ)
  "A template declaration of the form
    template < PARAMS > BASIS
BASIS is a class or interface declaration: either a ClassDeclNode or
an InterfaceDeclNode.  PARAMS is a node list containing formal
template parameters: a mix of TemplateTypeParamNodes and
TemplateConstParamNodes.  ENVIRON is an environment binding each template
formal parameter name to the corresponding actual argument."
  (decl:class
   resolvePackage
   resolveTypes
   resolveClass
   resolveInheritance
   resolveName
   foldConstants
   resolveTemplate
   foldFields
   verifyCircularity
   reportCircularity
   resolveField
   resolveConcat
   typecheck
   sglobalData
   sglobalCall
   single
   rewrite
   widen
   lower
   collapseTrivialBlocks
   checkIF
   resolveRequires
   unshareTypeTree
   inferLocalTree
   inferSharingLateTree
   inferSharingEarlyTree
   localEnactTree
   sharingEnactTree
   collectCleanups
   lookForMain
   selectedForCodeGen
   optimizeMonitors
   emitDebugInfo))

(defbasenode TemplateParamNode () t
  "A template formal parameter.")

(defnode TemplateConstParamNode (TemplateParamNode) (dtype simpName)
  "A template formal parameter named SIMPNAME, representing a constant
expression of type DTYPE."
  (fixTemplateActual:parm
   checkTemplateFormal
   checkTemplateActual:parm
   bindPseudonym))

(defnode TemplateTypeParamNode (TemplateParamNode) (simpName)
  "A template formal parameter named SIMPNAME, representing a qualified
type."
  (fixTemplateActual:parm
   checkTemplateFormal
   checkTemplateActual:parm
   bindPseudonym))

(defnode TemplateInstanceDeclNode () (instance environ)
  "A syntactically invisible node that appears as the parent of any
TypeDeclNode resulting from template instantiation.  The purpose of
this special parent node is to hold an additional environment.  That
environment binds template formal names to the corresponding actual
instantiation arguments."
  (resolveTypes
   checkIF))
