vrq
csimpletype.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (C) 1997-2010, 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  * csimpletype.h
25  * - abstract class for simple built in data types
26  *
27  *
28  ******************************************************************************
29  */
30 
31 #ifndef CSIMPLETYPE_H
32 #define CSIMPLETYPE_H
33 
34 #include "cobject.h"
35 #include "cdatatype.h"
36 
40 class CSimpleType : public CDataType
41 {
42 public:
43 private:
44  int signedAttr;
45  int unsignedAttr;
46 public:
57  CSimpleType( VarDataType_t vt, list<CNode*>& rangeList );
62  virtual CDataType* Clone( CObstack* heap );
67  virtual int GetSignedAttr() const { return signedAttr; }
72  virtual int GetUnsignedAttr() const { return unsignedAttr; }
77  virtual void SetSignedAttr( int v ) { signedAttr = v; }
82  virtual void SetUnsignedAttr( int v ) { unsignedAttr = v; }
87  virtual int GetSigned() const;
92  virtual int GetTwoState() const;
97  virtual NodeType_t GetNodeType( void ) const;
105  virtual int IsBaseWidthConstant( void ) const { return TRUE; }
113  virtual int IsBaseWidthVolatile( void ) const { return FALSE; }
120  virtual int IsBaseWidthEvaluateable( void ) const {return TRUE; }
125  virtual INT32 GetBaseWidth( void ) const;
130  virtual CNode* GetBaseWidthExp() const;
136  virtual int IsVector() const;
142  virtual int IsPacked() const;
148  virtual CNode* GetPackedMsb() const;
154  virtual CNode* GetPackedLsb() const;
160  virtual CNode* GetPackedRange() const;
165  virtual INT32 GetPackedWidth( void ) const;
170  virtual CNode* GetPackedWidthExp() const;
175  virtual int PackedWidthDirection( void ) const;
180  virtual INT32 GetNumberOfPackedDimensions( void ) const;
186  virtual CNode* GetPackedMsi( INT32 dim ) const;
192  virtual CNode* GetPackedLsi( INT32 dim ) const;
198  virtual CNode* GetPackedRange( INT32 dim ) const;
203  virtual void Dump( FILE* f ) const;
204 protected:
211  void Copy( CObstack* heap, const CSimpleType& o );
216  int GetVectorWidth() const;
217 private:
218  /*
219  * disable copy constructor
220  */
221  CSimpleType( const CSimpleType& o );
222 
223 };
224 
225 #endif // CSIMPLETYPE_H
226 
virtual CDataType * Clone(CObstack *heap)
Create a new copy with a deep copy.
virtual int PackedWidthDirection(void) const
Evaluate current decl width direction.
virtual int GetUnsignedAttr() const
Get declaration&#39;s unsigned attribute.
Definition: csimpletype.h:72
virtual CNode * GetPackedMsi(INT32 dim) const
Get expression tree for upper limit of given packed array dimension.
virtual CNode * GetPackedLsb() const
Get expression for declaration&#39;s lsb.
virtual int GetTwoState() const
Get declaration&#39;s 2 state property.
virtual int IsBaseWidthConstant(void) const
Determine if base width (sans packed dimensions) of declaration is constant, ie dependent upon only c...
Definition: csimpletype.h:105
virtual CNode * GetPackedLsi(INT32 dim) const
Get expression tree for lower limit of packed array dimension.
void Copy(CObstack *heap, const CSimpleType &o)
Perform deep copy of given object to this one This should never be call directly, only by subclasses...
virtual int GetSigned() const
Get declartion&#39;s signed property.
virtual int IsBaseWidthVolatile(void) const
Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameter...
Definition: csimpletype.h:113
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
virtual NodeType_t GetNodeType(void) const
Get data type.
virtual void Dump(FILE *f) const
Dump data type info to file descriptor.
Base class for describing data types.
Definition: cdatatype.h:112
class for describing simple builtin data types
Definition: csimpletype.h:40
Bulk object allocation object.
Definition: cobstack.h:46
virtual INT32 GetNumberOfPackedDimensions(void) const
Get number of packed dimensions of declaration.
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
CSimpleType(VarDataType_t vt)
Create data type instance.
virtual CNode * GetPackedWidthExp() const
Get expression for datatype&#39;s overall packed or vetor width.
virtual int IsPacked() const
Determine if complete data structure is packed.
virtual INT32 GetBaseWidth(void) const
Evaluate base width (sans packed dimensions) of declaration.
virtual CNode * GetPackedRange() const
Get expression for datatype&#39;s overall packed or vector range (msb/lsb)
virtual int GetSignedAttr() const
Get declaration&#39;s signed attribute.
Definition: csimpletype.h:67
int GetVectorWidth() const
Get width of vector.
virtual int IsVector() const
Determine if complete data structure is a vector.
virtual int IsBaseWidthEvaluateable(void) const
Determine if base width (sans packed dimensions) of declaration can be evaluated. ...
Definition: csimpletype.h:120
virtual CNode * GetBaseWidthExp() const
Get expression for datatype&#39;s base width (sans packed dimensions)
VarDataType_t
Variable data types.
Definition: cdatatype.h:42
NodeType_t
Expression node type.
Definition: cdatatype.h:101
virtual CNode * GetPackedMsb() const
Get expression for declaration&#39;s msb.
virtual INT32 GetPackedWidth(void) const
Evaluate packed or vector width of declaration.
virtual void SetUnsignedAttr(int v)
Set declaration&#39;s unsigned attribute.
Definition: csimpletype.h:82
virtual void SetSignedAttr(int v)
Set declaration&#39;s signed attribute.
Definition: csimpletype.h:77