Commit Graph

1113 Commits

Author SHA1 Message Date
Alessandro Di Federico a5600a68ab TupleTree: improve support for 0-sized tuples 2021-07-21 18:22:58 +02:00
Alessandro Di Federico bf55034fa6 Support deserializing empty TupleTreeReference 2021-07-21 18:22:58 +02:00
Alessandro Di Federico fd30d3de42 Import the model's type system
This commit introduces the type system of the model along with several
various other improvements to the model and its users.

* Introduce the type system.
* Introduce possibility to tag certain fields in the model as to be
  optional during YAML serialization.
* All the `Name` fields have been replaced in favor of `CustomName` plus
  a `name` method that will use `CustomName` if available, or an
  automatically generated name otherwise.
* Make TupleTreeReferences behavior more robust: now you either need to
  have a valid pointer to `Root` and a `Path` or be default constructed
  (`nullptr` for `Root` and an empty `Path`). Any other configuration is
  invalid.
* The type system introduces `RawFunctionType`: this superseds the
  previous way in which we were specifying arguments and return
  values. Users of such information have been updated accordingly.
2021-07-21 18:22:58 +02:00
Alessandro Di Federico 0f8fa271d9 TupleTree: reduce INTROSPECTION responsibilities
This commit also introduces support for optional YAML serialization of
fields.
2021-07-21 18:19:45 +02:00
Alessandro Di Federico a546ac2a37 Introduce model::Register::getSize 2021-07-21 18:19:45 +02:00
Alessandro Di Federico 69367669d7 model::Register: enable as KOC key 2021-07-21 18:19:45 +02:00
Alessandro Di Federico 56644b8512 Move model::Register in its own file 2021-07-15 13:50:53 +02:00
Pietro Fezzardi 8fa8ca2d03 Rework getWriteableModel to return a TupleTree
The previous design returned a model::Binary &, which did not allow
users writing the model to properly initialize cross references between
different parts of the model.
2021-07-15 13:30:25 +02:00
Alessandro Di Federico b4929b431c Drop IsTupleEnd concept 2021-07-15 13:30:25 +02:00
Alessandro Di Federico 6d10581163 Whitespace and other minor changes 2021-07-15 13:30:25 +02:00
Alessandro Di Federico 952602c6db Merge branch 'feature/llvm-12' 2021-06-14 23:04:35 +02:00
Pietro Fezzardi 1047f50f62 Silence -Wvoid-pointer-to-int-cast in support.c 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 67eaaab045 JumpTargetManager: enable InstCombine(true)
This fixes the latest failing tests after upgrading to llvm-12.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi b96fbd091d Fix check-conventions with clang-format-12 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 6f7de910a6 Enable warning -Wunused-local-typedefs 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 7735879fa0 Enable warning: -Wdeprecated-enum-enum-conversion
This was disabled because it triggered errors when compiling with older
versions of llvm-12 and -Werror.
With llvm-12 this needed anymore, so we can re-enable it
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 71c79461d8 MaterializedValue: fix comparison between APInt
Comparing APInt requires them to have the same BitWidth.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi f0a6184ac0 Propagate DebugLoc on CallInst and InvokeInst
With llvm-12 thera are more stringent requirement on the propagation of
DebugLoc on CallInst and InvokeInst.
Various CallInst and InvokeInst created during lifting did not fulfill
these requirements, causing the Module to not verify() with llvm-12.

This commit fixes the problem, properly propagating the debug locations.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 544b553e5c JumpTargetManger: swap constprop with instsimplify
Constant propagation has been dropped from llvm
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 2448fec4a5 AVI: use new LVI API 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 1e5cce6654 AVI: handle new SCEVType in switch 2021-06-14 23:04:02 +02:00
Pietro Fezzardi 12364e6d63 Update BinaryFile to new llvm::object APIs
This is required to compile against llvm-12
2021-06-14 23:04:02 +02:00
Pietro Fezzardi d3d4e1ea5e JumpTargetManager.cpp: include missing header
Before the addition of this include, the file failed to compile with
llvm-12.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi 370dfdaf13 Update InlineFunction API to LLVM-12 2021-06-14 23:04:02 +02:00
Pietro Fezzardi f8d20946d8 RecursiveCoroutine: add noexcept where needed
Fix compilation error: the expression 'co_await
__promise.final_suspend()' is required to be non-throwing

