Commit Graph

50 Commits

Author SHA1 Message Date
Alessandro Di Federico a4f4906ba7 Lift: re-enable InstCombine upon harvesting
InstCombine was disabled in favor of some more basic constant
propagation, but it turns that under certain circumstances this leads to
direct branches appearing as indirect branches until we run InstCombine
during finalization, which triggers an assertion, since we do not expect
any direct jump there.

If this, affects translation performance, we can think to run it less
often.
2023-01-03 13:41:40 +01:00
Alessandro Di Federico 8030f1c909 finalizeNewPCMarkers: do not copy attributes 2023-01-03 13:41:40 +01:00
Massimo Fioravanti 742e1a0c56 TupleTree: switch from public fields to accessors 2022-12-12 18:36:57 +01:00
Massimo Fioravanti 0d3133cfc9 Fix missing includes
This ensures headers make sense on their own, without implicit
assumption about includers to also include other headers before them.
2022-12-09 18:09:39 +01:00
Massimo Fioravanti 9363bbd70a Pipeline: every container type has now a C++ type 2022-09-29 15:51:17 +02:00
Alessandro Di Federico 5a7c120433 Translator: stop translation if leaving +x page
If a basic block is starting in a traslated page, but it extends out of
it, stop translation.
2022-09-29 09:02:52 +02:00
Alessandro Di Federico 8cf981fbf8 JTM: no assert on indirect jump to invalid address 2022-09-22 17:43:56 +02:00
Pietro Fezzardi 12ab345848 SubGraph: make getEntryNode more const-correct
GraphTraits<SubGraph<InnerNodeType>>::getEntryNode now takes a const
GraphType &, not just a GraphType &.
2022-09-19 08:33:45 +02:00
Alessandro Di Federico 712585be48 CodeGenerator: handle PTC translation failure 2022-08-31 18:07:47 +02:00
Alessandro Di Federico cd7429d100 pipes::Lift: fail if Architecture is Invalid 2022-08-29 15:13:25 +02:00
Massimo Fioravanti 9ce7b1e527 Drop Pipe suffix from pipe names 2022-08-29 14:45:45 +02:00
Massimo Fioravanti 915c083661 Pipes: reorganize who defines pipes 2022-08-29 14:44:35 +02:00
Alessandro Di Federico 6a6cd939db Rework EarlyFunctionAnalysis 2022-08-08 13:55:34 +02:00
Alessandro Di Federico 4eb70b0e35 Reimplement exitTBCleanup 2022-08-08 13:55:25 +02:00
Alessandro Di Federico b07d134b73 Introduce CanonicalRegisterValues in the model
These canonical values ease certain analysis that can assume their value
at function entry.
2022-08-08 13:55:25 +02:00
Alessandro Di Federico 5f49437393 CodeGenerator: invoke peek post newpc creation 2022-08-03 18:35:57 +02:00
Djordje Todorovic a36e22729f Model: Add PDB support 2022-07-28 14:52:50 +02:00
Ivan Krysak 4737efd763 Add a non-pass binary loader 2022-05-06 18:51:47 +02:00
Antonio Frighetto 20cdfe668a EFA: take the control-flow graph out of the model
The control-flow graph and all its hierarchy components
have been moved from `model` to `efa`. The CFG is now
serialized onto the LLVM IR module as a metadata.
2022-04-05 15:37:57 +02:00
Antonio Frighetto dad721941e JTM: set symbol name to OriginalName in newpc 2022-04-05 15:37:57 +02:00
Antonio Frighetto 5848063b66 TupleTree: make const TupleTree& behave as such
A logic issue was addressed with improved state management.
2022-04-05 15:37:57 +02:00
Alessandro Di Federico f6c9b04c81 Adopt clang-tidy: readability-identifier-naming 2022-04-04 21:15:52 +02:00
Alessandro Di Federico 2b55d1df22 Adopt cmake-format 2022-03-17 18:52:18 +01:00
Alessandro Di Federico 7d48059800 Turn revng-lift into a script 2022-03-11 15:37:12 +01:00
Alessandro Di Federico 0793e4afcb Turn lifting into a pass 2022-03-11 15:37:12 +01:00
Alessandro Di Federico ee0b8f44c1 Introduce BinaryImporter
This is a big step to split revng-lift in two parts: one that only
writes the model and one that actually lifts to LLVM IR.

