00001 /*============================================================================== 00002 * FILE: operator.h 00003 * OVERVIEW: Declares the enum OPER, which is used within class Exp to 00004 * denote what the top level operator is 00005 *============================================================================*/ 00006 /* 00007 * $Revision: 1.27 $ // 1.25.6.3 00008 * 00009 * 05 Apr 02 - Mike: Created 00010 * 12 Apr 02 - Mike: INDEX -> OPER 00011 */ 00012 00013 // The OPER (and integer representation) of expressions (they can be a fair 00014 // bit different from operators) 00015 enum OPER 00016 { 00017 // Operators 00018 opWild = -1, // Wildcard (Terminal for search Exps only) 00019 opPlus, // Binary addition 00020 opMinus, // Binary subtraction 00021 opMult, // Multiplication 00022 opDiv, // Integer division 00023 opFPlus, // Binary addition(single floats) 00024 opFMinus, // Binary subtraction(single floats) 00025 opFMult, // Multiplication(single floats) 00026 opFDiv, // (single floats) 00027 opFNeg, // Floating point negate 00028 opFPlusd, // addition(double floats) 00029 opFMinusd, // subtraction(double floats) 00030 opFMultd, // Multiplication(double floats) 00031 opFDivd, // Integer division(double floats) 00032 opFPlusq, // addition(quad floats) 00033 opFMinusq, // subtraction(quad floats) 00034 opFMultq, // Multiplication(quad floats) 00035 opFDivq, // division(quad floats) 00036 opFMultsd, // Multiplication(single floats--> double floats) 00037 opFMultdq, // Multiplication(single floats--> double floats) 00038 opSQRTs, // sqrt of a single 00039 opSQRTd, // sqrt of a double 00040 opSQRTq, // sqrt of a quad 00041 00042 opMults, // Multiply signed 00043 opDivs, // Divide signed 00044 opMod, // Remainder of integer division 00045 opMods, // Remainder of signed integer division 00046 opNeg, // Unary minus 00047 00048 opAnd, // Logical and 00049 opOr, // Logical or 00050 opEquals, // Equality (logical) 00051 opNotEqual, // Logical != 00052 opLess, // Logical less than (signed) 00053 opGtr, // Logical greater than (signed) 00054 opLessEq, // Logical <= (signed) 00055 opGtrEq, // Logical >= (signed) 00056 opLessUns, // Logical less than (unsigned) 00057 opGtrUns, // Logical greater than (unsigned) 00058 opLessEqUns, // Logical <= (unsigned) 00059 opGtrEqUns, // Logical >= (unsigned) 00060 opUpper, // Greater (signed or unsigned; used by switch code) 00061 opLower, // Less than signed or unsigned; used by switch code 00062 00063 opNot, // Bitwise inversion 00064 opLNot, // Logical not 00065 opSignExt, // Sign extend 00066 opBitAnd, // Bitwise and 00067 opBitOr, // Bitwise or 00068 opBitXor, // Bitwise xor 00069 opShiftL, // Left shift 00070 opShiftR, // Right shift 00071 opShiftRA, // Right shift arithmetic 00072 opRotateL, // Rotate left 00073 opRotateR, // Rotate right 00074 opRotateLC, // Rotate left through carry 00075 opRotateRC, // Rotate right through carry 00076 opTargetInst, // Target specific instruction (Unary) 00077 // See frontend.cc for details 00078 00079 opTypedExp, // Typed expression 00080 opNamedExp, // Named expression (binary, subExp1 = Const("name"), subExp2 = exp) 00081 opGuard, // Guarded expression (should be assignment) 00082 // The below is (and should) probably no longer used. Use opList instead 00083 opComma, // Separate expressions in a list (e.g. params) 00084 opFlagCall, // A flag call (Binary with string and params) 00085 opFlagDef, // A flag function definition (class FlagDef) 00086 opList, // A binary, with expression (1) and next element 00087 // in chain (2). Last element in chain is opNil 00088 // Next three are for parser use only. Binary with name of table and name 00089 // of string as Const string subexpressions. Actual table info held in the 00090 // TableDict object 00091 opNameTable, // A table of strings 00092 opExpTable, // A table of expressions 00093 // Actually, opOptable needs 4 subexpressions (table, index, and two 00094 // expressions to operate on), so it's actually a Ternary with table, 00095 // index, and a list of expressions to operate on. This actually allows 00096 // more generality, e.g. unary or ternary operators int the table 00097 opOpTable, // A table of operators 00098 opSuccessor, // Get the successor register of this parameter 00099 00100 opTern, // Ternary (i.e. ? : ) 00101 opAt, // Bit extraction (expr@first:last in that order) 00102 00103 opRegOf, // Represents r[] 00104 opMemOf, // Represents m[] 00105 opAddrOf, // Represents a[] 00106 opWildMemOf, // m[wild], 00107 opWildRegOf, // r[wild], 00108 opWildAddrOf, // a[wild], 00109 opDefineAll, // A wild definition 00110 opVar, // Represents l[] (recovered locations) 00111 opPhi, // Represents phi(a1, a2, a3) .. ie SSA form merging 00112 opSubscript, // Represents subscript(e, n) .. ie SSA renaming 00113 opParam, // SSL parameter param`' 00114 opArg, // Used a temporary for arguments to calls 00115 opLocal, // used to represent a local, takes a string 00116 opGlobal, // used to represent a global, takes a string 00117 opExpand, // Expandable expression 00118 opMemberAccess, // . and -> in C 00119 opArrayIndex, // [] in C 00120 opTemp, // Temp register name 00121 opSize, // Size specifier 00122 opCastIntStar, // Cast to int* 00123 opPostVar, // Post-instruction variable marker (unary with any subexpression). Can arise in some SSL 00124 // files when ticked variables are used 00125 opMachFtr, // A Unary with Const(string) representing a machine specific feature (register, instruction 00126 // or whatever; the analysis better understand it and transform it away) 00127 00128 opTruncu, // Integer truncate (unsigned) 00129 opTruncs, // Integer truncate (signed) 00130 opZfill, // Integer zero fill 00131 opSgnEx, // Integer sign extend 00132 00133 opFsize, // Floating point size conversion 00134 opItof, // Integer to floating point (and size) conversion 00135 opFtoi, // Floating point to integer (and size) conversion 00136 opFround, // Floating point to nearest float conversion 00137 opFtrunc, // chop float to int, e.g. 3.99 -> 3.00 00138 opFabs, // floating point absolute function 00139 opForceInt, // Forcibly change current type to int/flt, 00140 opForceFlt, // without changing any of the bits 00141 opFpush, // Floating point stack push 00142 opFpop, // Floating point stack pop 00143 00144 opSin, // sine 00145 opCos, // cosine 00146 opTan, // tangent 00147 opArcTan, // inverse tangent 00148 opLog2, // logarithm to base 2 00149 opLog10, // logarithm to base 10 00150 opLoge, // logarithm to base e 00151 opPow, // raise to a power 00152 opSqrt, // square root 00153 opExecute, // Execute instruction at(addr) 00154 00155 opIntConst, // integer constant 00156 opLongConst, // long integer constant 00157 opFltConst, // floating point constant 00158 opStrConst, // string constant 00159 opFuncConst, // a function constant (address of named function) 00160 opWildIntConst, // Terminal integer constant whose value is wild 00161 opWildStrConst, // Terminal string constant whose value is wild 00162 00163 00164 // Terminals (zero parameter special locations) 00165 // All machines are assumed to have these following registers: 00166 opPC, // program counter 00167 // This is the abstract frame pointer register (CSR/PAL analysis). 00168 opAFP, // abstract frame pointer 00169 // This is the abstract global pointer register (CSR/PAL analysis) 00170 opAGP, // abstract global pointer 00171 // This is a "nil list" terminal (e.g. no parameters) 00172 opNil, // Nil list 00173 // This is the abstracted integer flags register terminal 00174 opFlags, // Flags 00175 // This is the abstracted floating point flags terminal 00176 opFflags, 00177 00178 // This is an abstract boolean that if true causes the following instruction to be anulled 00179 opAnull, // Anull "variable" 00180 // This is a special terminal representing "all locations", which in practice means "every location whose definition 00181 // reaches here". 00182 00183 00184 // Added for type analysis 00185 opHLCTI, // High level Control transfer instruction 00186 opDEFINE, // Define Type of use with lexer 00187 opTrue, 00188 opFalse, 00189 opTypeOf, // Unary: takes a location, makes a type variable 00190 opKindOf, 00191 opTypeVal, // Wraps a Type into a type value (TypeVal) 00192 00193 // Added for range analysis 00194 opInitValueOf, // The initial value of a location, typically the stack pointer 00195 00196 //---------------------- "The line" --------------------------// 00197 // All id's greater or equal to idMachSpec are assumed to be source machine 00198 // specific. If any of these are left by the time the back end is called, 00199 // then these need to have local variables assigned for them 00200 opZF, // zero flag 00201 opCF, // carry flag 00202 opNF, // negative flag 00203 opOF, // overflow flag 00204 opDF, // pentium Direction (=Down) flag 00205 opFZF, // floating point zero flag 00206 opFLF, // floating point less flag 00207 opFGF, // floating point greater flag 00208 opCTI, // Control transfer instruction (boolean) 00209 opNEXT, // Next PC pseudo-register 00210 00211 // ALWAYS LAST! 00212 opNumOf // Special index: MUST BE LAST! 00213 }; 00214