Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ty2c.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 #ifndef ty2c_INCLUDED
00037 #define ty2c_INCLUDED
00038 /* ====================================================================
00039  * ====================================================================
00040  *
00041  *
00042  * Revision history:
00043  *  07-Oct-94 - Original Version
00044  *
00045  * Description:
00046  *
00047  *    For complex types we use the Complex_Type, Double_Complex_Type,
00048  *    Quad_Complex_Type, Complex_Type_Split and Complex_Type_Inverted
00049  *    ... all of which is defined in "stab.h".
00050  *
00051  *    TY2C_initialize:
00052  *    TY2C_finalize:
00053  *       This will initialize and terminate usage of this module().
00054  *       Initialization sets any internal state used in tokenizing
00055  *       types, and will also write to file a set of predefined
00056  *       typedef declarations, including the complex types defined
00057  *       in stab.h.
00058  *
00059  *    TY2C_translate:
00060  *       Add a C language type corresponding to the given TY node
00061  *       into the token_buffer, assuming the TOKEN_BUFFER already
00062  *       holds a construct to be declared of this type.  The type
00063  *       may surround the current contents of the given TOKEN_BUFFER
00064  *       as though these contents where declared to be of the given
00065  *       type; i.e. for an array or function type.  The qualifiers
00066  *       are not written out for the top-level ty, but will be written
00067  *       for component tys.
00068  *
00069  *    TY2C_translate_qualified:
00070  *       Same as TY2C_translate, but the qualifiers of the top-level
00071  *       ty will be written out.
00072  *
00073  *    TY2C_get_field_info:
00074  *       Return information about a field within the given struct/union 
00075  *       type at the given offset and of the given type or mtype.  If a
00076  *       field of the given TY is found, it will be selected; otherwise
00077  *       the first field of the given mtype will be selected.  If 
00078  *       no appropriate field is found found_fld will be NULL and
00079  *       the returned TOKEN_BUFFER is uninitialized; otherwise, the 
00080  *       field and a token buffer denoting the field selection
00081  *       will be returned.  Note that we can use this routine to
00082  *       search for a field of a given TY only, by setting the mtype
00083  *       to MTYPE_V.
00084  *
00085  *    TY2C_builtin:
00086  *       Returns TRUE if the given ty is given a builtin special name
00087  *       in whirl2c (i.e. it is a type not to be declared).
00088  *
00089  *    TY2C_Complex_Realpart_Name:
00090  *    TY2C_Complex_Imagpart_Name:
00091  *       Denotes the names of the real and imaginary components in
00092  *       a complex (struct) type.
00093  *
00094  * ====================================================================
00095  * ====================================================================
00096  */
00097 
00098 extern void TY2C_initialize(CONTEXT context);
00099 extern void TY2C_finalize(void);
00100 
00101 extern void TY2C_translate(TOKEN_BUFFER decl_tokens,
00102                            TY_IDX ty,
00103                            CONTEXT context);
00104 extern void TY2C_translate_unqualified(TOKEN_BUFFER decl_tokens, TY_IDX ty);
00105 
00106 typedef struct TY2C_Fld_Info
00107 {
00108    TOKEN_BUFFER select_tokens;
00109    FLD_HANDLE   found_fld;
00110 } TY2C_FLD_INFO;
00111 
00112 extern TY2C_FLD_INFO 
00113    TY2C_get_field_info(TY_IDX struct_ty,  /* base type */
00114                        TY_IDX field_ty,   /* preferred field type */
00115                        MTYPE  field_mty,  /* preferred field mtype */
00116                        INT64  offset);
00117 
00118 extern BOOL TY2C_builtin(TY_IDX ty);
00119 
00120 extern const char *TY2C_Complex_Realpart_Name;
00121 extern const char *TY2C_Complex_Imagpart_Name;
00122 
00123 #endif /* ty2c_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines