1/*
2 * Copyright (c) 2021-2022 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// Autogenerated file -- DO NOT EDIT!
17
18void RegEncoder::VisitIf([[maybe_unused]] GraphVisitor* v, Inst* inst_base) {
19    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
20    [[maybe_unused]] auto inst = inst_base->CastToIf();
21    switch (inst->GetCc()) {
22    case compiler::CC_EQ:
23    case compiler::CC_NE:
24    case compiler::CC_LT:
25    case compiler::CC_LE:
26    case compiler::CC_GT:
27    case compiler::CC_GE: {
28        re->Check8Width(inst);
29        break;
30    }
31    default:
32        LOG(DEBUG, BYTECODE_OPTIMIZER) << "CheckWidth for " << compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
33        re->success_ = false;
34    }
35}
36void RegEncoder::VisitIfImm([[maybe_unused]] GraphVisitor* v, Inst* inst_base) {
37    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
38    [[maybe_unused]] auto inst = inst_base->CastToIfImm();
39    switch (inst->GetCc()) {
40    case compiler::CC_EQ:
41    case compiler::CC_NE:
42    case compiler::CC_LT:
43    case compiler::CC_LE:
44    case compiler::CC_GT:
45    case compiler::CC_GE: {
46        break;
47    }
48    default:
49        LOG(DEBUG, BYTECODE_OPTIMIZER) << "CheckWidth for " << compiler::GetOpcodeString(inst->GetOpcode()) << " failed";
50        re->success_ = false;
51    }
52}
53% call_me_from_template
54
55% visitors.each do |visitor|
56void RegEncoder::Visit<%= visitor.ir_op %>([[maybe_unused]] GraphVisitor* v, Inst* inst_base) {
57    [[maybe_unused]] auto re = static_cast<RegEncoder*>(v);
58    [[maybe_unused]] auto inst = inst_base->CastTo<%= visitor.ir_op %>();
59<%= visitor.switch.check_width %>
60}
61% end
62