Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
mpp_sim.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <ar.h>
#include "arith.internal.h"
#include "int64.h"
Include dependency graph for mpp_sim.c:

Go to the source code of this file.

Classes

union  i64_union

Defines

#define AR_HDR_SIZE   sizeof(struct ar_hdr)
#define IEEE_FLOAT_32   (UNROUNDED_TYPE(AR_Float_IEEE_NR_32))
#define IEEE_FLOAT_64   (UNROUNDED_TYPE(AR_Float_IEEE_NR_64))
#define IEEE_FLOAT_128   (UNROUNDED_TYPE(AR_Float_IEEE_NR_128))
#define IEEE_COMPLEX_32   (UNROUNDED_TYPE(AR_Complex_IEEE_NR_32))
#define IEEE_COMPLEX_64   (UNROUNDED_TYPE(AR_Complex_IEEE_NR_64))
#define IEEE_COMPLEX_128   (UNROUNDED_TYPE(AR_Complex_IEEE_NR_128))
#define T3D   10 /* T3D primary machine type */
#define T3E   12 /* T3E primary machine type */
#define NOINTRIN   1 /* Unknown/unsupported intrinsic name */
#define ARITHERR   2 /* Arithmetic error detected by intrinsic */
#define EXTERROR   3 /* Unsupported external called by intrinsic */
#define SETERRNO   4 /* Set errno = ERANGE */
#define IFACEERR   5 /* Unsupported simulation interface */
#define HOSTEXT   6 /* Call host system external */
#define BADINSTR   7 /* Unsupported instructions in intrinsic */
#define MPP_STACK_SIZE   2048 /* # words to allocate for stack/heap space */
#define MPP_DSIB_SIZE   6 /* # words to allocate for DSIB space */
#define MPP_MAX_ARGS   8 /* Max number args allowed to any routine */
#define DISASM0(fmt)
#define DISASM1(fmt, x)
#define DISASM2(fmt, x, y)
#define DISASM3(fmt, x, y, z)
#define DISASM4(fmt, x, y, z, v)
#define DISASM5(fmt, x, y, z, v, w)
#define v0   0
#define t1   2
#define s0   9
#define fp   15
#define a0   16
#define a1   17
#define a2   18
#define a3   19
#define a4   20
#define a5   21
#define ci   25
#define ret   26
#define sp   30
#define zero   31
#define fv0   0
#define fv1   1
#define fa0   16
#define fzero   31
#define MAX_EXT_ADDRS   16 /* Max # of EXT addresses passed */
#define T3E_DSIB_LOC   (MPP_STACK_SIZE + (MPP_MAX_ARGS * 5))
#define T3D_AHDR_SIZE   174*8 /* # bytes in T3D a.out file headers */
#define CLD_T3E_AHDR_SIZE   512*8 /* # bytes in T3E a.out file headers */

Enumerations

enum  SegTypes {
  SEGT_DATA = 0, SEGT_TEXT = 1, SEGT_REGISTERS = 2, SEGT_STACK = 3,
  SEGT_EREGISTERS = 4, SEGT_BESUS = 5
}

Functions

static int call_host_external (char *func)
static void open_intrinsics_file (void)
static void load_mpp_word (AR_INT_64 *result, long segment, long offset)
static void store_mpp_word (long segment, long offset, AR_INT_64 *result)
int ar_clear_sim_state (AR_TYPE resulttype)
int ar_ext_address (AR_INT_64 *intaddr, const char *extaddr, int length)
int ar_pass_arg_address (const ar_data *arg, const AR_TYPE *argtype)
int ar_pass_ext_address (AR_INT_64 *extdesc, const char *addr, int nwords)
int ar_pass_fcd_address (const char *str, long lenstr)
int ar_pass_arg_value (const ar_data *arg, const AR_TYPE *argtype)
int ar_put_real_address (AR_INT_64 *extdesc)
int ar_get_function_value (ar_data *result, AR_TYPE *resulttype)
int ar_sim (char *intrinsic)

Variables

