vrq
cparam.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (C) 1997-2007, Mark Hummel
3  * This file is part of Vrq.
4  *
5  * Vrq is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * Vrq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA
19  *****************************************************************************
20  */
21 /******************************************************************************
22  *
23  *
24  * cparam.hpp
25  * - class definition of parameter
26  * definition nodes
27  *
28  ******************************************************************************
29  */
30 
31 #ifndef CPARAM_HPP
32 #define CPARAM_HPP
33 
34 #include <stdio.h>
35 #include "glue.h"
36 #include "cnode.h"
37 #include "cdecl.h"
38 
39 
40 class CNode;
41 
42 
46 class CParam: public CDecl
47 {
48 private:
49  CNode* expression;
50  int specify;
51  int inlined;
52 public:
61  CParam( CSymbol* symbol, Coord_t* aLoc,
62  Decl_t type, CDataType* dataType );
68  virtual CDecl* Clone( CObstack* heap );
73  void Specify( int v ) { specify = v; }
78  int Specify( void ) { return specify; }
83  void SetExpression( CNode* aExp );
88  CNode* GetExpression( void );
93  virtual NodeType_t GetNodeType( void );
99  virtual int IsWidthConstant( void );
105  virtual int IsWidthVolatile( void );
110  virtual int IsWidthEvaluateable( void );
115  virtual INT32 GetWidth( void );
120  virtual CNode* GetWidthExp( void );
125  virtual CNode* GetMsb();
130  virtual CNode* GetLsb();
135  virtual void Dump( FILE* f );
141  void SetInlined( int v ) { inlined = v; }
147  int GetInlined() { return inlined; }
152  void PreVisit1( int (*func)(CNode*,void*), void* data );
153  void PostVisit1( void (*func)(CNode*, void*), void* data );
154  void PostSubVisit1( CNode* (*func)(CNode*, void*), void* data );
155 protected:
159  void Copy( CObstack* heap, CParam& param );
160 private:
161  /*
162  * Disable copy constructor.
163  */
164  CParam( const CParam& param );
168 };
169 
170 #endif // CPARAM_HPP
CNode * GetExpression(void)
Get expression assigned to parameter.
void SetInlined(int v)
Set inlined attribute.
Definition: cparam.h:141
Decl_t
Declaration types.
Definition: cdecl.h:74
virtual void PreVisit1(int(*func)(CNode *, void *), void *data)
virtual NodeType_t GetNodeType(void)
Get node expression type.
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
virtual CNode * GetWidthExp(void)
Get expression representing width of declaration.
Base class for describing data types.
Definition: cdatatype.h:108
virtual CNode * GetMsb()
Get expression for declaration's msb.
virtual CNode * GetLsb()
Get expression for declaration's lsb.
Structure to hold file coordinates.
Definition: cdecl.h:47
Holder for character strings.
Definition: csymbol.h:44
void Copy(CObstack *heap, const CDecl &o)
Perform deep copy of given object to this one This should never be call directly, only by subclasses...
Bulk object allocation object.
Definition: cobstack.h:46
Primary data structure representing parse tree nodes.
Definition: cnode.h:188
virtual void PostSubVisit1(CNode *(*func)(CNode *, void *), void *data)
CParam(CSymbol *symbol, Coord_t *aLoc, Decl_t type, CDataType *dataType)
Create parameter declaration.
Base class for describing declaration objects.
Definition: cdecl.h:164
Declaration object for parameters.
Definition: cparam.h:46
virtual void Dump(FILE *f)
Dump parameter declaration info to file descriptor.
virtual CDecl * Clone(CObstack *heap)
Create a clone of this declaration.
virtual int IsWidthVolatile(void)
Determine if packed width of declaration is volatile, ie depend upon parameters or variables...
int Specify(void)
Get specify attribute.
Definition: cparam.h:78
virtual void PostVisit1(void(*func)(CNode *, void *), void *data)
virtual int IsWidthConstant(void)
Determine if packed width of declaration is constant, ie dependent upon only constants and parameters...
int GetInlined()
Get inlined attribute.
Definition: cparam.h:147
NodeType_t
Expression node type.
Definition: cdatatype.h:97
void SetExpression(CNode *aExp)
Set expression assigned to parameter.
void Specify(int v)
Set specify attribute.
Definition: cparam.h:73
virtual INT32 GetWidth(void)
Evaluate packed width of declaration.
virtual int IsWidthEvaluateable(void)
Determine if packed width of declaration can be evaluated.