vrq
cgenvar.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  * cgenvar.h
25  * - class definition of genvar
26  * variables
27  *
28  ******************************************************************************
29  */
30 
31 #ifndef CGENVAR_H
32 #define CGENVAR_H
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 CGenvar: public CDecl
47 {
48 public:
54  CGenvar( CSymbol* symbol, Coord_t* aLoc );
60  virtual CDecl* Clone( CObstack* heap );
65  virtual NodeType_t GetNodeType( void ) { return eS; }
70  virtual INT32 GetWidth( void ) { return 32; }
75  virtual int IsWidthEvaluateable() { return TRUE; }
81  virtual int IsWidthConstant( void ) { return TRUE; }
87  virtual int IsWidthVolatile( void ) { return FALSE; }
92  virtual CNode* GetWidthExp() { return cINT32(GetWidth()); }
97  virtual void Dump( FILE* f );
98 protected:
104  void Copy( CObstack* heap, CGenvar& d ) {};
105 private:
106  /*
107  * disable copy constructor
108  */
109  CGenvar( const CGenvar& );
110 };
111 
112 #endif // CGENVAR_H
Declaration object for genvars.
Definition: cgenvar.h:46
signed bit vector, includes integer
Definition: cdatatype.h:100
virtual int IsWidthConstant(void)
Determine if packed width of declaration is constant, ie dependent upon only constants and parameters...
Definition: cgenvar.h:81
virtual NodeType_t GetNodeType(void)
Get node type of declaration.
Definition: cgenvar.h:65
virtual INT32 GetWidth(void)
Get width of declaration.
Definition: cgenvar.h:70
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
CGenvar(CSymbol *symbol, Coord_t *aLoc)
Create a genvar declaration.
Structure to hold file coordinates.
Definition: cdecl.h:47
Holder for character strings.
Definition: csymbol.h:44
Bulk object allocation object.
Definition: cobstack.h:46
Primary data structure representing parse tree nodes.
Definition: cnode.h:188
virtual CNode * GetWidthExp()
Get expression representing genvar width.
Definition: cgenvar.h:92
Base class for describing declaration objects.
Definition: cdecl.h:164
virtual int IsWidthVolatile(void)
Determine if packed width of declaration is volatile, ie depend upon parameters or variables...
Definition: cgenvar.h:87
CNode * cINT32(INT32 i)
Short cut for creating VCONSTANT node with a given integer value.
Definition: cnode.h:784
virtual CDecl * Clone(CObstack *heap)
Create a clone of this declaration.
void Copy(CObstack *heap, CGenvar &d)
Deep copy of declaration.
Definition: cgenvar.h:104
NodeType_t
Expression node type.
Definition: cdatatype.h:97
virtual void Dump(FILE *f)
Dump genvar info to file descriptor.
virtual int IsWidthEvaluateable()
Determine if width is evaluateable.
Definition: cgenvar.h:75