int ar_rounding_modes = 1<<AR_ROUND_NEAREST
int ar_underflow_modes = 1<<AR_UNDERFLOW_TO_PLUS_ZERO
char AR_libmv2 []
char AR_version []
static int ar_sim_version = 0
static int ar_mach_type = T3D
static AR_TYPE integer_64 = AR_Int_64_S
static AR_TYPE ieee_float_32 = (AR_TYPE) IEEE_FLOAT_32
static AR_TYPE ieee_float_64 = (AR_TYPE) IEEE_FLOAT_64
static unsigned char * mpp_intrin = NULL
static unsigned char * code = NULL
static unsigned char * data = NULL
static unsigned char * stack = NULL
static int D_roundmode = -1
static AR_TYPE D_float_32
static AR_TYPE D_float_64
static AR_TYPE D_float_128
static AR_TYPE D_complex_64
static AR_TYPE D_complex_128
static AR_INT_64 R [32]
static AR_INT_64 F [32]
static AR_HOST_SINT64 numargs = 0
static int n_external_addresses = 1
static unsigned code_segment_id
static unsigned data_segment_id
static unsigned stack_segment_id
static char * external_address [MAX_EXT_ADDRS]
static long external_length [MAX_EXT_ADDRS]
static int idf_fd
static long idf_size
static long text_size
static long data_offset
static char USMID [] = "\n%Z%%M% %I% %G% %U%\n"
static char rcsid [] = "$Id: mpp_sim.c,v 1.1.1.1 2002-05-22 20:06:19 dsystem Exp $"

Define Documentation

#define a1   17

Definition at line 214 of file mpp_sim.c.

Referenced by main().

#define a2   18

Definition at line 215 of file mpp_sim.c.

Referenced by ar_c1frecip(), and main().

#define a3   19

Definition at line 216 of file mpp_sim.c.

Referenced by main().

#define a4   20

Definition at line 217 of file mpp_sim.c.

Referenced by main().

#define a5   21

Definition at line 218 of file mpp_sim.c.

Referenced by main().

#define AR_HDR_SIZE   sizeof(struct ar_hdr)

Definition at line 48 of file mpp_sim.c.

Referenced by open_intrinsics_file().

#define ARITHERR   2 /* Arithmetic error detected by intrinsic */

Definition at line 84 of file mpp_sim.c.

Referenced by ar_sim().

#define BADINSTR   7 /* Unsupported instructions in intrinsic */

Definition at line 89 of file mpp_sim.c.

Referenced by ar_sim().

#define CLD_T3E_AHDR_SIZE   512*8 /* # bytes in T3E a.out file headers */

Definition at line 2673 of file mpp_sim.c.

Referenced by open_intrinsics_file().

#define DISASM0 (   fmt)

Definition at line 198 of file mpp_sim.c.

Referenced by ar_sim().

#define DISASM1 (   fmt,
 
)

Definition at line 199 of file mpp_sim.c.

Referenced by ar_sim().

#define DISASM2 (   fmt,
  x,
 
)

Definition at line 200 of file mpp_sim.c.

Referenced by ar_sim().

#define DISASM3 (   fmt,
  x,
  y,
 
)

Definition at line 201 of file mpp_sim.c.

Referenced by ar_sim().

#define DISASM4 (   fmt,
  x,
  y,
  z,
 
)

Definition at line 202 of file mpp_sim.c.

#define DISASM5 (   fmt,
  x,
  y,
  z,
  v,
 
)

Definition at line 203 of file mpp_sim.c.

Referenced by ar_sim().

#define EXTERROR   3 /* Unsupported external called by intrinsic */

Definition at line 85 of file mpp_sim.c.

Referenced by ar_sim().

#define fa0   16

Definition at line 226 of file mpp_sim.c.

Referenced by ar_pass_arg_value().

#define fv0   0

Definition at line 224 of file mpp_sim.c.

Referenced by ar_get_function_value().

#define fv1   1

Definition at line 225 of file mpp_sim.c.

#define fzero   31

Definition at line 227 of file mpp_sim.c.

Referenced by ar_sim().

#define HOSTEXT   6 /* Call host system external */

Definition at line 88 of file mpp_sim.c.

Referenced by ar_sim().

#define IFACEERR   5 /* Unsupported simulation interface */

Definition at line 87 of file mpp_sim.c.

Referenced by ar_sim().

#define MAX_EXT_ADDRS   16 /* Max # of EXT addresses passed */

Definition at line 229 of file mpp_sim.c.

Referenced by ar_ext_address().

#define MPP_DSIB_SIZE   6 /* # words to allocate for DSIB space */

Definition at line 92 of file mpp_sim.c.

Referenced by ar_sim().

#define MPP_MAX_ARGS   8 /* Max number args allowed to any routine */
#define MPP_STACK_SIZE   2048 /* # words to allocate for stack/heap space */
#define NOINTRIN   1 /* Unknown/unsupported intrinsic name */

