instructionSelection

instructionSelection - Instruction Selection and Scheduling...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
cs5363 1 Instruction Selection and Scheduling Machine code generation
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cs5363 2 Machine code generation Intermediate Code generator machine Code generator Code optimizer Input: intermediate code + symbol tables All variables have values that machines can directly manipulate Each operation has at most two operands Assume program is free of errors Type checking has taken place, type conversion done Output: Absolute/relocatable machine (assembly) code Architectures RISC machines, CISC processors, stack machines Issues: Instruction selection Instruction scheduling Register allocation and memory management
Background image of page 2
cs5363 3 Retargetable back-end Build retargetable compilers Compilers on different machines share a common IR Can have common front and mid ends Isolate machine dependent information Table-based back ends share common algorithms Table-based instruction selector Create a description of target machine, use back-end generator Machine description Back end generator Tables Pattern- Matching engine Instruction selector
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cs5363 4 * ID(a,ARP,4) ID(b,ARP,8) * ID(a,ARP,4) NUM(2) loadI 4 => r5 loadA0 rarp, r5 => r6 LoadI 8 => r7 loadA0 rarp, r7 => r8 Mult r6, r8 => r9 loadI 4 => r5 loadA0 rarp, r5 => r6 loadI 2 => r7 Mult r6, r7 => r8 loadAI rarp, 4 => r5 loadAI rarp, 8 => r6 Mult r5, r6 loadAI rarp, 4 => r5 multI r5, 2 => r6 vs. vs. Instruction Selection Based on locations of operands, different instructions may be selected Two pattern-matching approaches Generate efficient instruction sequences from the AST Generate naïve code, then rewrite inefficient code sequences
Background image of page 4
cs5363 5 Tree-Pattern Matching Tiling the AST Use a low-level AST to expose all the impl. details Define a collection of (operation pattern, code generation template) pairs Match each AST subtree with an operation pattern, then select instructions accordingly Given an AST and a collection of operation trees
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/29/2012 for the course CS 5363 taught by Professor Staff during the Spring '08 term at Texas San Antonio.

Page1 / 15

instructionSelection - Instruction Selection and Scheduling...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online