tm_data_type_base.g.hh

Go to the documentation of this file.
00001 // This file is automatically generated, do not edit.
00002 
00003 /*!
00004         \file
00005         \brief Target-machine data types.
00006         \author jaz
00007 */
00008 
00009 #ifndef lestes__md__types__tm_data_type_base_g_hh__included
00010 #define lestes__md__types__tm_data_type_base_g_hh__included
00011 
00012 #include <lestes/std/map.hh>
00013 #include <lestes/md/common.hh>
00014 
00015 #include <lestes/std/objectize_macros.hh>
00016 package(lestes);
00017 package(std);
00018 class object;
00019 end_package(std);
00020 end_package(lestes);
00021 
00022 package(lestes);
00023 package(lang);
00024 package(cplus);
00025 package(sem);
00026 class ss_declaration;
00027 end_package(sem);
00028 end_package(cplus);
00029 end_package(lang);
00030 end_package(lestes);
00031 
00032 package(lestes);
00033 package(md);
00034 package(registers);
00035 class tm_register_base;
00036 end_package(registers);
00037 end_package(md);
00038 end_package(lestes);
00039 
00040 package(lestes);
00041 package(md);
00042 package(types);
00043 
00044 
00045 class tm_data_type_base;
00046 class tm_dt_simple_base;
00047 class tm_dt_bitfield_base;
00048 class tm_dt_array_base;
00049 class tm_dt_union_base;
00050 class tm_dt_struct_base;
00051 class tm_dt_struct_member_base;
00052 
00053 
00054 /*! \brief Target-architecture data type.
00055 
00056 
00057 There is a few kinds of data type defined in backend. 
00058 
00059 On the first place there are simple types. These types are basic types directly used and known by target CPU (e.g. int, long, double).
00060 
00061 On the other hand there are higher-level relicts - struct, enum, array. They are used to keep information about relationship of their 
00062 elements - simple types. CPU doesn't work with these data-type classes as with units but it accesses individual elements directly.
00063                 
00064 */
00065 class tm_data_type_base : public ::lestes::std::object {
00066 public:
00067         typedef ulint id_type;
00068         
00069         //! Data type kinds.
00070         enum kind_type {
00071                 SIMPLE,
00072                 BITFIELD,
00073                 STRUCT,
00074                 UNION,
00075                 ARRAY
00076         };
00077 //! Data type formats.
00078         enum format_type {
00079                 FORMAT_PLAIN,
00080                 FORMAT_C1,
00081                 FORMAT_C2,
00082                 FORMAT_OFF,
00083                 FORMAT_SM,
00084                 FORMAT_BCD,
00085                 FORMAT_PBCD,
00086                 FORMAT_IEEE
00087         };
00088 
00089         //! The method id_get returns the value of the field tm_data_type_base::id.
00090         tm_data_type_base::id_type id_get() const;
00091 
00092         //! The method id_set sets the field tm_data_type_base::id to the given value.
00093         void id_set(tm_data_type_base::id_type);
00094 
00095         //! The method format_get returns the value of the field tm_data_type_base::format.
00096         format_type format_get() const;
00097 
00098         //! The method format_set sets the field tm_data_type_base::format to the given value.
00099         void format_set(format_type);
00100 
00101         //! The method bitwidth_get returns the value of the field tm_data_type_base::bitwidth.
00102         ulint bitwidth_get() const;
00103 
00104         //! The method bitwidth_set sets the field tm_data_type_base::bitwidth to the given value.
00105         void bitwidth_set(ulint);
00106 
00107         //! The method alignment_get returns the value of the field tm_data_type_base::alignment.
00108         ulint alignment_get() const;
00109 
00110         //! The method alignment_set sets the field tm_data_type_base::alignment to the given value.
00111         void alignment_set(ulint);
00112 
00113         //! The method return_reg_get returns the value of the field tm_data_type_base::return_reg.
00114         ptr< ::lestes::md::registers::tm_register_base > return_reg_get() const;
00115 
00116         //! The method return_reg_set sets the field tm_data_type_base::return_reg to the given value.
00117         void return_reg_set(const ptr< ::lestes::md::registers::tm_register_base > &);
00118 
00119         //! The method asm_output_get returns the value of the field tm_data_type_base::asm_output.
00120         lstring asm_output_get() const;
00121 
00122         //! The method asm_output_set sets the field tm_data_type_base::asm_output to the given value.
00123         void asm_output_set(lstring);
00124 
00125         //! The method asm_decl_get returns the value of the field tm_data_type_base::asm_decl.
00126         lstring asm_decl_get() const;
00127 
00128         //! The method asm_decl_set sets the field tm_data_type_base::asm_decl to the given value.
00129         void asm_decl_set(lstring);
00130 
00131         //! Returns kind of the data type represented by this instance.
00132         virtual tm_data_type_base::kind_type kind_get() abstract;
00133 
00134         
00135 
00136         //! for purposes of dumping
00137         virtual ptr<reflection_list> reflection_get() const;
00138         //! for purposes of dumping
00139         virtual ptr<field_list_list> field_values_get() const;
00140         
00141 protected:
00142         //! Generated constructor for class tm_data_type_base.
00143         tm_data_type_base (
00144                 tm_data_type_base::id_type a__tm_data_type_base__id,
00145                 format_type a__tm_data_type_base__format,
00146                 ulint a__tm_data_type_base__bitwidth,
00147                 ulint a__tm_data_type_base__alignment,
00148                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00149                 lstring a__tm_data_type_base__asm_output,
00150                 lstring a__tm_data_type_base__asm_decl);
00151 
00152         //! Marking routine for class tm_data_type_base. 
00153         virtual void gc_mark();
00154 
00155 private:
00156         /*! \brief Data type id.
00157 
00158         Each data type is identified by its id (integer has id, double has id, struct has id, etc.)
00159         */
00160         tm_data_type_base::id_type id;
00161         //! Data type format.
00162         format_type format;
00163         //! Data type bitwidth.
00164         ulint bitwidth;
00165         //! Data type alignment.
00166         ulint alignment;
00167         //! Register where return value of the type is returned from function call.
00168         srp< ::lestes::md::registers::tm_register_base > return_reg;
00169         //! Asm output produced by the type.
00170         lstring asm_output;
00171         //! Asm output used in declarations.
00172         lstring asm_decl;
00173         static ptr<reflection_list> reflection;
00174         
00175 }; // tm_data_type_base
00176 
00177 
00178 /*! \brief Represents a simple type.
00179 
00180 
00181 This type is base class for basic data types. 
00182 Note: A concrete implementation is target-machine dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/md/types/ directory.
00183                 
00184 */
00185 class tm_dt_simple_base : public tm_data_type_base {
00186 public:
00187         //! Returns kind of the data type represented by this instance.
00188         virtual tm_data_type_base::kind_type kind_get();
00189 
00190         
00191 
00192         //! for purposes of dumping
00193         virtual ptr<reflection_list> reflection_get() const;
00194         //! for purposes of dumping
00195         virtual ptr<field_list_list> field_values_get() const;
00196         
00197 protected:
00198         //! Generated constructor for class tm_dt_simple_base.
00199         tm_dt_simple_base (
00200                 tm_data_type_base::id_type a__tm_data_type_base__id,
00201                 format_type a__tm_data_type_base__format,
00202                 ulint a__tm_data_type_base__bitwidth,
00203                 ulint a__tm_data_type_base__alignment,
00204                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00205                 lstring a__tm_data_type_base__asm_output,
00206                 lstring a__tm_data_type_base__asm_decl);
00207 
00208         //! Marking routine for class tm_dt_simple_base. 
00209         virtual void gc_mark();
00210 
00211 private:
00212         static ptr<reflection_list> reflection;
00213         
00214 }; // tm_dt_simple_base
00215 
00216 
00217 /*! \brief Bitfield type.
00218 
00219 Bitfield is subtype of tm_dt_simple_base - it has different bitwidth and layout than its base data type. 
00220 
00221 Note: Two bitfields can occupy single inseparable memory unit (e.g byte ) so that they must be transfered from memory together and some extra 
00222 CPU work is needed to unpack them before and pack them after computation.
00223 
00224 Note: This type is base class for bitfields. A concrete implementation is target machine-dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/md/types/ directory.
00225                 
00226 */
00227 class tm_dt_bitfield_base : public tm_dt_simple_base {
00228 public:
00229         //! The method bitfield_width_get returns the value of the field tm_dt_bitfield_base::bitfield_width.
00230         ulint bitfield_width_get() const;
00231 
00232         //! The method bitfield_width_set sets the field tm_dt_bitfield_base::bitfield_width to the given value.
00233         void bitfield_width_set(ulint);
00234 
00235         //! Returns kind of the data type represented by this instance.
00236         virtual tm_data_type_base::kind_type kind_get();
00237 
00238         
00239 
00240         //! for purposes of dumping
00241         virtual ptr<reflection_list> reflection_get() const;
00242         //! for purposes of dumping
00243         virtual ptr<field_list_list> field_values_get() const;
00244         
00245 protected:
00246         //! Generated constructor for class tm_dt_bitfield_base.
00247         tm_dt_bitfield_base (
00248                 tm_data_type_base::id_type a__tm_data_type_base__id,
00249                 format_type a__tm_data_type_base__format,
00250                 ulint a__tm_data_type_base__bitwidth,
00251                 ulint a__tm_data_type_base__alignment,
00252                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00253                 lstring a__tm_data_type_base__asm_output,
00254                 lstring a__tm_data_type_base__asm_decl,
00255                 ulint a__tm_dt_bitfield_base__bitfield_width);
00256 
00257         //! Marking routine for class tm_dt_bitfield_base. 
00258         virtual void gc_mark();
00259 
00260 private:
00261         //! Bitfield width.
00262         ulint bitfield_width;
00263         static ptr<reflection_list> reflection;
00264         
00265 }; // tm_dt_bitfield_base
00266 
00267 
00268 /*! \brief Array data type.
00269 
00270 Note: This type is base class for arrays. A concrete implementation is target-machine dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/md/types/ directory.
00271 */
00272 class tm_dt_array_base : public tm_data_type_base {
00273 public:
00274         //! The method bound_get returns the value of the field tm_dt_array_base::bound.
00275         t_size bound_get() const;
00276 
00277         //! The method bound_set sets the field tm_dt_array_base::bound to the given value.
00278         void bound_set(t_size);
00279 
00280         //! Returns kind of the data type represented by this instance.
00281         virtual tm_data_type_base::kind_type kind_get();
00282 
00283         
00284 
00285         //! for purposes of dumping
00286         virtual ptr<reflection_list> reflection_get() const;
00287         //! for purposes of dumping
00288         virtual ptr<field_list_list> field_values_get() const;
00289         
00290 protected:
00291         //! Generated constructor for class tm_dt_array_base.
00292         tm_dt_array_base (
00293                 tm_data_type_base::id_type a__tm_data_type_base__id,
00294                 format_type a__tm_data_type_base__format,
00295                 ulint a__tm_data_type_base__bitwidth,
00296                 ulint a__tm_data_type_base__alignment,
00297                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00298                 lstring a__tm_data_type_base__asm_output,
00299                 lstring a__tm_data_type_base__asm_decl,
00300                 t_size a__tm_dt_array_base__bound);
00301 
00302         //! Marking routine for class tm_dt_array_base. 
00303         virtual void gc_mark();
00304 
00305 private:
00306         //! Array bound.
00307         t_size bound;
00308         static ptr<reflection_list> reflection;
00309         
00310 }; // tm_dt_array_base
00311 
00312 
00313 /*! \brief Union data type.
00314 
00315 Union is variable type that can change type it represents. The actual type is 
00316 determined by datatype of pseudoinstruction where the union is used.
00317 
00318 Note: A concrete implementation is target machine-dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/md/types/ directory.
00319                 
00320 */
00321 class tm_dt_union_base : public tm_data_type_base {
00322 public:
00323         //! The method types_get returns the value of the field tm_dt_union_base::types.
00324         ptr< ::lestes::std::list< srp< tm_data_type_base > > > types_get() const;
00325 
00326         //! The method types_set sets the field tm_dt_union_base::types to the given value.
00327         void types_set(const ptr< ::lestes::std::list< srp< tm_data_type_base > > > & );
00328 
00329         //! Returns kind of the data type represented by this instance.
00330         virtual tm_data_type_base::kind_type kind_get();
00331 
00332         
00333 
00334         //! for purposes of dumping
00335         virtual ptr<reflection_list> reflection_get() const;
00336         //! for purposes of dumping
00337         virtual ptr<field_list_list> field_values_get() const;
00338         
00339 protected:
00340         //! Generated constructor for class tm_dt_union_base.
00341         tm_dt_union_base (
00342                 tm_data_type_base::id_type a__tm_data_type_base__id,
00343                 format_type a__tm_data_type_base__format,
00344                 ulint a__tm_data_type_base__bitwidth,
00345                 ulint a__tm_data_type_base__alignment,
00346                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00347                 lstring a__tm_data_type_base__asm_output,
00348                 lstring a__tm_data_type_base__asm_decl,
00349                 ptr< ::lestes::std::list< srp< tm_data_type_base > > > a__tm_dt_union_base__types);
00350 
00351         //! Marking routine for class tm_dt_union_base. 
00352         virtual void gc_mark();
00353 
00354 private:
00355         //! List of types that union can represent.
00356         srp< ::lestes::std::list< srp< tm_data_type_base > > >  types;
00357         static ptr<reflection_list> reflection;
00358         
00359 }; // tm_dt_union_base
00360 
00361 
00362 /*! \brief Struct data type.
00363 
00364 Struct contains data fields. Each field is of its own datatype. Info about its size, offset and its 
00365 higher-level declaration is stored with each field. This additional info is used to e.g. compute its placement within the struct.
00366 
00367 Concrete implementation is target machine-dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/backend/target/ directory.
00368                 
00369 */
00370 class tm_dt_struct_base : public tm_data_type_base {
00371 public:
00372         //! The method members_get returns the value of the field tm_dt_struct_base::members.
00373         ptr< ::lestes::std::list< srp< tm_dt_struct_member_base > > > members_get() const;
00374 
00375         //! The method members_set sets the field tm_dt_struct_base::members to the given value.
00376         void members_set(const ptr< ::lestes::std::list< srp< tm_dt_struct_member_base > > > & );
00377 
00378         //! Returns kind of the data type represented by this instance.
00379         virtual tm_data_type_base::kind_type kind_get();
00380 
00381         
00382 
00383         //! for purposes of dumping
00384         virtual ptr<reflection_list> reflection_get() const;
00385         //! for purposes of dumping
00386         virtual ptr<field_list_list> field_values_get() const;
00387         
00388 protected:
00389         //! Generated constructor for class tm_dt_struct_base.
00390         tm_dt_struct_base (
00391                 tm_data_type_base::id_type a__tm_data_type_base__id,
00392                 format_type a__tm_data_type_base__format,
00393                 ulint a__tm_data_type_base__bitwidth,
00394                 ulint a__tm_data_type_base__alignment,
00395                 ptr< ::lestes::md::registers::tm_register_base > a__tm_data_type_base__return_reg,
00396                 lstring a__tm_data_type_base__asm_output,
00397                 lstring a__tm_data_type_base__asm_decl,
00398                 ptr< ::lestes::std::list< srp< tm_dt_struct_member_base > > > a__tm_dt_struct_base__members);
00399 
00400         //! Marking routine for class tm_dt_struct_base. 
00401         virtual void gc_mark();
00402 
00403 private:
00404         //! List of struct's fields.
00405         srp< ::lestes::std::list< srp< tm_dt_struct_member_base > > >  members;
00406         static ptr<reflection_list> reflection;
00407         
00408 }; // tm_dt_struct_base
00409 
00410 
00411 /*! \brief Struct data field.
00412 
00413 Represents data field of a tm_dt_struct_base datatype.
00414                 
00415 Concrete implementation is target machine-dependent and it is placed in /target/machine/${TARGET_CPU}/lestes/backend/target/ directory.
00416                 
00417 */
00418 class tm_dt_struct_member_base : public ::lestes::std::object {
00419 public:
00420         //! The method offset_get returns the value of the field tm_dt_struct_member_base::offset.
00421         ulint offset_get() const;
00422 
00423         //! The method offset_set sets the field tm_dt_struct_member_base::offset to the given value.
00424         void offset_set(ulint);
00425 
00426         //! The method bitwidth_get returns the value of the field tm_dt_struct_member_base::bitwidth.
00427         ulint bitwidth_get() const;
00428 
00429         //! The method bitwidth_set sets the field tm_dt_struct_member_base::bitwidth to the given value.
00430         void bitwidth_set(ulint);
00431 
00432         //! The method type_get returns the value of the field tm_dt_struct_member_base::type.
00433         ptr< tm_data_type_base > type_get() const;
00434 
00435         //! The method type_set sets the field tm_dt_struct_member_base::type to the given value.
00436         void type_set(const ptr< tm_data_type_base > &);
00437 
00438         //! The method ss_decl_get returns the value of the field tm_dt_struct_member_base::ss_decl.
00439         ptr< ::lestes::lang::cplus::sem::ss_declaration > ss_decl_get() const;
00440 
00441         //! The method ss_decl_set sets the field tm_dt_struct_member_base::ss_decl to the given value.
00442         void ss_decl_set(const ptr< ::lestes::lang::cplus::sem::ss_declaration > &);
00443 
00444         
00445 
00446         //! for purposes of dumping
00447         virtual ptr<reflection_list> reflection_get() const;
00448         //! for purposes of dumping
00449         virtual ptr<field_list_list> field_values_get() const;
00450         
00451 protected:
00452         //! Generated constructor for class tm_dt_struct_member_base.
00453         tm_dt_struct_member_base (
00454                 ulint a__tm_dt_struct_member_base__offset,
00455                 ulint a__tm_dt_struct_member_base__bitwidth,
00456                 ptr< tm_data_type_base > a__tm_dt_struct_member_base__type,
00457                 ptr< ::lestes::lang::cplus::sem::ss_declaration > a__tm_dt_struct_member_base__ss_decl);
00458 
00459         //! Marking routine for class tm_dt_struct_member_base. 
00460         virtual void gc_mark();
00461 
00462 private:
00463         //! Field's offset within struct.
00464         ulint offset;
00465         //! Field's bitwidth.
00466         ulint bitwidth;
00467         //! Field's data type.
00468         srp< tm_data_type_base > type;
00469         /*! \brief Field's declaration passed from higher-level.
00470 
00471         It is used to access the field in struct.
00472         */
00473         srp< ::lestes::lang::cplus::sem::ss_declaration > ss_decl;
00474         static ptr<reflection_list> reflection;
00475         
00476 }; // tm_dt_struct_member_base
00477 
00478 
00479 end_package(types);
00480 end_package(md);
00481 end_package(lestes);
00482 
00483 package(lestes);
00484 package(std);
00485 specialize_objectize_for_enum( ::lestes::md::types::tm_data_type_base::kind_type );
00486 specialize_objectize_for_enum( ::lestes::md::types::tm_data_type_base::format_type );
00487 end_package(std);
00488 end_package(lestes);
00489 
00490 #endif // lestes__md__types__tm_data_type_base_g_hh__included

Generated on Mon Feb 12 18:23:37 2007 for lestes by doxygen 1.5.1-20070107