Register Allocation in Just-in-Time Compilers: 15 Years of Linear Scan
|
|
- Cameron Hampton
- 6 years ago
- Views:
Transcription
1 Register Allocation in Just-in-Time Compilers: 15 Years of Linear Scan Kevin Millikin Google 13 December 2013
2 Register Allocation Overview
3 Register allocation Intermediate representation (IR): arbitrarily many virtual registers Processor: fixed number (k) of registers Allocate virtual registers to registers or memory Registers are faster than memory
4 Liveness analysis A value is live at a program point if it is read before being written to on some path to an exit Data-flow analysis: for each program point what is the set of live values (virtual registers)? Live values need to be stored somewhere
5 Interference graph Two virtual registers interfere if they are both live at some program point Vertexes: all virtual registers Edges: all interferences Interferences cannot get the same register
6 Graph (k)-coloring Assign colors to vertexes No two adjacent vertexes can have the same color If impossible, delete (spill) a vertex and retry A coloring gives a register assignment
7 Too slow for just-in-time Graph coloring is NP-complete for k > 2 Plus spilling This is too slow
8 Linear Scan Register Allocation Poletto, M., & Sarkar, V. (1999). Linear scan register allocation. ACM Transactions on Programming Languages and Systems (TOPLAS), 21(5),
9 Liveness analysis for each program point, what is the set of live values? for each value, what is the set of program points where it is live? Focus on the virtual registers
10 Linearize the program Number the instructions consecutively Linear scan works for any ordering But the specific ordering is important Program points are totally ordered
11 Approximate liveness analysis for each value, what is the set of program points where it is live? for each value, what is the earliest and latest program points where it is live? This gives a live range per virtual register
12 Key ideas Sort the live ranges by start point Consider them for allocation in sorted order The number of needed registers only changes when a live range starts or ends Use a greedy strategy to assign registers
13 Allocate a free register class Interval { int start, end, register } Interval active[k] { null, } bool AllocateFreeRegister(Interval interval) for i 0 to k-1 if (active[i] = null) then active[i] interval return true return false
14 Example (k=3)
15 Example (k=3)
16 Example (k=3)
17 Example (k=3)
18 Spill an interval void SpillAtStart(Interval interval) spill -1, latest interval.end for i 0 to k-1 if (active[i].end > latest) then spill i, latest active[i].end if (spill = -1) then interval.register -1 else active[spill].register -1 active[spill] interval
19 Example (k=3)
20 Example (k=3)
21 Example (k=3)
22 Example (k=3)
23 Expiring old intervals void ExpireOldIntervals(int point) for i 0 to k-1 if (active[i].end point) then active[i].register i active[i] null
24 Example (k=3)
25 Example (k=3)
26 Example (k=3)
27 Putting it all together void LinearScan(Interval intervals[]) intervals.sort(); for i in intervals ExpireOldIntervals(i.start) if (!AllocateFreeRegister(i)) then SpillAtStart(i) ExpireOldIntervals(intervals.last().end)
28 Example (k=3)
29 Example (k=3)
30 Example (k=3)
31 Example (k=3)
32 Instruction ordering Poletto and Sarkar: reverse postorder Also: code generation order There was negligible impact
33 Spill selection Poletto and Sarkar: latest ending point Also: weight based on (estimated) use count There was negligible impact
34 Second-chance Binpacking Traub, O., Holloway, G., & Smith, M. D. (1998, June). Quality and speed in linear-scan register allocation. In Proceedings of the ACM SIGPLAN 1998 conference on Programming language design and implementation (Vol. 17, No. 19, pp ).
35 Lifetime holes Intervals within a live range that do not contain a useful value Example: between a load and a store, or a basic block where a virtual register is not used Linear scan does not consider lifetime holes
36 Example (k=3)
37 Example (k=3)
38 Example (k=3)
39 Example (k=3)
40 Example (k=3)
41 Second-chance allocation With linear scan a virtual register is spilled for its entire live range Instead: split and spill after the split, insert a move Add the spilled live range to the unallocated list Spilled values get a chance to get a register later
42 Spilling heuristic Latest next use (Poletto and Sarkar used latest ending point) Weighted by loop nesting depth of uses
43 Example (k=3)
44 Example (k=3)
45 Example (k=3)
46 Example (k=3)
47 Example (k=3)
48 Example (k=3)
49 Example (k=3)
50 Example (k=3)
51 Spill store elimination The spilled value could be the same as the current value in a spill slot (e.g., it was previously spilled) Track each spill slot, do not spill unless needed Can be inconsistent if a value is not spilled on all paths, use a data-flow analysis and extra stores to guarantee consistency
52 Resolution Control flow is not really linear Different allocation decisions on different paths (e. g., register/spill or register/register) Resolved at control-flow joins by moves in the predecessor blocks Implemented by iterating edges after allocation
53 Example A B C A B C
54 Example A B C Blue Green A B Blue Spill C
55 Example A B C Blue Green Green Blue A B Blue Spill C
56 Linear Scan in the Context of SSA Form Mössenböck, H., & Pfeiffer, M. (2002). Linear scan register allocation in the context of SSA form and register constraints. In Compiler Construction (pp ). Springer Berlin/Heidelberg.
57 Static single assignment form Each virtual register is assigned once, extra virtual registers are used Phi functions are inserted at control flow joins to merge multiple incoming values Translation out of SSA is performed before register allocation, by inserting moves in phi predecessor blocks
58 Liveness analysis Same as linear scan, except consider lifetime holes Live ranges are explicitly represented as a collection of intervals
59 Coalesce virtual registers Before allocation, live ranges are joined if they should share a register Example: phi moves Example: x86 two-operand instructions (e.g. ADD)
60 Inactive intervals In addition to active intervals (allocated to a register and live) Inactive intervals are ones allocated to a register but in a lifetime hole Inactive intervals are tracked separately
61 Expiring old intervals For each active interval: If ended, the interval is expired If a lifetime hole is reached, the interval is moved to inactive
62 Reactivate inactive intervals For each inactive interval: If ended, the interval is expired If the end of a lifetime hole is reached, the interval is moved to active
63 Allocate a free register Same as linear scan, except A register is not free at a position if it will contain a live part of an inactive interval
64 Spill an interval Same as linear scan, except Inactive intervals are also spill candidates
65 Resolution No splitting So no resolution is required
66 Optimized Interval Splitting Wimmer, C., & Mössenböck, H. (2005, June). Optimized interval splitting in a linear scan register allocator. In Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments (pp ). ACM.
67 Allocate a free register Same as in the context of SSA, except Registers containing inactive intervals are free, but The allocated interval must be split at the point that the lifetime hole ends
68 Resolution Splitting So, resolution is required again
69 Optimal split positions Remember: second-chance binpacking split as late as possible Instead: move splits out of loops Also: move splits to basic block boundaries
70 Register hints Lightweight coalescing Record the register of the first range as a hint to the second Hints are preferred but can be ignored
71 Linear Scan on SSA Form Wimmer, C., & Franz, M. (2010, April). Linear scan register allocation on SSA form. In Proceedings of the 8th annual IEEE/ACM international symposium on Code generation and optimization (pp ). ACM.
72 Resolution Recall: phi moves inserted in join predecessor blocks to translate out of SSA Recall: resolution due to splitting inserts moves in join predecessor blocks Idea: do allocation on SSA form then translate out, needing only one set of moves
73 Conclusion
74 Linear scan State of the art for JIT compilers Mature, though relatively new Easy to implement in a simple form Modern implementations are quite sophisticated Performance approaches graph coloring
Linear Scan Register Allocation. Kevin Millikin
Linear Scan Register Allocation Kevin Millikin Register Allocation Register Allocation An important compiler optimization Compiler: unbounded # of virtual registers Processor: bounded (small) # of registers
More informationImprovements to Linear Scan register allocation
Improvements to Linear Scan register allocation Alkis Evlogimenos (alkis) April 1, 2004 1 Abstract Linear scan register allocation is a fast global register allocation first presented in [PS99] as an alternative
More informationLinear Scan Register Allocation in the Context of SSA Form and Register Constraints 1
Linear Scan Register Allocation in the Context of SSA Form and Register Constraints 1 Hanspeter M ssenb ck and Michael Pfeiffer University of Linz, Institute of Practical Computer Science {moessenboeck,pfeiffer}@ssw.uni-linz.ac.at
More informationRegister Allocation. Register Allocation. Local Register Allocation. Live range. Register Allocation for Loops
DF00100 Advanced Compiler Construction Register Allocation Register Allocation: Determines values (variables, temporaries, constants) to be kept when in registers Register Assignment: Determine in which
More informationOptimized Interval Splitting in a Linear Scan Register Allocator
Optimized Interval Splitting in a Linear Scan Register Allocator ABSTRACT Christian Wimmer Institute for System Software Johannes Kepler University Linz Linz, Austria wimmer@ssw.jku.at We present an optimized
More informationGlobal Register Allocation
Global Register Allocation Y N Srikant Computer Science and Automation Indian Institute of Science Bangalore 560012 NPTEL Course on Compiler Design Outline n Issues in Global Register Allocation n The
More informationRegister Allocation & Liveness Analysis
Department of Computer Sciences Register Allocation & Liveness Analysis CS502 Purdue University is an Equal Opportunity/Equal Access institution. Department of Computer Sciences In IR tree code generation,
More informationGlobal Register Allocation - Part 2
Global Register Allocation - Part 2 Y N Srikant Computer Science and Automation Indian Institute of Science Bangalore 560012 NPTEL Course on Compiler Design Outline Issues in Global Register Allocation
More informationCombining Analyses, Combining Optimizations - Summary
Combining Analyses, Combining Optimizations - Summary 1. INTRODUCTION Cliff Click s thesis Combining Analysis, Combining Optimizations [Click and Cooper 1995] uses a structurally different intermediate
More informationRematerialization. Graph Coloring Register Allocation. Some expressions are especially simple to recompute: Last Time
Graph Coloring Register Allocation Last Time Chaitin et al. Briggs et al. Today Finish Briggs et al. basics An improvement: rematerialization Rematerialization Some expressions are especially simple to
More informationGlobal Register Allocation - 2
Global Register Allocation - 2 Y N Srikant Computer Science and Automation Indian Institute of Science Bangalore 560012 NPTEL Course on Principles of Compiler Design Outline n Issues in Global Register
More informationQuality and Speed in Linear-Scan Register Allocation
Quality and Speed in Linear-Scan Register Allocation A Thesis presented by Omri Traub to Computer Science in partial fulfillment of the honors requirements for the degree of Bachelor of Arts Harvard College
More informationregister allocation saves energy register allocation reduces memory accesses.
Lesson 10 Register Allocation Full Compiler Structure Embedded systems need highly optimized code. This part of the course will focus on Back end code generation. Back end: generation of assembly instructions
More informationToday More register allocation Clarifications from last time Finish improvements on basic graph coloring concept Procedure calls Interprocedural
More Register Allocation Last time Register allocation Global allocation via graph coloring Today More register allocation Clarifications from last time Finish improvements on basic graph coloring concept
More informationGlobal Register Allocation via Graph Coloring
Global Register Allocation via Graph Coloring Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission
More informationCSC D70: Compiler Optimization Register Allocation
CSC D70: Compiler Optimization Register Allocation Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons
More informationLecture 15 Register Allocation & Spilling
I. Motivation Lecture 15 Register Allocation & Spilling I. Introduction II. Abstraction and the Problem III. Algorithm IV. Spilling Problem Allocation of variables (pseudo-registers) to hardware registers
More informationRegister allocation. CS Compiler Design. Liveness analysis. Register allocation. Liveness analysis and Register allocation. V.
Register allocation CS3300 - Compiler Design Liveness analysis and Register allocation V. Krishna Nandivada IIT Madras Copyright c 2014 by Antony L. Hosking. Permission to make digital or hard copies of
More informationThe C2 Register Allocator. Niclas Adlertz
The C2 Register Allocator Niclas Adlertz 1 1 Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated
More informationRegister Allocation. Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations
Register Allocation Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class
More informationQuality and Speed in Linear-scan Register Allocation
Quality and Speed in Linear-scan Register Allocation Omri Traub, Glenn Holloway, Michael D. Smith Harvard University Division of Engineering and Applied Sciences Cambridge, MA 02138 {otraub, holloway,
More informationCode generation for modern processors
Code generation for modern processors Definitions (1 of 2) What are the dominant performance issues for a superscalar RISC processor? Refs: AS&U, Chapter 9 + Notes. Optional: Muchnick, 16.3 & 17.1 Instruction
More informationCode generation for modern processors
Code generation for modern processors What are the dominant performance issues for a superscalar RISC processor? Refs: AS&U, Chapter 9 + Notes. Optional: Muchnick, 16.3 & 17.1 Strategy il il il il asm
More informationControl-Flow Analysis
Control-Flow Analysis Dragon book [Ch. 8, Section 8.4; Ch. 9, Section 9.6] Compilers: Principles, Techniques, and Tools, 2 nd ed. by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jerey D. Ullman on reserve
More informationSSA-Form Register Allocation
SSA-Form Register Allocation Foundations Sebastian Hack Compiler Construction Course Winter Term 2009/2010 saarland university computer science 2 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2
More informationLecture Overview Register Allocation
1 Lecture Overview Register Allocation [Chapter 13] 2 Introduction Registers are the fastest locations in the memory hierarchy. Often, they are the only memory locations that most operations can access
More informationLecture Notes on Register Allocation
Lecture Notes on Register Allocation 15-411: Compiler Design Frank Pfenning Lecture 3 September 1, 2009 1 Introduction In this lecture we discuss register allocation, which is one of the last steps in
More informationOutline. Register Allocation. Issues. Storing values between defs and uses. Issues. Issues P3 / 2006
P3 / 2006 Register Allocation What is register allocation Spilling More Variations and Optimizations Kostis Sagonas 2 Spring 2006 Storing values between defs and uses Program computes with values value
More informationLecture 6. Register Allocation. I. Introduction. II. Abstraction and the Problem III. Algorithm
I. Introduction Lecture 6 Register Allocation II. Abstraction and the Problem III. Algorithm Reading: Chapter 8.8.4 Before next class: Chapter 10.1-10.2 CS243: Register Allocation 1 I. Motivation Problem
More informationLiveness Analysis and Register Allocation. Xiao Jia May 3 rd, 2013
Liveness Analysis and Register Allocation Xiao Jia May 3 rd, 2013 1 Outline Control flow graph Liveness analysis Graph coloring Linear scan 2 Basic Block The code in a basic block has: one entry point,
More informationIntroduction to Optimization, Instruction Selection and Scheduling, and Register Allocation
Introduction to Optimization, Instruction Selection and Scheduling, and Register Allocation Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Traditional Three-pass Compiler
More informationCompilers and Code Optimization EDOARDO FUSELLA
Compilers and Code Optimization EDOARDO FUSELLA Contents Data memory layout Instruction selection Register allocation Data memory layout Memory Hierarchy Capacity vs access speed Main memory Classes of
More informationLecture 21 CIS 341: COMPILERS
Lecture 21 CIS 341: COMPILERS Announcements HW6: Analysis & Optimizations Alias analysis, constant propagation, dead code elimination, register allocation Available Soon Due: Wednesday, April 25 th Zdancewic
More informationA Practical and Fast Iterative Algorithm for φ-function Computation Using DJ Graphs
A Practical and Fast Iterative Algorithm for φ-function Computation Using DJ Graphs Dibyendu Das U. Ramakrishna ACM Transactions on Programming Languages and Systems May 2005 Humayun Zafar Outline Introduction
More informationApril 15, 2015 More Register Allocation 1. Problem Register values may change across procedure calls The allocator must be sensitive to this
More Register Allocation Last time Register allocation Global allocation via graph coloring Today More register allocation Procedure calls Interprocedural April 15, 2015 More Register Allocation 1 Register
More informationCSE P 501 Compilers. Register Allocation Hal Perkins Autumn /22/ Hal Perkins & UW CSE P-1
CSE P 501 Compilers Register Allocation Hal Perkins Autumn 2011 11/22/2011 2002-11 Hal Perkins & UW CSE P-1 Agenda Register allocation constraints Local methods Faster compile, slower code, but good enough
More informationRegister Allocation. Stanford University CS243 Winter 2006 Wei Li 1
Register Allocation Wei Li 1 Register Allocation Introduction Problem Formulation Algorithm 2 Register Allocation Goal Allocation of variables (pseudo-registers) in a procedure to hardware registers Directly
More informationCS 406/534 Compiler Construction Putting It All Together
CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy
More informationLecture Compiler Backend
Lecture 19-23 Compiler Backend Jianwen Zhu Electrical and Computer Engineering University of Toronto Jianwen Zhu 2009 - P. 1 Backend Tasks Instruction selection Map virtual instructions To machine instructions
More informationFall Compiler Principles Lecture 12: Register Allocation. Roman Manevich Ben-Gurion University
Fall 2014-2015 Compiler Principles Lecture 12: Register Allocation Roman Manevich Ben-Gurion University Syllabus Front End Intermediate Representation Optimizations Code Generation Scanning Lowering Local
More informationReuse Optimization. LLVM Compiler Infrastructure. Local Value Numbering. Local Value Numbering (cont)
LLVM Compiler Infrastructure Source: LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation by Lattner and Adve Reuse Optimization Eliminate redundant operations in the dynamic execution
More informationTowards a More Principled Compiler: Register Allocation and Instruction Selection Revisited
Towards a More Principled Compiler: Register Allocation and Instruction Selection Revisited David Ryan Koes CMU-CS-09-157 October 2009 School of Computer Science Carnegie Mellon University Pittsburgh,
More informationRegister allocation. Register allocation: ffl have value in a register when used. ffl limited resources. ffl changes instruction choices
Register allocation IR instruction selection register allocation machine code errors Register allocation: have value in a register when used limited resources changes instruction choices can move loads
More informationA Propagation Engine for GCC
A Propagation Engine for GCC Diego Novillo Red Hat Canada dnovillo@redhat.com May 1, 2005 Abstract Several analyses and transformations work by propagating known values and attributes throughout the program.
More informationAn Overview of GCC Architecture (source: wikipedia) Control-Flow Analysis and Loop Detection
An Overview of GCC Architecture (source: wikipedia) CS553 Lecture Control-Flow, Dominators, Loop Detection, and SSA Control-Flow Analysis and Loop Detection Last time Lattice-theoretic framework for data-flow
More informationCompiler Design. Register Allocation. Hwansoo Han
Compiler Design Register Allocation Hwansoo Han Big Picture of Code Generation Register allocation Decides which values will reside in registers Changes the storage mapping Concerns about placement of
More informationCode Placement, Code Motion
Code Placement, Code Motion Compiler Construction Course Winter Term 2009/2010 saarland university computer science 2 Why? Loop-invariant code motion Global value numbering destroys block membership Remove
More informationDecoupled Software Pipelining in LLVM
Decoupled Software Pipelining in LLVM 15-745 Final Project Fuyao Zhao, Mark Hahnenberg fuyaoz@cs.cmu.edu, mhahnenb@andrew.cmu.edu 1 Introduction 1.1 Problem Decoupled software pipelining [5] presents an
More informationExtended Linear Scan: an Alternate Foundation for Global Register Allocation
Extended Linear Scan: an Alternate Foundation for Global Register Allocation Vivek Sarkar 1 and Rajkishore Barik 2 1 IBM T.J. Watson Research Center, Email: vsarkar@us.ibm.com 2 IBM India Research Laboratory,
More informationFunctional programming languages
Functional programming languages Part V: functional intermediate representations Xavier Leroy INRIA Paris-Rocquencourt MPRI 2-4, 2015 2017 X. Leroy (INRIA) Functional programming languages MPRI 2-4, 2015
More informationUNIVERSITY OF EDINBURGH COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS INFR08013 INFORMATICS 1 - FUNCTIONAL PROGRAMMING
UNIVERSITY OF EDINBURGH COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS INFR08013 INFORMATICS 1 - FUNCTIONAL PROGRAMMING Friday 20 th December 2013 14:30 to 16:30 INSTRUCTIONS TO CANDIDATES 1.
More informationJOHANNES KEPLER UNIVERSITÄT LINZ
JOHANNES KEPLER UNIVERSITÄT LINZ Institut für Praktische Informatik (Systemsoftware) Adding Static Single Assignment Form and a Graph Coloring Register Allocator to the Java Hotspot Client Compiler Hanspeter
More informationfast code (preserve flow of data)
Instruction scheduling: The engineer s view The problem Given a code fragment for some target machine and the latencies for each individual instruction, reorder the instructions to minimize execution time
More informationCSE P 501 Compilers. SSA Hal Perkins Spring UW CSE P 501 Spring 2018 V-1
CSE P 0 Compilers SSA Hal Perkins Spring 0 UW CSE P 0 Spring 0 V- Agenda Overview of SSA IR Constructing SSA graphs Sample of SSA-based optimizations Converting back from SSA form Sources: Appel ch., also
More informationCS 406/534 Compiler Construction Instruction Selection and Global Register Allocation
CS 406/534 Compiler Construction Instruction Selection and Global Register Allocation Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith
More informationIntermediate 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 informationA SURVEY OF REGISTER ALLOCATION TECHNIQUES. Jonathan Protzenko
A SURVEY OF REGISTER ALLOCATION TECHNIQUES Jonathan Protzenko July 29, 2009 I. GETTING STARTED 1. Introduction Contents I GETTING STARTED................ 2 1 Introduction.................... 2 a. Which
More informationRegister Allocation. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice.
Register Allocation Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP at Rice. Copyright 00, Keith D. Cooper & Linda Torczon, all rights reserved.
More informationP423/P523 Compilers Register Allocation
P423/P523 Compilers Register Allocation Deyaaeldeen Almahallawi 1 1 dalmahal@indiana.edu Indiana University March, 2015 Deyaaeldeen Almahallawi P423/P523 1/ 21 A bit of history During optimization, assume
More informationThe Mono JIT optimizations and evolution
The Mono JIT optimizations and evolution Massimiliano Mantione massi@ximian.com October 24, 2006 Current status Five years old and fairly mature subsystem Supports various optimizations and AOT compilation
More information8. Static Single Assignment Form. Marcus Denker
8. Static Single Assignment Form Marcus Denker Roadmap > Static Single Assignment Form (SSA) > Converting to SSA Form > Examples > Transforming out of SSA 2 Static Single Assignment Form > Goal: simplify
More informationMemory Management. COMP755 Advanced Operating Systems
Memory Management COMP755 Advanced Operating Systems Purpose of Memory Manager Find a place in RAM for programs and data. OS Memory Manager allocates RAM to programs and OS tasks and data. User level memory
More informationRegister Allocation. Lecture 16
Register Allocation Lecture 16 1 Register Allocation This is one of the most sophisticated things that compiler do to optimize performance Also illustrates many of the concepts we ve been discussing in
More informationTable ADT and Sorting. Algorithm topics continuing (or reviewing?) CS 24 curriculum
Table ADT and Sorting Algorithm topics continuing (or reviewing?) CS 24 curriculum A table ADT (a.k.a. Dictionary, Map) Table public interface: // Put information in the table, and a unique key to identify
More information17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer
Module 2: Divide and Conquer Divide and Conquer Control Abstraction for Divide &Conquer 1 Recurrence equation for Divide and Conquer: If the size of problem p is n and the sizes of the k sub problems are
More informationSingle-Pass Generation of Static Single Assignment Form for Structured Languages
1 Single-Pass Generation of Static Single Assignment Form for Structured Languages MARC M. BRANDIS and HANSPETER MÖSSENBÖCK ETH Zürich, Institute for Computer Systems Over the last few years, static single
More informationProgramming Languages
Programming Languages Tevfik Koşar Lecture - VIII February 9 th, 2006 1 Roadmap Allocation techniques Static Allocation Stack-based Allocation Heap-based Allocation Scope Rules Static Scopes Dynamic Scopes
More informationChallenges in the back end. CS Compiler Design. Basic blocks. Compiler analysis
Challenges in the back end CS3300 - Compiler Design Basic Blocks and CFG V. Krishna Nandivada IIT Madras The input to the backend (What?). The target program instruction set, constraints, relocatable or
More informationInterference Graphs for Procedures in Static Single Information Form are Interval Graphs
Interference Graphs for Procedures in Static Single Information Form are Interval Graphs ABSTRACT Static Single Information (SSI) Form is a compiler intermediate representation that extends the more well-known
More informationLecture Notes on Static Single Assignment Form
Lecture Notes on Static Single Assignment Form 15-411: Compiler Design Frank Pfenning Lecture 6 September 12, 2013 1 Introduction In abstract machine code of the kind we have discussed so far, a variable
More informationCSE 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 informationCIS 341 Final Examination 30 April 2013
CIS 341 Final Examination 30 April 2013 1 /40 2 /30 3 /30 4 /20 Total /120 Do not begin the exam until you are told to do so. You have 120 minutes to complete the exam. There are 12 pages in this exam.
More informationIf-Conversion SSA Framework and Transformations SSA 09
If-Conversion SSA Framework and Transformations SSA 09 Christian Bruel 29 April 2009 Motivations Embedded VLIW processors have architectural constraints - No out of order support, no full predication,
More informationSSA Construction. Daniel Grund & Sebastian Hack. CC Winter Term 09/10. Saarland University
SSA Construction Daniel Grund & Sebastian Hack Saarland University CC Winter Term 09/10 Outline Overview Intermediate Representations Why? How? IR Concepts Static Single Assignment Form Introduction Theory
More informationLLVM code generation and implementation of nested functions for the SimpliC language
LLVM code generation and implementation of nested functions for the SimpliC language Oscar Legetth Lunds University dat12ole@student.lth.se Gustav Svensson Lunds University dat12gs1@student.lth.se Abstract
More informationPractice Problems for the Final
ECE-250 Algorithms and Data Structures (Winter 2012) Practice Problems for the Final Disclaimer: Please do keep in mind that this problem set does not reflect the exact topics or the fractions of each
More informationC/C++ Programming Lecture 18 Name:
. The following is the textbook's code for a linear search on an unsorted array. //***************************************************************** // The searchlist function performs a linear search
More informationIntroduction to Machine-Independent Optimizations - 6
Introduction to Machine-Independent Optimizations - 6 Machine-Independent Optimization Algorithms Department of Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course
More informationStructure Array Copy Optimization
Structure Array Copy Optimization 1. Objective Modern programming language use structure to gather relative datum, in some of the program, only part of the structure is accessed. If the size of accessed
More informationRegister allocation. instruction selection. machine code. register allocation. errors
Register allocation IR instruction selection register allocation machine code errors Register allocation: have value in a register when used limited resources changes instruction choices can move loads
More informationRegister Allocation 3/16/11. What a Smart Allocator Needs to Do. Global Register Allocation. Global Register Allocation. Outline.
What a Smart Allocator Needs to Do Register Allocation Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations Determine ranges for each variable can benefit from using
More informationLecture Notes on Memory Layout
Lecture Notes on Memory Layout 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 11 1 Introduction In order to understand how programs work, we can consider the functions,
More informationMore Code Generation and Optimization. Pat Morin COMP 3002
More Code Generation and Optimization Pat Morin COMP 3002 Outline DAG representation of basic blocks Peephole optimization Register allocation by graph coloring 2 Basic Blocks as DAGs 3 Basic Blocks as
More informationSSA Based Mobile Code: Construction and Empirical Evaluation
SSA Based Mobile Code: Construction and Empirical Evaluation Wolfram Amme Friedrich Schiller University Jena, Germany Michael Franz Universit of California, Irvine, USA Jeffery von Ronne Universtity of
More informationRegister Allocation. CS 502 Lecture 14 11/25/08
Register Allocation CS 502 Lecture 14 11/25/08 Where we are... Reasonably low-level intermediate representation: sequence of simple instructions followed by a transfer of control. a representation of static
More informationComputer Science 136 Spring 2004 Professor Bruce. Final Examination May 19, 2004
Computer Science 136 Spring 2004 Professor Bruce Final Examination May 19, 2004 Question Points Score 1 10 2 8 3 15 4 12 5 12 6 8 7 10 TOTAL 65 Your name (Please print) I have neither given nor received
More informationCourse introduction. Advanced Compiler Construction Michel Schinz
Course introduction Advanced Compiler Construction Michel Schinz 2016 02 25 General information Course goals The goal of this course is to teach you: how to compile high-level functional and objectoriented
More informationRegister Allocation (wrapup) & Code Scheduling. Constructing and Representing the Interference Graph. Adjacency List CS2210
Register Allocation (wrapup) & Code Scheduling CS2210 Lecture 22 Constructing and Representing the Interference Graph Construction alternatives: as side effect of live variables analysis (when variables
More informationLinear-Scan Register Allocation. CS 352 Lecture 12 11/28/07
Linear-Scan Register Allocation CS 352 Lecture 12 11/28/07 Introduction A simple local allocation algorithm Assume code is already scheduled Build a linear ordering of live ranges (also called live intervals
More informationRegister Allocation Deconstructed
Register Allocation Deconstructed David Ryan Koes Carnegie Mellon University Pittsburgh, PA dkoes@cs.cmu.edu Seth Copen Goldstein Carnegie Mellon University Pittsburgh, PA seth@cs.cmu.edu Abstract Register
More informationCS5363 Final Review. cs5363 1
CS5363 Final Review cs5363 1 Programming language implementation Programming languages Tools for describing data and algorithms Instructing machines what to do Communicate between computers and programmers
More informationChapter 9. Register Allocation
Chapter 9. Register Allocation Basics of Compiler Design Torben Ægidius Mogensen Dr. Marco Valtorta, Professor Computer Science and Engineering Dept. University of South Carolina Radu Vitoc, PhD candidate
More informationCSE 431S Final Review. Washington University Spring 2013
CSE 431S Final Review Washington University Spring 2013 What You Should Know The six stages of a compiler and what each stage does. The input to and output of each compilation stage (especially the back-end).
More informationData Structures Lecture 3 Order Notation and Recursion
Data Structures Lecture 3 Order Notation and Recursion 1 Overview The median grade.cpp program from Lecture 2 and background on constructing and using vectors. Algorithm analysis; order notation Recursion
More informationGlobal Register Allocation - Part 3
Global Register Allocation - Part 3 Y N Srikant Computer Science and Automation Indian Institute of Science Bangalore 560012 NPTEL Course on Compiler Design Outline Issues in Global Register Allocation
More informationCSE 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 informationControl Flow Analysis
COMP 6 Program Analysis and Transformations These slides have been adapted from http://cs.gmu.edu/~white/cs60/slides/cs60--0.ppt by Professor Liz White. How to represent the structure of the program? Based
More informationCIS 341 Final Examination 3 May 2011
CIS 341 Final Examination 3 May 2011 1 /16 2 /20 3 /40 4 /28 5 /16 Total /120 Do not begin the exam until you are told to do so. You have 120 minutes to complete the exam. There are 12 pages in this exam.
More informationProcess s Address Space. Dynamic Memory. Backing the Heap. Dynamic memory allocation 3/29/2013. When a process starts the heap is empty
/9/01 Process s Address Space Dynamic Memory 0x7fffffff Stack Data (Heap) Data (Heap) 0 Text (Code) Backing the Heap When a process starts the heap is empty The process is responsible for requesting memory
More informationCompiler construction in4303 lecture 9
Compiler construction in4303 lecture 9 Code generation Chapter 4.2.5, 4.2.7, 4.2.11 4.3 Overview Code generation for basic blocks instruction selection:[burs] register allocation: graph coloring instruction
More information