#!/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$
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";
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");
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<<EOF;
-#ifndef _GEN_$tmp\_MACHINE_H_
-#define _GEN_$tmp\_MACHINE_H_
-
/**
- * Function prototypes for the machine description.
- * DO NOT EDIT THIS FILE, your changes will be lost.
- * Edit $specfile instead.
- * created by: $0 $specfile $target_dir
- * date: $creation_time
+ * \@file
+ * \@brief Function prototypes for the machine description.
+ * \@note DO NOT EDIT THIS FILE, your changes will be lost.
+ * Edit $specfile instead.
+ * created by: $0 $specfile $target_dir
+ * \@date $creation_time
*/
+#ifndef FIRM_BE_${tmp}_GEN_${tmp}_MACHINE_H
+#define FIRM_BE_${tmp}_GEN_${tmp}_MACHINE_H
#include "../bemachine.h"
print OUT<<EOF;
-#endif /* _GEN_$tmp\_MACHINE_H_ */
+#endif
EOF
close(OUT);
-open(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<<EOF;
/**
- * Generated functions for machine description interface.
- * DO NOT EDIT THIS FILE, your changes will be lost.
- * Edit $specfile instead.
- * created by: $0 $specfile $target_dir
- * date: $creation_time
+ * \@file
+ * \@brief Generated functions for machine description interface.
+ * \@note DO NOT EDIT THIS FILE, your changes will be lost.
+ * Edit $specfile instead.
+ * created by: $0 $specfile $target_dir
+ * \@date $creation_time
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
+
+#include <stdlib.h>
#include "gen_$arch\_machine.h"
print OUT @obst_execunits;
+if ($num_unit_types > 0) {
print OUT<<EOF;
be_execution_unit_type_t $arch\_execution_unit_types[] = {
EOF
+}
print OUT @obst_init_unit_types;
-print OUT<<EOF;
-};
+my $types;
+if ($num_unit_types > 0) {
+ print OUT "};\n\n";
+ $types = "$arch\_execution_unit_types";
+} else {
+ $types = "NULL";
+}
+print OUT<<EOF;
be_machine_t $arch\_cpu = {
$bundle_size,
$bundles_per_cycle,
$num_unit_types,
- $arch\_execution_unit_types
+ $types
};
/**