00001 /* 00002 * host.h - host-dependent definitions and interfaces 00003 * 00004 * This file is a part of the SimpleScalar tool suite written by 00005 * Todd M. Austin as a part of the Multiscalar Research Project. 00006 * 00007 * The tool suite is currently maintained by Doug Burger and Todd M. Austin. 00008 * 00009 * Copyright (C) 1998 by Todd M. Austin 00010 * 00011 * This source file is distributed "as is" in the hope that it will be 00012 * useful. The tool set comes with no warranty, and no author or 00013 * distributor accepts any responsibility for the consequences of its 00014 * use. 00015 * 00016 * Everyone is granted permission to copy, modify and redistribute 00017 * this tool set under the following conditions: 00018 * 00019 * This source code is distributed for non-commercial use only. 00020 * Please contact the maintainer for restrictions applying to 00021 * commercial use. 00022 * 00023 * Permission is granted to anyone to make or distribute copies 00024 * of this source code, either as received or modified, in any 00025 * medium, provided that all copyright notices, permission and 00026 * nonwarranty notices are preserved, and that the distributor 00027 * grants the recipient permission for further redistribution as 00028 * permitted by this document. 00029 * 00030 * Permission is granted to distribute this file in compiled 00031 * or executable form under the same conditions that apply for 00032 * source code, provided that either: 00033 * 00034 * A. it is accompanied by the corresponding machine-readable 00035 * source code, 00036 * B. it is accompanied by a written offer, with no time limit, 00037 * to give anyone a machine-readable copy of the corresponding 00038 * source code in return for reimbursement of the cost of 00039 * distribution. This written offer must permit verbatim 00040 * duplication by anyone, or 00041 * C. it is distributed by someone who received only the 00042 * executable form, and is accompanied by a copy of the 00043 * written offer of source code that they received concurrently. 00044 * 00045 * In other words, you are welcome to use, share and improve this 00046 00047 * source file. You are forbidden to forbid anyone else to use, share 00048 * and improve what you give them. 00049 * 00050 * INTERNET: dburger@cs.wisc.edu 00051 * US Mail: 1210 W. Dayton Street, Madison, WI 53706 00052 * 00053 * $Id: host.h,v 1.1.1.1 2003/09/18 00:57:54 panalyzer Exp $ 00054 * 00055 * $Log: host.h,v $ 00056 * Revision 1.1.1.1 2003/09/18 00:57:54 panalyzer 00057 * 00058 * 00059 * Revision 1.1.1.1 2003/09/18 00:18:43 panalyzer 00060 * 00061 * 00062 * Revision 1.1.1.1 2003/09/16 18:48:14 gdm 00063 * 00064 * 00065 * Revision 1.1.1.1 2000/11/29 14:53:54 cu-cs 00066 * Grand unification of arm sources. 00067 * 00068 * 00069 * Revision 1.1.1.1 2000/05/26 15:18:57 taustin 00070 * SimpleScalar Tool Set 00071 * 00072 * 00073 * Revision 1.3 1999/12/31 18:36:58 taustin 00074 * cross-endian execution support added 00075 * quad_t naming conflicts removed 00076 * 00077 * Revision 1.2 1999/03/08 06:33:49 taustin 00078 * added SVR4 host support 00079 * 00080 * Revision 1.1 1998/08/27 08:28:46 taustin 00081 * Initial revision 00082 * 00083 * 00084 */ 00085 00086 #ifndef HOST_H 00087 #define HOST_H 00088 00089 /* make sure host compiler supports ANSI-C */ 00090 #ifndef __STDC__ /* an ansi C compiler is required */ 00091 #error The SimpleScalar simulators must be compiled with an ANSI C compiler. 00092 #endif /* __STDC__ */ 00093 00094 /* enable inlining here, if supported by host compiler */ 00095 #undef INLINE 00096 #if defined(__GNUC__) 00097 #define INLINE inline 00098 #else 00099 #define INLINE 00100 #endif 00101 00102 /* bind together two symbols, at preprocess time */ 00103 #ifdef __GNUC__ 00104 /* this works on all GNU GCC targets (that I've seen...) */ 00105 #define SYMCAT(X,Y) X##Y 00106 #define ANSI_SYMCAT 00107 #else /* !__GNUC__ */ 00108 #ifdef OLD_SYMCAT 00109 #define SYMCAT(X,Y) X/**/Y 00110 #else /* !OLD_SYMCAT */ 00111 #define SYMCAT(X,Y) X##Y 00112 #define ANSI_SYMCAT 00113 #endif /* OLD_SYMCAT */ 00114 #endif /* __GNUC__ */ 00115 00116 /* host-dependent canonical type definitions */ 00117 typedef int bool_t; /* generic boolean type */ 00118 typedef unsigned char byte_t; /* byte - 8 bits */ 00119 typedef signed char sbyte_t; 00120 typedef unsigned short half_t; /* half - 16 bits */ 00121 typedef signed short shalf_t; 00122 typedef unsigned int word_t; /* word - 32 bits */ 00123 typedef signed int sword_t; 00124 typedef float sfloat_t; /* single-precision float - 32 bits */ 00125 typedef double dfloat_t; /* double-precision float - 64 bits */ 00126 00127 /* qword defs, note: not all targets support qword types */ 00128 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__CC_C89) || defined(__CC_XLC) 00129 #define HOST_HAS_QWORD 00130 typedef unsigned long long qword_t; /* qword - 64 bits */ 00131 typedef signed long long sqword_t; 00132 #ifdef ANSI_SYMCAT 00133 #define ULL(N) N##ULL /* qword_t constant */ 00134 #define LL(N) N##LL /* sqword_t constant */ 00135 #else /* OLD_SYMCAT */ 00136 #define ULL(N) N/**/ULL /* qword_t constant */ 00137 #define LL(N) N/**/LL /* sqword_t constant */ 00138 #endif 00139 #elif defined(__alpha) 00140 #define HOST_HAS_QWORD 00141 typedef unsigned long qword_t; /* qword - 64 bits */ 00142 typedef signed long sqword_t; 00143 #ifdef ANSI_SYMCAT 00144 #define ULL(N) N##UL /* qword_t constant */ 00145 #define LL(N) N##L /* sqword_t constant */ 00146 #else /* OLD_SYMCAT */ 00147 #define ULL(N) N/**/UL /* qword_t constant */ 00148 #define LL(N) N/**/L /* sqword_t constant */ 00149 #endif 00150 #elif defined(_MSC_VER) 00151 #define HOST_HAS_QWORD 00152 typedef unsigned __int64 qword_t; /* qword - 64 bits */ 00153 typedef signed __int64 sqword_t; 00154 #define ULL(N) ((qword_t)(N)) 00155 #define LL(N) ((sqword_t)(N)) 00156 #else /* !__GNUC__ && !__alpha */ 00157 #undef HOST_HAS_QWORD 00158 #endif 00159 00160 /* statistical counter types, use largest counter type available */ 00161 #ifdef HOST_HAS_QWORD 00162 typedef sqword_t counter_t; 00163 typedef sqword_t tick_t; /* NOTE: unsigned breaks caches */ 00164 #else /* !HOST_HAS_QWORD */ 00165 typedef dfloat_t counter_t; 00166 typedef dfloat_t tick_t; 00167 #endif /* HOST_HAS_QWORD */ 00168 00169 #ifdef __svr4__ 00170 #define setjmp _setjmp 00171 #define longjmp _longjmp 00172 #endif 00173 00174 #endif /* HOST_H */