COMP 181. Prelude. Intermediate representations. Today. Types of IRs. High-level IR. Intermediate representations and code generation

Size: px
Start display at page:

Download "COMP 181. Prelude. Intermediate representations. Today. Types of IRs. High-level IR. Intermediate representations and code generation"

Transcription

1 Prelude COMP 181 Intermediate representations and ode generation November, 009 What is this devie? Large Hadron Collider What is a hadron? Subatomi partile made up of quarks bound by the strong fore What is the premier LHC experiment? Finding the Higgs boson First, what is a boson? Elementary partile that arries fore What is the Higgs boson Interats with Higgs field Gives partiles mass Tufts University Computer Siene Today Intermediate representations and ode generation Sanner Parser Intermediate ode generation Semanti heker Bak end Low-level IR High-level IR Intermediate representations IR design affets ompiler speed and apabilities Some important IR properties Ease of generation, manipulation, optimization Size of the representation Level of abstration: level of detail in the IR How lose is IR to soure ode? To the mahine? What kinds of operations are represented? Often, different IRs for different jobs Typially: High-level IR: lose to the soure language Low-level IR: lose to the mahine assembly ode Tufts University Computer Siene 3 Tufts University Computer Siene 4 Types of IRs Three major ategories Strutural s: Trees, DAGs Graph oriented Heavily used in IDEs, language translators Tend to be large Linear Pseudo-ode for an abstrat mahine Level of abstration varies Simple, ompat data strutures Easier to rearrange Hybrid Combination of graphs and linear ode s: 3 address ode Stak mahine ode : Control-flow graph Tufts University Computer Siene 5 High-level IR High-level language onstruts Array aesses, field aesses Complex ontrol flow Loops, onditionals, swith, break, ontinue Proedures: allers and allees Arithmeti and logi operators Inluding things like short-iruit && and Often: tree strutured Arbitrary nesting of expressions and statements Tufts University Computer Siene 6 1

2 Abstrat Syntax Tree AST: parse tree with some intermediate nodes removed x * y What is this representation good for? Interpreters We an reonstrut original soure Program understanding tools Language translators x - * y Direted Ayli Graph A direted ayli graph (DAG) AST with a unique node for eah value z - w / x Why do this? y More ompat (sharing) Enodes redundany * z x - * y w x / Same expression twie means that the ompiler might arrange to evaluate it just one! Tufts University Computer Siene 7 Tufts University Computer Siene 8 Low-level IR Linear stream of abstrat instrutions Instrution: single operation and assignment Must break down high-level onstruts x y op z x y op z op x, y, z : Introdue temps as neessary: alled virtual registers Simple ontrol-flow Label and goto z x * y label1: goto label1 if_goto x, label1 t * y z x - t Jump to label1 if x has non-zero value Tufts University Computer Siene 9 Memory model What kind of storage do variables represent? x y op z Possibilities: Values on the stak Values in global variables Temporaries introdued during lowering Expliit loads and stores We must ompute addresses t1 *p t1 load p move t1, [p] *p t store [p] t move [p], t Tufts University Computer Siene 10 Memory model z x * y Memory operations Often added later, by bak-end Expliitly represent variables t1 * y z x t1 IA3 (Intel x86) %name a register $val a onstant %esp stak pointer 4 (%esp) indiret + offset move -4(%esp), %eax // load y mul $, %eax move -8(%esp), %edx // load x sub %edx, %eax, %ebx // t1 is ebx move %eax, -1(%esp) // store in z Tufts University Computer Siene 11 Stak mahines Originally for stak-based omputers Now, Java VM push x Post-fix notation x * y push push y multiply subtrat What are advantages? Introdued names are impliit, not expliit Simple to generate and exeute ode Compat form who ares about ode size? Embedded systems Systems where ode is transmitted (the Net) Tufts University Computer Siene 1

