Commit Graph

465 Commits

Author SHA1 Message Date
Alessandro Di Federico 8d22c5205f Push CustomName to model::Type
Before this commit `CustomName` was in each inheritor, except for
`model::PrimitiveType`.
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
Alessandro Di Federico b31e7b1f5e Introduce model::Type::edges()
This makes building a graph for the type system very easy.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 80ed065206 model::Type: move makeTypeWithID to .cpp
It needs to see the full declaration of all concrete types.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 92ea78b0a8 Fix ReservedKeywords list
Commas were missing.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico c9d47d4ee7 Drop model::EnumEntry::Aliases
They turn out to be problematic to handle in the model and not very
usable in practice.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 1ce1f1cbd6 model::Function::verify: relax assumptions
Now `model::Function` can miss the CFG, the `Prototype` and have
`Invalid` type.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 3799f1e973 Whitespace and other minor changes 2022-01-25 21:27:05 +01:00
Alessandro Di Federico 3ab32cd2ef tuple_tree_generator: make fully standalone 2022-01-21 18:05:51 +01:00
Massimo Fioravanti 70ec456078 Introduce revng-pipeline 2022-01-17 18:17:54 +01:00
Massimo Fioravanti afbebaf531 ProgramRunner: fix misuse of executable path
ProgramRunner was using garbage data instead of correctly using the path
to the current executable directory.
2022-01-17 18:17:54 +01:00
Massimo Fioravanti 6421aeed3e Support: depend on generated model headers
renvg.h should not use model headers, however, currently it does. This,
combined with the fact that the revngSupport library did not depend on
revngModel or the header generation led to non-deterministic build
failures.

Before this commit the bug can be found by:

    orc clean revng
    orc uninstall revng
    orc configure revng
    orc shell -c revng ninja renvgSupport

The error should manifest itself as some generated headers missing.

The proper fix would be to rewrite revng.h so that it does not uses the
model.
2022-01-17 18:17:45 +01:00
Alessandro Di Federico d19879d4e8 Minor changes 2022-01-17 16:30:42 +01:00
Filippo Cremonese 74217b4fe5 Generate C++ model from YAML definition
Model classes are now described by a YAML document, which is used to
generate C++ headers containing classes and all the boilerplate
required for YAML serialization/deserialization, usage in
SortedVectors, etc. See the README in include/revng/Model for more
info.
2022-01-13 14:34:11 +01:00
Filippo Cremonese fbeee896e1 Rename model::abi -> model::ABI 2022-01-10 10:31:27 +01:00
Alessandro Di Federico 546efa345a More verbose model verification failures 2022-01-09 19:00:57 +01:00
Alessandro Di Federico 7d4ef44cb7 DwarfImporter: ignore 0-sized arrays 2022-01-09 19:00:57 +01:00
Alessandro Di Federico 441a5552b7 ProgramRunner: do not depend on main
`main` is not in all cases a dynamically exported symbol, therefore,
it's not safe to rely on it.

This commit switches to use `PathList`'s `getCurrentExecutableFullPath`,
which reads `/proc/self/exe`.
2022-01-09 19:00:57 +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
Massimo Fioravanti fdfeb2b6e9 LoadModelPass: support for external model 2022-01-05 14:45:01 +01:00
Massimo Fioravanti 79d5ca1e27 Introduce FunctionTags::IsolatedRoot
This will be used by the revng-pipeline to tell apart a `root` calling
isolated functions from a regular one.
2022-01-05 14:45:01 +01:00
Massimo Fioravanti 80c3121c29 Introduce ProgramRunner
The ProgramRunner will be used by revng-pipeline to invoke the external
linker to operate on object file stored on disk.
2022-01-05 14:45:01 +01:00
Pietro Fezzardi b689f7f0c0 lib/Model/Type.cpp: add global using llvm::Twine
This using was defined many times with local scope.
This commit makes it global.
2022-01-05 14:37:37 +01:00
Pietro Fezzardi 94c1c5323a Improve error reporting for model::UnionType 2022-01-05 14:37:37 +01:00
Pietro Fezzardi 09dd05c975 UnionTypes with zero-sized fields don't verify 2022-01-05 14:37:37 +01:00
Pietro Fezzardi a4c9d6c6fd Allow model::StructType with no fields
This is necessary for how we represent the type of the stack frames when
we know about its size but not yet about its fields.
2022-01-05 13:33:52 +01:00
Pietro Fezzardi 275959618f TupleTree: make Root a std::variant<T *, const T*>
This enables holding TupleTreeReferences to immutable model objects
2022-01-05 13:33:52 +01:00
Alessandro Di Federico 8c0b918ace s/DebugHelper.*/IRAnnotators.*/ 2021-12-22 17:47:54 +01:00
Alessandro Di Federico 88dbc39f29 Reorganize LLVM IR debug annotations emission 2021-12-22 17:47:54 +01:00
Alessandro Di Federico 6073133545 CodeGenerator: drop IR emission duties 2021-12-22 17:47:54 +01:00
Alessandro Di Federico f97f8a880c Drop extra assertions related to debug info 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
Alessandro Di Federico 65e8923fcc GCBI::getSuccessors: relax assertion 2021-12-22 13:40:47 +01:00
Alessandro Di Federico 7c050ee377 mv include/revng/{TypeShrinking,MFP}/SetLattices.h 2021-12-17 18:51:06 +01:00
Alessandro Di Federico 3e1e69e08f Introduce eraseFromParent 2021-12-17 18:50:08 +01:00
Alessandro Di Federico 4b6a557a19 Fix key issues in -promote-csv
The following bugs have been fixed:

* PromoteCSV no longer mixes `alloca` with other instructions, which is
  a convention in LLVM IR that some passes rely upon.
* Before this commit, we were detecting if *calls to CSV initializers*
  where already present in order to reuse them, but this was not right,
  we need to reuse the *alloca* instructions they are associated
  with. This commit does exaclty that.
2021-12-17 18:49:51 +01:00
Alessandro Di Federico a2364bc6a0 GeneratedCodeBasicInfo: parse root lazily
This commit makes sure that GeneratedCodeBasicInfo can be used even in
absence of the `root`.

This also ensure that no time is wasted on brief/focused pipelines that
do not care about analyzing each basic block in the `root` function.
2021-12-17 18:49:42 +01:00
Alessandro Di Federico 04633a21ca Tag call sites with CallToLifted 2021-12-17 18:49:26 +01:00
Alessandro Di Federico 09914e56cf model::Type::dump: upcast 2021-12-17 18:48:52 +01:00
Alessandro Di Federico ca899c96f5 Debug output: pad before ] 2021-12-17 18:48:44 +01:00
Alessandro Di Federico 9a60a5fd82 Expand IRHelpers
* New `getCallTo` overloads accepting `Function *`
* `setInsertPointToFirstNonAlloca`
* Various additional helpers for Load/StoreInst
* `changeFunctionType`
2021-12-17 18:48:36 +01:00
Alessandro Di Federico 1dbe474873 Whitespace fixes 2021-12-16 11:56:06 +01:00
Antonio Frighetto 10f45c593a Move StackAnalysis to EarlyFunctionAnalysis 2021-12-15 18:03:30 +01:00
Antonio Frighetto ffd5ac7f57 Drop old StackAnalysis 2021-12-15 18:03:30 +01:00