* Introduce `revng import binary`
* Split off `BinaryFile.h`
* Drop `revng.h`
* `GeneratedCodeBasicInfo`: use model
* Reduce role of `GeneratedCodeBasicInfo` in favor of
  `model::Architecture` and `model::Register` methods
* `CodeGenerator`: adopt `RawBinaryView` and model
* `JumpTargetManager`: adopt `RawBinaryView` and model
* `ExternalJumpsHandler`: adopt model
* `InstructionTranslator`: discard `Architecture` in favor of
  `EndianessMismatch`
* Many other changes
2022-03-08 15:15:24 +01:00
Alessandro Di Federico 60cce26768 Support streaming llvm::Errors to Loggers 2022-03-08 15:04:34 +01:00
Alessandro Di Federico 0a5d2c04a7 Rework LoadModelPass 2022-03-08 15:04:34 +01:00
Alessandro Di Federico a88a9e52c3 Improve model::Segment 2022-03-08 13:06:47 +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 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
Ivan Krysak 242b885a78 Remove obsolete ABI utilities 2022-02-14 13:35:37 +01:00
Ivan Krysak 68129c9221 Add model::Binary::DefaultABI field 2022-02-14 13:35:36 +01:00
Massimo Fioravanti 6f0d0c4f9d CodeGenerator: accept an external model 2022-02-07 22:24:39 +01:00
Alessandro Di Federico 0f084ed620 Minor changes 2022-02-07 16:55:46 +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 680924b643 CodeGenerator.cpp: drop some outdated assertions
Drop some outdated checks for `model::Binary::ImportedDynamicFunctions`
being sorted.
2022-01-27 11:51:03 +01:00
Filippo Cremonese fbeee896e1 Rename model::abi -> model::ABI 2022-01-10 10:31:27 +01:00
Alessandro Di Federico cfb47157b9 clang-tidy: readability-identifier-naming
This commit fixes all the non-compliance with our preliminary clang-tidy
configuration, which will be merged soon.
2022-01-07 09:18:05 +01:00
Massimo Fioravanti b8f6303101 Fix wrong usages of StringRef::data
StringRef::data() does not ensure that the string is zero terminated,
thus when printed it can contain more data than expected.

Specifically, this triggered the reported name of the registers to be
incorrect, and this manifested itself as wrong inline assembly emitted.
2022-01-05 14:47:25 +01:00
Massimo Fioravanti bdcc1d2e30 BinaryFile::BinaryFile: accept object::Binary
The constructor now accepts a llvm::object::Binary directly rather than
a path. Will be used by the revng-pipeline which will retain ownership
of the binary.
2022-01-05 14:47:25 +01:00
Alessandro Di Federico 6073133545 CodeGenerator: drop IR emission duties 2021-12-22 17:47:54 +01:00
Alessandro Di Federico 27b553f09e CodeGenerator: stop emitting .li.csv and .need.csv 2021-12-22 17:47:54 +01:00
Alessandro Di Federico 777adcbd45 model::Binary: add segments and imported libraries
Now, `scripts/revng` uses the model and we no longer need to emit
.li.csv and .need.csv.
2021-12-22 17:47:54 +01:00
Alessandro Di Federico 5a28bfedea Move SegmentInfo::generateName to BinaryFile.cpp 2021-12-22 13:47:21 +01:00
Alessandro Di Federico 57ae7613e1 Drop obsolete debug files
This commit drops the generation of `.coverage.csv` and `.bbsummary.csv`
files. No one really uses them anymore.
2021-12-22 13:47:21 +01:00
Massimo Fioravanti 9e477d0ada Make a library out of revng-lift 2021-12-22 13:47:21 +01:00