Commit Graph

271 Commits

Author SHA1 Message Date
Thomas Jarosch 542c6e82d3 Match compiler: Cosmetic changes after running pylint 2013-01-04 03:44:04 +01:00
Thomas Jarosch 71a236b3df Match compiler: Turn code into a python class
This will make passing around internal states a lot easier
2013-01-04 03:38:40 +01:00
Thomas Jarosch f9c752667e Match compiler: Inline generated pattern match code for Token::findmatch
Verified the output in build/ stayed the same
if Token::findmatch support is disabled.
2013-01-04 03:13:22 +01:00
Thomas Jarosch 4b386986fc Match compiler: Check varid on first use like Token::Match does 2013-01-04 01:14:52 +01:00
Thomas Jarosch 5d5efdf99f Match compiler: Add support for Token::findmatch
(still disabled for performance reasons)
2013-01-04 01:01:57 +01:00
Thomas Jarosch 241d23ba8e Remove reduce tool in 'make clean' 2013-01-03 21:59:28 +01:00
Thomas Jarosch 4a2d2f78ef tools/reduce: Remove unused variable detected by cppcheck
[reduce.cpp:475]: (style) Variable 'decl' is assigned a value that is never used.
2013-01-03 21:38:47 +01:00
Thomas Jarosch 7417144784 Match compiler: Compile Token::findsimplematch() calls
Disabled for now as it runs slowers than before.
2013-01-03 19:33:37 +01:00
Daniel Marjamäki 76c8887f5f tools/reduce: remove cast in function parameter 2013-01-03 18:28:20 +01:00
Daniel Marjamäki 16612d010d tools/reduce: improvements to make it possible to reduce code that hangs 2013-01-03 15:22:54 +01:00
Daniel Marjamäki ed803b302b reduce: remove more stuff. unneeded #define , unneeded constructors, unneeded #ifndef etc 2013-01-02 17:08:04 +01:00
Daniel Marjamäki 1f3628a2fe reduce: remove more code blocks 2013-01-02 15:37:41 +01:00
Daniel Marjamäki 28d5ad9d21 dmake: fixed reduce compilation 2013-01-02 15:36:17 +01:00
Daniel Marjamäki 7f2d9cb7eb dmake: fixed compilation of reduce 2013-01-02 14:43:31 +01:00
Daniel Marjamäki 9877b77291 dmake: use 'make reduce' to compile the reduce program 2013-01-02 13:30:06 +01:00
Daniel Marjamäki e0a902e071 tools/reduce: various improvements to remove more code 2013-01-01 20:18:31 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki f2f8780504 tools/reduce: better handling of #include 2013-01-01 16:18:06 +01:00
Daniel Marjamäki e824f76ed7 tools/reduce: removing blocks of code that contain #if,#else,#endif 2013-01-01 14:33:32 +01:00
Daniel Marjamäki 6ee32943f2 tools/reduce: speedup, terminate checking when error is found 2013-01-01 13:56:37 +01:00
Thomas Jarosch 62b05193c4 MC: Split convertFile() function into smaller pieces
Output of build/ stayed the same.
2012-12-31 15:30:27 +01:00
Thomas Jarosch 311630ac1c Match compiler: Python syntax simplification
Output in build/ stayed the same
2012-12-31 15:03:00 +01:00
Thomas Jarosch 51cff0cb9b Match compiler: Speed up Token comparison with string literals. Ticket #4451
"Cache" string literals as C++ std::string objects.
The string length gets cached and so we don't need to
call strlen() on the literals at runtime.
2012-12-31 14:45:16 +01:00
Daniel Marjamäki 676b5a15a6 reduce: Added simple command line tool that reduces code for a false positive. 2012-12-31 12:41:36 +01:00
Thomas Jarosch 3c915b534d Match compiler: Collect and cache plain C-strings
Profiler runs with gperftools showed we were spending
a lot of time in strlen() even with compiled match patterns.

If you compare a std::string with a plain C-string,
the comparison operator needs to calculate the length
of the C-string via strlen().

