Find Jobs
Hire Freelancers

Debug IA32 Code Generation in C

$90-100 USD

En curso
Publicado hace alrededor de 11 años

$90-100 USD

Pagado a la entrega
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 or gcc3 -O0 -S prog.c From the assembly codes, you can learn a lot about IA32 instructions. Your job is to write a program hw9.gen.codes.c, which you can modify from hw8.gen.codes.c (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.
ID del proyecto: 4433041

Información sobre el proyecto

1 propuesta
Proyecto remoto
Activo hace 11 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Hi, i am interested with this work
$99 USD en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
Albuquerque, United States
5,0
2
Miembro desde abr 8, 2013

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.