Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
srcpos.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 srcpos_INCLUDED
00037 #define srcpos_INCLUDED
00038 
00039 #include "config_host.h"        /* for HOST_IS_LITTLE_ENDIAN */
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 /* ====================================================================
00046  * ====================================================================
00047  *
00048  *
00049  * Description:
00050  *
00051  *   Description of the various fields in the source position structure.
00052  *
00053  * ====================================================================
00054  */
00055 
00056 
00057 /* SRCPOS is defined as a 64bit unsigned integer. This is the declaration 
00058  * visible to most files. Defining it this way allows existing calls that 
00059  * pass a INT32 line number to still compile fine. The prototype will 
00060  * automatically do the conversion from INT32 to the SRCPOS type. The 
00061  * value of the linenum field is still valid, since it is the lower 
00062  * 32bits of the source_position structure.
00063  */
00064 
00065  typedef mUINT64 SRCPOS;
00066 
00067 
00068 /* The following struct, the union and with SRCPOS and the macros are 
00069  * for use by routines that need to setup or access the individual 
00070  * fields of the source position descriptor.
00071  */
00072 struct srcpos_struct {
00073   mUINT16       filenum;
00074   mUINT16       column : 12;
00075   mUINT16       stmt_begin : 1;
00076   mUINT16       bb_begin : 1;
00077   mUINT16       unused : 2;
00078   mINT32        linenum;
00079 };
00080 #define SRC_POS_SIZE  2       /* 2 * sizeof(mINT32) */
00081 
00082 typedef union source_position {
00083   SRCPOS srcpos;
00084   struct srcpos_struct t;
00085   mINT32 fillers[SRC_POS_SIZE];
00086 } USRCPOS;
00087 
00088 #define CHECK_SIZE_CONSISTENCY(s) check_assertion(sizeof(s) == (SRC_POS_SIZE*sizeof(INT32)))
00089 #define USRCPOS_clear(s)          ((s).fillers[0] = 0,(s).fillers[1] = 0)
00090 
00091 #define USRCPOS_srcpos(s)       ((s).srcpos)
00092 #define USRCPOS_filenum(s)      ((s).t.filenum)
00093 #define USRCPOS_column(s)       ((s).t.column)
00094 #define USRCPOS_stmt_begin(s)   ((s).t.stmt_begin)
00095 #define USRCPOS_bb_begin(s)     ((s).t.bb_begin)
00096 #define USRCPOS_linenum(s)      ((s).t.linenum)
00097 
00098 #define SRCPOS_clear(s)         ((s) = 0)
00099 #define SRCPOS_filenum(s)       (((USRCPOS *)&(s))->t.filenum)
00100 #define SRCPOS_column(s)        (((USRCPOS *)&(s))->t.column)
00101 #define SRCPOS_stmt_begin(s)    (((USRCPOS *)&(s))->t.stmt_begin)
00102 #define SRCPOS_bb_begin(s)      (((USRCPOS *)&(s))->t.bb_begin)
00103 #define SRCPOS_linenum(s)       (((USRCPOS *)&(s))->t.linenum)
00104 
00105 #if HOST_IS_LITTLE_ENDIAN
00106 #define Srcpos_To_Line(s)       ((mINT32)((s)>>32))
00107 #else
00108 #define Srcpos_To_Line(s)       ((mINT32)(s))
00109 #endif /* HOST_IS_LITTLE_ENDIAN */
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif
00114 #endif /* srcpos_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines