COINS‥ a COmpiler INfraStructure

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

Intermediate Representations CS 671 February 12, 2008.
Adding custom instructions to Simplescalar/GCC architecture
Comparison and Evaluation of Back Translation Algorithms for Static Single Assignment Form Masataka Sassa #, Masaki Kohama + and Yo Ito # # Dept. of Mathematical.
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
Program Representations. Representing programs Goals.
Introduction to Advanced Topics Chapter 1 Mooly Sagiv Schrierber
Intermediate Representation I High-Level to Low-Level IR Translation EECS 483 – Lecture 17 University of Michigan Monday, November 6, 2006.
Chapter 14: Building a Runnable Program Chapter 14: Building a runnable program 14.1 Back-End Compiler Structure 14.2 Intermediate Forms 14.3 Code.
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
Representing programs Goals. Representing programs Primary goals –analysis is easy and effective just a few cases to handle directly link related things.
Cpeg421-08S/final-review1 Course Review Tom St. John.
The Design of a Resourceable and Retargetable Binary Translator Cristina Cifuentes Sixth Working Conference on Reverse Engineering On page(s):
Hardware-Software Interface Machine Program Performance = t cyc x CPI x code size X Available resources statically fixed Designed to support wide variety.
CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
CSC 338: Compiler design and implementation
Computer Architecture Instruction Set Architecture Lynn Choi Korea University.
Static Single Assignment Form in the COINS Compiler Infrastructure - Current Status and Background - Masataka Sassa, Toshiharu Nakaya, Masaki Kohama (Tokyo.
Static Single Assignment Form in the COINS Compiler Infrastructure Masataka Sassa, Toshiharu Nakaya, Masaki Kohama, Takeaki Fukuoka and Masahito Takahashi.
1 Chapter 1 Introduction. 2 Outlines 1.1 Overview and History 1.2 What Do Compilers Do? 1.3 The Structure of a Compiler 1.4 The Syntax and Semantics of.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
Introduction Lecture 1 Wed, Jan 12, The Stages of Compilation Lexical analysis. Syntactic analysis. Semantic analysis. Intermediate code generation.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
. n COMPILERS n n AND n n INTERPRETERS. -Compilers nA compiler is a program thatt reads a program written in one language - the source language- and translates.
COMPILER CONSTRUCTION Lesson 1 – TDDD16 TDDB44 Compiler Construction 2010 Kristian Stavåker (Erik Hansson.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
INTRODUCTION TO COMPILERS(cond….) Prepared By: Mayank Varshney(04CS3019)
LLVM Compiler Katie Dew. Lectures High-level overview of LLVM (Katie) Walkthrough of LLVM in context of our project (Jason) –Input requirements –Configuration.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
Introduction to Language Programming Hierarchy of programming lang. Based on machine independences: 1. Machine language 2. Assembly language 3. Higher.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
CSC 4181 Compiler Construction
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Chapter 1 Introduction Samuel College of Computer Science & Technology Harbin Engineering University.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
CS 404 Introduction to Compiler Design
Programs, Instructions, and Registers
Chapter 1 Introduction.
Introduction to Compiler Construction
Computer Architecture Instruction Set Architecture
Introduction to Advanced Topics Chapter 1 Text Book: Advanced compiler Design implementation By Steven S Muchnick (Elsevier)
Compiler Construction (CS-636)
6.001 SICP Compilation Context: special purpose vs. universal machines
Compiler Chapter 9. Intermediate Languages
Overview of Compilation The Compiler BACK End
C# and the .NET Framework
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
Chapter 1: Introduction to Compiling (Cont.)
Compiler Lecture 1 CS510.
CS 536 / Fall 2017 Introduction to programming languages and compilers
An Overview to Compiler Design
Compiler Construction
CPSC 388 – Compiler Design and Construction
Compiler 薛智文 TH 6 7 8, DTH Spring.
Code Generation.
Intermediate Code Generation
Overview of Compilation The Compiler BACK End
Compilers B V Sai Aravind (11CS10008).
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Chapter 10: Compilers and Language Translation
Compiler Construction
Lec00-outline May 18, 2019 Compiler Design CS416 Compiler Design.
Compiler Structures 1. Overview Objective
Intermediate Code Generating machine-independent intermediate form.
Research: Past, Present and Future
Presentation transcript:

COINS‥ a COmpiler INfraStructure COINS helps you to make a new compiler for new language for new processor with new optimization method COINS assists compiler designers educators computer architects

Introduction to COINS written in Java. Slow compilation⇔ easy BUG tracking about 176k lines or 710 source files easy to understand ‥high modularity C and FORTRAN ‥‥ input (Java ‥‥ in progress) SPARC and x86 ‥‥ target (ARM, MIPS, SH4, PowerPC ‥ in progress)

Structure of COINS Language specific analyzer HIR (High-level Intermediate Representation) represents an abstract language keeps source code level info. and suitable for high-level opt. (parallelization , alias analysis) two output paths‥‥LIR and C LIR (Low-level Intermediate Representation) represents an abstract machine has a strictly defined denotational semantics suitable for low-level opt. (SSA, branch, inst. scheduling, SIMD) Re-targetable code generator based on TMD

a + b 1 = a = b + 1; a = b + 1 (assign int <var int a> (add int <var int b> <const int 1>)) a + b 1 = or

a + b 1 = (SET I32 (MEM I32 (FRAME I32 "a.1")) (ADD I32 (MEM I32 (FRAME I32 "b.2")) “a” & “b” : local (INTCONST I32 1))) (SET I32 (MEM I32 (STATIC I32 "a")) (ADD I32 (MEM I32 (STATIC I32 "b")) “a” & “b” : global(INT CONST I32 1))) (assign int <var int a> (add int <var int b> <const int 1>)) a + b 1 = or Visualization

TMD (Target Machine Description) Correspondence between LIR pattern and target machine code pattern LIR→LIR re-writing rules Tmd2Java : iburg-like tree parser generator performing DP matching (for cost). 1408~ ARM 1404 x86 1100 SPARC 1744~ SH4 2807~ PowerPC 1603 MIPS Retargeting costs (lines):

Examples from a TMD (SPARC) ;; Register decl. (def *real-reg-symtab* (SYMTAB (foreach @n (01 23 45 67) ("%l@n" REG I64 4 0)) (foreach @p (i o) (foreach @n (01 23 45) ("%@p@n" REG I64 4 0))) (foreach @gl (g l) (foreach @n (0 1 2 3 4 5 6 7) ("%@gl@n" REG I32 4 0))) (foreach @oi (o i) (foreach @n (0 1 2 3 4 5) ("%@oi@n" REG I32 4 0))) (foreach @n (0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30) ("%f@n" REG F64 8 0)) ("%sp" REG I32 4 0) ("%fp" REG I32 4 0))) ;; Two versions of signed MUL. (foreach (@op @lib) ((MUL .mul) (DIVS .div) (DIVU .udiv) (MODS .rem) (MODU .urem)) (defrule regl (@op I32 regl regl) (cond "!machineOptV8") (regset ($0 *reg-o0-I32*) ($1 *reg-o0-I32*) ($2 *reg-o1-I32*)) (code (call "@lib") (nop)) (clobber (REG I32 "%o1") (REG I32 "%o2")(REG I32 "%o3") (REG I32 "%o4")(REG I32 "%o5")) (cost 10))) ;; V8 MUL instruction (defrule regl (MUL I32 regl rc) (cond "machineOptV8") (code (smul $1 $2 $0)) (cost 1))