topic 7 ½ : instruction selection - computer science ... · dst= j ; end munchexp (t . temp (t) )...

32
1 Topic 7 ½ : Instruction Selection COS 320 Compiling Techniques Princeton University Spring 2015 Prof. David August

Upload: trannguyet

Post on 19-Sep-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

1

Topic 7 ½ : Instruction Selection

COS 320

Compiling Techniques

Princeton University Spring 2015

Prof. David August

Page 2: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Instruction Selection

Page 3: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Our Architecture

Page 4: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Our Architecture

Page 5: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Pseudo-ops

Page 6: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Instruction Tree Patterns

Page 7: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Instruction Tree Patterns

Page 8: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Example

Page 9: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Individual Node Selection

Page 10: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Individual Node Selection

Page 11: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Random Tiling

Page 12: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Random Tiling

Page 13: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Node Selection

Page 14: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimal Instruction Selection: Maximal Munch

Page 15: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Maximal Munch

Page 16: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Maximal Munch

Page 17: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Maximal Munch

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

Page 18: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Assembly Representation

Page 19: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Codegen

Page 20: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Statement Munch

Page 21: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Expression Munch

Page 22: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Expression Munch

Page 23: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection

Page 24: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Example

Page 25: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Example

Page 26: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Example

Page 27: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Insruction Selection – Example

Page 28: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Big Example

Page 29: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Big Example

Page 30: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions

Optimum Instruction Selection – Big Example

Page 31: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions
Page 32: Topic 7 ½ : Instruction Selection - Computer Science ... · dst= j ; end munchExp (T . TEMP (t) ) Find optimum solution for problem (tiling of IR tree) based on optimum solutions