Variable i ml variable bindings a bindings l t ecture

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Linear IRs are typically low- level –  But these generaliza@ons don’t always hold Winter 2013 UW CSE 401 (Michael Ringenburg) 10 Graphical IRs CSE341: Programming C represented as a graph (or tree) •  IRs SE341: Programming Languages Languages Lecture 1 L eflect s •  Nodes and edges typically recture 1ome structure Course Course of the program Mechanics Mechanics ML Variable Bindings ML Variable Bindings –  E.g., source, control flow, data dependence •  May be large (an Grossman sDan Grossman D especially yntax trees) Fall 2011 Fall 2011 •  High- level examples: Syntax trees, DAGs –  Generally used in early phases of compilers •  Other examples: Control flow graphs and data dependence graphs –  Ohen used in op@miza@on and code genera@on Winter 2013 UW CSE 401 (Michael Ringenburg) 11 Graphical IR: Concrete Syntax Trees ECSE341: Programming CSE341: Programming Languages Languages Subscript 1 Lecture 1 Course Mechanics Course Mechanics T * F ML Variable [ i ] ML Variable Bindings A Bindings L T ecture F Id(y) Dan Grossman Id(x) Fall 2011 Dan Grossman Fall 2011 •  The full grammar is needed to guide the parser, but contains many extraneous details –  E.g., syntac@c tokens, rules that control precedence •  Typically the full syntax tree does not need to be used explicitly Winter 2013 UW CSE 401 (Michael Ringenburg) 12 Graphical IR: Abstract Syntax Trees CSE341: Mult CSE341: Programming Languages Programming Languages Subscript Lecture 1 Lecture 1 Id(y) i Course A Course Mechanics Mechanics ML Variable Bindings ML Variable Bindings •  Want only essen@al structural informa@on (omit extra junk) Id(x) •  Can be represented explicitly as a tree or in a linear form, e.g., in the order of a Dan Grossman Dan Grossmani+j], this might be: depth- first traversal. For a[ Fall 2011 ! ! !Subscript!2011 Fall ! ! ! Id(A)! ! ! ! Plus! !!! Id(i)! !!! Id(j) •  Common output from parser; used for sta@c seman@cs (type checking, etc.) and some@mes high- level op@miza@ons ! Winter 2013 UW CSE 401 (Michael Ringenburg) 13 Graphical IR: DAG Plus CSE341: Programming CSE341: Programming Languages Languages Lecture 1 Lecture 1 Mult Course Course Mechanics Mechanics Mult ML Variable ML Variable Bindings b Bindings a 2 Dan Grossman D Grossman •  DAG = Directed ancyclic Graph Fall 2011 A Fall 2011 –  In compilers, typically used to refer to an AST like structure, where common components may be reused. E.g, the 2*a in 2*a...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online