Alter(or mess with) sun4i target flags a bit
[AROS.git] / tools / sfdc / Macro68k.pl
blobc2b6ef62dfc9f7af6340e546036afc5f46c802c7
2 ### Class Macro68k: Implements m68k-only features for macro files #############
4 BEGIN {
5 package Macro68k;
6 use vars qw(@ISA);
7 @ISA = qw( MacroLP );
9 sub new {
10 my $proto = shift;
11 my $class = ref($proto) || $proto;
12 my $self = $class->SUPER::new( @_ );
14 $self->{a4a5} = 0;
16 bless ($self, $class);
17 return $self;
20 sub function_start {
21 my $self = shift;
22 my %params = @_;
23 my $prototype = $params{'prototype'};
24 my $sfd = $self->{SFD};
26 if ($$prototype{'type'} eq 'function') {
28 my $regs = join(',', @{$$prototype{'regs'}});
29 my $argtypes = join(',', @{$$prototype{'argtypes'}});
30 my $a4 = $regs =~ /a4/;
31 my $a5 = $regs =~ /a5/;
32 my $fp = $argtypes =~ /\(\*\)/;
34 if ($a4 && $a5) {
35 $self->{a4a5} = 1;
38 $self->{FUNCARGTYPE} = '';
39 for my $argtype (@{$$prototype{'argtypes'}}) {
40 if ($argtype =~ /\(\*\)/) {
41 $self->{FUNCARGTYPE} = $argtype;
42 last;
46 printf " LP%d%s%s%s%s%s(0x%x, ", $$prototype{'numargs'},
47 $prototype->{nr} ? "NR" : "",
48 $prototype->{nb} ? "NB" : "",
49 $a4 ? "A4" : "", $a5 ? "A5" : "",
50 $self->{FUNCARGTYPE} ne '' ? "FP" : "",
51 $$prototype{'bias'};
53 if (!$prototype->{nr}) {
54 print "$$prototype{'return'}, ";
57 print "$$prototype{'funcname'} ";
59 else {
60 $self->SUPER::function_start (@_);
65 sub function_arg {
66 my $self = shift;
67 my %params = @_;
68 my $prototype = $params{'prototype'};
70 if ($$prototype{'type'} eq 'function') {
71 my $argtype = $params{'argtype'};
72 my $argname = $params{'argname'};
73 my $argreg = $params{'argreg'};
75 if (!$self->{a4a5} && ($argreg eq 'a4' || $argreg eq 'a5')) {
76 $argreg = 'd7';
79 if ($argtype =~ /\(\*\)/) {
80 print ", __fpt, $argname, $argreg";
82 else {
83 print ", $argtype, $argname, $argreg";
86 else {
87 $self->SUPER::function_arg (@_);