Skip to content

Wrote a collection of code optimization algorithms for C++ and bitcode generators for C-- using C++, Yacc, and LLVM IR

License

Notifications You must be signed in to change notification settings

ryenumu2/C-Compiler-Optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSE

Introduction

Using LLVM, I developed an algorithm for Common Subexpression Elimination, Constant Folding, and Dead Code elimination.

Results

Optimizations are recorded by incrementing output counters CSE_Dead, CSE_Basic, and CSE_Simplify. These variables displayed the number of dead code eliminations, constant foldings, and subexpression eliminations respectively after running these optimization files over any given piece of code. An example output on terminal after optimizations are done is as shown:

Alt text

Where different optimizations done to the code are recorded by each output counter.

C--

Introduction

Using C++, I wrote a script that can take any C-- program and create an LLVM bitcode file.

Features

Some features that differentiate C-- from C and C++ include:

  • lack of function prototypes
  • no support for type checking and type interference
  • int (i64) is only supported
  • global variable and function definitions

Example

A sample piece of C-- code that my script would create LLVM bitcode for:

Alt text

Pieces of my cmm.cpp file that would be called for while (j < 10) (line numbers included for convenience):

Alt text

Alt text

About

Wrote a collection of code optimization algorithms for C++ and bitcode generators for C-- using C++, Yacc, and LLVM IR

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published