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 18#include <initializer_list> 19#include "assembly-ins.h" 20 21namespace panda::pandasm { 22 23% Panda::instructions.group_by(&:mnemonic).each do |mnemonic, group| 24% insn = group.first 25% signature = assembler_signature(group, insn.jump?) 26% signature_str = signature.map { |o| "#{o.type} #{o.name}" }.join(', ') 27inline Ins Create_<%= insn.asm_token %>(<%= signature_str %>) 28 { 29 Ins <%=insn.emitter_name%>_; 30 <%=group.first.emitter_name%>_.opcode = Opcode::<%= insn.asm_token %>; 31% format = format_ops(insn.format) 32% format.each { |o| o.width = storage_width(o.width) } 33% count_reg = 0 34% format.each_with_index do |o, i| 35% if o.name.start_with?('v') 36% count_reg += 1 37% end 38% end 39% if count_reg > 0 then 40 <%=group.first.emitter_name%>_.regs.reserve(<%= count_reg %>); 41% end 42% format.each_with_index do |o, i| 43% if o.name.start_with?('imm') 44% if insn.jump? 45 <%=group.first.emitter_name%>_.ids.push_back(label); 46% else 47 <%=group.first.emitter_name%>_.imms.emplace_back(<%= o.name %>); 48% end 49% elsif o.name.start_with?('id') 50 <%=group.first.emitter_name%>_.ids.push_back(<%= o.name %>); 51% else 52 <%=group.first.emitter_name%>_.regs.push_back(<%= o.name %>); 53% end 54% end 55 return <%=insn.emitter_name%>_; 56 } 57 58% end 59 60 61} // namespace panda::pandasm 62