Added New regs.pl, and associated modules
[nasm/perl-rewrite.git] / perl / lib / Nasm / Regs / Format / FC.pm
blob38d76e82265c255350bf5a69e3cdd358671d63b3
1 use strict;
2 use warnings;
3 package Nasm::Regs::Format::FC;
5 sub format{
6 my($regs) = @_;
7 my $filename = $regs->filename;
9 my $out = <<END;
10 /* automatically generated from $filename - do not edit */
12 #include "tables.h"
13 #include "nasm.h"
15 const int32_t nasm_reg_flags[] = {
17 END
19 my @names = $regs->names;
21 #$out .= qq[ "];
22 for my $name (@names){
23 my $reg = $regs->Register($name)->AssemblerClass;
24 $out .= sprintf(" %-15s /* %-5s */\n", $reg, $name)
27 $out .= "};\n";
29 return $out;
34 __END__
35 # Output regflags.c
36 print "/* automatically generated from $file - do not edit */\n\n";
37 print "#include \"tables.h\"\n";
38 print "#include \"nasm.h\"\n\n";
39 print "const int32_t nasm_reg_flags[] = {\n";
40 printf " 0,\n"; # Dummy entry for 0
41 foreach $reg ( sort(keys(%regs)) ) {
42 # Print the class of the register
43 printf " %-15s /* %-5s */\n",
44 $regs{$reg}.',', $reg;
46 print "};\n";