3 IR Trade-offs for (i0; in; i++) A[i] i; Loop iterations are independent A [ ] i i for i0;in;i++ Loop invariant Strength redue to temp + 4 loop: temp1 &A temp i * 4 temp3 temp1 + temp store [temp3] i... goto loop IR Summary Intermediate representations High-level Rih struture, lose to soure Good for soure-level tools, IDEs : abstrat syntax tree Low-level Linear sequene, lose to the mahine Good for optimization : abstrat mahine ode, byteode Essene of ompilation: Translating from the high-level IR to low-level IR Tufts University Computer Siene 13 Tufts University Computer Siene 14 Towards ode generation if ( 0) { ( 0) { + ; else n * n + ; t1 0 if_goto t1, lab1 t n * n t + goto end lab1: t3 > 0 if_goto t3, end + goto lab1 end: generation Convert from high-level IR to low-level IR HIR is omplex, with nested strutures LIR is low-level, with everything expliit Often alled lowering or linearizing the ode Result is a sequene of LIR instrutions Need a systemati algorithm Idea: Define translation for eah AST node, assuming we an get ode to implement hildren Come up with a sheme to stith them together Reursively desend the AST Tufts University Computer Siene 15 Tufts University Computer Siene 16 Lowering sheme : add expression General sheme template for eah AST node Captures key semantis of eah onstrut Has holes for the hildren of the node Implemented in a funtion alled generate To fill in the template: Call generate funtion reursively on hildren Plug ode into the holes How to stith ode together? Generate returns a temporary that holds the result Emit ode that ombines the results Soure: expr1 + expr + template: AST: expr1 expr ode for expr1> ode for expr> result> expr1> + expr> Flow hart: to ompute expr1 to ompute expr Add results Tufts University Computer Siene 17 Tufts University Computer Siene 18 3

4 : loop Soure: AST: Flow hart: (ond) body; template: ond body top_label: ode for ondition> ifnot_goto ond>, end_label ode for body> goto top_label end_label: to ompute ond Is ond true? for body Exit Tufts University Computer Siene 19 Generation sheme Two problems: Getting the order right How to pass values between the piees of ode Solution: order Append eah instrution to a global buffer Emit instrutions in the desired order Solution: passing values Request a new (unique) temporary variable name Generate ode that omputes value into the temp Return the name of the temp to higher-level generate all Tufts University Computer Siene 0 While loop Compiler: generate(whilenode w) { E new_label() T new_label() emit( $T: ) t generate(w.condition) emit( ifnot_goto $t, $E ) generate(w.body) emit( goto $T ) emit( $E: ) template: top: ode for ondition> ifnot_goto ond>, end ode for body> goto top end: Tufts University Computer Siene 1 Tufts University Computer Siene Lowering expressions Arithmeti operations expr1 op expr expr1 t1 generate(expr1) t generate(expr) r new_temp() emit( r t1 op t ) Return the register to generate all above Tufts University Computer Siene 3 op expr Generate ode for left and right hildren, get the registers holding the results Obtain a fresh register name Emit ode for this operation Lowering sheme Emit funtion Appends low-level abstrat instrutions to a global buffer Order of alls to emit is important! Sheme works for: Binary arithmeti Unary operations Logi operations What about && and? In C and Java, they are shortiruiting Need ontrol flow expr1 expr r t1 op t Tufts University Computer Siene 4 4

5 Short-iruiting Details If expr1 is true, don t eval expr expr1 expr E new_label() r new_temp() t1 generate(expr1) emit( r t1 ) emit( if_goto t1, E ) t generate(expr) emit( r t ) expr1 expr E new_label() r new_temp() t1 generate(expr1) emit( r t1 ) emit( if_goto t1, E ) t generate(expr) emit( r t ) t1 expr1 r t1 if_goto t1, E t expr r t E: t3 L: ifgoto t1 Tufts University Computer Siene 5 Tufts University Computer Siene 6 Helper funtions Short-iruiting && emit() The only funtion that generates instrutions Adds instrutions to end of buffer At the end, buffer ontains ode new_label() Generate a unique label name Does not update ode new_temp() Generate a unique temporary name May require type information (from where?) expr1 && expr && expr1 expr N new_label() E new_label() r new_temp() t1 generate(expr1) emit( r t1 ) emit( if_goto t1, N ) emit( goto E ) emit( N: ) t generate(expr) emit( r t ) Tufts University Computer Siene 7 Tufts University Computer Siene 8 Short-iruiting && Can we do better? Array aess Depends on abstration expr1 && expr && expr1 expr E new_label() r new_temp() t1 generate(expr1) emit( r t1 ) emit( ifnot_goto t1, E ) t generate(expr) emit( r t ) expr1 [ expr ] OR: Emit array op Lower later r new_temp() a generate(expr1) o generate(expr) emit( o o * size ) emit( a a + o ) emit( r load a ) Tufts University Computer Siene 9 Type information from the symbol table Tufts University Computer Siene 30 5

6 Statements Simple sequenes statement1; statement; statementn; Conditionals if (expr) statement; generate(statement1) generate(statementn) E new_label() t generate(expr) Loops Emit label for top of loop Generate ondition and loop body (expr) statement; E new_label() T new_label() t generate(expr) Tufts University Computer Siene 31 Tufts University Computer Siene 3 Funtion all Different alling onventions x f(expr1, expr, ); Why all generate here? a generate(f) foreah expr-i ti generate(expri) emit( push ti ) For loop How does for work? for (expr1; expr; expr3) statement emit( all_jump a ) emit( x get_result ) Tufts University Computer Siene 33 Tufts University Computer Siene 34 Assignment How should we generate x y? Problem Differene between right-side and left-side Right-side: a value r-value Left-side: a loation l-value Speial generate Define speial generate for l-values lgenerate() returns register ontaining address Use lgenerate() for left-side Return r-value for nested assignment : array assignment A[i] B[j] expr1 expr; r generate(expr) l lgenerate(expr1) emit( store *l r ) Store to this loation Load from this loation Tufts University Computer Siene 35 Tufts University Computer Siene 36 6

7 : arrays At leaves : A[i] B[j] Depends on level of abstration Two versions of generate: r new_temp() a generate(arr) o generate(index) emit( o o * size ) emit( a a + o ) emit( r load a ) r-value ase a generate(arr) o generate(index) emit( o o * size ) emit( a a + o ) return a l-value ase generate(v) for variables All virtual registers: return v Strit register mahine: emit( r load &v ) Note: may introdues many temporaries Later: where is storage for v? More speifially: how the does the ompiler set aside spae for v and ompute its address? generate() for onstants Speial ases to avoid r # Tufts University Computer Siene 37 Tufts University Computer Siene 38 Generation: Big piture Reg generate(astnode node) { Reg r; swith (node.getkind()) { ase BIN: t1 generate(node.getleft()); t generate(node.getright()); r new_temp(); emit( r t1 op t ); break; ase NUM: r new_temp(); emit( r node.getvalue() ); break; ase ID: r new_temp(); o symtab.getoffset(node.getid()); emit( r load address of o> ); break; if ( 0) { ( 0) { + ; else n * n + ; if * n n Tufts University Computer Siene 39 Tufts University Computer Siene 40 E new_label() L0 T new_label() L1 t generate(expr) E new_label() L0 T new_label() L1 t generate(expr) Tufts University Computer Siene 41 Tufts University Computer Siene 4 7

8 E new_label() L0 T new_label() L1 t generate(expr) E new_label() L0 T new_label() L1 t generate(expr) R0 load 0 + t1 generate(expr1) t generate(expr) r new_temp() emit( r t1 op t ) 0 + t1 generate(expr1) t generate(expr) r new_temp() emit( r t1 op t ) r new_temp() R0 emit( r load v ) Tufts University Computer Siene 43 Tufts University Computer Siene E new_label() L0 T new_label() L1 t generate(expr) t1 generate(expr1)r0 t generate(expr) r new_temp() emit( r t1 op t ) R0 load 0 + E new_label() L0 T new_label() L1 t generate(expr) t1 generate(expr1)r0 t generate(expr) r new_temp() emit( r t1 op t ) R0 load R1 0 r new_temp() R1 emit( r 0 ) Tufts University Computer Siene 45 Tufts University Computer Siene E new_label() L0 T new_label() L1 t generate(expr) t1 generate(expr1)r0 t generate(expr)r1 r new_temp() R emit( r t1 op t ) R0 load R1 0 R R0 R1 0 + E new_label() L0 T new_label() L1 t generate(expr)r R0 load R1 0 R R0 R1 not_goto R,L0 Tufts University Computer Siene 47 Tufts University Computer Siene 48 8

9 0 + E new_label() L0 T new_label() L1 t generate(expr)r r generate(expr) l lgenerate(expr) emit( store *l r ) R0 load R1 0 R R0 R1 not_goto R,L0 0 + E new_label() L0 T new_label() L1 t generate(expr)r r generate(expr) l lgenerate(expr) emit( store *l r ) t1 generate(expr1)r3 t generate(expr)r4 r new_temp() R5 emit( r t1 op t ) R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R Tufts University Computer Siene 49 Tufts University Computer Siene E new_label() L0 T new_label() L1 t generate(expr)r r generate(expr)r5 l lgenerate(expr) emit( store *l r ) R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R 0 + E new_label() L0 T new_label() L1 t generate(expr)r r generate(expr)r5 l lgenerate(expr) emit( store *l r ) r new_temp() R6 emit( r & v ) R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & Something like: R6 base + offset Tufts University Computer Siene 51 Tufts University Computer Siene E new_label() L0 T new_label() L1 t generate(expr)r r generate(expr)r5 l lgenerate(expr)r6 emit( store *l r ) R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & store [R6]R5 0 + E new_label() L0 T new_label() L1 t generate(expr)r R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & store [R6]R5 goto L1 L0: Tufts University Computer Siene 53 Tufts University Computer Siene 54 9

10 if * n n R7 load R8 0 R9 R7 R8 not_goto R9,L3 R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & store [R6]R5 goto L1 L0: goto L4 L3: L4: Nesting (0) R7 load R8 0 R9 R7 R8 not_goto R9,L3 R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & store [R6]R5 goto L1 L0: goto L4 L3: L4: Tufts University Computer Siene 55 Tufts University Computer Siene 56 quality Are there ways to make this ode better? Many CPUs have a fast 0 test Can use aumulators: + Label leads to another goto; may have multiple labels R7 R8 0 R9 R7 R8 not_goto R9,L3 R0 R1 0 R R0 R1 not_goto R,L0 R3 R4 R5 R3 + R R5 goto L1 L0: goto L4 L3: L4: Effiient lowering Redue number of temporary registers Don t opy variable values unneessarily Aumulate values, when possible Reuse temporaries, where possible Generate more effiient labels Don t generate multiple adjaent labels Avoid goto-label-goto Typially done later, as a separate ontrol-flow optimization Tufts University Computer Siene 57 Tufts University Computer Siene 58 Registers only RISC-like low-level IR In pratie: Assume all variables are in registers Add loads and stores later as part of register alloation R9 0 R7 load R8 0 R9 R7 R8 not_goto R9,L3 R0 load R1 0 R R0 R1 not_goto R,L0 R3 load R4 R5 R3 + R R6 & store [R6]R5 goto L1 L0: goto L4 L3: L4: Avoiding extra opies Basi algorithm Reursive generation traverses to leaves At leaves, generate: R v or R Improvement Stop reursion one level early Chek to see if hildren are leaves Don t all generate reursively on variables, onstants Tufts University Computer Siene 59 Tufts University Computer Siene 60 10

11 Avoiding opies expr1 op expr op v expr1 if (expr1 is-a Var) t1 (Var) expr1 else t1 generate(expr1) if (expr is-a Var) t (Var) expr else t generate(expr) r new_temp() emit( r t1 op t ) Expr1 is (a+b) Not a leaf Reursively generate ode Return temp Expr is Return Emit ( R0 * ) ( a + b ) * R0 a + b R1 R0 * Tufts University Computer Siene 61 Tufts University Computer Siene 6 Use aumulation Idea: We only need registers to evaluate expr1 op expr Reuse temp assigned to one of the subexpressions if (expr1 is var) t1 (Var) expr1 else t1 generate(expr1) if (expr is var) t (Var) expr else t generate(expr) emit( t1 t1 op t ) return t1 Combined: Remove opies Aumulate value Only need one register How many would the original sheme have used? ( a + b ) * R0 a + b R0 R0 * Tufts University Computer Siene 63 Tufts University Computer Siene 64 Reuse of temporaries Reuse of temporaries Idea: Can generate(expr1) and generate(expr) share temporaries? expr1 op expr t1 generate(expr1) t generate(expr) r new_temp() emit( r t1 op t ) Yes, exept for t1 and t Observation: temporaries have a limited lifetime Lifetime onfined to a subtree Subtrees an share registers Algorithm: Use a stak of registers Start at # 0 Eah all to generate: Push next number Use any register > # When done, pop bak up R n-1 op R n R n+ R n+ expr1 expr R# expr1 R# R# op expr Tufts University Computer Siene 65 Tufts University Computer Siene 66 11

12 Misellaneous shape Consider expression x + y + z : t1 x + y t t1 + z What if x 3 and y What if y+z evaluated earlier in ode? Ordering for performane t1 x + z t t1 + y t1 y + z t t1 + x Using assoiativity and ommutativity very hard Operands op1 must be preserved op is omputed Emit ode for more intensive one first Generation Tree-walk algorithm Notie: generates ode for hildren first Effetively, a bottom up algorithm So that means. Right! Use syntax direted translation Can emit LIR ode in produtions Pass register names in $$, $1, $, et. Can generate assembly: one-pass ompiler Triky part: assignment Tufts University Computer Siene 67 Tufts University Computer Siene 68 One-pass ode generation Goal:: Expr:e {: RES e : Expr:: Expr:e + Term:t {: r new_temp(); emit( r e + t ); RES r; : Expr:e Term:t {: r new_temp(); emit( r e - t ); RES r; : Term:: Term:t * Fat:f {: r new_temp(); emit( r t * f ); RES r; : Term:t / Fat:f {: r new_temp(); emit( r t / f ); RES r; : Next time Study the IRs of your ompiler Implementing proedures and methods New programming assignment Fat:: ID:i {: r new_temp(); o symtab.getoffset(i); emit( r load address of o> ); RES r; : NUM:n {: r new_temp(); emit( r $n ); RES r; : Tufts University Computer Siene 69 Tufts University Computer Siene 70 1

Compilers. Intermediate representations and code generation. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Intermediate representations and code generation. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Intermediate representations and code generation Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Today Intermediate representations and code generation Scanner Parser Semantic

More information

COMP 181. Prelude. Intermediate representations. Today. High-level IR. Types of IRs. Intermediate representations and code generation

COMP 181. Prelude. Intermediate representations. Today. High-level IR. Types of IRs. Intermediate representations and code generation Prelude COMP 181 Lecture 14 Intermediate representations and code generation October 19, 2006 Who is Seth Lloyd? Professor of mechanical engineering at MIT, pioneer in quantum computing Article in Nature:

More information

Compilation Lecture 11a. Register Allocation Noam Rinetzky. Text book: Modern compiler implementation in C Andrew A.

Compilation Lecture 11a. Register Allocation Noam Rinetzky. Text book: Modern compiler implementation in C Andrew A. Compilation 0368-3133 Leture 11a Text book: Modern ompiler implementation in C Andrew A. Appel Register Alloation Noam Rinetzky 1 Registers Dediated memory loations that an be aessed quikly, an have omputations

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Test I Solutions

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Test I Solutions Department of Eletrial Engineering and Computer iene MAACHUETT INTITUTE OF TECHNOLOGY 6.035 Fall 2016 Test I olutions 1 I Regular Expressions and Finite-tate Automata For Questions 1, 2, and 3, let the

More information

Outline: Software Design

Outline: Software Design Outline: Software Design. Goals History of software design ideas Design priniples Design methods Life belt or leg iron? (Budgen) Copyright Nany Leveson, Sept. 1999 A Little History... At first, struggling

More information

CS415 Compilers. Intermediate Represeation & Code Generation

CS415 Compilers. Intermediate Represeation & Code Generation CS415 Compilers Intermediate Represeation & Code Generation These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Review - Types of Intermediate Representations

More information

Total 100

Total 100 CS331 SOLUTION Problem # Points 1 10 2 15 3 25 4 20 5 15 6 15 Total 100 1. ssume you are dealing with a ompiler for a Java-like language. For eah of the following errors, irle whih phase would normally

More information

Intermediate Representations

Intermediate Representations Intermediate Representations Where In The Course Are We? Rest of the course: compiler writer needs to choose among alternatives Choices affect the quality of compiled code time to compile There may be

More information

Reading Object Code. A Visible/Z Lesson

Reading Object Code. A Visible/Z Lesson Reading Objet Code A Visible/Z Lesson The Idea: When programming in a high-level language, we rarely have to think about the speifi ode that is generated for eah instrution by a ompiler. But as an assembly

More information

Reading Object Code. A Visible/Z Lesson

Reading Object Code. A Visible/Z Lesson Reading Objet Code A Visible/Z Lesson The Idea: When programming in a high-level language, we rarely have to think about the speifi ode that is generated for eah instrution by a ompiler. But as an assembly

More information

8 Instruction Selection

8 Instruction Selection 8 Instrution Seletion The IR ode instrutions were designed to do exatly one operation: load/store, add, subtrat, jump, et. The mahine instrutions of a real CPU often perform several of these primitive

More information

Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit

Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit Intermediate Representations Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission to make copies

More information

Space- and Time-Efficient BDD Construction via Working Set Control

Space- and Time-Efficient BDD Construction via Working Set Control Spae- and Time-Effiient BDD Constrution via Working Set Control Bwolen Yang Yirng-An Chen Randal E. Bryant David R. O Hallaron Computer Siene Department Carnegie Mellon University Pittsburgh, PA 15213.

More information

Data Structures in Java

Data Structures in Java Data Strutures in Java Leture 8: Trees and Tree Traversals. 10/5/2015 Daniel Bauer 1 Trees in Computer Siene A lot of data omes in a hierarhial/nested struture. Mathematial expressions. Program struture.

More information

CS:APP2e Web Aside ASM:X87: X87-Based Support for Floating Point

CS:APP2e Web Aside ASM:X87: X87-Based Support for Floating Point CS:APP2e Web Aside ASM:X87: X87-Based Support for Floating Point Randal E. Bryant David R. O Hallaron June 5, 2012 Notie The material in this doument is supplementary material to the book Computer Systems,

More information

Pipelined Multipliers for Reconfigurable Hardware

Pipelined Multipliers for Reconfigurable Hardware Pipelined Multipliers for Reonfigurable Hardware Mithell J. Myjak and José G. Delgado-Frias Shool of Eletrial Engineering and Computer Siene, Washington State University Pullman, WA 99164-2752 USA {mmyjak,

More information

CSE P 501 Compilers. Intermediate Representations Hal Perkins Spring UW CSE P 501 Spring 2018 G-1

CSE P 501 Compilers. Intermediate Representations Hal Perkins Spring UW CSE P 501 Spring 2018 G-1 CSE P 501 Compilers Intermediate Representations Hal Perkins Spring 2018 UW CSE P 501 Spring 2018 G-1 Administrivia Semantics/types/symbol table project due ~2 weeks how goes it? Should be caught up on

More information

Intermediate Representations

Intermediate Representations Intermediate Representations Intermediate Representations (EaC Chaper 5) Source Code Front End IR Middle End IR Back End Target Code Front end - produces an intermediate representation (IR) Middle end

More information

Intermediate representation

Intermediate representation Intermediate representation Goals: encode knowledge about the program facilitate analysis facilitate retargeting facilitate optimization scanning parsing HIR semantic analysis HIR intermediate code gen.

More information

Intermediate Representations

Intermediate Representations COMP 506 Rice University Spring 2018 Intermediate Representations source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students

More information

Parametric Abstract Domains for Shape Analysis

Parametric Abstract Domains for Shape Analysis Parametri Abstrat Domains for Shape Analysis Xavier RIVAL (INRIA & Éole Normale Supérieure) Joint work with Bor-Yuh Evan CHANG (University of Maryland U University of Colorado) and George NECULA (University

More information

Learning Convention Propagation in BeerAdvocate Reviews from a etwork Perspective. Abstract

Learning Convention Propagation in BeerAdvocate Reviews from a etwork Perspective. Abstract CS 9 Projet Final Report: Learning Convention Propagation in BeerAdvoate Reviews from a etwork Perspetive Abstrat We look at the way onventions propagate between reviews on the BeerAdvoate dataset, and

More information

XML Data Streams. XML Stream Processing. XML Stream Processing. Yanlei Diao. University of Massachusetts Amherst

XML Data Streams. XML Stream Processing. XML Stream Processing. Yanlei Diao. University of Massachusetts Amherst XML Stream Proessing Yanlei Diao University of Massahusetts Amherst XML Data Streams XML is the wire format for data exhanged online. Purhase orders http://www.oasis-open.org/ommittees/t_home.php?wg_abbrev=ubl

More information

CSE 401/M501 Compilers

CSE 401/M501 Compilers CSE 401/M501 Compilers Intermediate Representations Hal Perkins Autumn 2018 UW CSE 401/M501 Autumn 2018 G-1 Agenda Survey of Intermediate Representations Graphical Concrete/Abstract Syntax Trees (ASTs)

More information

Code Generation. Lecture 30

Code Generation. Lecture 30 Code Generation Lecture 30 (based on slides by R. Bodik) 11/14/06 Prof. Hilfinger CS164 Lecture 30 1 Lecture Outline Stack machines The MIPS assembly language The x86 assembly language A simple source

More information

opt. front end produce an intermediate representation optimizer transforms the code in IR form into an back end transforms the code in IR form into

opt. front end produce an intermediate representation optimizer transforms the code in IR form into an back end transforms the code in IR form into Intermediate representations source code front end ir opt. ir back end target code front end produce an intermediate representation (IR) for the program. optimizer transforms the code in IR form into an

More information

Definitions Homework. Quine McCluskey Optimal solutions are possible for some large functions Espresso heuristic. Definitions Homework

Definitions Homework. Quine McCluskey Optimal solutions are possible for some large functions Espresso heuristic. Definitions Homework EECS 33 There be Dragons here http://ziyang.ees.northwestern.edu/ees33/ Teaher: Offie: Email: Phone: L477 Teh dikrp@northwestern.edu 847 467 2298 Today s material might at first appear diffiult Perhaps

More information

Register Allocation III. Interference Graph Allocators. Coalescing. Granularity of Allocation (Renumber step in Briggs) Chaitin

Register Allocation III. Interference Graph Allocators. Coalescing. Granularity of Allocation (Renumber step in Briggs) Chaitin Register Alloation III Last time Register alloation aross funtion alls Toay Register alloation options Interferene Graph Alloators Chaitin Briggs CS553 Leture Register Alloation III 1 CS553 Leture Register

More information

Lecture Outline. Code Generation. Lecture 30. Example of a Stack Machine Program. Stack Machines

Lecture Outline. Code Generation. Lecture 30. Example of a Stack Machine Program. Stack Machines Lecture Outline Code Generation Lecture 30 (based on slides by R. Bodik) Stack machines The MIPS assembly language The x86 assembly language A simple source language Stack-machine implementation of the

More information

System-Level Parallelism and Throughput Optimization in Designing Reconfigurable Computing Applications

System-Level Parallelism and Throughput Optimization in Designing Reconfigurable Computing Applications System-Level Parallelism and hroughput Optimization in Designing Reonfigurable Computing Appliations Esam El-Araby 1, Mohamed aher 1, Kris Gaj 2, arek El-Ghazawi 1, David Caliga 3, and Nikitas Alexandridis

More information

Exploring the Commonality in Feature Modeling Notations

Exploring the Commonality in Feature Modeling Notations Exploring the Commonality in Feature Modeling Notations Miloslav ŠÍPKA Slovak University of Tehnology Faulty of Informatis and Information Tehnologies Ilkovičova 3, 842 16 Bratislava, Slovakia miloslav.sipka@gmail.om

More information

Register Allocation III. Interference Graph Allocators. Computing the Interference Graph (in MiniJava compiler)

Register Allocation III. Interference Graph Allocators. Computing the Interference Graph (in MiniJava compiler) Register Alloation III Announements Reommen have interferene graph onstrution working by Monay Last leture Register alloation aross funtion alls Toay Register alloation options Interferene Graph Alloators

More information

Lecture 15-16: Intermediate Code-Generation

Lecture 15-16: Intermediate Code-Generation Lecture 15-16: Intermediate Code-Generation Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (16/11/17) Lecture 15-16: Intermediate Code-Generation 2017-2018 1 /

More information

HEXA: Compact Data Structures for Faster Packet Processing

HEXA: Compact Data Structures for Faster Packet Processing Washington University in St. Louis Washington University Open Sholarship All Computer Siene and Engineering Researh Computer Siene and Engineering Report Number: 27-26 27 HEXA: Compat Data Strutures for

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

A DYNAMIC ACCESS CONTROL WITH BINARY KEY-PAIR

A DYNAMIC ACCESS CONTROL WITH BINARY KEY-PAIR Malaysian Journal of Computer Siene, Vol 10 No 1, June 1997, pp 36-41 A DYNAMIC ACCESS CONTROL WITH BINARY KEY-PAIR Md Rafiqul Islam, Harihodin Selamat and Mohd Noor Md Sap Faulty of Computer Siene and

More information

Recursion examples: Problem 2. (More) Recursion and Lists. Tail recursion. Recursion examples: Problem 2. Recursion examples: Problem 3

Recursion examples: Problem 2. (More) Recursion and Lists. Tail recursion. Recursion examples: Problem 2. Recursion examples: Problem 3 Reursion eamples: Problem 2 (More) Reursion and s Reursive funtion to reverse a string publi String revstring(string str) { if(str.equals( )) return str; return revstring(str.substring(1, str.length()))

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

Compiler Design. Code Shaping. Hwansoo Han

Compiler Design. Code Shaping. Hwansoo Han Compiler Design Code Shaping Hwansoo Han Code Shape Definition All those nebulous properties of the code that impact performance & code quality Includes code, approach for different constructs, cost, storage

More information

Writing Evaluators MIF08. Laure Gonnord

Writing Evaluators MIF08. Laure Gonnord Writing Evaluators MIF08 Laure Gonnord Laure.Gonnord@univ-lyon1.fr Evaluators, what for? Outline 1 Evaluators, what for? 2 Implementation Laure Gonnord (Lyon1/FST) Writing Evaluators 2 / 21 Evaluators,

More information

The recursive decoupling method for solving tridiagonal linear systems

The recursive decoupling method for solving tridiagonal linear systems Loughborough University Institutional Repository The reursive deoupling method for solving tridiagonal linear systems This item was submitted to Loughborough University's Institutional Repository by the/an

More information

Runtime Support for OOLs Part II Comp 412

Runtime Support for OOLs Part II Comp 412 COMP 412 FALL 2017 Runtime Support for OOLs Part II Comp 412 soure IR Front End Optimizer Bak End IR target Copright 2017, Keith D. Cooper & Linda Torzon, all rights reserved. Students enrolled in Comp

More information

Dynamic Programming. Lecture #8 of Algorithms, Data structures and Complexity. Joost-Pieter Katoen Formal Methods and Tools Group

Dynamic Programming. Lecture #8 of Algorithms, Data structures and Complexity. Joost-Pieter Katoen Formal Methods and Tools Group Dynami Programming Leture #8 of Algorithms, Data strutures and Complexity Joost-Pieter Katoen Formal Methods and Tools Group E-mail: katoen@s.utwente.nl Otober 29, 2002 JPK #8: Dynami Programming ADC (214020)

More information

Allocating Rotating Registers by Scheduling

Allocating Rotating Registers by Scheduling Alloating Rotating Registers by Sheduling Hongbo Rong Hyunhul Park Cheng Wang Youfeng Wu Programming Systems Lab Intel Labs {hongbo.rong,hyunhul.park,heng..wang,youfeng.wu}@intel.om ABSTRACT A rotating

More information

Principles of Compiler Design

Principles of Compiler Design Principles of Compiler Design Intermediate Representation Compiler Lexical Analysis Syntax Analysis Semantic Analysis Source Program Token stream Abstract Syntax tree Unambiguous Program representation

More information

On - Line Path Delay Fault Testing of Omega MINs M. Bellos 1, E. Kalligeros 1, D. Nikolos 1,2 & H. T. Vergos 1,2

On - Line Path Delay Fault Testing of Omega MINs M. Bellos 1, E. Kalligeros 1, D. Nikolos 1,2 & H. T. Vergos 1,2 On - Line Path Delay Fault Testing of Omega MINs M. Bellos, E. Kalligeros, D. Nikolos,2 & H. T. Vergos,2 Dept. of Computer Engineering and Informatis 2 Computer Tehnology Institute University of Patras,

More information

Intermediate Representations & Symbol Tables

Intermediate Representations & Symbol Tables Intermediate Representations & Symbol Tables Copyright 2014, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission

More information

Reverse Engineering of Assembler Programs: A Model-Based Approach and its Logical Basis

Reverse Engineering of Assembler Programs: A Model-Based Approach and its Logical Basis Reverse Engineering of Assembler Programs: A Model-Based Approah and its Logial Basis Tom Lake and Tim Blanhard, InterGlossa Ltd., Reading, UK Tel: +44 174 561919 email: {Tom.Lake,Tim.Blanhard}@glossa.o.uk

More information

Lecture 3 Local Optimizations, Intro to SSA

Lecture 3 Local Optimizations, Intro to SSA Lecture 3 Local Optimizations, Intro to SSA I. Basic blocks & Flow graphs II. Abstraction 1: DAG III. Abstraction 2: Value numbering IV. Intro to SSA ALSU 8.4-8.5, 6.2.4 Phillip B. Gibbons 15-745: Local

More information

Intermediate Representation (IR)

Intermediate Representation (IR) Intermediate Representation (IR) Components and Design Goals for an IR IR encodes all knowledge the compiler has derived about source program. Simple compiler structure source code More typical compiler

More information

Background/Review on Numbers and Computers (lecture)

Background/Review on Numbers and Computers (lecture) Bakground/Review on Numbers and Computers (leture) ICS312 Mahine-Level and Systems Programming Henri Casanova (henri@hawaii.edu) Numbers and Computers Throughout this ourse we will use binary and hexadeimal

More information

Acknowledgement. CS Compiler Design. Intermediate representations. Intermediate representations. Semantic Analysis - IR Generation

Acknowledgement. CS Compiler Design. Intermediate representations. Intermediate representations. Semantic Analysis - IR Generation Acknowledgement CS3300 - Compiler Design Semantic Analysis - IR Generation V. Krishna Nandivada IIT Madras Copyright c 2000 by Antony L. Hosking. Permission to make digital or hard copies of part or all

More information

Drawing lines. Naïve line drawing algorithm. drawpixel(x, round(y)); double dy = y1 - y0; double dx = x1 - x0; double m = dy / dx; double y = y0;

Drawing lines. Naïve line drawing algorithm. drawpixel(x, round(y)); double dy = y1 - y0; double dx = x1 - x0; double m = dy / dx; double y = y0; Naïve line drawing algorithm // Connet to grid points(x0,y0) and // (x1,y1) by a line. void drawline(int x0, int y0, int x1, int y1) { int x; double dy = y1 - y0; double dx = x1 - x0; double m = dy / dx;

More information

6. Intermediate Representation

6. Intermediate Representation 6. Intermediate Representation Oscar Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes. http://www.cs.ucla.edu/~palsberg/

More information

Gray Codes for Reflectable Languages

Gray Codes for Reflectable Languages Gray Codes for Refletable Languages Yue Li Joe Sawada Marh 8, 2008 Abstrat We lassify a type of language alled a refletable language. We then develop a generi algorithm that an be used to list all strings

More information

Lecture 14. Recursion

Lecture 14. Recursion Leture 14 Reursion Announements for Today Prelim 1 Tonight at 5:15 OR 7:30 A D (5:15, Uris G01) E-K (5:15, Statler) L P (7:30, Uris G01) Q-Z (7:30, Statler) Graded y noon on Sun Sores will e in CMS In

More information

Algorithms, Mechanisms and Procedures for the Computer-aided Project Generation System

Algorithms, Mechanisms and Procedures for the Computer-aided Project Generation System Algorithms, Mehanisms and Proedures for the Computer-aided Projet Generation System Anton O. Butko 1*, Aleksandr P. Briukhovetskii 2, Dmitry E. Grigoriev 2# and Konstantin S. Kalashnikov 3 1 Department

More information

Multiple Assignments

Multiple Assignments Two Outputs Conneted Together Multiple Assignments Two Outputs Conneted Together if (En1) Q

More information

Alternatives for semantic processing

Alternatives for semantic processing Semantic Processing Copyright c 2000 by Antony L. Hosking. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies

More information

Parallelizing Frequent Web Access Pattern Mining with Partial Enumeration for High Speedup

Parallelizing Frequent Web Access Pattern Mining with Partial Enumeration for High Speedup Parallelizing Frequent Web Aess Pattern Mining with Partial Enumeration for High Peiyi Tang Markus P. Turkia Department of Computer Siene Department of Computer Siene University of Arkansas at Little Rok

More information

Graph-Based vs Depth-Based Data Representation for Multiview Images

Graph-Based vs Depth-Based Data Representation for Multiview Images Graph-Based vs Depth-Based Data Representation for Multiview Images Thomas Maugey, Antonio Ortega, Pasal Frossard Signal Proessing Laboratory (LTS), Eole Polytehnique Fédérale de Lausanne (EPFL) Email:

More information

Compiler Construction D7011E

Compiler Construction D7011E Compiler Construction D7011E Lecture 8: Introduction to code generation Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 What is a Compiler? Compilers

More information

Agenda. CSE P 501 Compilers. Big Picture. Compiler Organization. Intermediate Representations. IR for Code Generation. CSE P 501 Au05 N-1

Agenda. CSE P 501 Compilers. Big Picture. Compiler Organization. Intermediate Representations. IR for Code Generation. CSE P 501 Au05 N-1 Agenda CSE P 501 Compilers Instruction Selection Hal Perkins Autumn 2005 Compiler back-end organization Low-level intermediate representations Trees Linear Instruction selection algorithms Tree pattern

More information

CS2210: Compiler Construction. Code Generation

CS2210: Compiler Construction. Code Generation Modern Compiler Project Fortran program Fortran s Lexer, Parser, and Static Checker Intermediate Code Generator IR MIPS Code Generator MIPS code C program C s Lexer, Parser, and Static Checker Intermediate

More information

CODE GENERATION Monday, May 31, 2010

CODE GENERATION Monday, May 31, 2010 CODE GENERATION memory management returned value actual parameters commonly placed in registers (when possible) optional control link optional access link saved machine status local data temporaries A.R.

More information

Code Generation. The Main Idea of Today s Lecture. We can emit stack-machine-style code for expressions via recursion. Lecture Outline.

Code Generation. The Main Idea of Today s Lecture. We can emit stack-machine-style code for expressions via recursion. Lecture Outline. The Main Idea of Today s Lecture Code Generation We can emit stack-machine-style code for expressions via recursion (We will use MIPS assembly as our target language) 2 Lecture Outline What are stack machines?

More information

We can emit stack-machine-style code for expressions via recursion

We can emit stack-machine-style code for expressions via recursion Code Generation The Main Idea of Today s Lecture We can emit stack-machine-style code for expressions via recursion (We will use MIPS assembly as our target language) 2 Lecture Outline What are stack machines?

More information

Fall Compiler Principles Lecture 6: Intermediate Representation. Roman Manevich Ben-Gurion University of the Negev

Fall Compiler Principles Lecture 6: Intermediate Representation. Roman Manevich Ben-Gurion University of the Negev Fall 2015-2016 Compiler Principles Lecture 6: Intermediate Representation Roman Manevich Ben-Gurion University of the Negev Tentative syllabus Front End Intermediate Representation Optimizations Code Generation

More information

Algorithms for External Memory Lecture 6 Graph Algorithms - Weighted List Ranking

Algorithms for External Memory Lecture 6 Graph Algorithms - Weighted List Ranking Algorithms for External Memory Leture 6 Graph Algorithms - Weighted List Ranking Leturer: Nodari Sithinava Sribe: Andi Hellmund, Simon Ohsenreither 1 Introdution & Motivation After talking about I/O-effiient

More information

Run Time Environment. Implementing Object-Oriented Languages

Run Time Environment. Implementing Object-Oriented Languages Run Time Environment Implementing Objet-Oriented Languages Copright 2017, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers lass at the Universit of Southern California have epliit

More information

What is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation

What is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation Compiler Construction SMD163 Lecture 8: Introduction to code generation Viktor Leijon & Peter Jonsson with slides by Johan Nordlander Contains material generously provided by Mark P. Jones What is a Compiler?

More information

Intermediate Representations

Intermediate Representations Intermediate Representations A variety of intermediate representations are used in compilers Most common intermediate representations are: Abstract Syntax Tree Directed Acyclic Graph (DAG) Three-Address

More information

A Dual-Hamiltonian-Path-Based Multicasting Strategy for Wormhole-Routed Star Graph Interconnection Networks

A Dual-Hamiltonian-Path-Based Multicasting Strategy for Wormhole-Routed Star Graph Interconnection Networks A Dual-Hamiltonian-Path-Based Multiasting Strategy for Wormhole-Routed Star Graph Interonnetion Networks Nen-Chung Wang Department of Information and Communiation Engineering Chaoyang University of Tehnology,

More information

timestamp, if silhouette(x, y) 0 0 if silhouette(x, y) = 0, mhi(x, y) = and mhi(x, y) < timestamp - duration mhi(x, y), else

timestamp, if silhouette(x, y) 0 0 if silhouette(x, y) = 0, mhi(x, y) = and mhi(x, y) < timestamp - duration mhi(x, y), else 3rd International Conferene on Multimedia Tehnolog(ICMT 013) An Effiient Moving Target Traking Strateg Based on OpenCV and CAMShift Theor Dongu Li 1 Abstrat Image movement involved bakground movement and

More information

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Language Processing Systems Prof. Mohamed Hamada Software ngineering Lab. The University of Aizu Japan Intermediate/Code Generation Source language Scanner (lexical analysis) tokens Parser (syntax analysis)

More information

Tour of common optimizations

Tour of common optimizations Tour of common optimizations Simple example foo(z) { x := 3 + 6; y := x 5 return z * y } Simple example foo(z) { x := 3 + 6; y := x 5; return z * y } x:=9; Applying Constant Folding Simple example foo(z)

More information

A Simple Syntax-Directed Translator

A Simple Syntax-Directed Translator Chapter 2 A Simple Syntax-Directed Translator 1-1 Introduction The analysis phase of a compiler breaks up a source program into constituent pieces and produces an internal representation for it, called

More information

Front End. Hwansoo Han

Front End. Hwansoo Han Front nd Hwansoo Han Traditional Two-pass Compiler Source code Front nd IR Back nd Machine code rrors High level functions Recognize legal program, generate correct code (OS & linker can accept) Manage

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it

More information

PASCAL 64. "The" Pascal Compiler for the Commodore 64. A Data Becker Product. >AbacusiII Software P.O. BOX 7211 GRAND RAPIDS, MICK 49510

PASCAL 64. The Pascal Compiler for the Commodore 64. A Data Becker Product. >AbacusiII Software P.O. BOX 7211 GRAND RAPIDS, MICK 49510 PASCAL 64 "The" Pasal Compiler for the Commodore 64 A Data Beker Produt >AbausiII Software P.O. BOX 7211 GRAND RAPIDS, MICK 49510 7010 COPYRIGHT NOTICE ABACUS Software makes this pakage available for use

More information

Accommodations of QoS DiffServ Over IP and MPLS Networks

Accommodations of QoS DiffServ Over IP and MPLS Networks Aommodations of QoS DiffServ Over IP and MPLS Networks Abdullah AlWehaibi, Anjali Agarwal, Mihael Kadoh and Ahmed ElHakeem Department of Eletrial and Computer Department de Genie Eletrique Engineering

More information

BSPLND, A B-Spline N-Dimensional Package for Scattered Data Interpolation

BSPLND, A B-Spline N-Dimensional Package for Scattered Data Interpolation BSPLND, A B-Spline N-Dimensional Pakage for Sattered Data Interpolation Mihael P. Weis Traker Business Systems 85 Terminal Drive, Suite Rihland, WA 995-59-946-544 mike@vidian.net Robert R. Lewis Washington

More information

THEORY OF COMPILATION

THEORY OF COMPILATION Lecture 10 Code Generation THEORY OF COMPILATION EranYahav Reference: Dragon 8. MCD 4.2.4 1 You are here Compiler txt Source Lexical Analysis Syntax Analysis Parsing Semantic Analysis Inter. Rep. (IR)

More information

CSc 453. Compilers and Systems Software. 13 : Intermediate Code I. Department of Computer Science University of Arizona

CSc 453. Compilers and Systems Software. 13 : Intermediate Code I. Department of Computer Science University of Arizona CSc 453 Compilers and Systems Software 13 : Intermediate Code I Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2009 Christian Collberg Introduction Compiler Phases

More information

Semantic actions for declarations and expressions

Semantic actions for declarations and expressions Semantic actions for declarations and expressions Semantic actions Semantic actions are routines called as productions (or parts of productions) are recognized Actions work together to build up intermediate

More information

Semantic actions for declarations and expressions

Semantic actions for declarations and expressions Semantic actions for declarations and expressions Semantic actions Semantic actions are routines called as productions (or parts of productions) are recognized Actions work together to build up intermediate

More information

represent = as a finite deimal" either in base 0 or in base. We an imagine that the omputer first omputes the mathematial = then rounds the result to

represent = as a finite deimal either in base 0 or in base. We an imagine that the omputer first omputes the mathematial = then rounds the result to Sientifi Computing Chapter I Computer Arithmeti Jonathan Goodman Courant Institute of Mathemaial Sienes Last revised January, 00 Introdution One of the many soures of error in sientifi omputing is inexat

More information

Design of High Speed Mac Unit

Design of High Speed Mac Unit Design of High Speed Ma Unit 1 Harish Babu N, 2 Rajeev Pankaj N 1 PG Student, 2 Assistant professor Shools of Eletronis Engineering, VIT University, Vellore -632014, TamilNadu, India. 1 harishharsha72@gmail.om,

More information

Implementing Control Flow Constructs Comp 412

Implementing Control Flow Constructs Comp 412 COMP 412 FALL 2018 Implementing Control Flow Constructs Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students

More information

Code Shape II Expressions & Assignment

Code Shape II Expressions & Assignment Code Shape II Expressions & Assignment Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission to make

More information

6. Intermediate Representation!

6. Intermediate Representation! 6. Intermediate Representation! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/!

More information

Compilers. Compiler Construction Tutorial The Front-end

Compilers. Compiler Construction Tutorial The Front-end Compilers Compiler Construction Tutorial The Front-end Salahaddin University College of Engineering Software Engineering Department 2011-2012 Amanj Sherwany http://www.amanj.me/wiki/doku.php?id=teaching:su:compilers

More information

Semantic actions for declarations and expressions. Monday, September 28, 15

Semantic actions for declarations and expressions. Monday, September 28, 15 Semantic actions for declarations and expressions Semantic actions Semantic actions are routines called as productions (or parts of productions) are recognized Actions work together to build up intermediate

More information

Reducing Runtime Complexity of Long-Running Application Services via Dynamic Profiling and Dynamic Bytecode Adaptation for Improved Quality of Service

Reducing Runtime Complexity of Long-Running Application Services via Dynamic Profiling and Dynamic Bytecode Adaptation for Improved Quality of Service Reduing Runtime Complexity of Long-Running Appliation Servies via Dynami Profiling and Dynami Byteode Adaptation for Improved Quality of Servie ABSTRACT John Bergin Performane Engineering Laboratory University

More information

Analysis of input and output configurations for use in four-valued CCD programmable logic arrays

Analysis of input and output configurations for use in four-valued CCD programmable logic arrays nalysis of input and output onfigurations for use in four-valued D programmable logi arrays J.T. utler H.G. Kerkhoff ndexing terms: Logi, iruit theory and design, harge-oupled devies bstrat: s in binary,

More information

CS 360 Programming Languages Interpreters

CS 360 Programming Languages Interpreters CS 360 Programming Languages Interpreters Implementing PLs Most of the course is learning fundamental concepts for using and understanding PLs. Syntax vs. semantics vs. idioms. Powerful constructs like

More information

Administration. Where we are. Canonical form. Canonical form. One SEQ node. CS 412 Introduction to Compilers

Administration. Where we are. Canonical form. Canonical form. One SEQ node. CS 412 Introduction to Compilers Administration CS 412 Introduction to Compilers Andrew Myers Cornell University Lecture 15: Canonical IR 26 Feb 01 HW3 due Friday Prelim 1 next Tuesday evening (7:30-9:30PM) location TBA covers topics

More information

13.1 Numerical Evaluation of Integrals Over One Dimension

13.1 Numerical Evaluation of Integrals Over One Dimension 13.1 Numerial Evaluation of Integrals Over One Dimension A. Purpose This olletion of subprograms estimates the value of the integral b a f(x) dx where the integrand f(x) and the limits a and b are supplied

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation Intermediate codes are machine independent codes, but they are close to machine instructions The given program in a source language is converted to an equivalent program in

More information

Where we are. Instruction selection. Abstract Assembly. CS 4120 Introduction to Compilers

Where we are. Instruction selection. Abstract Assembly. CS 4120 Introduction to Compilers Where we are CS 420 Introduction to Compilers Andrew Myers Cornell University Lecture 8: Instruction Selection 5 Oct 20 Intermediate code Canonical intermediate code Abstract assembly code Assembly code

More information