112099Sjoerg/* $NetBSD: op.h,v 1.2 1995/07/03 21:24:27 cgd Exp $ */ 212099Sjoerg 312099Sjoerg/* 412099Sjoerg * Copyright (c) 1994, 1995 Jochen Pohl 512099Sjoerg * All Rights Reserved. 612099Sjoerg * 712099Sjoerg * Redistribution and use in source and binary forms, with or without 812099Sjoerg * modification, are permitted provided that the following conditions 912099Sjoerg * are met: 1012099Sjoerg * 1. Redistributions of source code must retain the above copyright 1112099Sjoerg * notice, this list of conditions and the following disclaimer. 1212099Sjoerg * 2. Redistributions in binary form must reproduce the above copyright 1312099Sjoerg * notice, this list of conditions and the following disclaimer in the 1412099Sjoerg * documentation and/or other materials provided with the distribution. 1512099Sjoerg * 3. All advertising materials mentioning features or use of this software 1612099Sjoerg * must display the following acknowledgement: 1712099Sjoerg * This product includes software developed by Jochen Pohl for 1812099Sjoerg * The NetBSD Project. 1912099Sjoerg * 4. The name of the author may not be used to endorse or promote products 2012099Sjoerg * derived from this software without specific prior written permission. 2112099Sjoerg * 2212099Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2312099Sjoerg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2412099Sjoerg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2512099Sjoerg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2612099Sjoerg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2712099Sjoerg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2812099Sjoerg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2912099Sjoerg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3012099Sjoerg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3112099Sjoerg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3212099Sjoerg */ 3312099Sjoerg 3412099Sjoerg/* 3512099Sjoerg * Various information about operators 3612099Sjoerg */ 3712099Sjoergtypedef struct { 3812099Sjoerg u_int m_binary : 1; /* binary op. */ 3912099Sjoerg u_int m_logop : 1; /* logical op., result is int */ 4012099Sjoerg u_int m_rqint : 1; /* operands must have integer type */ 4112099Sjoerg u_int m_rqsclt : 1; /* operands must have scalar type */ 4212099Sjoerg u_int m_rqatyp : 1; /* operands must have arithmetic type */ 4312099Sjoerg u_int m_fold : 1; /* operands should be folded */ 4412099Sjoerg u_int m_vctx : 1; /* value context for left operand */ 4512099Sjoerg u_int m_tctx : 1; /* test context for left operand */ 4612099Sjoerg u_int m_balance : 1; /* op. requires balancing */ 4712099Sjoerg u_int m_sideeff : 1; /* op. has side effect */ 4812099Sjoerg u_int m_tlansiu : 1; /* warning if left op. is unsign. in ANSI C */ 4912099Sjoerg u_int m_transiu : 1; /* warning if right op. is unsign. in ANSI C */ 5012099Sjoerg u_int m_tpconf : 1; /* test possible precedence confusion */ 5191586Smarkm u_int m_comp : 1; /* op. performs comparison */ 5212099Sjoerg u_int m_enumop : 1; /* valid operation on enums */ 5312099Sjoerg u_int m_badeop : 1; /* dubious operation on enums */ 5412099Sjoerg u_int m_eqwarn : 1; /* warning if on operand stems from == */ 5512099Sjoerg const char *m_name; /* name of op. */ 5612099Sjoerg} mod_t; 5712099Sjoerg 5812099Sjoergtypedef enum { 5912099Sjoerg NOOP = 0, 6012099Sjoerg ARROW, 6112099Sjoerg POINT, 6212099Sjoerg NOT, 6312099Sjoerg COMPL, 6412099Sjoerg INC, 6512099Sjoerg DEC, 6612099Sjoerg INCBEF, 6712099Sjoerg DECBEF, 6812099Sjoerg INCAFT, 6912099Sjoerg DECAFT, 7012099Sjoerg UPLUS, 7112099Sjoerg UMINUS, 7212099Sjoerg STAR, 7312099Sjoerg AMPER, 7412099Sjoerg MULT, 7512099Sjoerg DIV, 7612099Sjoerg MOD, 7712099Sjoerg PLUS, 7812099Sjoerg MINUS, 7912099Sjoerg SHL, 8012099Sjoerg SHR, 8112099Sjoerg LT, 8212099Sjoerg LE, 8312099Sjoerg GT, 8412099Sjoerg GE, 8512099Sjoerg EQ, 8612099Sjoerg NE, 8712099Sjoerg AND, 8812099Sjoerg XOR, 8912099Sjoerg OR, 9012099Sjoerg LOGAND, 9112099Sjoerg LOGOR, 9212099Sjoerg QUEST, 9312099Sjoerg COLON, 9412099Sjoerg ASSIGN, 9512099Sjoerg MULASS, 9612099Sjoerg DIVASS, 9712099Sjoerg MODASS, 9812099Sjoerg ADDASS, 9912099Sjoerg SUBASS, 10012099Sjoerg SHLASS, 10112099Sjoerg SHRASS, 10212099Sjoerg ANDASS, 10312099Sjoerg XORASS, 10412099Sjoerg ORASS, 10512099Sjoerg NAME, 10612099Sjoerg CON, 10712099Sjoerg STRING, 10812099Sjoerg FSEL, 10912099Sjoerg CALL, 11012099Sjoerg COMMA, 11112099Sjoerg CVT, 11212099Sjoerg ICALL, 11312099Sjoerg LOAD, 11412099Sjoerg PUSH, 11512099Sjoerg RETURN, 11612099Sjoerg INIT, /* pseudo op, not used in trees */ 11712099Sjoerg CASE, /* pseudo op, not used in trees */ 11812099Sjoerg FARG /* pseudo op, not used in trees */ 11912099Sjoerg#define NOPS ((int)FARG + 1) 12012099Sjoerg} op_t; 121