• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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<%= $HEADER %>
17
18// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
19#define OPCODE_LIST(DEF) \
20% IR::instructions.each do |inst|
21% flags = inst.flags.empty? ? ['none'] : inst.flags
22% flags << 'pseudo_dst' if !inst.operands.empty? && inst.operands.first.has('pseudo')
23% flags << 'no_dst' if inst.operands.empty? || !inst.operands.first.is_dst?
24    DEF( <%= inst.opcode.ljust(20) %>, <%= inst.base.ljust(20) %>, <%= flags.map{|x| x.upcase }.join('|') %> ) \
25% end
26
27// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
28#define OPCODE_CLASS_LIST(DEF)  \
29% IR::instructions.map { |x| x.base }.uniq.each do |base|
30    DEF(<%= base %>) \
31% end
32    DEF(DynamicInputsInst) \
33
34// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
35#define FLAGS_LIST(DEF) \
36% IR::flags.each_pair do |flag, v|
37    DEF(<%= flag.upcase %>) \
38% end
39
40#ifndef NDEBUG
41// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
42#define INST_MODES_LIST \
43% IR::instructions.each do |inst|
44    <%= inst.modes.map{|x| x.upcase }.join('|') %>, \
45% end
46
47// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
48#define MODES_LIST(DEF) \
49% IR::modes.each_pair do |mode, v|
50    DEF(<%= mode.upcase %>) \
51% end
52
53#endif
54