4 Commits

Author SHA1 Message Date
Matula Peter
e24b7b86d9 deps/eigen: do not install the target.
Use it directly where needed.
2020-07-21 14:18:15 +02:00
Peter Kubov
e860e57bcc Speed up compilation: include needed files of Eigen in repository
* Removes IO from eigen

Removes IO module from Eigen in order to minimize dependency size.
2020-07-09 20:19:15 +02:00
Peter Matula
5281b06dc8
Retdec is a library now (#779)
* llvmir-emul: do not include llvm/Support/PluginLoader.h

This must not be included in a library.

* bin2llvmirtool: simplify

* llvmir2hlltool: do not include llvm/Support/PluginLoader.h

It is not needed and it is dangerous because it contains "load" option which can be included only once.

* bin2llvmir/providers/config: use params output file to generate config

* config/parameters: add more params

* bin2llvmir: add config-generator pass

* retdec/retdec: add super ugly decompilation API

* stacofin: stricter signature filtering

This is still very shitty. A better solution would be using some metadata in signature files - not the current signature-file-path-based filtering.

* progress: all test from "integration.ack" work

* progress

* progress

* do not manually create passes in code, use just the pass list

* create LlvmIr2Hll pass in llvmir2hll lib

* progress

* add decompiler-config.json

* aggregate LLVM passes

* add -k option

* bin2llvmir/config: fix Config::empty()

* bin2llvmir/unreahable_funcs: use params to disable opt

* retdec-decompiler: add more command line options

* progress

* all regression tests pass

* src/configtool: remove, not needed anymore

* config: remove isFromIda flag

* config: remove unused exceptions

* configL fix exceptions

* config: remove frontend version entry

* config: remove some duplicate values

* config: refactor

* config: refactor

* bin2llvmir: fix #301, fix #750, proper removal of artificial undef functions

* deps/llvm: update ref to fix gcc 10 compilation error

* deps/llvm: enable exeptions and RTTI

* progress

* remove debug msgs

* tests/debugformat_tests: fix compilation

* replace retdec-decompiler.py with retdec-decompiler

* retdec-decompiler: return decompilation error code

* tests/bin2llvmir/unreachable_funcs: fix JSON configs

* progress

* llvmir2hll: remove code specific for Python output HLL

* llvmir2hll: fix JSON output generation

* progress

* progress

* progress

* remove bin2llvmirtool and llvmir2hlltool

* refactor

* tests/bin2llvmir/x87_fpu: fix compilation

* unpackertool: do not build unpaker plugins separatelly

* scripts: return retdec-fileinfo.py back, some reg tests need it

* bin2llvmir: fix doxygen warnings

* set CMAKE_POSITION_INDEPENDENT_CODE and propagate it to deps

* Win: macOS: link llvmir2hll to decompiler target

* bin2llvmir/lti: fix pat filtering on windows

* retdec-decompiler: increase windows stack size

Co-authored-by: Peter Kubov <peter.kubov@avast.com>
2020-06-05 07:42:46 +02:00
JurajHolub
2183f846ae
Extension of bin2llvmir with optimization of X87 FPU stack. (#715)
* capstone2llvmir/x86: Add support of x87 FISTPP instruction and unit tests of new supported instruction.

* capstone2llvmir/x86: Add support of x87 FCMOVEcc instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add tests for x87 FPREM instructions.

* capstone2llvmir/x86: Add support of x87 F2XM1, FYL2X, FYL2xP1 instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FFREE instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FNSTCW instructions and unit test of new supported instructions.

* bin2llvmir/optimizations/x87_fpu: Add test for x87 fpu analysis and fix register indexing bug.

* bin2llvmir/optimizations/x87_fpu: Fix test for x87 fpu analysis.

* capstone2llvmir/x86.cpp: remove extra new lines

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* capstone2llvmir/x86: Fix indention of new tests + comments.

* bin2llvmir/optimizations/x87_fpu: Create tests for different calling conventions and different architectures of x86.

Tests for architectures x86-16, x86-32, x86-64.
Tests for calling conventions cdecl, pascal, fastcall, stdcall, thiscall.

* capstone2llvmir/x86: Unit tests and translation of all FPU capstone instruction to llvmir.

FBLD, FBSTP, FNCLEX, FLDCW, FLDENV, FRSTOR, FNSAVE, FNSTENV, FNSTCW, FXSAVE, FXSAVE64, FXRSTOR, FXRSTOR64, FPTAN, FPATAN, FSCALE, FXTRACT, FXAM.

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* config: Include "watcom" calling convention.

* bin2llvmir/optimizations/x87_fpu: Tests for x87 FPU analyze.

Tests for calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for functions with floating point return value (definitions and calls).

Analyzed calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Tests for FPU register stack usage with branches and loops.

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for nested blocks (branches, loops).

* bin2llvmir/optimizations/x87_fpu: Fix nested blocks analyze tests.

* bin2llvmir/optimizations/x87_fpu: Implement linear equation solver of basic block TOP tracking. Include OpenCV lib.

* bin2llvmir/optimizations/x87_fpu: FPU TOP optimization implemented for simple and nested BasicBlocks, floating-point return values of functions.

TODO: Import OpenCV library to Cmake build. Implement special calling conventions for 32bit architecture.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FNSTCW instructions and unit test of new supported instructions.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* deps/eigen: Include third party library Eigen to cmake of project. Library is used to math computation with matricies for X86 FPU analyze optimization.

* bin2llvmir/optimization/x87_fpu: Rewrite optimization with new Eigen library. Use matrix implementation of SVD from eigen library.

* tests/bin2llvmir: Refactor CMakeLists.txt

* bin2llvmir/optimization/x87_fpu: Fix bux for X86-16bit calling convention. Optimization now validate value of FPU top at the end of every terminating block and detects unsupported states.

* bin2llvmir/optimizations/x87_fpu: Fix and improve FPU stack optimization testss

* bin2llvmir/optimizations/x87_fpu: Fix major bug of overdetermined linear equation solver and minor bugs of final llvm ir generating.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FNSTCW instructions and unit test of new supported instructions.

* bin2llvmir/optimizations/x87_fpu: Add test for x87 fpu analysis and fix register indexing bug.

* bin2llvmir/optimizations/x87_fpu: Fix test for x87 fpu analysis.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* bin2llvmir/optimizations/x87_fpu: Create tests for different calling conventions and different architectures of x86.

Tests for architectures x86-16, x86-32, x86-64.
Tests for calling conventions cdecl, pascal, fastcall, stdcall, thiscall.

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* bin2llvmir/optimizations/x87_fpu: Tests for x87 FPU analyze.

Tests for calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for functions with floating point return value (definitions and calls).

Analyzed calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Tests for FPU register stack usage with branches and loops.

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for nested blocks (branches, loops).

* bin2llvmir/optimizations/x87_fpu: Fix nested blocks analyze tests.

* bin2llvmir/optimizations/x87_fpu: Implement linear equation solver of basic block TOP tracking. Include OpenCV lib.

* bin2llvmir/optimizations/x87_fpu: FPU TOP optimization implemented for simple and nested BasicBlocks, floating-point return values of functions.

TODO: Import OpenCV library to Cmake build. Implement special calling conventions for 32bit architecture.

* deps/eigen: Include third party library Eigen to cmake of project. Library is used to math computation with matricies for X86 FPU analyze optimization.

* bin2llvmir/optimization/x87_fpu: Rewrite optimization with new Eigen library. Use matrix implementation of SVD from eigen library.

* tests/bin2llvmir: Refactor CMakeLists.txt

* bin2llvmir/optimization/x87_fpu: Fix bux for X86-16bit calling convention. Optimization now validate value of FPU top at the end of every terminating block and detects unsupported states.

* bin2llvmir/optimizations/x87_fpu: Fix and improve FPU stack optimization testss

* bin2llvmir/optimizations/x87_fpu: Fix major bug of overdetermined linear equation solver and minor bugs of final llvm ir generating.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86: Add support of x87 FNSTCW instructions and unit test of new supported instructions.

* bin2llvmir/optimizations/x87_fpu: Add test for x87 fpu analysis and fix register indexing bug.

* bin2llvmir/optimizations/x87_fpu: Fix test for x87 fpu analysis.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* bin2llvmir/optimizations/x87_fpu: Create tests for different calling conventions and different architectures of x86.

Tests for architectures x86-16, x86-32, x86-64.
Tests for calling conventions cdecl, pascal, fastcall, stdcall, thiscall.

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* bin2llvmir/optimizations/x87_fpu: Tests for x87 FPU analyze.

Tests for calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for functions with floating point return value (definitions and calls).

Analyzed calling conventions:
- x86-16: cdecl, pascal, fastcall, watcom, unknown
- x86-32: cdecl, stdcall, pascal, fastcall, thiscall, watcom, unknown
- x86-64

* bin2llvmir/optimizations/x87_fpu: Tests for FPU register stack usage with branches and loops.

* bin2llvmir/optimizations/x87_fpu: Analyze of FPU stack for nested blocks (branches, loops).

* bin2llvmir/optimizations/x87_fpu: Fix nested blocks analyze tests.

* bin2llvmir/optimizations/x87_fpu: Implement linear equation solver of basic block TOP tracking. Include OpenCV lib.

* bin2llvmir/optimizations/x87_fpu: FPU TOP optimization implemented for simple and nested BasicBlocks, floating-point return values of functions.

TODO: Import OpenCV library to Cmake build. Implement special calling conventions for 32bit architecture.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* capstone2llvmir/x86: Fix bug in FXRSTOR unit etst.

* deps/eigen: Include third party library Eigen to cmake of project. Library is used to math computation with matricies for X86 FPU analyze optimization.

* bin2llvmir/optimization/x87_fpu: Rewrite optimization with new Eigen library. Use matrix implementation of SVD from eigen library.

* tests/bin2llvmir: Refactor CMakeLists.txt

* bin2llvmir/optimization/x87_fpu: Fix bux for X86-16bit calling convention. Optimization now validate value of FPU top at the end of every terminating block and detects unsupported states.

* bin2llvmir/optimizations/x87_fpu: Fix and improve FPU stack optimization testss

* bin2llvmir/optimizations/x87_fpu: Fix major bug of overdetermined linear equation solver and minor bugs of final llvm ir generating.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* bin2llvmir/optimizations/x87_fpu: Create tests for different calling conventions and different architectures of x86.

Tests for architectures x86-16, x86-32, x86-64.
Tests for calling conventions cdecl, pascal, fastcall, stdcall, thiscall.

* capstone2llvmir/x86: Add support of x87 FPREM instructions and unit test of new supported instructions.

* capstone2llvmir/x86_impl.h: remove extra newline & indent

* bin2llvmir/optimization/x87_fpu: Fix bux for X86-16bit calling convention. Optimization now validate value of FPU top at the end of every terminating block and detects unsupported states.

* bin2llvmir/optimizations/x87_fpu: Fix and improve FPU stack optimization testss

* src/capstone2llvmir/x86: Fix and remove duplicities caused by my incorrect merge commit

* src/bin2llvmir/x87_fpu: Fix bug - remove forgotten declaration.

* src/bin2llvmir/x87_fpu: Fix bug - make analyze more accurate: fix some bugs when TOP is changed but not stored etc.

* tests/bin2llvmir/optimizations/x87_fpu: Rewrite actual and include new tests - fix bugs revealed by integration tests analyze.

* src/bin2llvmir/optimizations/x87_fpu: Fix bugs revealed by integration testing and improve performance of this optimization.

* src/capstoce2llvmir/x86: Fix merge conflict.

* deps/eigen: Remove Eigen library from deps and moves it into external libs.

* tests/bin2llvmir/optimizations/x87_fpu: Remove tests to 16bit architecture because this feature has depreaced due to unacceptable performance lack.

* src/bin2llvmir/optimizations/x87_fpu: Improve and optimize performance of algorithm. Replace SVD decomposition for QR decomosition due to performance increase. Fix includes for eigen library that is now external project. Optimize matrix rank calculation.

* bin2llvmir/optimization/x87_fpu: Set max performance ceil.

* Add External Eigen to cmake/deps.

* deps/eigen: Update CMake build.

* deps/eigen: Update CMake build.

* bin2llvmir/x87_fpu: Update analyze and tests -> remove FPU TAGS because RetDec do not use them anymore.

* deps/eigen: Fix eigen INTERFACE_INCLUDE_DIRECTORIES which was prefixed in the build directory.

Co-authored-by: Peter Matula <peter.matula@avast.com>
2020-05-28 14:31:04 +02:00