Alessandro Di Federico 540b87e2ff EnforceABI step: reduce work done by InlineHelpers
InlineHelpers often inlines functions that contain a switch on an
argument that is constant on the call site. Specifically, this is true
for the `cc_compute_c` and `cc_compute_all` helpers of x86
architectures. The LLVM inliner, in such situations, is smart and
inlines a reduced amount of code, significantly reducing the maximum
size of the modules we work with.

However, before this commit, we couldn't capture this fact due to
`newpc` preventing constant propagation of the values of CSV set in an
instruction into their usage in the next instruction.

Running `PromoteCSV` before `InlineHelpers`, along with `mem2reg`
enables us to capture this behavior effectively.
2023-11-21 15:15:29 +01:00
2023-05-11 10:05:32 +02:00
2023-09-06 15:23:43 +02:00

Purpose

revng is a static binary translator. Given a input ELF binary for one of the supported architectures (currently i386, x86-64, MIPS, ARM, AArch64 and s390x) it will analyze it and emit an equivalent LLVM IR. To do so, revng employs the QEMU intermediate representation (a series of TCG instructions) and then translates them to LLVM IR.

How to build

revng employs CMake as a build system. In order to build revng, use orchestra and make sure you're building revng from source.

You can install as follows:

orc install revng

Remember to enter an orc shell to run revng:

orc shell
revng --help

You can run the test suite as follows:

orc install --test revng

Example run

The simplest possible example consists in the following:

# Install revng
orc install revng

# Install the ARM toolchain
orc install toolchain/arm/gcc

# Enter in the build directory
orc shell -c revng

# Build
ninja

# Create hello world program
cat > hello.c <<EOF
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("Hello, world!\n");
}
EOF

# Compile
armv7a-hardfloat-linux-uclibceabi-gcc \
  -Wl,-Ttext-segment=0x20000 \
  -static hello.c \
  -o hello.arm

# Translate
./bin/revng translate hello.arm
chmod +x hello.arm.translated

# Run translated version
./hello.arm.translated
# Hello, world!
S
Description
Automated archival mirror of github.com/revng/revng
Readme GPL-2.0 24 MiB
Languages
C++ 77.1%
Python 12.6%
MLIR 4.4%
CMake 1.9%
LLVM 1.4%
Other 2.5%