• No results found

Machine Descriptions and Retargetability

N/A
N/A
Protected

Academic year: 2022

Share "Machine Descriptions and Retargetability"

Copied!
22
0
0

Loading.... (view fulltext now)

Full text

(1)

Workshop on Essential Abstractions in GCC

Machine Descriptions and Retargetability

GCC Resource Center

(www.cse.iitb.ac.in/grc)

Department of Computer Science and Engineering, Indian Institute of Technology, Bombay

July 2009

July 09 Machine Descriptions and Retargetability: Outline 1/1

Outline

• Influences on GCC Machine Descriptions

• Organization of GCC Machine Descriptions

• Machine description constructs

• The essence of retargetability in GCC

• Systematic construction of machine descriptions

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

Part 1

Influences on Machine Descriptions

(2)

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 2/1

Examples of Influences on the Machine Descriptions

Machine Description Source Language

• INT TYPE SIZE

• Activation Record

<target>.h

GCC Architecture

• Generation of nop

• tree covers for instruction selection

• define predicate

<target>.h

Build System Host System hwint.h

Target System

• Instruction Set Architecture

• Assembly and executable formats

<target>.md

<target>.h

<target>.h other headers

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 2/1

Examples of Influences on the Machine Descriptions

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 3/1

HLL Influences on Machine Description

int main () {

int a;

char b;

float c;

while (a != 0) a = b + sqr(c);

return 0;

}

Memory

a b c

main

sqr

Data

Code CPU Data types, sizes

Control Structures Operators Function Call

Scope ?

How do we describe these?

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 3/1

HLL Influences on Machine Description

N o te s

(3)

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 4/1

GCC Architecture Influence on MD

• Standard pattern names with predefined semantics are used in MD

• New Standard Pattern Names may be introduced (eg. cbranch didn’t exist in earlier version)

• A new MD constructs may be introduced

(e.g. define predicate didn’t exist in earlier versions)

• Macros to be added, removed, or changed in future!

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 4/1

GCC Architecture Influence on MD

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 5/1

Target Influences on MD

NOTE: Target System = Target ISA + Target System Software Illustration of ISA Influence

Memory

CPU 1

Store Load

Target 1

CPU 2

Move Move

Target 2

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 5/1

Target Influences on MD

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(4)

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 6/1

System Influences

Compiler

System Software

• Assembler

• Linker

• Profiler

• Debugger

• Library

Layout ELF/PE markers

Profiling Debugging

Headers

Operating System

• Unix

• Windows

• . . . COFF?

Path sep.

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Influences on Machine Descriptions 6/1

System Influences

N o te s

Part 2

Organization of GCC MD

(5)

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 7/1

GCC Machine Descriptions

• Processor instructions useful to GCC

• Processor characteristics useful to GCC

• Target ASM syntax

• Target specific optimizations as IR-RTL → IR-RTL transformations (GCC code performs the transformation computations,

MD supplies their target patterns)

Peephole optimizations

Transformations for enabling scheduling

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 7/1

GCC Machine Descriptions

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 8/1

Syntactic Entities in GCC MD

• Necessary Specifications

Processor instructions useful to GCC

One Gimple → One IR-RTL define insn

One Gimple → More than one IR-RTL define expand

Processor characteristics useful to GCC define cpu unit

Target ASM syntax part of define insn

IR-RTL → IR-RTL transformations define split

Target Specific Optimizations define peephole2

• Programming Conveniences

(eg. define insn and split, define constants, define cond exec, define automaton )

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 8/1

Syntactic Entities in GCC MD

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(6)

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 9/1

File Organization of GCC MD

The GCC MD comprises of

• <target>.h: A set of C macros that describe

HLL properties: e.g. INT TYPE SIZE to h/w bits

Activation record structure

Target Register (sub)sets, and characteristics (lists of read-only regs, dedicated regs, etc.)

System Software details: formats of assembler, executable etc.

• <target>.md: Target instructions described using MD constructs.

(Our main interest!)

<target>.md: Target instructions described using MD constructs.

(Our main interest!)

• <target>.c: Optional, but usually required.

C functions that implement target specific code (e.g. target specific activation layout).

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Organization of GCC MD 9/1

File Organization of GCC MD

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

Part 3

Essential Constructs in Machine Descriptions

(7)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 10/1

The GCC Phase Sequence

Target Independent Target Dependent

Parse Gimplify Tree SSA Optimize

Generate

RTL Optimize RTL Generate ASM

Gimple

RTL RTL

ASM

MD Info Required

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 10/1

The GCC Phase Sequence

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 11/1

The GCC Phase Sequence

Observe that

• RTL is a target specific IR

• GIMPLE → non strict RTL → strict RTL.

• SPN: “(Semantic) Glue” between GIMPLE and RTL

operator match + coarse operand match, and

refine the operand match

• Finally: Strict RTL ⇔ Unique target ASM string

Consider generating RTL expressions of GIMPLE nodes

• Two constructs available: define insn and define expand

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 11/1

The GCC Phase Sequence

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(8)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 12/1

Running Example

Consider a data move operation

• reads data from source location, and

• writes it to the destination location.

• GIMPLE node: GIMPLE MODIFY STMT

• SPN: “movsi”

Some possible combinations are:

• Reg ← Reg : Register move

• Reg ← Mem : Load

• Reg ← Const : Load immediate

• Mem ← Reg : Store

• Mem ← Mem : Illegal instruction

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 12/1

Running Example

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 13/1

Specifying Target Instruction Semantics

(define_insn

"movsi"

(set

(match_operand 0 "register_operand" "r") (match_operand 1 "const_int_operand" "k") )

"" /* C boolean expression, if required */

"li %0, %1"

)

Define instruction pattern Standard Pattern Name

RTL Expression (RTX):

Semantics of target instruction

target asm inst. = Concrete syntax for RTX

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 13/1

Specifying Target Instruction Semantics

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(9)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 13/1

Specifying Target Instruction Semantics

(define_insn

"movsi"

(set

(match_operand 0 "register_operand" "r") (match_operand 1 "const_int_operand" "k") )

"" /* C boolean expression, if required */

"li %0, %1"

)

RTL operator MD constructs

Constraints Predicates

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 13/1

Specifying Target Instruction Semantics

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 14/1

Instruction Specification and Translation

Target Independent Target Dependent

Parse Gimplify Tree SSA Optimize

Generate

RTL Optimize RTL Generate ASM

Gimple

RTL RTL

ASM

GIMPLE: target independent

RTL: target dependent

• Need: associate thesemantics

GCC Solution:

Standard Pattern Names

GIMPLE MODIFY STMT

RTL Template ASM

(define_insn "movsi"

(set (match_operand 0 "register_operand" "r") (match_operand 1 "const_int_operand" "k"))

"" /* C boolean expression, if required */

"mov %0, %1"

)

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 14/1

Instruction Specification and Translation

N o te s

(10)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 15/1

General Move Instruction

(define_insn "maybe_spn_like_movsi"

(set (match_operand 0 "general_operand" "") (match_operand 1 "general_operand" ""))

""

"mov %0, %1"

)

• This define insn can generate data movement patterns of all combinations

• Even Mem → Mem is possible.

• We need a mechanism to generate more restricted data movement RTX instances!

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 15/1

General Move Instruction

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 16/1

The define expand Construct

(define_expand "movsi"

[(set (match_operand:SI 0 "nonimmediate_operand" "") (match_operand:SI 1 "general_operand" "") )]

""

{

if (GET_CODE (operands[0]) == MEM &&

GET_CODE (operands[1]) != REG) if (can_create_pseudo_p())

operands[1] = force_reg (SImode, operands[1]);

} )

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 16/1

The define expand Construct

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(11)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 17/1

Relationship Between <target>.md, <target>.c, and

<target>.h Files

Example:

• Register class constraints are used in <target>.md file

• Register class is defined in <target>.h file

• Checks for register class are implemented in <target>.c file

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 17/1

Relationship Between <target>.md, <target>.c, and

<target>.h Files

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 18/1

Register Class Constraints in <target>.md File

;; Here z is the constraint character defined in

;; REG_CLASS_FROM_LETTER_P

;; The register $zero is used here.

(define_insn "IITB_move_zero"

[(set

(match_operand:SI 0 "nonimmediate_operand" "=r,m") (match_operand:SI 1 "zero_register_operand" " z ,z") )]

""

"@

move \t%0,%1 sw \t%1, %m0"

)

The Register Class letter code

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 18/1

Register Class Constraints in <target>.md File

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(12)

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 19/1

Register Class specification in <target>.h File /* From spim.h */

#define REG_CLASS_FROM_LETTER_P \

reg_class_from_letter

enum reg_class \

{ \

NO_REGS, ZERO_REGS , \

CALLER_SAVED_REGS, CALLEE_SAVED_REGS, \

BASE_REGS, GENERAL_REGS, \

ALL_REGS, LIM_REG_CLASSES \

};

#define REG_CLASS_CONTENTS \

{0x00000000, 0x00000001 , 0x0200ff00, 0x00ff0000, 0xf2fffffc, 0xfffffffe, 0xffffffff}

The Register Classes The Register Class Enumeration

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 19/1

Register Class specification in <target>.h File

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 20/1

The <target>.c File enum reg_class

reg_class_from_letter (char ch) {

switch(ch) {

case ’b’:return BASE_REGS;

case ’x’:return CALLEE_SAVED_REGS;

case ’y’:return CALLER_SAVED_REGS;

case ’z’:return ZERO_REGS;

}

return NO_REGS;

}

Get the enumeration from the Register class letter

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Essential Constructs in Machine Descriptions 20/1

The <target>.c File

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(13)

Part 5

Other Constructs in Machine Descriptions

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 21/1

Defining Attributes

• Classifications are need based

• Useful to GCC phases – e.g. pipelining Property: Pipelining

Need: To classify target instructions Construct: define attr

;; Instruction type.

(define_attr "type"

"other,multi, alu,alu1,negnot, ... str ,cld, ..."

(const_string "other") )

Fields:

Attribute name, all possible values, one of the possible values, default.

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 21/1

Defining Attributes

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(14)

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 22/1

Specifying Instruction Attributes

• Optional field of a define insn

• For an i386, we choose to mark string instructions with the attribute value str

(define_insn "*strmovdi_rex_1"

[(set (mem:DI (match_operand:DI 2 ...)]

"TARGET_64BIT && (TARGET_SINGLE_ ...)"

"movsq"

[ (set_attr "type" "str") ...

(set_attr "memory" "both")])

NOTE

An instruction may have more than one attribute!

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 22/1

Specifying Instruction Attributes

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 23/1

Using Attributes

(define_insn_reservation "pent_str" 12 (and (eq_attr "cpu" "pentium")

(eq_attr "type" "str") )

"pentium-np*12")

Pipeline specification requires the CPU type to be “pentium”

and the instruction type to be “str”

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 23/1

Using Attributes

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(15)

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 24/1

Some Other RTL Constructs

• define split: Split complex insn into simpler ones e.g. for better use of delay slots

• define insn and split: A combination of define insn and define split

Used when the split pattern matches and insn exactly.

• define peephole: (Old) Peephole optimization over insns that substitutes target ASM text.

• define peephole2: (New) Peephole optimization over insns that substitutes insns. Run after register allocation, and before

scheduling.

• define constants: Use literal constants in rest of the MD.

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Other Constructs in Machine Descriptions 24/1

Some Other RTL Constructs

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

Part 7

The Essence of Retargetability

(16)

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 25/1

Instruction Specification and Translation: A Recap

Target Independent Target Dependent

Parse Gimplify Tree SSA Optimize

Generate

RTL Optimize RTL Generate ASM

Gimple

RTL RTL

ASM

GIMPLE: target independent

RTL: target dependent

• Need: associate thesemantics

GCC Solution:

Standard Pattern Names

GIMPLE MODIFY STMT

RTL Template ASM

(define_insn "movsi"

(set (match_operand 0 "register_operand" "r") (match_operand 1 "const_int_operand" "k"))

"" /* C boolean expression, if required */

"mov %0, %1"

)

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 25/1

Instruction Specification and Translation: A Recap

N o te s

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 26/1

Translation Sequence in GCC

(define_insn

"movsi"

(set

(match_operand 0 "register_operand" "r") (match_operand 1 "const_int_operand" "k") )

"" /* C boolean expression, if required */

"li %0, %1"

)

D.1283 = 10;

(set

(reg:SI 58 [D.1283]) (const int 10: [0xa]) )

li $t0, 10 D ev el op m en t U se

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 26/1

Translation Sequence in GCC

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(17)

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 27/1

The Essence of Retargetability

When are the machine descriptions read?

• During the build process

• When a program is compiled by gcc the information gleaned from machine descriptions is consulted

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 27/1

The Essence of Retargetability

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 28/1

Retargetability Mechanism of GCC

Language Specific

Code

Language and Machine Independent Generic Code

Machine Dependent

Generator Code

Machine Descriptions Compiler Generation Framework

Input Language Target Name

Parser Gimplifier Tree SSA Optimizer

RTL

Generator Optimizer Code Generator Selected Copied

Copied

Generated

Generated

Generated Compiler

Development Time

Build Time

TimeUse

Gimple → PN + PN → IR-RTL

+ IR-RTL → ASM

Gimple → IR-RTL +

IR-RTL → ASM

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: The Essence of Retargetability 28/1

Retargetability Mechanism of GCC

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(18)

Part 8

Systematic Construction of Machine Descriptions

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 29/1

In Search of Modularity in Retargetable Compilation

Phase 1 Phase n

Ta rge t Fe at ur es Sou

rc e Fe at ur es

Phases of Compilation

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 29/1

In Search of Modularity in Retargetable Compilation

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(19)

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 30/1

In Search of Modularity in Retargetable Compilation

Ta rge t Fe at ur es Sou

rc e Fe at ur es

Phases of Compilation

Phase 1 Phase n

Feature 1 Feature m

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 30/1

In Search of Modularity in Retargetable Compilation

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 31/1

In Search of Modularity in Retargetable Compilation

Ta rge t Fe at ur es Sou

rc e Fe at ur es

Phases of Compilation

Phase 1 Phase n

Feature 1 Feature k Feature 1

Feature m

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 31/1

In Search of Modularity in Retargetable Compilation

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(20)

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 32/1

In Search of Modularity in Retargetable Compilation

M in im al Ta rge

t Fe at ur es (C um ul at ive ) Sou

rc e Fe at ur es (C um ul at ive )

Phases of Compilation

Ta rge t Level 1

Level p

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 32/1

In Search of Modularity in Retargetable Compilation

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 33/1

Systematic Development of Machine Descriptions

Other data types Conditional control transfers

Function Calls Arithmetic Expressions

Sequence of Simple Assignments involving integers

MD Level 1 MD Level 2 MD Level 3 MD Level 4 MD Level 5

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 33/1

Systematic Development of Machine Descriptions

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

(21)

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 34/1

Systematic Development of Machine Descriptions

• Define different levels of source language

• Identify the minimal information required in the machine description to support each level

Successful compilation of any program, and

correct execution of the generated assembly program.

• Interesting observations

It is the increment in the source language which results in

understandable increments in machine descriptions rather than the increment in the target architecture.

If the levels are identified properly, the increments in machine descriptions are monotonic.

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Systematic Construction of Machine Descriptions 34/1

Systematic Development of Machine Descriptions

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

Part 10

Summary

(22)

July 09 Machine Descriptions and Retargetability: Summary 35/1

Summary

• GCC achieves retargetability by reading the machine descriptions and generating a back end customised to the machine descriptions

• Machine descriptions are influenced by:

The HLLs, GCC architecture, and properties of target, host and build systems

• Writing machine descriptions requires:

specifying the C macros, target instructions and any required support functions

• define insn and define expand are used to convert a GIMPLE representation to RTL

• GCC machine descriptions can be constructed in a systematic manner

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

July 09 Machine Descriptions and Retargetability: Summary 35/1

Summary

N o te s

Essential Abstrations in GCC GCC Resource Center, IIT Bombay

References

Related documents

Essential Abstractions in GCC GCC Resource Center, IIT Bombay.. July 2010 Spim MD Levels 0,1: Retargeting GCC to Spim: A Recap 13/39. Building a Cross-Compiler

2 July 2011 Spim MD Levels 0,1: Systematic Construction of Machine Descriptions 2/38.. In Search of Modularity in

◮ Explain essential abstractions related to generation of a compiler The machine descriptions and their influence on compilation. •

◮ Explain essential abstractions related to generation of a compiler The machine descriptions and their influence on compilation. •

◮ Explain essential abstractions related to generation of a compiler The machine descriptions and their influence on compilation. •

Need: To classify target instructions Construct: define attr.. MD

IITKgp Improving GCC: Improving Machine Descriptions and Instruction Selection 47/54. Tree Tiling Instructions are viewed as

◮ Explain essential abstractions related to generation of a compiler The machine descriptions and their influence on compilation. •