1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// Stmt & Notmmpl 17 // storage access opcodes 18 OPCODE(dassign, DassignNode, (OPCODEISSTMT | OPCODENOTMMPL | OPCODEHASSSADEF), 8) 19 OPCODE(iassign, IassignNode, (OPCODEISSTMT | OPCODENOTMMPL | OPCODEHASSSADEF), 12) 20 // hierarchical control flow opcodes 21 OPCODE(block, BlockNode, (OPCODEISSTMT | OPCODENOTMMPL), 0) 22 OPCODE(if, IfStmtNode, (OPCODEISSTMT | OPCODENOTMMPL), 0) 23 OPCODE(switch, SwitchNode, (OPCODEISSTMT | OPCODENOTMMPL), 8) 24 // other opcodes 25 OPCODE(comment, CommentNode, (OPCODEISSTMT | OPCODENOTMMPL), 0) 26 OPCODE(eval, UnaryStmtNode, (OPCODEISSTMT | OPCODENOTMMPL), 8) 27// Expr & Notmmpl 28 // storage access opcodes 29 OPCODE(dread, AddrofNode, (OPCODENOTMMPL | OPCODEHASSSAUSE), 12) 30 OPCODE(iread, IreadNode, (OPCODENOTMMPL | OPCODEHASSSAUSE), 12) 31 // leaf opcodes 32 OPCODE(addrof, AddrofNode, OPCODENOTMMPL, 12) 33// Stmt 34 // storage access opcodes 35 OPCODE(regassign, RegassignNode, (OPCODEISSTMT | OPCODEHASSSADEF), 8) 36 // flat control flow opcodes 37 OPCODE(goto, GotoNode, OPCODEISSTMT, 8) 38 OPCODE(brfalse, CondGotoNode, OPCODEISSTMT, 8) 39 OPCODE(brtrue, CondGotoNode, OPCODEISSTMT, 8) 40 OPCODE(return, NaryStmtNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE), 0) 41 OPCODE(rangegoto, RangeGotoNode, OPCODEISSTMT, 8) 42 // call opcodes 43 OPCODE(call, CallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 44 OPCODE(icall, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 45 OPCODE(intrinsiccall, IntrinsiccallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 46 OPCODE(intrinsiccallwithtype, IntrinsiccallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 12) 47 OPCODE(callassigned, CallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL | OPCODEISCALLASSIGNED), 0) 48 OPCODE(icallassigned, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL | OPCODEISCALLASSIGNED), 0) 49 OPCODE(intrinsiccallassigned, IntrinsiccallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL | OPCODEISCALLASSIGNED), 0) 50 OPCODE(deoptcall, CallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 51 OPCODE(tailicall, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 52 53 // other opcodes 54 OPCODE(label, LabelNode, OPCODEISSTMT, 8) 55// Expr 56 // storage access opcodes 57 OPCODE(regread, RegreadNode, OPCODEHASSSAUSE, 8) 58 // leaf opcodes 59 OPCODE(constval, ConstvalNode, 0, 8) 60 // type conversion expression opcodes 61 OPCODE(ceil, TypeCvtNode, OPCODEISTYPECVT, 8) 62 OPCODE(cvt, TypeCvtNode, OPCODEISTYPECVT, 8) 63 OPCODE(floor, TypeCvtNode, OPCODEISTYPECVT, 8) 64 OPCODE(retype, RetypeNode, OPCODEISTYPECVT, 8) 65 OPCODE(trunc, TypeCvtNode, OPCODEISTYPECVT, 8) 66 // unary expression opcodes 67 OPCODE(abs, UnaryNode, 0, 0) 68 OPCODE(bnot, UnaryNode, 0, 0) 69 OPCODE(lnot, UnaryNode, 0, 0) 70 OPCODE(neg, UnaryNode, 0, 0) 71 OPCODE(sqrt, UnaryNode, 0, 0) 72 OPCODE(sext, ExtractbitsNode, 0, 8) 73 OPCODE(zext, ExtractbitsNode, 0, 8) 74 75 // binary expression opcodes 76 OPCODE(add, BinaryNode, 0, 0) 77 OPCODE(sub, BinaryNode, 0, 0) 78 OPCODE(mul, BinaryNode, 0, 0) 79 OPCODE(div, BinaryNode, OPCODEMAYTHROWEXCEPTION, 0) 80 OPCODE(rem, BinaryNode, OPCODEMAYTHROWEXCEPTION, 0) 81 OPCODE(ashr, BinaryNode, 0, 0) 82 OPCODE(lshr, BinaryNode, 0, 0) 83 OPCODE(shl, BinaryNode, 0, 0) 84 OPCODE(max, BinaryNode, 0, 0) 85 OPCODE(min, BinaryNode, 0, 0) 86 OPCODE(band, BinaryNode, 0, 0) 87 OPCODE(bior, BinaryNode, 0, 0) 88 OPCODE(bxor, BinaryNode, 0, 0) 89 OPCODE(eq, CompareNode, OPCODEISCOMPARE, 8) 90 OPCODE(ge, CompareNode, OPCODEISCOMPARE, 8) 91 OPCODE(gt, CompareNode, OPCODEISCOMPARE, 8) 92 OPCODE(le, CompareNode, OPCODEISCOMPARE, 8) 93 OPCODE(lt, CompareNode, OPCODEISCOMPARE, 8) 94 OPCODE(ne, CompareNode, OPCODEISCOMPARE, 8) 95 OPCODE(cmp, CompareNode, OPCODEISCOMPARE, 8) 96 OPCODE(cand, BinaryNode, OPCODENOTMMPL, 0) 97 OPCODE(cior, BinaryNode, OPCODENOTMMPL, 0) 98 // N-ary expression opcodes 99 OPCODE(intrinsicop, IntrinsicopNode, OPCODEISVARSIZE, 8) 100 // Other expression opcodes 101 OPCODE(extractbits, ExtractbitsNode, 0, 8) 102 // leaf node 103 OPCODE(icallproto, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 104 OPCODE(icallprotoassigned, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL | OPCODEISCALLASSIGNED), 8) 105