Definition at line 83 of file mpp_sim.c.

Referenced by ar_sim().

#define ret   26

Definition at line 220 of file mpp_sim.c.

Referenced by ar_sim().

#define s0   9
#define SETERRNO   4 /* Set errno = ERANGE */

Definition at line 86 of file mpp_sim.c.

Referenced by ar_sim().

#define T3D   10 /* T3D primary machine type */

Definition at line 73 of file mpp_sim.c.

Referenced by ar_pass_fcd_address(), ar_sim(), and open_intrinsics_file().

#define T3D_AHDR_SIZE   174*8 /* # bytes in T3D a.out file headers */

Definition at line 2672 of file mpp_sim.c.

Referenced by open_intrinsics_file().

#define T3E   12 /* T3E primary machine type */

Definition at line 74 of file mpp_sim.c.

Referenced by open_intrinsics_file().

#define T3E_DSIB_LOC   (MPP_STACK_SIZE + (MPP_MAX_ARGS * 5))

Referenced by ar_sim().

#define v0   0

Definition at line 209 of file mpp_sim.c.

Referenced by ar_get_function_value(), ar_sim(), and call_host_external().


Enumeration Type Documentation

enum SegTypes
Enumerator:
SEGT_DATA 
SEGT_TEXT 
SEGT_REGISTERS 
SEGT_STACK 
SEGT_EREGISTERS 
SEGT_BESUS 

Definition at line 245 of file mpp_sim.c.


Function Documentation

int ar_pass_ext_address ( AR_INT_64 extdesc,
const char *  addr,
int  nwords 
)

Definition at line 450 of file mpp_sim.c.

References a0, ar_ext_address(), ar_internal_error(), AR_STAT_OK, ci, IS_ERROR_STATUS, MPP_MAX_ARGS, MPP_STACK_SIZE, NULL, numargs, AR_INT_64::part4, s0, stack_segment_id, store_mpp_word(), and ZERO64.

Here is the call graph for this function:

int ar_sim ( char *  intrinsic)

Definition at line 887 of file mpp_sim.c.

References A, ADD64, AMASK, ar_c1frecip(), ar_cfadd64(), ar_cfmul64(), ar_cfsub64(), ar_check_status(), AR_compare(), AR_Compare_EQ, AR_Compare_GT, AR_Compare_LT, AR_Compare_Unord, ar_convert_to_float(), AR_CRAY_FLOATING_POINT, AR_ERROR_STATUS, ar_ext_address(), ar_state_info::ar_float_format, AR_Float_IEEE_NR_32, AR_Float_IEEE_ZE_32, AR_IEEE_FLOATING_POINT, ar_ifadd64(), ar_ifcmp64(), ar_ifdiv64(), ar_ifix64(), ar_iflt64(), ar_ifmul64(), ar_ifsub64(), ar_imul64u(), ar_internal_error(), ar_isqrt64(), ar_mach_type, AR_RECIPROCAL_ITERATION, AR_ROUND_NEAREST, AR_ROUND_ZERO, AR_ROUNDED, ar_state_info::ar_rounding_mode, ar_sim_version, ar_sqrt(), AR_STAT_NEGATIVE, AR_STAT_OK, AR_STAT_OVERFLOW, AR_STAT_UNDEFINED, AR_STAT_ZERO, ar_state_register, ar_state_info::ar_truncate_bits, AR_UNROUNDED, i64_union::ari64, ARITHERR, ASB, B, BADINSTR, call_host_external(), ci, code, COPY64, D_float_32, D_roundmode, DISASM0, DISASM1, DISASM2, DISASM3, DISASM4, DISASM5, DISASMB, DISASMT, DISASMV, errno, EXTERROR, fp, fzero, getp1, HOSTEXT, ieee_float_32, ieee_float_64, IFACEERR, Internal, INTERRUPT_DIV, INTERRUPT_INP, INTERRUPT_INV, INTERRUPT_INX, INTERRUPT_OVF, INTERRUPT_UNF, IS_ERROR_STATUS, JSZP, i64_union::l64, load_mpp_word(), load_pvp_word(), MPP_DSIB_SIZE, MPP_STACK_SIZE, name, NEG64, NOINTRIN, NOT64, numargs, numargwds, one, p1, p2, AR_INT_64::part1, AR_INT_64::part2, AR_INT_64::part3, AR_INT_64::part4, prefix_check, PRINTMSG(), ret, RMMASK, S, s0, SETERRNO, SHLEFT64, SHLEFT64N, SHRIGHT64, SHRIGHT64N, sp, SR0, STACK, stack_segment_id, STACK_SIZE, store_mpp_word(), store_pvp_word(), T, t1, T3D, T3E_DSIB_LOC, T90, UNIMPL_INST, UNIMPL_PRFX, V, v0, VL, VM, VM1, VSZ, zero, and ZERO64.

