• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2024 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// NOLINTNEXTLINE(misc-definitions-in-headers,readability-function-size)
17inline void SetAbcKitFlags(Inst *inst)
18{
19    auto opcode = inst->GetOpcode();
20    if (opcode == Opcode::Intrinsic) {
21        inst->ClearFlag(inst_flags::REQUIRE_STATE);
22        return;
23    }
24    switch(opcode) {
25% IR::instructions.each do |inst|
26%   if inst.respond_to?("abckit_flags")
27% flags = inst.abckit_flags
28% flags << 'pseudo_dst' if !inst.operands.empty? && inst.operands.first.has('pseudo')
29% flags << 'no_dst' if inst.operands.empty? || !inst.operands.first.is_dst?
30        case Opcode::<%= inst.opcode %>: {
31            inst->SetFlagsMask(static_cast<inst_flags::Flags>(<%= flags.map{|x| "inst_flags::" + x.upcase }.join('|') %>));
32            return;
33        }
34%   else
35        case Opcode::<%= inst.opcode %>:
36            return;
37%   end
38%end
39        default:
40            return;
41    }
42}
43