Skip to content

An automated tool for the source-to-source optimization of C code.

Notifications You must be signed in to change notification settings

sriram1999s/Coptimizer

Repository files navigation

Coptimizer : Automated Tool For C Source Optimization.

NOTE : Combinations of optimizations do not work currently due to implementation issues.

Optimizations

The optimizations are governed by Jon Bentley's rules for optimizing work.

Find the link to a pdf explaining the rules here

  • Function Inlining
  • Loop Unrolling
  • Combining Tests(If-Else to Switch)
  • Compile Time Initialization
  • Tail End Recursion Elimination
  • Loop Jamming

Interfaces

  • can be accessed through CLI or GUI
  • The CLI is installed directly on the host.
  • GUI is run in a docker container.

Command Line Utility

Is a software tool with a command line interface

Dependancies

  • Python3.6+
  • linux
  • flask
  • indent
  • tqdm
  • fire
  • ply
  • uuid
  • emoji
  • sympy

Functionalities

Installation

  1. Clone the repository
  2. Run the install script (install.sh)
  3. Add this to your shell config file : export PATH=$PATH":<enter-path-to-directory>/env
  4. Add this to your shell config file : export COPTIMIZER_PATH="<enter-path-to-directory>"

To verify installation :

Coptimizer help

The output should look like this:

Welcome to the command line Coptimizer....🔥

Usage sf ➡️  Coptimizer sf [FLAGS]
Usage ox ➡️  Coptimizer ox [PATH]
sf [options] ➡️  setflags in from this pool [UNROLL,COMPILE_INIT,INLINE,IF_TO_SWITCH,TAIL_RECURSION,JAMMING]
ox [PATH] ➡️  optimize file in given path and create output.c file in same path

Usage

Help

provides general information about the interface

Coptimizer help

Set flags

Set flags for selected optimization found here Used to select which optimizations are applied on the next run.

Coptimizer sf <flags list>

Use help to see flags options

Optimize

Optimizes input source code. Outputs processed source code to stdout and stores it in output.c

Coptimizer ox <path to file>

Graphical User Interface

Instructions to run the server and access the GUI.

Build

  • while in the main directory
docker build -t coptimizer-server:1.0 .

Run

docker run -p 5000:5000 coptimizer-server:1.0 

Hosted interface

cout << "Yet to Host! \n";

Demonstration

Find the link for the demonstration here

User Interface 1

User Interface 2

User Interface 3

User Interface 4