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 // other opcodes 51 OPCODE(label, LabelNode, OPCODEISSTMT, 8) 52// Expr 53 // storage access opcodes 54 OPCODE(regread, RegreadNode, OPCODEHASSSAUSE, 8) 55 // leaf opcodes 56 OPCODE(constval, ConstvalNode, 0, 8) 57 // type conversion expression opcodes 58 OPCODE(ceil, TypeCvtNode, OPCODEISTYPECVT, 8) 59 OPCODE(cvt, TypeCvtNode, OPCODEISTYPECVT, 8) 60 OPCODE(floor, TypeCvtNode, OPCODEISTYPECVT, 8) 61 OPCODE(retype, RetypeNode, OPCODEISTYPECVT, 8) 62 OPCODE(trunc, TypeCvtNode, OPCODEISTYPECVT, 8) 63 // unary expression opcodes 64 OPCODE(abs, UnaryNode, 0, 0) 65 OPCODE(bnot, UnaryNode, 0, 0) 66 OPCODE(lnot, UnaryNode, 0, 0) 67 OPCODE(neg, UnaryNode, 0, 0) 68 OPCODE(sqrt, UnaryNode, 0, 0) 69 OPCODE(sext, ExtractbitsNode, 0, 8) 70 OPCODE(zext, ExtractbitsNode, 0, 8) 71 72 // binary expression opcodes 73 OPCODE(add, BinaryNode, 0, 0) 74 OPCODE(sub, BinaryNode, 0, 0) 75 OPCODE(mul, BinaryNode, 0, 0) 76 OPCODE(div, BinaryNode, OPCODEMAYTHROWEXCEPTION, 0) 77 OPCODE(rem, BinaryNode, OPCODEMAYTHROWEXCEPTION, 0) 78 OPCODE(ashr, BinaryNode, 0, 0) 79 OPCODE(lshr, BinaryNode, 0, 0) 80 OPCODE(shl, BinaryNode, 0, 0) 81 OPCODE(max, BinaryNode, 0, 0) 82 OPCODE(min, BinaryNode, 0, 0) 83 OPCODE(band, BinaryNode, 0, 0) 84 OPCODE(bior, BinaryNode, 0, 0) 85 OPCODE(bxor, BinaryNode, 0, 0) 86 OPCODE(eq, CompareNode, OPCODEISCOMPARE, 8) 87 OPCODE(ge, CompareNode, OPCODEISCOMPARE, 8) 88 OPCODE(gt, CompareNode, OPCODEISCOMPARE, 8) 89 OPCODE(le, CompareNode, OPCODEISCOMPARE, 8) 90 OPCODE(lt, CompareNode, OPCODEISCOMPARE, 8) 91 OPCODE(ne, CompareNode, OPCODEISCOMPARE, 8) 92 OPCODE(cmp, CompareNode, OPCODEISCOMPARE, 8) 93 OPCODE(cand, BinaryNode, OPCODENOTMMPL, 0) 94 OPCODE(cior, BinaryNode, OPCODENOTMMPL, 0) 95 // N-ary expression opcodes 96 OPCODE(intrinsicop, IntrinsicopNode, OPCODEISVARSIZE, 8) 97 // Other expression opcodes 98 OPCODE(extractbits, ExtractbitsNode, 0, 8) 99 // leaf node 100 OPCODE(icallproto, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL), 8) 101 OPCODE(icallprotoassigned, IcallNode, (OPCODEISSTMT | OPCODEISVARSIZE | OPCODEHASSSAUSE | OPCODEHASSSADEF | OPCODEISCALL | OPCODEISCALLASSIGNED), 8) 102