Devam Ediyor

Debug IA32 Code Generation in C

This is a high level programming project, thus I need someone who fits this skill set. I have already written the code called hw9.gen.parser.c, as a text file, however I need help debugging the program. I will need this program in 11 hours, and I have attached all the files you need to run this as well.

In this homework, we are going to do the Intel IA32 codes generation by processing the abstract syntax tree constructed from the parsing process.

For a C program, one can run gcc to generate the Intel assembly codes by the following command:

gcc -S prog.c

The assembly codes are found in the file with the name prog.s.

For this homework, we want to learn to generate codes for 32-bit Intel architecture, which are simpler than the codes for 64-bit architecture. Also, the codes generated by the older gcc (gcc 3.x) is also easier for follow.

To run gcc 3.x, add the following alias to your Linux environment:

alias gcc3 /home/CS473/sp12/gcc34/bin/gcc -m32

Moreover, you may want to run it with a low level of optimization as in:

gcc3 -O1 -S prog.c


gcc3 -O0 -S prog.c

From the assembly codes, you can learn a lot about IA32 instructions.

Your job is to write a program, which you can modify from (which generates codes for three-address intermediate codes, while IA32 are two-address codes).

To make a function call, one way is to follow the instructions given here under "Calling Functions". Arguments are passed by pushl, followed by a call to the function, then discarding the arguments by changing the stack pointer %esp using addl, and finally retrieve the function result from register %eax. In this homework, we suggest you to use the above method. However, gcc (or, gcc 3.x) uses a more efficient way. You can run gcc3 -S to see the assembly codes generated for calling a function. We will explain the method used by gcc's in class. Next, consider the function call:

c = f(a,b);

We need to push the argument b first, then push the argument a, followed by calling function f, saved the value of %eax to c. In order to generate the pushes for the arguments in the right order, when processing an ast node of the type AST_ARG_LIST, the correct logic is to process the right subtree before the left subtree.

Beceriler: C Programlama

Daha fazlasını görün: code generation program, code ia32, syntax programming, stack programming, programming job address, pointer programming, node programming, node job, node tree, intermediate programming, high level programming, help programming homework, gcc functions, functions programming, programming syntax, programming pointer, programming homework help, bit tree, argument programming, abstract programming, learn code

İşveren Hakkında:
( 2 değerlendirme ) Albuquerque, United States

Proje NO: #4433041



Hi, i am interested with this work

1 gün içinde 99$ USD
(0 Değerlendirme)