Add -MP option

git-svn-id: file://localhost/svn/verilator/trunk/verilator@772 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2006-08-31 15:29:15 +00:00
parent 764e067c84
commit fe99abeccc
8 changed files with 36 additions and 16 deletions

View File

@ -5,13 +5,14 @@ indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.60**
** Many changes to the pointers used for internal structures.
When used with gcc's -fstrict-aliasing, large models are ~***% faster.
*** Changed how internal functions are invoked to avoid aliasing in GCC 3.3+.
*** Added --inhibit-sim flag for environments using old __Vm_inhibitSim.
*** Added `systemc_dtor for destructor extentions. [Allan Cochrane]
*** Added -MP to make phony dependencies, ala GCC's.
**** Declare optimized lookup tables as 'static', to reduce D-Cache miss rate.
**** Fix memory leak when destroying modules. [John Stroebel]

View File

@ -318,6 +318,11 @@ modules; they will always be inlined, if allowed.
Enable creation of .d dependency files, used for make dependency detection,
similar to gcc -MMD option. On by default, use --no-MMD to disable.
=item --MP
When creating .d dependency files with --MMD, make phony targets. Similar
to gcc -MP option.
=item --Mdir I<directory>
Specifies the name of the Make object directory. All generated files will
@ -645,14 +650,11 @@ fast path, mostly code that is executed every cycle. OPT_SLOW specifies
optimizations for slow-path files (plus tracing), which execute only
rarely, yet take a long time to compile with optimization on. OPT
specifies overall optimization and affects all compiles, including those
OPT_FAST and OPT_SLOW affect. For best results, use OPT="-O2
-fstrict-aliasing". Nearly the same results can be had with much better
compile times with OPT_FAST="-O1 -fstrict-aliasing". Unfortunately, using
the optimizer with SystemC files can result in compiles taking several
minutes. (The SystemC libraries have many little inlined functions that
drive the compiler nuts.) Also read the manual as to the effects of
-fstrict-aliasing; you may want to compile only the verilated code with
this flag.
OPT_FAST and OPT_SLOW affect. For best results, use OPT="-O2". Nearly the
same results can be had with much better compile times with OPT_FAST="-O1
-fstrict-aliasing". Unfortunately, using the optimizer with SystemC files
can result in compiles taking several minutes. (The SystemC libraries have
many little inlined functions that drive the compiler nuts.)
For best results, use GCC 3.3 or newer. GCC 3.2 and earlier have
optimization bugs around pointer aliasing detection, which can result in 2x

View File

@ -22,6 +22,7 @@ SP_INCLUDER = $(PERL) $(VERILATOR_ROOT)/bin/verilator_includer
######################################################################
# C Preprocessor flags
# Add -MMD -MP if you're using a recent version of GCC.
VK_CPPFLAGS_ALWAYS += \
-MMD \
-I$(VERILATOR_ROOT)/include \

View File

@ -65,6 +65,7 @@ CPPFLAGSNOWALL += -DYYDEBUG # Required to get nice error messages
CPPFLAGSNOWALL += $(COPT)
CPPFLAGS = $(CPPFLAGSNOWALL)
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
CPPFLAGSNOWALL += -MP # Only works on recent GCC versions
CPPFLAGS += -W -Wall -Wno-unused-parameter -Wno-char-subscripts -Werror
#CPPFLAGS += -pedantic-errors
endif

View File

@ -122,7 +122,18 @@ inline void V3FileDependImp::writeDepend(const string& filename) {
*ofp<<iter->filename()<<" ";
}
}
*ofp<<endl;
if (v3Global.opt.makePhony()) {
*ofp<<endl;
for (set<DependFile>::iterator iter=m_filenameList.begin();
iter!=m_filenameList.end(); ++iter) {
if (!iter->target()) {
*ofp<<iter->filename()<<":"<<endl;
}
}
}
}
inline void V3FileDependImp::writeTimes(const string& filename, const string& cmdlineIn) {

View File

@ -358,7 +358,8 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
}
// Single switches
else if ( !strcmp (sw, "-E") ) { m_preprocOnly = true; }
else if ( onoff (sw, "-MMD", flag/*ref*/) ) { m_depend = flag; }
else if ( onoff (sw, "-MMD", flag/*ref*/) ) { m_makeDepend = flag; }
else if ( onoff (sw, "-MP", flag/*ref*/) ) { m_makePhony = flag; }
else if ( onoff (sw, "-assert", flag/*ref*/) ) { m_assert = flag; m_psl = flag; }
else if ( !strcmp (sw, "-cc") ) { m_outFormatOk = true; m_systemC = false; m_systemPerl = false; }
else if ( onoff (sw, "-coverage", flag/*ref*/) ) { coverage(flag); }
@ -556,11 +557,12 @@ V3Options::V3Options() {
m_coverageLine = false;
m_coverageUser = false;
m_depend = true;
m_dumpTree = false;
m_exe = false;
m_ignc = false;
m_l2Name = true;
m_makeDepend = true;
m_makePhony = false;
m_outFormatOk = false;
m_pins64 = false;
m_profileCFuncs = false;

View File

@ -44,7 +44,8 @@ class V3Options {
V3StringSet m_libraryFiles; // Verilog -v files
bool m_preprocOnly; // main switch: -E
bool m_depend; // main switch: -MMD
bool m_makeDepend; // main switch: -MMD
bool m_makePhony; // main switch: -MP
bool m_assert; // main switch: --assert
bool m_coverageLine; // main switch: --coverage-block
bool m_coverageUser; // main switch: --coverage-func
@ -120,7 +121,8 @@ class V3Options {
// ACCESSORS (options)
const string& top() const { return m_top; }
bool preprocOnly() const { return m_preprocOnly; }
bool depend() const { return m_depend; }
bool makeDepend() const { return m_makeDepend; }
bool makePhony() const { return m_makePhony; }
bool underlineZero() const { return m_underlineZero; }
string bin() const { return m_bin; }
string flags() const { return m_flags; }

View File

@ -503,10 +503,10 @@ int main(int argc, char** argv, char** env) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",99));
V3Error::abortIfErrors();
if (v3Global.opt.depend()) {
if (v3Global.opt.makeDepend()) {
V3File::writeDepend(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__ver.d");
}
if (v3Global.opt.skipIdentical() || v3Global.opt.depend()) {
if (v3Global.opt.skipIdentical() || v3Global.opt.makeDepend()) {
V3File::writeTimes(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__verFiles.dat", argString);
}