1 /* 2 * Copyright (c) 1993-2018, NVIDIA CORPORATION. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #ifndef ILM_H_ 19 #define ILM_H_ 20 21 /* *** ILM Area *****/ 22 23 /* ILM_T is defined in gbldefs.h */ 24 25 typedef struct { 26 ILM_T *ilm_base; /* base pointer for ILM area */ 27 int ilm_size; /* size in ILM_Ts of ILM area */ 28 int ilmavl; /* relative ptr to next available word */ 29 int globalilmstart, globalilmcount; 30 } ILMB; 31 32 typedef struct { 33 ILM_T *ilm_base; 34 int ilm_size; 35 int ilmavl; 36 int ilmpos; 37 int globalilmcount, globalilmstart, globalilmtotal, globalilmfirst; 38 } GILMB; 39 40 /* *** ILM Attributes Declarations *****/ 41 42 typedef struct { 43 char *name; 44 char type; 45 short oprs; 46 unsigned int oprflag; 47 short temps; 48 short pattern; 49 short ilict; 50 } ILMINFO; 51 52 #define BOS_SIZE 4 53 54 #define IMTY_ARTH 'a' 55 #define IMTY_BRANCH 'b' 56 #define IMTY_CONS 'c' 57 #define IMTY_FSTR 'f' 58 #define IMTY_LOAD 'l' 59 #define IMTY_MISC 'm' 60 #define IMTY_PROC 'p' 61 #define IMTY_REF 'r' 62 #define IMTY_STORE 's' 63 #define IMTY_TRANS 't' 64 #define IMTY_INTR 'i' 65 #define IMTY_SMP 'S' 66 67 #define ILMO_NULL 0 68 #define ILMO_R 1 69 #define ILMO_RR 2 70 #define ILMO_IR 3 71 #define ILMO_KR 4 72 #define ILMO_T 5 73 #define ILMO_V 6 74 #define ILMO_IV 7 75 #define ILMO_ISYM 8 76 #define ILMO_RSYM 9 77 #define ILMO_DSYM 10 78 #define ILMO_ESYM 11 79 #define ILMO_DR 12 80 #define ILMO_AR 13 81 #define ILMO_SP 14 82 #define ILMO_DP 15 83 #define ILMO_SZ 16 84 #define ILMO_SCZ 17 85 #define ILMO_SCF 18 86 #define ILMO_ISP 19 87 #define ILMO_IDP 20 88 #define ILMO_XRSYM 21 89 #define ILMO_XDSYM 22 90 #define ILMO__ESYM 23 91 #define ILMO_LSYM 24 92 #define ILMO_LLSYM 25 93 #define ILMO_DRRET 26 94 #define ILMO_ARRET 27 95 #define ILMO_SPRET 28 96 #define ILMO_DPRET 29 97 #define ILMO_KRRET 30 98 #define ILMO_DRPOS 31 99 #define ILMO_ARPOS 32 100 #define ILMO_SPPOS 33 101 #define ILMO_DPPOS 34 102 103 #define ILMO_P 1 104 #define ILMO_RP 2 105 #define ILMO_IP 3 106 107 #define OPR_LNK 0 108 #define OPR_SYM 1 109 #define OPR_STC 2 110 #define OPR_N 3 111 112 #define IM_TYPE(i) ilms[i].type 113 #define IM_OPRFLAG(i, opn) ((ilms[i].oprflag >> (opn - 1) * 2) & 3) 114 #define IM_SPEC(i) (ilms[i].oprflag & 0x80000000) 115 #define IM_TRM(i) (ilms[i].oprflag & 0x40000000) 116 #define IM_VAR(i) (ilms[i].oprflag & 0x20000000) 117 #define IM_VEC(i) (ilms[i].oprflag & 0x10000000) 118 #define IM_DCPLX(i) (ilms[i].oprflag & 0x08000000) 119 #define IM_I8(i) (ilms[i].oprflag & 0x04000000) 120 #define IM_X87CPLX(i) (ilms[i].oprflag & 0x02000000) 121 #define IM_NOINLC(i) (ilms[i].oprflag & 0x01000000) 122 #define IM_DOUBLEDOUBLECPLX(i) (ilms[i].oprflag & 0x00800000) 123 #define IM_FLOAT128CPLX(i) (ilms[i].oprflag & 0x00400000) 124 125 /* *** ILM Template Declarations *****/ 126 127 typedef struct { 128 short opc; 129 short result; 130 short opnd[1]; 131 } ILMMAC; 132 133 typedef struct { 134 short type; 135 short aux; 136 } ILMOPND; 137 138 /* *** ILM External Data Declarations *****/ 139 140 extern ILMB ilmb; /* defined in ilmutil.c */ 141 extern ILMINFO ilms[]; /* defined in ilmtpdf.h */ 142 extern short ilmtp[]; /* defined in ilmtpdf.h */ 143 extern short ilmopnd[]; /* defined in ilmtpdf.h */ 144 extern char *ilmaux[]; /* defined in ilmtpdf.h */ 145 146 /* for non array parameters, default set by attributes of the function 147 */ 148 #define BYVALDEFAULT(func) \ 149 (!(PASSBYREFG(func)) && (PASSBYVALG(func) | STDCALLG(func) | CFUNCG(func))) 150 151 #ifdef N_ILM /* Use N_ILM to detect whether ILM_OP is defined */ 152 /** Check that ilmptr is plausibly a valid ILM index, and issue internal error 153 with text if it is not. Active only in DEBUG mode. */ 154 #define ASSERT_IS_LNK(ilmptr, text) \ 155 DEBUG_ASSERT((unsigned)(ilmptr)-1 < (unsigned)ilmb.ilmavl - 1 && \ 156 (unsigned)(ilmb.ilm_base[ilmptr]) - 1 < N_ILM - 1, \ 157 (text)) 158 159 #define ASSERT_IS_LABEL(labelptr, text) \ 160 DEBUG_ASSERT(STYPEG(labelptr) == ST_LABEL, (text)) 161 #endif // N_ILM 162 163 #ifndef ILMTOOLBUILD 164 #include "ilmutil.h" 165 #endif 166 167 #endif // ILM_H_ 168