• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14  ets: |-
15    % name = inst.opcode.upcase.split('_')[1]
16    % case name
17    % when "LAUNCH"
18    %   is_range = inst.opcode.include? 'range'
19    %   is_virtual = inst.opcode.include? 'virt'
20    %   acc_read = inst.acc_read?
21    BuildLaunch<Opcode::<%= is_virtual ? 'CallLaunchVirtual' : 'CallLaunchStatic' %>, <%= is_range ? 'true' : 'false' %>, <%= acc_read %>>(instruction);
22    % when "LDOBJ"
23    BuildLdObjByName(instruction, <%= get_type(inst.dtype) %>);
24    % when "STOBJ"
25    BuildStObjByName(instruction, <%= get_type(inst.type(0)) %>);
26    % when "LDUNDEFINED"
27    UpdateDefinitionAcc(graph_->GetOrCreateUndefinedInst());
28    % when "MOVUNDEFINED"
29    UpdateDefinition(instruction->GetVReg<<%=inst.get_format%>, 0>(), graph_->GetOrCreateUndefinedInst());
30    % when "ISUNDEFINED"
31    auto undef_inst = graph_->GetOrCreateUndefinedInst();
32    auto cmp_inst = graph_->CreateInstCompare(DataType::BOOL, GetPc(instruction->GetAddress()), GetDefinitionAcc(),
33                                              undef_inst, DataType::REFERENCE, ConditionCode::CC_EQ);
34    AddInstruction(cmp_inst);
35    UpdateDefinitionAcc(cmp_inst);
36    % when "EQUALS"
37    BuildEquals(instruction);
38    % else
39    UNREACHABLE();
40    % end
41