ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I should think it would depend on how the compiler writer implemented the compiler, eh?
If you're using gcc, just look at the source code (most likely the parser) to see how the code is converted into CPU instructions.
Of course, the actual conversion depends on the target CPU(s). That's why most compilers first compile to an "intermediate" code, then convert that to the actual hardware instructions. The first part can usually be done without reference to the target CPU. (I think that MS has done this with their C# compiler even more explicitly, making the first stage code exportable so the final implementation can be done "on the fly" by different CPUs as needed. [That, of course, is so they can "protect" the "Intelectual Property" of "owners" of the source code. But that's an issue for some other thread.])
There is no single list because the code generated is dependant on (at least), the compiler, the compiler version, optimization flags used, the processor being compiled for (486, pentium, athlon etc), and probably a number of other things that don't come to mind offhand. Compiling lists for all possible permutations would be a huge and pointless task. If you want to see the assembler for some specific code, then assemble it with gcc -S.
It covers all the basics of x86 assembler, has some great insights into "less travelled" roads like FPU instructions and MMX extensions ... and does it all from a Linux perspective.
Among other things, you'll learn how "printf" (a call into the standard C library) and actual system calls (like the "int 0x80" that corresponds to "open()" or "fork()") work surprisingly early on. Blum has written both a great primer, and a great reference text. I think you might like it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.