• 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% columns = %w(Instruction Destination Inputs Properties Verification Description)
17| <%= columns.join(' | ') %> |
18| <%= '---|' * columns.size %>
19<%
20null_check_users = IR::instructions.select { |x| x.operands.any? { |o| o.tokens.include? Tokens::Other::NULL_CHECK}}
21zero_check_users = IR::instructions.select { |x| x.operands.any? { |o| o.tokens.include? Tokens::Other::ZERO_CHECK}}
22bounds_check_users = IR::instructions.select { |x| x.operands.any? { |o| o.tokens.include? Tokens::Other::BOUNDS_CHECK}}
23negative_check_users = IR::instructions.select { |x| x.operands.any? { |o| o.tokens.include? Tokens::Other::NEGATIVE_CHECK}}
24
25IR::instructions.each do |inst|
26  dest = inst.has_dst? ? inst.operands.first.types.join(', ') : ''
27  inputs = inst.has_inputs? ? "<ul><li> #{inst.inputs.map {|x| x.types_string }.join('</li><li>') } </li></ul>" : ''
28  verify = (inst.respond_to? 'verification') ? inst.verification : []
29  case inst.opcode
30  when 'NullCheck'
31    verify << "users.contain(#{ null_check_users.map { |x| x.opcode }.join(', ')})"
32  when 'ZeroCheck'
33    verify << "users.contain(#{ zero_check_users.map { |x| x.opcode }.join(', ')})"
34  when 'BoundsCheck'
35    verify << "users.contain(#{ bounds_check_users.map { |x| x.opcode }.join(', ')})"
36  when 'NegativeCheck'
37    verify << "users.contain(#{ negative_check_users.map { |x| x.opcode }.join(', ')})"
38  end
39  verify_str = !verify.empty? ? "<ul><li> #{verify.join('</li><li>') } </li></ul>" : ''
40-%>
41| <%= inst.opcode %> | <%= dest %> | <%= inputs %> | <%= inst.flags.join(', ') %> | <%= verify_str %> | <%= inst.description %> |
42% end
43
44### Legend:
45% IR::legend.each_pair do |chapter, values|
46**<%= chapter %>**
47%   values.each_pair do |key, value|
48- <font color="green"><%= key %></font>: <%= value %>
49%   end
50
51% end