Here is the call graph for this function:

static int call_host_external ( char *  func) [static]

Definition at line 870 of file mpp_sim.c.

References a0, ar_ext_address(), AR_STAT_UNDEFINED, AR_INT_64::part3, and v0.

Referenced by ar_sim().

Here is the call graph for this function:

static void load_mpp_word ( AR_INT_64 result,
long  segment,
long  offset 
) [static]

Definition at line 2996 of file mpp_sim.c.

References ar_internal_error(), data, data_segment_id, external_address, external_length, MPP_MAX_ARGS, MPP_STACK_SIZE, n_external_addresses, NULL, stack, and stack_segment_id.

Referenced by ar_sim().

Here is the call graph for this function:

static void store_mpp_word ( long  segment,
long  offset,
AR_INT_64 result 
) [static]

Variable Documentation

char AR_libmv2[]

Definition at line 39 of file edition.c.

int ar_mach_type = T3D [static]

Definition at line 77 of file mpp_sim.c.

Definition at line 60 of file mpp_sim.c.

int ar_sim_version = 0 [static]

Definition at line 76 of file mpp_sim.c.

Referenced by ar_sim(), and open_intrinsics_file().

Definition at line 61 of file mpp_sim.c.

char AR_version[]

Definition at line 38 of file edition.c.

unsigned char* code = NULL [static]

Definition at line 96 of file mpp_sim.c.

Referenced by ar_sim(), and open_intrinsics_file().

unsigned code_segment_id [static]

Definition at line 238 of file mpp_sim.c.

Referenced by ar_ext_address(), and open_intrinsics_file().

AR_TYPE D_float_32 [static]

Definition at line 102 of file mpp_sim.c.

Referenced by ar_clear_sim_state(), ar_pass_arg_address(), ar_pass_arg_value(), and ar_sim().

int D_roundmode = -1 [static]

Definition at line 100 of file mpp_sim.c.

Referenced by ar_clear_sim_state(), ar_pass_arg_address(), ar_pass_arg_value(), and ar_sim().

long data_offset [static]

Definition at line 2684 of file mpp_sim.c.

unsigned data_segment_id [static]

Definition at line 239 of file mpp_sim.c.

Referenced by ar_ext_address(), load_mpp_word(), open_intrinsics_file(), and store_mpp_word().

Definition at line 254 of file mpp_sim.c.

Referenced by ar_ext_address(), ar_put_real_address(), load_mpp_word(), and store_mpp_word().

Definition at line 255 of file mpp_sim.c.

Referenced by ar_ext_address(), load_mpp_word(), and store_mpp_word().

AR_INT_64 F[32] [static]

Definition at line 111 of file mpp_sim.c.

int idf_fd [static]

Definition at line 2681 of file mpp_sim.c.

Referenced by open_intrinsics_file().

long idf_size [static]

Definition at line 2682 of file mpp_sim.c.

Referenced by open_intrinsics_file().

Definition at line 80 of file mpp_sim.c.

Referenced by ar_pass_arg_value(), and ar_sim().

Definition at line 81 of file mpp_sim.c.

Referenced by ar_pass_arg_value(), and ar_sim().

Definition at line 79 of file mpp_sim.c.

Referenced by ar_get_function_value(), and ar_pass_arg_value().

unsigned char* mpp_intrin = NULL [static]

Definition at line 95 of file mpp_sim.c.

Referenced by ar_clear_sim_state(), and open_intrinsics_file().

AR_INT_64 R[32] [static]

Definition at line 110 of file mpp_sim.c.

char rcsid[] = "$Id: mpp_sim.c,v 1.1.1.1 2002-05-22 20:06:19 dsystem Exp $" [static]

Definition at line 3077 of file mpp_sim.c.

unsigned char* stack = NULL [static]
long text_size [static]

Definition at line 2683 of file mpp_sim.c.

Referenced by open_intrinsics_file().

char USMID[] = "\n%Z%%M% %I% %G% %U%\n" [static]

Definition at line 3076 of file mpp_sim.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines