X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fscripts%2Fgenerate_machine.pl;h=93781690b64aaf1c909384be9b0aa3a0974869b8;hb=fca4a7571e9936920b4a116317826f796789cb15;hp=4272be0409d10467a42a71ba594d01cf136f95e8;hpb=8535fe8732b0acf822be252812a7158ce5b8134a;p=libfirm diff --git a/ir/be/scripts/generate_machine.pl b/ir/be/scripts/generate_machine.pl index 4272be040..93781690b 100755 --- a/ir/be/scripts/generate_machine.pl +++ b/ir/be/scripts/generate_machine.pl @@ -1,5 +1,24 @@ #!/usr/bin/perl -w +# +# Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. +# +# This file is part of libFirm. +# +# This file may be distributed and/or modified under the terms of the +# GNU General Public License version 2 as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL included in the +# packaging of this file. +# +# Licensees holding valid libFirm Professional Edition licenses may use +# this file in accordance with the libFirm Commercial License. +# Agreement provided with the Software. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE. +# + # This script generates the data structures for the machine description. # Creation: 2006/10/20 # $Id$ @@ -20,9 +39,9 @@ my $return; no strict "subs"; unless ($return = do $specfile) { - warn "couldn't parse $specfile: $@" if $@; - warn "couldn't do $specfile: $!" unless defined $return; - warn "couldn't run $specfile" unless $return; + die "Fatal error: couldn't parse $specfile: $@" if $@; + die "Fatal error: couldn't do $specfile: $!" unless defined $return; + die "Fatal error: couldn't run $specfile" unless $return; } use strict "subs"; @@ -40,10 +59,10 @@ my @obst_init_unit_types; # stack for unit type variable init my $bundle_size = exists($vliw{"bundle_size"}) ? $vliw{"bundle_size"} : 3; my $bundles_per_cycle = exists($vliw{"bundles_per_cycle"}) ? $vliw{"bundles_per_cycle"} : 1; -my $num_unit_types = scalar(keys(%cpu)); my $tmp = uc($arch); my $idx = 0; my $has_desc = defined(%cpu); +my $num_unit_types = scalar(keys(%cpu)); if ($has_desc) { push(@obst_unit_tp_defs, "/* enum for execution unit types */\n"); @@ -79,21 +98,21 @@ foreach my $unit_type (keys(%cpu)) { push(@obst_unit_tp_defs, "};\n\n") if ($has_desc); -open(OUT, ">$target_h") || die("Could not open $target_h, reason: $!\n"); +open(OUT, ">$target_h") || die("Fatal error: Could not open $target_h, reason: $!\n"); my $creation_time = localtime(time()); print OUT<$target_c") || die("Could not open $target_c, reason: $!\n"); +open(OUT, ">$target_c") || die("Fatal error: Could not open $target_c, reason: $!\n"); $creation_time = localtime(time()); print OUT< -#endif +#include "config.h" + +#include #include "gen_$arch\_machine.h" @@ -138,21 +158,29 @@ EOF print OUT @obst_execunits; +if ($num_unit_types > 0) { print OUT< 0) { + print OUT "};\n\n"; + $types = "$arch\_execution_unit_types"; +} else { + $types = "NULL"; +} +print OUT<