facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.51k stars 176 forks source link

[IDEA] optimizing code #254

Closed Sambhrama754 closed 2 years ago

Sambhrama754 commented 2 years ago

I have an idea 😃: Can we just seprate the part which rearranges the code into a separate repo and make it output the optimized code

rafaelauler commented 2 years ago

Hi @Sambhrama754, can you give more context on your idea? Do you mean putting the basic block reordering algorithm in a separate repo?

In general, we are moving in the direction of putting everything in the same repo (BOLT and LLVM).

Sambhrama754 commented 2 years ago

Yee I mean it

Sambhrama754 commented 2 years ago

And making the algo out put the optimized code

Sambhrama754 commented 2 years ago

Btw tysm for the bolt I am using it for my own linux distro

Sambhrama754 commented 2 years ago

And yeah I have one more doubt that how I am supposed to BOLT .Deb files??

rafaelauler commented 2 years ago

So the point is to make it independent from LLVM? Well, we need LLVM to disassemble the binary. Then we do our own processing, and finally we rely on LLVM again to emit the code (write it in almost final form) and then link the final code (resolve addresses). This was done to avoid rewriting code that is already available in the LLVM repo. Because the project was created as an extension to existing LLVM tools, we are working towards integrating it with LLVM and live in the same repo.

Regarding the .deb files, these are usually packages that the distro uses that contain the program, or multiple programs/executables. You would need to run BOLT in each important executable before packaging them into a .deb file (as a distro package maintainer).

Sambhrama754 commented 2 years ago

Oh nice 😊 tysm