This compilation error started being triggered when switching to
clang-12.
2021-06-14 23:04:02 +02:00
Alessandro Di Federico 1c403b5dd8 Merge branch 'feature/improve-model' 2021-06-09 20:25:59 +02:00
Pietro Fezzardi a7a55f974a Require TupleTreeCompatible concept on TupleTree 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 3cb6dcd163 Move IsYamlizable generic lambda in TupleTree.h 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 75bff8f29c Move CompositeScalar in YAMLTraits.h
Soon Binary.h will not be the only user.
This commit makes the same machinery usable elsewhere.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi c9b3cdd88b Fix UpcastablePointer copy/move ctor/assignment 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 4b7f383ea5 Conceptify YAMLTraits.h 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 432b75f2ba TupleTreePath.h: fix copy/move ctors/assignments 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 8557a30206 TupleTree: improve serialization 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 83a629444a Default operator== for TupleTreePath 2021-06-09 20:13:27 +02:00
Pietro Fezzardi b78d52ac3c Add TupleTreeReference::operator==, ignoring Root 2021-06-09 20:13:27 +02:00
Pietro Fezzardi 88a48015dc TupleTree.h: require IsKeyedObjectContainer
Requires IsKeyedObjectContainer in TupleTree.h wherever possible,
instead of IsContainer. This enables using std::vectors.
In this way, they will not be diffed based on the key, but on the entire
vector. This is intended.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi 0a293b5881 CallByPathVisitorWithInstance on UpcastablePointer
Add a specialization for
CallByPathVisitorWithInstance::visitContainerElement to handle cases
where the element of the container is an UpcastablePointer, that needs
to be unwrapped before visiting.

This fixes a problem causing bad TupleTree traversal with
TupleTreeReference. Specifically, CallByPathVisitorWithInstance did not
know how to visitContainerElement when the element of the container was
an UpcastablePointer. This caused the visit to always return nullptr
even when the TupleTreeReference was well-formed. This has been fixed by
adding an overload with proper concept constraint, that teaches
CallByPathVisitorWithInstance how to properly traverse
UpcastablePointers.
2021-06-09 20:13:27 +02:00
Pietro Fezzardi baeae84c65 UpcastablePointer: use std::is_void 2021-06-09 20:13:27 +02:00
Pietro Fezzardi b4395794dd KeyedObjectTraits: drop useless template parameter
The second template parameter, defaulted to void, was only used for
SFINAE with enable_if. Now that all uses of enable_if are gone replaced
by concepts, this parameter does not serve any purpose anymore.
2021-06-09 20:13:27 +02:00
Filippo Cremonese 478baf1f43 Fix use-after-free in InstructionTranslator 2021-06-09 18:42:56 +02:00
Filippo Cremonese 5004ec789e Fix multiple cppcoro issues
* Assert that the coroutine has reached its final suspension point
  when the destructor is called.
* Ensure the move assignment operator takes an rvalue reference.
* Explicitly delete the copy assignment operator.
2021-06-09 18:42:34 +02:00
Antonio Frighetto 1e68b6e665 EnforceABI: drop handleRoot
Unmaintained code has been removed.
2021-06-09 18:39:43 +02:00
Antonio Frighetto 67b6bc491b BinaryFile: always relocate addresses
Always relocating addresses allows to include symbols on
dynamically linked position independent objects as well.
2021-06-09 18:15:16 +02:00
Matteo Giordano 04c5b5c5c3 MetaAddress.cpp: fix on fields processing order
Adjusted methods `MetaAddress::toConstant()` and
`MetaAddress::fromConstant()` in processing the order of MetaAddress
field.
2021-06-09 18:14:16 +02:00
Ivan Krysak bc8c8f82d2 Prevent separation of 'main' headers into group 0
The prevention mechanism uses a dummy suffix:
'_THIS_SEQUENCE_IS_NEVER_GOING_TO_HAPPEN'.
2021-06-09 18:05:20 +02:00
Ivan Krysak 2e214bc661 Add an include category for Qt headers 2021-06-08 17:03:58 +02:00
Alessandro Di Federico b150274a1f Import overview document 2021-05-14 13:45:00 +02:00
Alessandro Di Federico 5a002a6fc9 Merge branch 'feature/various-bugfixes' 2021-05-12 18:59:56 +02:00
Alessandro Di Federico 0af0fea277 Handle R_386_32 relocations 2021-05-12 18:42:17 +02:00
Alessandro Di Federico 5878fee3e2 Make PCH::addCaseToDispatcher more efficient
Checking if a `SwitchInst` has a certain case triggers a linear search.
When we have *a lot* of jump targets this is an issue.

This commit assumes that when we add a case to a dispatcher, that case
is not already there.
2021-05-12 18:42:13 +02:00