The aim of this project is to implement a decompilation pipeline composed of independent components interacting through well-defined interfaces, as further described in the design documents of the project.
From a high-level perspective, the components of the decompilation pipeline are conceptually grouped into three modules. Firstly, the front-end translates a source language (e.g. x86 assembly) into LLVM IR; a platform-independent low-level intermediate representation. Secondly, the middle-end structures the LLVM IR by identifying high-level control flow primitives (e.g. pre-test loops, 2-way conditionals). Lastly, the back-end translates the structured LLVM IR into a high-level target programming language (e.g. Go).
The following poster summarizes the current capabilities of the decompilation pipeline, using a composition of independent components to translate LLVM IR to Go.
Translate machine code (e.g. x86 assembly) to LLVM IR.
Third-party front-end components.
Perform control flow analysis on the LLVM IR to identify high-level control flow primitives (e.g. pre-test loops).
https://godoc.org/github.com/decomp/decomp/cmd/ll2dot
Control flow graph generation tool.
Generate control flow graphs from LLVM IR assembly (*.ll -> *.dot).
https://godoc.org/github.com/decomp/decomp/cmd/restructure
Control flow recovery tool.
Recover control flow primitives from control flow graphs (*.dot -> *.json).
Translate structured LLVM IR to a high-level target language (e.g. Go).
https://godoc.org/github.com/decomp/decomp/cmd/ll2go
Go code generation tool.
Decompile LLVM IR assembly files to Go source code (*.ll -> *.go).
https://godoc.org/github.com/decomp/decomp/cmd/go-post
Go post-processing tool.
Post-process Go source code to make it more idiomatic (*.go -> *.go).
The source code and any original content of this repository is hereby released into the public domain.