We can avoid this by turning all C-strings into C++ strings,
which cache the string length internally.

The match compiler has been adapted to collect all
C-strings during compilation and aggregate them.

Benchmark on the 'rpm' code base on a Core i7 920 box:

cppcheck without matchcompiler:
real    0m30.977s

cppcheck with previous matchcompiler:
real    0m28.157s

cppcheck with cached C-strings:
real    0m17.823s
2012-12-30 23:24:28 +01:00
Thomas Jarosch fe5ee76165 Match compiler: No need to handle %num% twice 2012-12-30 20:33:49 +01:00
Thomas Jarosch 33f4bd0298 Silence cppcheck warning 2012-12-25 15:28:58 +01:00
Thomas Jarosch 3d0b4a9f7e Add execute permissions to matchcompiler.py on linux 2012-12-25 13:18:24 +01:00
Thomas Jarosch a2885a1759 Python 3 compatibility for the helper scripts
print() is a function in python 3.
Works with pyhton 2.x, too.
2012-12-25 13:12:58 +01:00
Daniel Marjamäki 3b3fe1c616 matchcompiler: throw InternalError if Token::Match is called with the varid 0 2012-12-19 06:45:05 +01:00
XhmikosR 9f11c01450 apply astyle 2012-12-15 09:46:02 +01:00
Daniel Marjamäki b6786c87b4 matchcompiler: handle %varid% 2012-12-14 16:59:37 +01:00
Daniel Marjamäki 7c931960bd Merge pull request #123 from Keruspe/master
build: Fix sources location
2012-12-11 11:13:39 -08:00
Marc-Antoine Perennou cd9782472f build: rename LIBDIR to SRCDIR
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2012-12-11 09:30:37 +01:00
Daniel Marjamäki 2d8ed65d43 compiled Token::Match patterns: refactorings,improvements 2012-12-10 20:28:11 +01:00
Daniel Marjamäki a11ec4a5ee matchcompiler: replaced regular expression with simple code that parses the code better 2012-12-08 19:29:16 +01:00
Daniel Marjamäki 9fcfb38a1c matchcompiler: merged regular expressions to a single expression 2012-12-08 16:22:55 +01:00
Daniel Marjamäki bef0cf149b matchcompiler: reverted changes so the 'make test' works again 2012-12-08 07:41:18 +01:00
Daniel Marjamäki 9bd222970e matchcompiler: fixed hang. don't know why it hangs. 2012-12-04 23:38:49 +01:00
Daniel Marjamäki ae7846bf7e matchcompiler: added some selftests for findMatchPattern 2012-12-04 22:57:52 +01:00
Daniel Marjamäki 514d06b015 Makefile: minor cleanup 2012-12-03 06:34:43 +01:00
Daniel Marjamäki 94930c3bd7 Compiled Token::Match patterns: let 'make clean' cleanup compiled patterns 2012-12-02 13:42:48 +01:00
Daniel Marjamäki ef5eece286 Compiled Token::Match patterns: extended match patterns and refactored the script a little 2012-12-02 13:39:59 +01:00
Daniel Marjamäki d630d34b62 Compiled Token::Match patterns. Added python script solution. Python is required to build with compiled patterns. To build cppcheck with compiled patterns use 'make LIBDIR=build'. 2012-12-02 12:36:55 +01:00
Daniel Marjamäki 29263e63fe times: added shell script that executes previous tags 2012-11-30 12:12:04 +01:00
Daniel Marjamäki ea9f0718b0 tools/times: minor tweaks 2012-11-27 12:20:23 +01:00
Daniel Marjamäki b200e1c430 tools/times: tweaked shell script to work better 2012-11-27 07:24:18 +01:00
Daniel Marjamäki 1ebab4a442 tools/times: added simple scripts to generate time stats for cppcheck 2012-11-27 06:08:26 +01:00
XhmikosR 941945bf42 missing tab to space 2012-09-29 18:02:34 +02:00
XhmikosR 9b5c245899 tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-29 13:49:16 +02:00