문제

I'm writing some methods in C that must run very efficiently, so I'd like to manually edit some of the assembly code that is automatically generated. I know how to read the assembly code using gdb or "objdump -d myfile.o", but can anyone tell me how to edit this code? (Will probably just be minor tweaks.)

도움이 되었습니까?

해결책 2

Sure. It's called "inline assembly", and most compilers support it.

Here's an example using GCC:

다른 팁

gcc have -S switch, which stops compilation on after assembly generation phase. Then you cound edit resulting file and manually call assembly (with gas, for example)

There's no way you can do it. Compiler generates code directly, there is no assembler involved; assembly listing is an aux product that can be generated, can be not. You can take asm listing and assemble it yourself, however.

If you want to improve efficiency of your code, the best way to follow is, as stated before, inline asm; or write an assembly proc, make an object file and link it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top