Docsity

Intermediate Representation, Basic Block, Optimization - Lecture Slide | CS 4240, Study notes of Computer Science

Toggle sidebar
bg1
1
• Everything covered in class since the midterm in
detail
• The assumption is you know everything covered
before that
• Questions about how is such-and-such done in
Tiger compiler are legit
– I won’t ask you to write ML code though
• List on following slides IS NOT complete
– everything covered in class is fair game
new topics:
• Intermediate Representation
• Instruction Selection
• Basic Blocks and Traces
• Optimizations
• Liveness
• Dataflow analysis
• Register allocation
• Instruction scheduling
old topics:
• Compilers
• Lexical analysis
• Parsing
• Abstract Syntax Tree
• Symbol Tables
• Type checking and Semantic Analysis
• Stack Frames
• Procedure Calling Conventions
Intermediate Representation
• what and why? where is the line between source
code/IR/machine insts.
• expressions, statements and conditionals
• simple variables to function calls
– what’s interesting
– e.g., - give intermediate tree representation for array
creation
• conditionals, special cases, & and | operations…
• while, for loops; case statements
• function calls, external functions, procedure
`prologue/epilogue’
pf3

Partial preview of the text

Download Intermediate Representation, Basic Block, Optimization - Lecture Slide | CS 4240 and more Study notes Computer Science in PDF only on Docsity!

  • Everything covered in class since the midterm in detail
  • The assumption is you know everything covered before that
  • Questions about how is such-and-such done in Tiger compiler are legit - I won’t ask you to write ML code though
  • List on following slides IS NOT complete
    • everything covered in class is fair game

new topics:

  • Intermediate Representation
  • Instruction Selection
  • Basic Blocks and Traces
  • Optimizations
  • Liveness
  • Dataflow analysis
  • Register allocation
  • Instruction scheduling

old topics:

  • Compilers
  • Lexical analysis
  • Parsing
  • Abstract Syntax Tree
  • Symbol Tables
  • Type checking and Semantic Analysis
  • Stack Frames
  • Procedure Calling Conventions

Intermediate Representation

  • what and why? where is the line between source code/IR/machine insts.
  • expressions, statements and conditionals
  • simple variables to function calls
    • what’s interesting
    • e.g., - give intermediate tree representation for array creation
  • conditionals, special cases, & and | operations…
  • while, for loops; case statements
  • function calls, external functions, procedure `prologue/epilogue’

Basic Blocks

  • getting rid (pulling) of SEQ/ESEQ, CALL

… why? what is the objective of steps in

canon?

  • BINOP( op , e1 ,(ESEQ( s , e2 )) ==> ESEQ(MOVE(TEMP tnew , e1 ), ESEQ( s ,(BINOP( op , TEMP tnew , e2 ))
  • true label/false label … generating optimal traces…

Optimizations

  • what to optimize? scope?
  • optimize a piece of code
  • steps to ensure constant propagation (or

other optimization)

  • peephole optimization

Instruction Selection

  • why tiles? optimal vs. optimum tiling
  • maximal munch
  • dynamic programming
  • tree grammars
  • given a IR tree, find optimum/al tiling
  • RISC vs. CISC inst sets
    • pros and cons of having CISC options

Liveness

  • what info are we gathering
  • outline algorithm
  • static vs. dynamic info
  • halting problem
  • graph construction and move instruction
  • example – construct graph and do analysis