开发者

Are there any ASM compilers?

I know ASM is generaly run through an assembler and result in a more or less one to one mapping to the final binary but that's not what I'm thinking of.开发者_JAVA百科

Does anyone make a tool that treats ASM (or object files) as a complied language that it can perform the full gamut of optimizations on? While such a tool might not be particularly useful in and of it's self, it could do things like function inlining from closed source static libraries.


Think of ASM and machine code as two different forms of expressing the same information (instructions). The output of a compiler is machine code. ASM is that already (only written in a human readable form), so a compiler wouldn't have much to do.

There are tools for assembly language that let you define macros or that do register allocation for you, but anything more advanced would be considered a compiler and its input not assembly language anymore.


while I agree with travelboy's answer in that any such 'compiled assembly' language wouldn't be assembly anymore, I have to mention that there are 'recompilers', and JITs whose source language is machine language (not even assembly).

These programs take a bunch of executable code, typically already loaded and ready to execute, and transform it, recognizing a varyiety of constructs and replacing with different versions, which can be better, faster, safer or just different.

qemu is an example of this. In it's original form is a CPU emulator that works by recompiling from a given CPU binary into a different CPU for execution (Binary Translation). But it can also work when both CPUs are the same, in this case the transformation allows privileged code to execute in a VM environment by 'breaking out' to the hardware emulator.

A very interesting example is HP Dynamo (old Ars Technica article), a research software that achieved unexpected speedups by recompiling HP PA-8000 binaries.


I believe Art of Assembly language is what you are looking for : http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/index.html


When DEC made a transition from VAX architecture to AlphaAXP, their MACRO32 assembler became a sort of high-level language compiler targeting Alpha. AFAIR, there've been some optimisations.

http://en.wikipedia.org/wiki/VAX_Macro

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