code generation
Download
Skip this Video
Download Presentation
Code Generation

Loading in 2 Seconds...

play fullscreen
1 / 11

Code Generation - PowerPoint PPT Presentation


  • 197 Views
  • Uploaded on

Code Generation. Gülfem Savrun Yeniçeri CS 142 (b) 02/26/2013. Code Generation. Translates intermediate representation into machine code Generated code is target specific x86 ARM. Code Generation. . class file. Parser. SSA Generator. Optimizations. Register Allocator.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Code Generation' - lars


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
code generation

Code Generation

GülfemSavrun Yeniçeri

CS 142 (b)

02/26/2013

code generation1
Code Generation
  • Translates intermediate representation into machine code
  • Generated code is target specific
    • x86
    • ARM
code generation2
Code Generation

.class file

Parser

SSA Generator

Optimizations

Register Allocator

Code Generator

x86 code

x86 instruction format
x86 Instruction Format
  • In project:
    • Opcode
    • ModR/M
    • Immediate
x86 instructions
X86 Instructions
  • Instructions can reference different operands
    • Immediate
    • Register
    • Memory

MOV register, immediate

MOV register, register

MOV register, memory

calling convention
Calling Convention
  • Protocol between the caller and the callee used during a function invocation
    • Which registers are saved by the caller
    • Which registers are saved by the callee
    • Where parameters and return values are placed
x 86 calling convention
x86 Calling Convention
  • Caller-saved registers

EAX,ECX,EDX

  • Callee-saved registers

EBX,EDI,ESI

x 86 calling convention1
x86 Calling Convention

Caller’s frame

Caller-saved registers

Arguments

Return address

Saved frame pointer

Callee-saved registers

Callee’s frame

x86 calling convention
x86 Calling Convention
  • Caller:

– Saves caller-savedregisters

–Pushes arguments on stack

– Executes call instruction

x86 calling convention1
x86 Calling Convention
  • Callee:
    • Pushescaller’s frame pointer on stack

– Sets up callee’s frame pointer

– Saves callee-saved registers

– Allocatesa frame

– Startexecuting callee’s code

ad