13af6ab5fSopenharmony_ci% def get_node_kind(mnemonic) 23af6ab5fSopenharmony_ci% return "#{mnemonic.gsub('.', '_').upcase}" 33af6ab5fSopenharmony_ci% end 43af6ab5fSopenharmony_ci% 53af6ab5fSopenharmony_ci% def get_format_name(mnemonic) 63af6ab5fSopenharmony_ci% return "#{mnemonic.gsub('.', '_').upcase}" + "_FORMATS" 73af6ab5fSopenharmony_ci% end 83af6ab5fSopenharmony_ci/** 93af6ab5fSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 103af6ab5fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 113af6ab5fSopenharmony_ci * you may not use this file except in compliance with the License. 123af6ab5fSopenharmony_ci * You may obtain a copy of the License at 133af6ab5fSopenharmony_ci * 143af6ab5fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 153af6ab5fSopenharmony_ci * 163af6ab5fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 173af6ab5fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 183af6ab5fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 193af6ab5fSopenharmony_ci * See the License for the specific language governing permissions and 203af6ab5fSopenharmony_ci * limitations under the License. 213af6ab5fSopenharmony_ci */ 223af6ab5fSopenharmony_ci 233af6ab5fSopenharmony_ci// Autogenerated file -- DO NOT EDIT! 243af6ab5fSopenharmony_ci 253af6ab5fSopenharmony_ci#ifndef ES2PANDA_COMPILER_GEN_IR_ISA_H 263af6ab5fSopenharmony_ci#define ES2PANDA_COMPILER_GEN_IR_ISA_H 273af6ab5fSopenharmony_ci 283af6ab5fSopenharmony_ci#include <ir/irnode.h> 293af6ab5fSopenharmony_ci#include <gen/formats.h> 303af6ab5fSopenharmony_ci#include <assembly-ins.h> 313af6ab5fSopenharmony_ci 323af6ab5fSopenharmony_cinamespace panda::es2panda::compiler { 333af6ab5fSopenharmony_ci 343af6ab5fSopenharmony_ciclass Label : public IRNode { 353af6ab5fSopenharmony_cipublic: 363af6ab5fSopenharmony_ci explicit Label(const ir::AstNode* node, std::string id) : IRNode(node), id_(std::move(id)) {} 373af6ab5fSopenharmony_ci 383af6ab5fSopenharmony_ci static constexpr std::string_view PREFIX = "LABEL_"; 393af6ab5fSopenharmony_ci 403af6ab5fSopenharmony_ci Formats GetFormats() const override 413af6ab5fSopenharmony_ci { 423af6ab5fSopenharmony_ci return Span<const Format>(nullptr, nullptr); 433af6ab5fSopenharmony_ci } 443af6ab5fSopenharmony_ci 453af6ab5fSopenharmony_ci const std::string &Id() const 463af6ab5fSopenharmony_ci { 473af6ab5fSopenharmony_ci return id_; 483af6ab5fSopenharmony_ci } 493af6ab5fSopenharmony_ci 503af6ab5fSopenharmony_ci size_t Registers([[maybe_unused]] std::array<VReg*, MAX_REG_OPERAND>* regs) override 513af6ab5fSopenharmony_ci { 523af6ab5fSopenharmony_ci return 0; 533af6ab5fSopenharmony_ci } 543af6ab5fSopenharmony_ci 553af6ab5fSopenharmony_ci size_t Registers([[maybe_unused]] std::array<const VReg*, MAX_REG_OPERAND>* regs) const override 563af6ab5fSopenharmony_ci { 573af6ab5fSopenharmony_ci return 0; 583af6ab5fSopenharmony_ci } 593af6ab5fSopenharmony_ci 603af6ab5fSopenharmony_ci void Transform(pandasm::Ins *ins) const override 613af6ab5fSopenharmony_ci { 623af6ab5fSopenharmony_ci ins->opcode = pandasm::Opcode::INVALID; 633af6ab5fSopenharmony_ci ins->set_label = true; 643af6ab5fSopenharmony_ci ins->label = id_; 653af6ab5fSopenharmony_ci } 663af6ab5fSopenharmony_ci 673af6ab5fSopenharmony_ci ICSlot SetIcSlot(IcSizeType currentSlot) override 683af6ab5fSopenharmony_ci { 693af6ab5fSopenharmony_ci return 0; 703af6ab5fSopenharmony_ci } 713af6ab5fSopenharmony_ci 723af6ab5fSopenharmony_ci bool InlineCacheEnabled() override 733af6ab5fSopenharmony_ci { 743af6ab5fSopenharmony_ci return false; 753af6ab5fSopenharmony_ci } 763af6ab5fSopenharmony_ci 773af6ab5fSopenharmony_ci ICSlot GetIcSlot() override 783af6ab5fSopenharmony_ci { 793af6ab5fSopenharmony_ci return 0; 803af6ab5fSopenharmony_ci } 813af6ab5fSopenharmony_ci 823af6ab5fSopenharmony_ci bool oneByteSlotOnly() override 833af6ab5fSopenharmony_ci { 843af6ab5fSopenharmony_ci return false; 853af6ab5fSopenharmony_ci } 863af6ab5fSopenharmony_ci 873af6ab5fSopenharmony_ci uint8_t IcSlots() override 883af6ab5fSopenharmony_ci { 893af6ab5fSopenharmony_ci return 0; 903af6ab5fSopenharmony_ci } 913af6ab5fSopenharmony_ci 923af6ab5fSopenharmony_ciprivate: 933af6ab5fSopenharmony_ci std::string id_; 943af6ab5fSopenharmony_ci}; 953af6ab5fSopenharmony_ci 963af6ab5fSopenharmony_ci% def insn2node(insn) 973af6ab5fSopenharmony_ci% mnemonic = insn.mnemonic.split('.') 983af6ab5fSopenharmony_ci% return mnemonic.map{|el| el == '64' ? 'Wide' : el.capitalize}.join() 993af6ab5fSopenharmony_ci% end 1003af6ab5fSopenharmony_ci% 1013af6ab5fSopenharmony_ci% def is_Range(insn) 1023af6ab5fSopenharmony_ci% if insn.mnemonic == "callrange" or insn.mnemonic == "wide.callrange" or 1033af6ab5fSopenharmony_ci% insn.mnemonic == "callthisrange" or insn.mnemonic == "wide.callthisrange" or 1043af6ab5fSopenharmony_ci% insn.mnemonic == "newobjrange" or insn.mnemonic == "wide.newobjrange" or 1053af6ab5fSopenharmony_ci% insn.mnemonic == "createobjectwithexcludedkeys" or insn.mnemonic == "wide.createobjectwithexcludedkeys" or 1063af6ab5fSopenharmony_ci% insn.mnemonic == "supercallthisrange" or insn.mnemonic == "wide.supercallthisrange" or 1073af6ab5fSopenharmony_ci% insn.mnemonic == "supercallarrowrange" or insn.mnemonic == "wide.supercallarrowrange" 1083af6ab5fSopenharmony_ci% return true 1093af6ab5fSopenharmony_ci% end 1103af6ab5fSopenharmony_ci% return false 1113af6ab5fSopenharmony_ci% end 1123af6ab5fSopenharmony_ci% 1133af6ab5fSopenharmony_ci% def is_VReg(name) 1143af6ab5fSopenharmony_ci% if name == :v 1153af6ab5fSopenharmony_ci% return true 1163af6ab5fSopenharmony_ci% end 1173af6ab5fSopenharmony_ci% end 1183af6ab5fSopenharmony_ci% 1193af6ab5fSopenharmony_ci% def is_Acc(name) 1203af6ab5fSopenharmony_ci% if name == :acc 1213af6ab5fSopenharmony_ci% return true 1223af6ab5fSopenharmony_ci% end 1233af6ab5fSopenharmony_ci% end 1243af6ab5fSopenharmony_ci% 1253af6ab5fSopenharmony_ci% def is_Imm(name) 1263af6ab5fSopenharmony_ci% if name == :imm 1273af6ab5fSopenharmony_ci% return true 1283af6ab5fSopenharmony_ci% end 1293af6ab5fSopenharmony_ci% end 1303af6ab5fSopenharmony_ci% 1313af6ab5fSopenharmony_ci% def is_Id(name) 1323af6ab5fSopenharmony_ci% if %i[method_id type_id field_id string_id stringId callsite_id literalarray_id].include?(name) 1333af6ab5fSopenharmony_ci% return true 1343af6ab5fSopenharmony_ci% end 1353af6ab5fSopenharmony_ci% end 1363af6ab5fSopenharmony_ci% 1373af6ab5fSopenharmony_ci% def get_operand_type(name, name_tmp, insn, map) 1383af6ab5fSopenharmony_ci% if is_VReg (name_tmp) 1393af6ab5fSopenharmony_ci% map['reg'].push("#{name}_") 1403af6ab5fSopenharmony_ci% return 'VReg' 1413af6ab5fSopenharmony_ci% elsif is_Imm(name_tmp) 1423af6ab5fSopenharmony_ci% if insn.properties.include? 'jump' 1433af6ab5fSopenharmony_ci% map['lbl'].push("#{name}_") 1443af6ab5fSopenharmony_ci% return "Label*" 1453af6ab5fSopenharmony_ci% end 1463af6ab5fSopenharmony_ci% map['imm'].push("#{name}_") 1473af6ab5fSopenharmony_ci% if insn.sig.include? 'imm:f64' 1483af6ab5fSopenharmony_ci% return 'double' 1493af6ab5fSopenharmony_ci% end 1503af6ab5fSopenharmony_ci% return 'int64_t' 1513af6ab5fSopenharmony_ci% elsif is_Id(name_tmp) 1523af6ab5fSopenharmony_ci% map['str'].push("#{name}_") 1533af6ab5fSopenharmony_ci% return 'util::StringView' 1543af6ab5fSopenharmony_ci% else 1553af6ab5fSopenharmony_ci% return nil 1563af6ab5fSopenharmony_ci% end 1573af6ab5fSopenharmony_ci% end 1583af6ab5fSopenharmony_ci% 1593af6ab5fSopenharmony_ci% def get_operands(sig) 1603af6ab5fSopenharmony_ci% return [] unless sig.include? ' ' 1613af6ab5fSopenharmony_ci% _, operands = sig.match(/(\S+) (.+)/).captures 1623af6ab5fSopenharmony_ci% operands = operands.split(', ') 1633af6ab5fSopenharmony_ci% end 1643af6ab5fSopenharmony_ci% 1653af6ab5fSopenharmony_ci% def get_ctor_args(insn) 1663af6ab5fSopenharmony_ci% operands = get_operands(insn.sig) 1673af6ab5fSopenharmony_ci% ops = Array.new 1683af6ab5fSopenharmony_ci% ctor_args = Array.new 1693af6ab5fSopenharmony_ci% op_map = Hash.new { |h, k| h[k] = [] } 1703af6ab5fSopenharmony_ci% id_count = 0 1713af6ab5fSopenharmony_ci% operands.map do |operand| 1723af6ab5fSopenharmony_ci% operand_parts = operand.split(':') 1733af6ab5fSopenharmony_ci% case operand_parts.size 1743af6ab5fSopenharmony_ci% when 1 1753af6ab5fSopenharmony_ci% name = operand_parts[0] 1763af6ab5fSopenharmony_ci% when 2 1773af6ab5fSopenharmony_ci% name, _ = operand_parts 1783af6ab5fSopenharmony_ci% when 3 1793af6ab5fSopenharmony_ci% name, _, _ = operand_parts 1803af6ab5fSopenharmony_ci% else 1813af6ab5fSopenharmony_ci% raise 'Unexpected operand string' 1823af6ab5fSopenharmony_ci% end 1833af6ab5fSopenharmony_ci% 1843af6ab5fSopenharmony_ci% name_tmp = name_tmp = name.to_s.gsub(/[0-9]/, '').to_sym; 1853af6ab5fSopenharmony_ci% 1863af6ab5fSopenharmony_ci% if is_Id(name_tmp) 1873af6ab5fSopenharmony_ci% name = "stringId_" 1883af6ab5fSopenharmony_ci% name.concat(id_count.to_s) 1893af6ab5fSopenharmony_ci% id_count = id_count + 1 1903af6ab5fSopenharmony_ci% end 1913af6ab5fSopenharmony_ci% 1923af6ab5fSopenharmony_ci% ops.push(name) 1933af6ab5fSopenharmony_ci% type = get_operand_type(name, name_tmp, insn, op_map) 1943af6ab5fSopenharmony_ci% ctor_args.push("#{type} #{name}") 1953af6ab5fSopenharmony_ci% end 1963af6ab5fSopenharmony_ci% return ops,ctor_args,op_map 1973af6ab5fSopenharmony_ci% end 1983af6ab5fSopenharmony_ci% 1993af6ab5fSopenharmony_ci% Panda::instructions.group_by(&:mnemonic).each do |mnemonic, group| 2003af6ab5fSopenharmony_ci% insn = group.first 2013af6ab5fSopenharmony_ci% node_kind = get_node_kind(mnemonic) 2023af6ab5fSopenharmony_ci% class_name = insn2node(insn) 2033af6ab5fSopenharmony_ci% is_range_op = is_Range(insn) 2043af6ab5fSopenharmony_ci% base_class = "IRNode" 2053af6ab5fSopenharmony_ci% ops_list,ctor_arg_list,op_map = get_ctor_args(insn) 2063af6ab5fSopenharmony_ci% ctor_args = "const ir::AstNode* node" + (ctor_arg_list.length == 0 ? "" : ", ") + ctor_arg_list.map {|arg| "#{arg}"}.join(", ") 2073af6ab5fSopenharmony_ci% members = ctor_arg_list.map {|arg| "#{arg}_;"}.join("\n ") 2083af6ab5fSopenharmony_ci% registers = op_map['reg'].map {|reg| "&#{reg}"}.join(", ") 2093af6ab5fSopenharmony_ci% ops = (ops_list.length == 0 ? "" : ", ") + ops_list.map { |op| "#{op}_(#{op})"}.join(", ") 2103af6ab5fSopenharmony_ciclass <%= class_name %> : public <%= base_class %> 2113af6ab5fSopenharmony_ci{ 2123af6ab5fSopenharmony_cipublic: 2133af6ab5fSopenharmony_ci explicit <%= class_name %>(<%= ctor_args %>) : <%= base_class %>(node)<%= ops %> {} 2143af6ab5fSopenharmony_ci 2153af6ab5fSopenharmony_ci Formats GetFormats() const override { 2163af6ab5fSopenharmony_ci return Span<const Format>(<%= get_format_name(insn.mnemonic) %>); 2173af6ab5fSopenharmony_ci } 2183af6ab5fSopenharmony_ci 2193af6ab5fSopenharmony_ci size_t Registers([[maybe_unused]] std::array<VReg*, MAX_REG_OPERAND>* regs) override 2203af6ab5fSopenharmony_ci { 2213af6ab5fSopenharmony_ci% reg_cnt = 0 2223af6ab5fSopenharmony_ci% for reg in op_map['reg'] 2233af6ab5fSopenharmony_ci (*regs)[<%= reg_cnt %>] = &<%= reg %>; 2243af6ab5fSopenharmony_ci% reg_cnt+=1; 2253af6ab5fSopenharmony_ci% end 2263af6ab5fSopenharmony_ci return <%= reg_cnt %>; 2273af6ab5fSopenharmony_ci } 2283af6ab5fSopenharmony_ci 2293af6ab5fSopenharmony_ci size_t Registers([[maybe_unused]] std::array<const VReg*, MAX_REG_OPERAND>* regs) const override 2303af6ab5fSopenharmony_ci { 2313af6ab5fSopenharmony_ci% reg_cnt = 0 2323af6ab5fSopenharmony_ci% for reg in op_map['reg'] 2333af6ab5fSopenharmony_ci (*regs)[<%= reg_cnt %>] = &<%= reg %>; 2343af6ab5fSopenharmony_ci% reg_cnt+=1; 2353af6ab5fSopenharmony_ci% end 2363af6ab5fSopenharmony_ci return <%= reg_cnt %>; 2373af6ab5fSopenharmony_ci } 2383af6ab5fSopenharmony_ci 2393af6ab5fSopenharmony_ci void Transform(pandasm::Ins* ins) const override 2403af6ab5fSopenharmony_ci { 2413af6ab5fSopenharmony_ci ins->opcode = pandasm::Opcode::<%= node_kind %>; 2423af6ab5fSopenharmony_ci% if op_map['reg'].length != 0 2433af6ab5fSopenharmony_ci ins->regs.reserve(<%= op_map['reg'].length %>); 2443af6ab5fSopenharmony_ci% end 2453af6ab5fSopenharmony_ci% if op_map['imm'].length != 0 2463af6ab5fSopenharmony_ci ins->imms.reserve(<%= op_map['imm'].length %>); 2473af6ab5fSopenharmony_ci% end 2483af6ab5fSopenharmony_ci% if op_map['str'].length + op_map['lbl'].length != 0 2493af6ab5fSopenharmony_ci ins->ids.reserve(<%= op_map['str'].length + op_map['lbl'].length %>); 2503af6ab5fSopenharmony_ci% end 2513af6ab5fSopenharmony_ci% for reg in op_map['reg'] 2523af6ab5fSopenharmony_ci ins->regs.emplace_back(<%= reg %>); 2533af6ab5fSopenharmony_ci% end 2543af6ab5fSopenharmony_ci% for imm in op_map['imm'] 2553af6ab5fSopenharmony_ci ins->imms.emplace_back(<%= imm %>); 2563af6ab5fSopenharmony_ci% end 2573af6ab5fSopenharmony_ci% for str in op_map['str'] 2583af6ab5fSopenharmony_ci ins->ids.emplace_back(<%= str %>.Mutf8()); 2593af6ab5fSopenharmony_ci% end 2603af6ab5fSopenharmony_ci% for lbl in op_map['lbl'] 2613af6ab5fSopenharmony_ci ins->ids.emplace_back(<%= lbl %>->Id()); 2623af6ab5fSopenharmony_ci% end 2633af6ab5fSopenharmony_ci } 2643af6ab5fSopenharmony_ci 2653af6ab5fSopenharmony_ci ICSlot SetIcSlot(IcSizeType slot) override 2663af6ab5fSopenharmony_ci { 2673af6ab5fSopenharmony_ci% is_jit_ic = insn.properties.include?("jit_ic_slot") 2683af6ab5fSopenharmony_ci% is_ic = (!is_jit_ic) && insn.properties.include?("ic_slot") 2693af6ab5fSopenharmony_ci% is_8_bit_ic = insn.properties.include?("eight_bit_ic") 2703af6ab5fSopenharmony_ci% is_16_bit_ic = (!is_8_bit_ic) && insn.properties.include?("sixteen_bit_ic") 2713af6ab5fSopenharmony_ci% is_8_16_bit_ic = (!is_16_bit_ic) && insn.properties.include?("eight_sixteen_bit_ic") 2723af6ab5fSopenharmony_ci% if (!is_jit_ic && !is_ic) 2733af6ab5fSopenharmony_ci return 0; 2743af6ab5fSopenharmony_ci% else 2753af6ab5fSopenharmony_ci% ret = insn.properties.include?("one_slot") ? 1 : 2; 2763af6ab5fSopenharmony_ci constexpr static ICSlot invalid = 0xFF; 2773af6ab5fSopenharmony_ci% if (is_16_bit_ic || is_8_16_bit_ic) 2783af6ab5fSopenharmony_ci if (slot <= 0xFF) { 2793af6ab5fSopenharmony_ci if ((slot + <%= ret %>) > 0xFF) { 2803af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = 0x100; 2813af6ab5fSopenharmony_ci return <%= ret %> + (0x100 - slot); 2823af6ab5fSopenharmony_ci } 2833af6ab5fSopenharmony_ci 2843af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = slot; 2853af6ab5fSopenharmony_ci return <%= ret %>; 2863af6ab5fSopenharmony_ci } 2873af6ab5fSopenharmony_ci 2883af6ab5fSopenharmony_ci if (slot > 0xFF && slot <= 0xFFFF) { 2893af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = slot; 2903af6ab5fSopenharmony_ci return <%= ret %>; 2913af6ab5fSopenharmony_ci } 2923af6ab5fSopenharmony_ci 2933af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = invalid; 2943af6ab5fSopenharmony_ci return 0; 2953af6ab5fSopenharmony_ci% end 2963af6ab5fSopenharmony_ci% if (is_8_bit_ic) 2973af6ab5fSopenharmony_ci if (slot <= 0xFF) { 2983af6ab5fSopenharmony_ci if ((slot + <%= ret %>) > 0xFF) { 2993af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = invalid; 3003af6ab5fSopenharmony_ci return 0x100 - slot; 3013af6ab5fSopenharmony_ci } 3023af6ab5fSopenharmony_ci 3033af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = slot; 3043af6ab5fSopenharmony_ci return <%= ret %>; 3053af6ab5fSopenharmony_ci } 3063af6ab5fSopenharmony_ci 3073af6ab5fSopenharmony_ci <%= op_map['imm'][0] %> = invalid; 3083af6ab5fSopenharmony_ci return 0; 3093af6ab5fSopenharmony_ci% end 3103af6ab5fSopenharmony_ci% end 3113af6ab5fSopenharmony_ci } 3123af6ab5fSopenharmony_ci 3133af6ab5fSopenharmony_ci bool InlineCacheEnabled() override 3143af6ab5fSopenharmony_ci { 3153af6ab5fSopenharmony_ci% is_jit_ic = insn.properties.include?("jit_ic_slot") 3163af6ab5fSopenharmony_ci% is_ic = (!is_jit_ic) && insn.properties.include?("ic_slot") 3173af6ab5fSopenharmony_ci% if (!is_jit_ic && !is_ic) 3183af6ab5fSopenharmony_ci return false; 3193af6ab5fSopenharmony_ci% else 3203af6ab5fSopenharmony_ci return true; 3213af6ab5fSopenharmony_ci% end 3223af6ab5fSopenharmony_ci } 3233af6ab5fSopenharmony_ci 3243af6ab5fSopenharmony_ci ICSlot GetIcSlot() override 3253af6ab5fSopenharmony_ci { 3263af6ab5fSopenharmony_ci% is_jit_ic = insn.properties.include?("jit_ic_slot") 3273af6ab5fSopenharmony_ci% is_ic = (!is_jit_ic) && insn.properties.include?("ic_slot") 3283af6ab5fSopenharmony_ci% if (!is_jit_ic && !is_ic) 3293af6ab5fSopenharmony_ci return 0; 3303af6ab5fSopenharmony_ci% else 3313af6ab5fSopenharmony_ci return <%= op_map['imm'][0] %>; 3323af6ab5fSopenharmony_ci% end 3333af6ab5fSopenharmony_ci } 3343af6ab5fSopenharmony_ci 3353af6ab5fSopenharmony_ci bool oneByteSlotOnly() override 3363af6ab5fSopenharmony_ci { 3373af6ab5fSopenharmony_ci% is_jit_ic = insn.properties.include?("jit_ic_slot") 3383af6ab5fSopenharmony_ci% is_ic = (!is_jit_ic) && insn.properties.include?("ic_slot") 3393af6ab5fSopenharmony_ci% if (!is_jit_ic && !is_ic) 3403af6ab5fSopenharmony_ci return false; 3413af6ab5fSopenharmony_ci% end 3423af6ab5fSopenharmony_ci% is_8_bit_ic = insn.properties.include?("eight_bit_ic") 3433af6ab5fSopenharmony_ci% if (is_8_bit_ic) 3443af6ab5fSopenharmony_ci return true; 3453af6ab5fSopenharmony_ci% else 3463af6ab5fSopenharmony_ci return false; 3473af6ab5fSopenharmony_ci% end 3483af6ab5fSopenharmony_ci } 3493af6ab5fSopenharmony_ci 3503af6ab5fSopenharmony_ci uint8_t IcSlots() override 3513af6ab5fSopenharmony_ci { 3523af6ab5fSopenharmony_ci% is_jit_ic = insn.properties.include?("jit_ic_slot") 3533af6ab5fSopenharmony_ci% is_ic = (!is_jit_ic) && insn.properties.include?("ic_slot") 3543af6ab5fSopenharmony_ci% if (!is_jit_ic && !is_ic) 3553af6ab5fSopenharmony_ci return 0; 3563af6ab5fSopenharmony_ci% else 3573af6ab5fSopenharmony_ci% ret = insn.properties.include?("one_slot") ? 1 : 2; 3583af6ab5fSopenharmony_ci return <%= ret %>; 3593af6ab5fSopenharmony_ci% end 3603af6ab5fSopenharmony_ci } 3613af6ab5fSopenharmony_ci 3623af6ab5fSopenharmony_ci% if is_range_op 3633af6ab5fSopenharmony_ci bool IsRangeInst() const override 3643af6ab5fSopenharmony_ci { 3653af6ab5fSopenharmony_ci return true; 3663af6ab5fSopenharmony_ci } 3673af6ab5fSopenharmony_ci 3683af6ab5fSopenharmony_ci int64_t RangeRegsCount() override 3693af6ab5fSopenharmony_ci { 3703af6ab5fSopenharmony_ci% if insn.mnemonic == "createobjectwithexcludedkeys" or insn.mnemonic.start_with? "wide." 3713af6ab5fSopenharmony_ci% if insn.mnemonic == "wide.callthisrange" or insn.mnemonic == "createobjectwithexcludedkeys" or 3723af6ab5fSopenharmony_ci% insn.mnemonic == "wide.createobjectwithexcludedkeys" 3733af6ab5fSopenharmony_ci return <%= op_map['imm'][0] %> + 1; 3743af6ab5fSopenharmony_ci% else 3753af6ab5fSopenharmony_ci return <%= op_map['imm'][0] %>; 3763af6ab5fSopenharmony_ci% end 3773af6ab5fSopenharmony_ci% else 3783af6ab5fSopenharmony_ci% if insn.mnemonic == "callthisrange" 3793af6ab5fSopenharmony_ci return <%= op_map['imm'][1] %> + 1; 3803af6ab5fSopenharmony_ci% else 3813af6ab5fSopenharmony_ci return <%= op_map['imm'][1] %>; 3823af6ab5fSopenharmony_ci% end 3833af6ab5fSopenharmony_ci% end 3843af6ab5fSopenharmony_ci } 3853af6ab5fSopenharmony_ci% end 3863af6ab5fSopenharmony_ci 3873af6ab5fSopenharmony_ci% if ops_list.length != 0 3883af6ab5fSopenharmony_ciprivate: 3893af6ab5fSopenharmony_ci <%= members %> 3903af6ab5fSopenharmony_ci% end 3913af6ab5fSopenharmony_ci}; 3923af6ab5fSopenharmony_ci 3933af6ab5fSopenharmony_ci% end 3943af6ab5fSopenharmony_ci} // namespace panda::es2panda::compiler 3953af6ab5fSopenharmony_ci 3963af6ab5fSopenharmony_ci#endif 397