News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

New Toy

Started by hutch--, December 15, 2005, 10:37:31 AM

Previous topic - Next topic

hutch--

I have had occasion on a regular basis to convert C algorithms into a reasonable MASM format for manual optimisation. I had a rough tool that did most of it but it needed to be tidied up to deliver more reliable results. The attached tool requires either CL.EXE from the VCTOOLKIT2003 or the version from the current VC2005 express edition. It does not work with the VC6 version of CL.EXE and most probably will not work with any others either.

When it is set up it builds a completely unoptimised output to get enough free registers to properly optimise the algorithm manually. It will only work on a single function and simply ignores any others and the parser is designed for a STDCALL procedure only, if the procedure is written with the C calling convention, the results will be untidy. A minor optimisation is performed by the tool, it replaces redundant loads and stores wihen used around and ADD or SUB with a direct memory ADD or SUB.

This is mainly to declutter the output and free up some of the registers used.

It should be easy enough to set up if you have either of the two tested C compilers. The settings button at the top allows you to choose the CL version required. The readme.txt file is built into the EXE and it displays on startup. There are a number of C algos supplied with it to test out the capacity.

With simple C algos that use normal data sizes, it will usually produce a MASM procedure that will run correctly but it can produce degraded quality output if there are unusual data structures, the tool is written to handle BYTE WORD and DWORD and it does not know how to handle anything else.

It is primarily a tool for programmers who want either optimisation practice or who need to produce better quality code that a good C compiler, something that is not an easy task.

Any feedback is welcome.


[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php