Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ty2c.cxx File Reference
#include "whirl2c_common.h"
#include "PUinfo.h"
#include "ty2c.h"
#include "tcon2c.h"
#include "unparse_target.h"
#include <set>
Include dependency graph for ty2c.cxx:

Go to the source code of this file.

Classes

struct  SCALAR_C_NAME
struct  eqstr

Defines

#define MTYPE_PREDEF   MTYPE_F16
#define GET_SPECIAL_TYPENAME(mtype)
#define PTR_OR_ALIGNED_WITH_STRUCT(fld_ty, struct_align)   (TY_Is_Pointer(fld_ty) || TY_align(fld_ty) <= struct_align)

Typedefs

typedef struct SCALAR_C_NAME SCALAR_C_NAME
typedef void(* TY2C_HANDLER_FUNC )(TOKEN_BUFFER, TY_IDX, CONTEXT)

Functions

static void TY2C_scalar (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_array (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_struct (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_function (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_pointer (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_void (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_invalid (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void Write_Scalar_Typedef (FILE *ofile, const char *real_type, const char *new_name)
static void Write_Typedef (FILE *ofile, TY_IDX ty, const char *type_name)
static void TY2C_prepend_qualifiers (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static INT64 get_field_gap (FLD_HANDLE this_fld, FLD_HANDLE next_fld, INT64 max_size, BOOL is_union)
static FLD_HANDLE skip_till_next_field (FLD_HANDLE this_fld, const INT64 struct_align, const INT64 struct_size, BOOL is_union)
static void TY2C_prepend_filler_field (TOKEN_BUFFER decl_tokens, INT64 byte_size)
static void TY2C_prepend_FLD_list (TOKEN_BUFFER decl_tokens, FLD_HANDLE fld, const BOOL is_union, const INT64 struct_align, const INT64 struct_size, CONTEXT context)
static void TY2C_Prepend_Alignment_Type (TOKEN_BUFFER tokens, INT64 align)
static void TY2C_prototype_params (TOKEN_BUFFER decl_tokens, TYLIST_IDX params, CONTEXT context)
static void TY2C_complete_struct (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
static void TY2C_Output_Struct_Type (TY_IDX ty, INT lines_between_decls, CONTEXT context)
static void TY2C_Translate_Structure (TY_IDX ty, CONTEXT context)
void TY2C_initialize (CONTEXT context)
void TY2C_finalize (void)
void TY2C_translate (TOKEN_BUFFER decl_tokens, TY_IDX ty, CONTEXT context)
void TY2C_translate_unqualified (TOKEN_BUFFER decl_tokens, TY_IDX ty)
TY2C_FLD_INFO TY2C_get_field_info (TY_IDX struct_ty, TY_IDX desired_ty, MTYPE desired_mty, INT64 desired_offset)
BOOL TY2C_builtin (TY_IDX ty)

Variables

const char TY2C_Aligned_Block_Name [] = "__block"
static char Name_Unknown_Type [] = "__UNKNOWN_TYPE"
static const SCALAR_C_NAME Scalar_C_Names [MTYPE_PREDEF+1]
const char Special_Void_TypeName [] = "void"
const char Special_String_TypeName [] = "_STRING"
const char Special_Quad_TypeName [] = "_QUAD"
const char Special_Complex32_TypeName [] = "_COMPLEX32"
const char Special_Complex64_TypeName [] = "_COMPLEX64"
const char Special_ComplexQD_TypeName [] = "_COMPLEXQD"
static const TY2C_HANDLER_FUNC TY2C_Handle [KIND_LAST]
const char * TY2C_Complex_Realpart_Name = "realpart"
const char * TY2C_Complex_Imagpart_Name = "imagpart"
int compiling_upc_flag
static hash_set< const char
*, hash< const char * >, eqstr
struct_names

Define Documentation

#define GET_SPECIAL_TYPENAME (   mtype)
Value:
((mtype) == MTYPE_V? Special_Void_TypeName : \
    ((mtype) == MTYPE_STR? Special_String_TypeName : \
     ((mtype) == MTYPE_FQ? Special_Quad_TypeName : \
      ((mtype) == MTYPE_C4? Special_Complex32_TypeName : \
       ((mtype) == MTYPE_C8? Special_Complex64_TypeName : \
        ((mtype) == MTYPE_CQ? Special_ComplexQD_TypeName : \
         (const char *)NULL))))))

Definition at line 129 of file ty2c.cxx.

Referenced by TY2C_builtin(), and TY2C_translate().

#define MTYPE_PREDEF   MTYPE_F16

Definition at line 94 of file ty2c.cxx.

Referenced by TY2C_builtin(), and TY2C_scalar().

#define PTR_OR_ALIGNED_WITH_STRUCT (   fld_ty,
  struct_align 
)    (TY_Is_Pointer(fld_ty) || TY_align(fld_ty) <= struct_align)

Definition at line 138 of file ty2c.cxx.

Referenced by skip_till_next_field(), TY2C_get_field_info(), and TY2C_prepend_FLD_list().


Typedef Documentation

typedef struct SCALAR_C_NAME SCALAR_C_NAME

Definition at line 156 of file ty2c.cxx.


Function Documentation

static INT64 get_field_gap ( FLD_HANDLE  this_fld,
FLD_HANDLE  next_fld,
INT64  max_size,
BOOL  is_union 
) [static]

Definition at line 238 of file ty2c.cxx.

References FLD_ofst(), FLD_type(), FLD_HANDLE::Is_Null(), and TY_size().

Referenced by TY2C_prepend_FLD_list().

Here is the call graph for this function:

static FLD_HANDLE skip_till_next_field ( FLD_HANDLE  this_fld,
const INT64  struct_align,
const INT64  struct_size,
BOOL  is_union 
) [static]

Definition at line 264 of file ty2c.cxx.

References FLD_Is_Bitfield(), FLD_next(), FLD_ofst(), FLD_type(), FLD_HANDLE::Is_Null(), PTR_OR_ALIGNED_WITH_STRUCT, TY_align(), and TY_Is_Pointer().

Referenced by TY2C_get_field_info(), and TY2C_prepend_FLD_list().

Here is the call graph for this function:

Definition at line 1176 of file ty2c.cxx.

References GET_SPECIAL_TYPENAME, KIND_INVALID, MTYPE_PREDEF, MTYPE_UNKNOWN, name, NULL, Scalar_C_Names, TY_kind(), and TY_mtype().

Referenced by Unparse_Target_C::Builtin_Type().

Here is the call graph for this function:

void TY2C_finalize ( void  )

Definition at line 974 of file ty2c.cxx.

Referenced by W2C_Fini().

void TY2C_initialize ( CONTEXT  context)

Definition at line 960 of file ty2c.cxx.

References Be_Type_Tbl, MTYPE_C4, MTYPE_C8, MTYPE_CQ, MTYPE_STRING, and Set_TY_is_translated_to_c().

Referenced by W2C_Init().

Here is the call graph for this function:

static void TY2C_invalid ( TOKEN_BUFFER  decl_tokens,
TY_IDX  ty,
CONTEXT  context 
) [static]

Definition at line 950 of file ty2c.cxx.

References FALSE, Is_True, and TY_kind().

Here is the call graph for this function:

static void TY2C_Prepend_Alignment_Type ( TOKEN_BUFFER  tokens,
INT64  align 
) [static]

Definition at line 408 of file ty2c.cxx.

References c, CONTEXT_reset, FALSE, Is_True, MTYPE_FQ, MTYPE_U1, MTYPE_U2, MTYPE_U4, MTYPE_U8, Stab_Mtype_To_Ty(), and TY2C_translate().

Referenced by TY2C_complete_struct().

Here is the call graph for this function:

static void TY2C_prepend_qualifiers ( TOKEN_BUFFER  decl_tokens,
TY_IDX  ty,
CONTEXT  context 
) [static]

Definition at line 223 of file ty2c.cxx.

References CONTEXT_unqualified_ty2c, Prepend_Token_String(), TY_is_const(), TY_is_restrict(), and TY_is_volatile().

Referenced by TY2C_array(), TY2C_pointer(), TY2C_scalar(), TY2C_struct(), TY2C_translate(), and TY2C_void().

Here is the call graph for this function:

static void TY2C_prototype_params ( TOKEN_BUFFER  decl_tokens,
TYLIST_IDX  params,
CONTEXT  context 
) [static]
static void TY2C_scalar ( TOKEN_BUFFER  decl_tokens,
TY_IDX  ty,
CONTEXT  context 
) [static]
static void TY2C_void ( TOKEN_BUFFER  decl_tokens,
TY_IDX  ty,
CONTEXT  context 
) [static]

Definition at line 942 of file ty2c.cxx.

References Prepend_Token_String(), Special_Void_TypeName, and TY2C_prepend_qualifiers().

Here is the call graph for this function:

static void Write_Scalar_Typedef ( FILE *  ofile,
const char *  real_type,
const char *  new_name 
) [static]

Definition at line 185 of file ty2c.cxx.

References Append_Indented_Newline(), Append_Token_Special(), Append_Token_String(), New_Token_Buffer(), NULL, and Write_And_Reclaim_Tokens().

Here is the call graph for this function:

static void Write_Typedef ( FILE *  ofile,
TY_IDX  ty,
const char *  type_name 
) [static]

Variable Documentation

Definition at line 71 of file driver_util.cxx.

char Name_Unknown_Type[] = "__UNKNOWN_TYPE" [static]

Definition at line 96 of file ty2c.cxx.

Initial value:
   {{"void",               Name_Unknown_Type},  
    {"char",               "_BOOLEAN"},         
    {"signed char",        "_INT8"},            
    {"signed short",       "_INT16"},           
    {"signed int",         "_INT32"},           
    {"signed long long",   "_INT64"},           
    {"unsigned char",      "_UINT8"},           
    {"unsigned short",     "_UINT16"},          
    {"unsigned int",       "_UINT32"},          
    {"unsigned long long", "_UINT64"},          
    {"float",              "_IEEE32"},          
    {"double",             "_IEEE64"},          
    {Name_Unknown_Type,    "_IEEE80"},          
    {Name_Unknown_Type,    "_IEEE128"}  
   }

Definition at line 97 of file ty2c.cxx.

Referenced by TY2C_builtin(), TY2C_prepend_filler_field(), and TY2C_scalar().

const char Special_Complex32_TypeName[] = "_COMPLEX32"

Definition at line 125 of file ty2c.cxx.

const char Special_Complex64_TypeName[] = "_COMPLEX64"

Definition at line 126 of file ty2c.cxx.

const char Special_ComplexQD_TypeName[] = "_COMPLEXQD"

Definition at line 127 of file ty2c.cxx.

const char Special_Quad_TypeName[] = "_QUAD"

Definition at line 124 of file ty2c.cxx.

const char Special_String_TypeName[] = "_STRING"

Definition at line 123 of file ty2c.cxx.

const char Special_Void_TypeName[] = "void"

Definition at line 122 of file ty2c.cxx.

Referenced by TY2C_void().

hash_set<const char*, hash<const char*>, eqstr> struct_names [static]

Definition at line 708 of file ty2c.cxx.

Referenced by TY2C_Output_Struct_Type().

const char TY2C_Aligned_Block_Name[] = "__block"

Definition at line 92 of file ty2c.cxx.

Referenced by TY2C_complete_struct(), and TY2C_get_field_info().

const char* TY2C_Complex_Imagpart_Name = "imagpart"

Definition at line 178 of file ty2c.cxx.

Referenced by WN2C_Assign_Complex_Const(), WN2C_complex(), and WN2C_imagpart().

const char* TY2C_Complex_Realpart_Name = "realpart"

Definition at line 177 of file ty2c.cxx.

Referenced by WN2C_Assign_Complex_Const(), WN2C_complex(), and WN2C_realpart().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines