CStar Optimizing a C Compiler Group Hellim GROUP

  • Slides: 23
Download presentation
CStar Optimizing a C Compiler Group Hellim

CStar Optimizing a C Compiler Group Hellim

GROUP MEMBERS - Halit Emre Sayılır - Anıl Koyuncu - Kutay Yıldırıcı - Tayfun

GROUP MEMBERS - Halit Emre Sayılır - Anıl Koyuncu - Kutay Yıldırıcı - Tayfun Çakıcıer 2

OUTLINE • Problem Definition • Framework Information • Modules 1 Optimizations 2 Optimization Manager

OUTLINE • Problem Definition • Framework Information • Modules 1 Optimizations 2 Optimization Manager 3 Test Case Generator • Screenshots 3

PROBLEM DEFINITION Why • Performance and Efficiency - Reduce Execution Time - Decrease Space

PROBLEM DEFINITION Why • Performance and Efficiency - Reduce Execution Time - Decrease Space of Code - Reduce Memory Space • Must be Reliable 4

FRAMEWORK INFO • • Object Oriented Software Library Own intermediate representation Design by Contract

FRAMEWORK INFO • • Object Oriented Software Library Own intermediate representation Design by Contract Modular 5

OPTIMIZATIONS Dead Code Elemination if(0) a=1; else a=2; Evaluation of if statement in run

OPTIMIZATIONS Dead Code Elemination if(0) a=1; else a=2; Evaluation of if statement in run time avoided Space of code reduced will be replaced by a=2; 6

OPTIMIZATIONS(cont. ) Constant Folding return 100*40 return 4000 7

OPTIMIZATIONS(cont. ) Constant Folding return 100*40 return 4000 7

OPTIMIZATIONS(cont. ) Local Copy Propagation a=b; c=a+d; c=b+d; also after dead code elimination 8

OPTIMIZATIONS(cont. ) Local Copy Propagation a=b; c=a+d; c=b+d; also after dead code elimination 8

OPTIMIZATIONS (%35) - Constant Folding (+) - Basic Block Ordering - Dead Code Elimination

OPTIMIZATIONS (%35) - Constant Folding (+) - Basic Block Ordering - Dead Code Elimination - Local/Global Forward Substitution - Local/Global Copy Propagation(+) - Strength Reduction (+) - Local/Global Common Sub. Expression Elimination (+) - If Simplifications - Algebraic Simplifications (+) 9

OPTIMIZATIONS(cont. ) • • Dead Object Elimination Jump Optimizations Tail Merging Tail Recursion Procedure

OPTIMIZATIONS(cont. ) • • Dead Object Elimination Jump Optimizations Tail Merging Tail Recursion Procedure Cloning and Specilization Partial Redundancy Elimination Unreachable Code Elimination (+) 10

OPTIMIZATION MANAGER (%40) • A tool for managing the optimizations which will be used

OPTIMIZATION MANAGER (%40) • A tool for managing the optimizations which will be used during compilation • An assistant for advanced users 11

OPTIMIZATION MANAGER • Two modes: 1 - File mode: § There is an external

OPTIMIZATION MANAGER • Two modes: 1 - File mode: § There is an external file. The optimizations which will be used , are configured in the file § When the file is read , rules will be managed and then chosen optimizations will be executed 12

Optimization Manager Configuration File 13

Optimization Manager Configuration File 13

OPTIMIZATION MANAGER 2 - Interactive mode: § It is a mode which interacts with

OPTIMIZATION MANAGER 2 - Interactive mode: § It is a mode which interacts with user. § The user will enter input via keyboard. § Optimizations will be done in an interactive manner. 14

TEST CASE GENERATOR (%30) Aim: Automating the process of test case generation * Reduce

TEST CASE GENERATOR (%30) Aim: Automating the process of test case generation * Reduce and prevent human errors * Flexibility for generation of different test cases 15

TEST CASE GENERATOR How Option File Inspection 16

TEST CASE GENERATOR How Option File Inspection 16

OPTION FILE 17

OPTION FILE 17

TEST CASE GENERATOR How Option File Inspection Parse Option File Generated Test File IR

TEST CASE GENERATOR How Option File Inspection Parse Option File Generated Test File IR Dump Generate Options IR Code Generation 18

Screenshots • Some result screenshots of the optimizations 19

Screenshots • Some result screenshots of the optimizations 19

Constant Folding 20

Constant Folding 20

Algebraic Simplifications 21

Algebraic Simplifications 21

Local Common Subexpression Elimination 22

Local Common Subexpression Elimination 22

QUESTIONS ? ? ? 23

QUESTIONS ? ? ? 23