Remove redundant back-end selections.

Target selection is done by the DLL target code generator, so there
is no value having a layer of target selection ahead of it. Remove
all that redundant code and simplify the target config files to reflect
this.
This commit is contained in:
Stephen Williams 2008-09-07 16:43:54 -07:00
parent 8717a85f7f
commit 4898cd04c6
14 changed files with 21 additions and 80 deletions

View File

@ -110,7 +110,7 @@ net_proc.o net_scope.o net_tran.o net_udp.o pad_to_width.o \
parse.o parse_misc.o pform.o pform_analog.o pform_disciplines.o \
pform_dump.o pform_types.o \
set_width.o symbol_search.o sync.o sys_funcs.o \
verinum.o verireal.o target.o targets.o \
verinum.o verireal.o target.o \
Attrib.o HName.o LineInfo.o Module.o PDelays.o PEvent.o \
PExpr.o PGate.o PGenerate.o PScope.o PSpec.o \
PTask.o PUdp.o PFunction.o PWire.o Statement.o AStatement.o StringHeap.o \

14
emit.cc
View File

@ -540,17 +540,3 @@ void NetEUnary::expr_scan(struct expr_scan_t*tgt) const
{
tgt->expr_unary(this);
}
int emit(const Design*des, const char*type)
{
for (unsigned idx = 0 ; target_table[idx] ; idx += 1) {
const struct target*tgt = target_table[idx];
if (strcmp(tgt->name, type) == 0)
return des->emit(tgt->meth);
}
cerr << "error: Code generator type " << type
<< " not found." << endl;
return -1;
}

14
main.cc
View File

@ -59,6 +59,7 @@ const char NOTICE[] =
# include "target.h"
# include "compiler.h"
# include "discipline.h"
# include "t-dll.h"
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
extern "C" int getopt(int argc, char*argv[], const char*fmt);
@ -79,8 +80,6 @@ const char VERSION[] = "$Name: $";
const char*basedir = ".";
const char*target = "null";
/*
* These are the language support control flags. These support which
* language features (the generation) to support. The generation_flag
@ -293,7 +292,7 @@ static void find_module_mention(map<perm_string,bool>&check_map, PGenerate*s);
* -T:<min/typ/max>
* Select which expression to use.
*
* -t:<target>
* -t:<target> (obsolete)
* Usually, "-t:dll"
*
* basedir:<path>
@ -483,7 +482,7 @@ static void read_iconfig_file(const char*ipath)
library_suff.push_back(strdup(cp));
} else if (strcmp(buf,"-t") == 0) {
target = strdup(cp);
// NO LONGER USED
} else if (strcmp(buf,"-T") == 0) {
if (strcmp(cp,"min") == 0) {
@ -844,11 +843,10 @@ int main(int argc, char*argv[])
}
if (verbose_flag) {
cout << "CODE GENERATION -t "<<target<< endl;
cout << "CODE GENERATION" << endl;
}
int emit_rc;
emit_rc = emit(des, target);
if (int emit_rc = des->emit(&dll_target_obj)) {
if (emit_rc > 0) {
cerr << "error: Code generation had "
<< emit_rc << " errors."
@ -859,6 +857,8 @@ int main(int argc, char*argv[])
cerr << "error: Code generator failure: " << emit_rc << endl;
return -1;
}
assert(emit_rc);
}
if (verbose_flag) {
if (times_flag) {

View File

@ -32,6 +32,8 @@
# include <stdlib.h>
# include "ivl_assert.h"
struct dll_target dll_target_obj;
#if defined(__WIN32__)
inline ivl_dll_t ivl_dlopen(const char *name)
@ -144,8 +146,6 @@ static perm_string make_scope_name(const hname_t&name)
return lex_strings.make(buf);
}
static struct dll_target dll_target_obj;
static void drive_from_link(const Link&lnk, ivl_drive_t&drv0, ivl_drive_t&drv1)
{
switch (lnk.drive0()) {
@ -2578,5 +2578,3 @@ bool dll_target::signal_paths(const NetNet*net)
return true;
}
extern const struct target tgt_dll = { "dll", &dll_target_obj };

View File

@ -178,6 +178,8 @@ struct dll_target : public target_t, public expr_scan_t {
static ivl_expr_t expr_from_value_(const verinum&that);
};
extern struct dll_target dll_target_obj;
/*
* These are various private declarations used by the t-dll target.
*/

View File

@ -151,11 +151,6 @@ struct expr_scan_t {
};
/* The emit functions take a design and emit it to the output stream
using the specified target. If the target is given by name, it is
located in the target_table and used. */
extern int emit(const Design*des, const char*type);
/* This function takes a fully qualified Verilog name (which may have,
for example, dots in it) and produces a mangled version that can be
used by most any language. */
@ -165,8 +160,4 @@ extern string mangle(const string&str);
used inside a string constant for a C++ compiler. */
extern string stresc(const string&str);
/* This is the table of supported output targets. It is a null
terminated array of pointers to targets. */
extern const struct target *target_table[];
#endif

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 1998 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "config.h"
# include "target.h"
extern const struct target tgt_dll;
const struct target *target_table[] = {
&tgt_dll,
0
};

View File

@ -1,5 +1,4 @@
functor:synth2
functor:synth
functor:syn-rules
-t:dll
flag:DLL=null.tgt

View File

@ -1,2 +1 @@
-t:dll
flag:DLL=null.tgt

View File

@ -3,5 +3,4 @@ functor:synth
functor:syn-rules
functor:cprop
functor:nodangle
-t:dll
flag:DLL=stub.tgt

View File

@ -1,4 +1,3 @@
functor:cprop
functor:nodangle
-t:dll
flag:DLL=stub.tgt

View File

@ -1,4 +1,3 @@
functor:cprop
functor:nodangle
-t:dll
flag:DLL=vhdl.tgt

View File

@ -3,5 +3,4 @@ functor:synth
functor:syn-rules
functor:cprop
functor:nodangle
-t:dll
flag:DLL=vvp.tgt

View File

@ -1,4 +1,3 @@
functor:cprop
functor:nodangle
-t:dll
flag:DLL=vvp.tgt