Commit Graph

465 Commits

Author SHA1 Message Date
Alessandro Di Federico 8570923d64 Introduce model::Relocation 2022-03-08 12:25:59 +01:00
Alessandro Di Federico 39ace7dc56 mv revng{DwarfImporter,ModelImporterDwarf} 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 1cd17a13e8 readFromPointer: use bool IsLittleEndian 2022-03-08 12:25:47 +01:00
Alessandro Di Federico 0589697dca CMake: sort headers for tuple_tree_generator 2022-03-08 12:25:35 +01:00
Alessandro Di Federico 7c515ff997 Use std::string for MaterializedValue::SymbolName 2022-03-08 12:25:35 +01:00
Alessandro Di Federico c1ed018786 Fix a revng_assert meant to be a revng_abort 2022-03-08 12:25:22 +01:00
Alvise de Faveri 0659e6b6a3 Model: Improve getCallSitePrototype() helper
1. Hoist the logic to retrieve a model CallEdge from an llvm::CallInst
   out of `getCallSitePrototype()`, in a separate `getCallEdge()`
   function.
2. Modify `getCallSitePrototype()` so that the parent function's type is
   optional.
2022-03-02 15:40:27 +01:00
Massimo Fioravanti b982b69c5d revng-model-inject: support model-less modules
Inject is meant to inject a model into an `llvm::Module`, but it fails
when operating on a Module that had no model metadata.

This commit fixes the bug.
2022-03-02 15:40:27 +01:00
Ivan Krysak bc0e6d1392 ABI: preliminary FinalStackOffset computation 2022-02-25 00:32:24 +01:00
Ivan Krysak 2c35fc87d5 Conversion to RawFunctionType cannot fail 2022-02-25 00:31:14 +01:00
Ivan Krysak 11989b316b Ensure model is untouched RawToCABI
It's now guaranteed to leave the model unmodified if the converstion
from `RawFunctionType` to `CABIFunctionType` fails.
2022-02-25 00:30:51 +01:00
Ivan Krysak d811321538 InvokeIsolatedFunctions: adopt Layout 2022-02-25 00:30:38 +01:00
Ivan Krysak f30ed88eb5 EnforceABI: adopt FunctionType::Layout 2022-02-25 00:30:27 +01:00
Ivan Krysak b14fee7515 Implement abi::FunctionType::layout()
The `Layout` data structure works as a common view over
`RawFunctionType` and `CABIFunctionType`.
2022-02-25 00:30:14 +01:00
Ivan Krysak 541643afc3 Move function type conversion to librevngABI 2022-02-24 23:56:30 +01:00
Filippo Cremonese 09a995ba51 python-model: generate from jsonschema 2022-02-23 18:03:35 +01:00
Alessandro Di Federico b7f5884f8c DynamicFunction::name: no OriginalName direct use 2022-02-14 17:54:32 +01:00
Ivan Krysak 242b885a78 Remove obsolete ABI utilities 2022-02-14 13:35:37 +01:00
Ivan Krysak 371f5c4555 Implement ABI-based register state deductions
This will help EarlyFunctionAnalysis in providing more accurate results,
in case assumptions about the ABI can be made.
2022-02-14 13:35:37 +01:00
Ivan Krysak 9771ae29d6 Move RegisterState to ABI 2022-02-14 13:35:37 +01:00
Ivan Krysak cafe44097b ABI: introduce default function type generation 2022-02-14 13:35:37 +01:00
Ivan Krysak 8d876b0def ABI: introduce bulk function conversion 2022-02-14 13:35:37 +01:00
Ivan Krysak e20e65ca9a Require a description when registering a pass 2022-02-14 13:35:36 +01:00
Ivan Krysak 7369e49eba Implement "best effort" function type convertion 2022-02-14 13:35:36 +01:00
Ivan Krysak 68129c9221 Add model::Binary::DefaultABI field 2022-02-14 13:35:36 +01:00
Ivan Krysak bac670a38a monotone_framework_lattice: move generation notice
It made it look like the template was autogenerated.
2022-02-14 10:57:20 +01:00
Alessandro Di Federico ec6d4dbe74 Ensure all files end with a newline 2022-02-14 10:56:15 +01:00
Alvise de Faveri 7593d4da23 PromoteCSVs: promote PC CSVs 2022-02-12 12:04:14 +01:00
Alvise de Faveri 812b73f2a2 Remove opaquepc()
We can set the PC to the expected value after each call instead
of creating an `opaquepc()` call.
2022-02-11 13:42:29 +01:00
Alessandro Di Federico e80d159944 revng-pipline: simplify Kinds.h 2022-02-08 17:44:33 +01:00
Alessandro Di Federico fa8061b805 Drop dead Kinds 2022-02-08 17:44:19 +01:00
Pietro Fezzardi 29c50fa909 Model: reserve names defined in stdint.h
This commit adds a bunch of type names and macro names to the set of
reserved keywords that cannot be used for names in the revng Model.
These are the names defined in the stdint.h standard C header, that is
included automatically by the decompiler in decompiled code.

We need to reserve these names otherwise it would be possible to add
things to the revng Model with names that clash with the names defined
in stdint.h, which would in turn break recompilation of decompiled code
because of conflicting definitions.
2022-02-08 15:54:02 +01:00
Massimo Fioravanti fe9686be03 revng-pipeline: introduce C API 2022-02-08 00:05:03 +01:00
Massimo Fioravanti a8a8da3bae Introduce revng pipes
This commit imports all the revng pipes (and other support utilities) to
be used with `revng-pipeline`. In particular, the pipes necessary for
binary translations have been introduced.
2022-02-08 00:05:03 +01:00
Massimo Fioravanti 6f0d0c4f9d CodeGenerator: accept an external model 2022-02-07 22:24:39 +01:00
Massimo Fioravanti 98ecd38162 Drop PureLLVMPipe
Now LLVM passes can be used directly in an LLVMPipe without specifying a
contract for it.
2022-02-07 22:24:39 +01:00
Alessandro Di Federico fec5f3537b s/Granularity/Rank/ 2022-02-07 22:24:39 +01:00
Alessandro Di Federico e2cd7cbcdf Pipeline: simplify LLVMContainer 2022-02-07 20:11:37 +01:00
Massimo Fioravanti 396095706f Minor changes to revngPipeline 2022-02-07 20:11:15 +01:00
Alessandro Di Federico 0f084ed620 Minor changes 2022-02-07 16:55:46 +01:00
Alessandro Di Federico 280848484e SerializeModelPass: verify model 2022-01-31 16:28:17 +01:00
Alessandro Di Federico a353e00ac1 Introduce model passes 2022-01-31 16:28:14 +01:00
Alessandro Di Federico b3d6c721ad Introduce purgeUnnamedAndUnreachableTypes 2022-01-27 11:51:03 +01:00
Alessandro Di Federico f14e722c86 Introduce deduplicateEquivalentTypes 2022-01-27 11:51:03 +01:00
Alessandro Di Federico d0bb3d4c2c CodeGenerator.cpp: use OriginalName for symbols 2022-01-27 11:51:03 +01:00
Alessandro Di Federico 445066bd0a CodeGenerator.cpp: posticipate DWARF import
This way we apply the optimization passes.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 2d08050220 DwarfImporter: adopt OriginalName 2022-01-27 11:51:03 +01:00
Alessandro Di Federico dd7477664c Update CustomName verification criteria
This commit ensures `CustomName` is unambiguous according to C symbols
rules.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 74a7496020 deduplicateNames -> promoteOriginalName
This commit switches from `deduplicateNames`, which changed certain
`CustomName` values, to `promoteOriginalName`, which updates empty
`CustomName` using non-ambiguous versions of `OriginalName`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 863652f480 Introduce OriginalName in the type system
The goal of `OriginalName` is to keep track of the original name of a
symbol upon import.

In future, this will also be used to promote it to `CustomName`.
2022-01-27 11:51:03 +01:00