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 INT32 GetPackedWidth(void) const
Evaluate packed or vector width of declaration.
virtual CDataType * Clone(CObstack *heap)
Create a new copy with a deep copy.
virtual CNode * GetPackedLsi(INT32 dim) const
Get expression tree for lower limit of packed array dimension.
virtual CNode * GetBaseWidthExp() const
Get expression for datatype's base width (sans packed dimensions)
virtual int IsBaseWidthEvaluateable(void) const
Determine if base width (sans packed dimensions) of declaration can be evaluated. ...
Definition: csimpletype.h:120
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 IsBaseWidthVolatile(void) const
Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameter...
Definition: csimpletype.h:113
virtual void Dump(FILE *f) const
Dump data type info to file descriptor.
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
virtual int GetUnsignedAttr() const
Get declaration's unsigned attribute.
Definition: csimpletype.h:72
virtual INT32 GetBaseWidth(void) const
Evaluate base width (sans packed dimensions) of declaration.
virtual CNode * GetPackedLsb() const
Get expression for declaration's lsb.
virtual NodeType_t GetNodeType(void) const
Get data type.
int GetVectorWidth() const
Get width of vector.
Base class for describing data types.
Definition: cdatatype.h:110
virtual CNode * GetPackedRange() const
Get expression for datatype's overall packed or vector range (msb/lsb)
virtual CNode * GetPackedMsi(INT32 dim) const
Get expression tree for upper limit of given packed array dimension.
class for describing simple builtin data types
Definition: csimpletype.h:40
virtual int GetSignedAttr() const
Get declaration's signed attribute.
Definition: csimpletype.h:67
Bulk object allocation object.
Definition: cobstack.h:46
virtual int GetSigned() const
Get declartion's signed 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
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
CSimpleType(VarDataType_t vt)
Create data type instance.
virtual int PackedWidthDirection(void) const
Evaluate current decl width direction.
virtual CNode * GetPackedMsb() const
Get expression for declaration's msb.
virtual CNode * GetPackedWidthExp() const
Get expression for datatype's overall packed or vetor width.
virtual int IsPacked() const
Determine if complete data structure is packed.
VarDataType_t
Variable data types.
Definition: cdatatype.h:42
NodeType_t
Expression node type.
Definition: cdatatype.h:99
virtual INT32 GetNumberOfPackedDimensions(void) const
Get number of packed dimensions of declaration.
virtual int IsVector() const
Determine if complete data structure is a vector.
virtual void SetUnsignedAttr(int v)
Set declaration's unsigned attribute.
Definition: csimpletype.h:82
virtual int GetTwoState() const
Get declaration's 2 state property.
virtual void SetSignedAttr(int v)
Set declaration's signed attribute.
Definition: csimpletype.h:77