Commit Graph

2366 Commits

Author SHA1 Message Date
Ivan Krysak 42c1461b9f Add MetaAddressType::getLLVMCPUFeatures 2022-05-06 18:51:47 +02:00
Ivan Krysak 20ccb79dd1 Add constant module tag-based filters 2022-05-06 18:51:47 +02:00
Ivan Krysak 4737efd763 Add a non-pass binary loader 2022-05-06 18:51:47 +02:00
Ivan Krysak 6ba8010507 Add a missing include 2022-05-06 18:51:47 +02:00
Ivan Krysak 2a6a7943f4 Fix a couple of minor typos 2022-05-06 18:51:47 +02:00
Pietro Fezzardi a4dae8c903 Add LoadGHASTWrapperPass 2022-05-05 14:53:30 +02:00
Alessandro Di Federico f85f08e410 SegregateStackAccesses: handle CABIFunctionType
This commit heavily reworks SegregateStackAccesses in order to have
`llvm::Function`s reflect the prototype in the model.
2022-05-03 21:48:07 +02:00
Alessandro Di Federico 92d3b95fba Model: make more things optional 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 291ed672b4 Introduce FunctionType::Layout::dump 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 83f08249d7 Introduce Layout::Argument::StackSpan::operator+ 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 9e46d4fdcc Introduce getLLVMTypeForScalar(QualifiedType) 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 0f3c29fa1b Split moveToNewFunctionType off changeFunctionType 2022-04-29 17:57:49 +02:00
Alessandro Di Federico a355a90c7e model::Binary::getPointerTo(model::QualifiedType) 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 85e031c218 FunctionType::Layout: construct from model::Type 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 4904f8cbe1 GeneratorIterator: simplify iterators 2022-04-29 17:57:49 +02:00
Massimo Fioravanti 016a9464b8 Model diff: handle UpcastablePointer correctly 2022-04-29 17:57:49 +02:00
Alessandro Di Federico e6f6010cfd Build with -fvisibility-inlines-hidden
`-fvisibility-inlines-hidden` ensures that each dynamic library uses its
own version of each `inline` function.

This reduces the number of exported symbols and resolves issues related
to picking a version of a weak symbol that has already been deleted upon
`dlclose`.

The downside of this flag is that the address of `inline` functions can
be different across different libraries. This commit drops certain
assertions that were relying on this behavior.
2022-04-29 16:40:24 +02:00
Giacomo Vercesi 168eab6cc5 Use /proc/self/maps to determine root
Use the path of the mapped librevngSupport.so to determine the root
directory.
2022-04-28 22:18:08 +02:00
Pietro Fezzardi e9470d031d Add std::map-like methods to StringMapContainer 2022-04-27 17:40:21 +02:00
Pietro Fezzardi de0398754d Add makeStringMapContainerFactory 2022-04-27 17:09:28 +02:00
Giacomo Vercesi 4445a841b2 revng-pipeline: introduce artifacts
Add a new key to a Step, named Artifacts. If present, it indicates that
the step has a "default" Kind and Container that can be easily retrieved
without explicitly specifying either when producing an artifact.
2022-04-26 15:59:35 +02:00
Giacomo Vercesi 99ae9c98e0 Add MIMEType to container
Add additional field MIMEType to Container.

This allows API consumers to know at runtime how to treat the data
within a container without any prior knowledge.
2022-04-26 15:59:35 +02:00
Giacomo Vercesi f4d63759de PipelineC: expose kinds, ranks and more
Adds missing API functions to PipelineC that will be needed by the
GraphQL API:

* Kinds enumeration
* Get Rank and parent of a Kind
* Enumerate and inspect Ranks
* Get a Step's parent

Included are some docstring fixes
2022-04-26 15:05:30 +02:00
Giacomo Vercesi 87b09fd401 PipelineC: Refactor headers
Split PipelineC.h in 4 separate header, this is due to cffi not
being able to interpret `#ifdef`s so C++ declarations need to be
in a separate file.
2022-04-26 15:05:30 +02:00
Giacomo Vercesi a831fa8e74 ContainerSet: add isContainerRegistered
This function allows to check if a container is registered,
irrespective of its initialization status
2022-04-26 15:05:30 +02:00
Filippo Cremonese 1af425c730 Minor changes 2022-04-26 15:05:30 +02:00
Pietro Fezzardi fbe4f7520c Add SegregateStackAccessesPipe 2022-04-26 14:33:05 +02:00
Pietro Fezzardi 234f9cf401 Add PromoteStackPointerPipe 2022-04-26 14:21:59 +02:00
Pietro Fezzardi 60c1f1c4ad Add RemoveLiftingArtifacts library
This library contains what were previously 6 separate libraries:
- FilterForDecompilation
- MakeEnvNull
- RemoveCpuLoopStore
- RemoveExceptionCalls
- RemoveLLVMDbgIntrinsics
- RemoveREmoveNewPCCalls

These libraries are now aggregated, and will be merged in single
llvm::Pass for migrating revng-c to the new revng pipelines
infrastructure.
2022-04-26 11:50:42 +02:00
Pietro Fezzardi 92b74b0131 Add LiftingArtifactsRemoved Tag and Kind
For now they are unused, but they will be used by the first
revng-c pipeline using revng::pipeline, that will strip off all the
artifacts left from the lifting process.
2022-04-26 11:50:42 +02:00
Pietro Fezzardi 737c8bd2e1 Drop FilterForDecompilationFunctionPass
The only user of this FunctionPass was caliban, through a public API
that is now gone. This pass is no longer needed.
2022-04-26 11:50:42 +02:00
Pietro Fezzardi 8e6af6dec1 Drop RemoveLLVMAssumeCalls
This pass was used to remove llvm.addume(false) calls that caused some
paths of the CFG to be marked as unreachable and optimized away.

The insertion of calls to `llvm.assume(false)` calls was happening due
to the handling of the PC around `opaquepc` calls, generated by `revng`.
The calls to `opaquepc` are no longer emitted by `revng`, nor is the
special handling of the PC around them that causes `llvm.assume(false)`
calls to be emitted.

Hence, the RemoveLLVMAssumeCalls pass to no longer makes sense. This
commit removes it.
2022-04-26 10:18:46 +02:00
Pietro Fezzardi a0f6fe8dd7 RestructureCFG: drop old unused NDuplicates field 2022-04-26 10:18:46 +02:00
Pietro Fezzardi b909bb6629 New MarkAssignments library in IRCanonicalization
This library replaces the old AddIRSerializationMarkers, cleaning up a
lot of historcal baggage, merging Liveness and MarkAnalysis, and
adopting a more accurate naming across all the codebase.
2022-04-21 18:13:51 +02:00
Pietro Fezzardi 14d40096b7 Rearrange Liveness and MarkForSerialization
These two parts of the code needed to be separated into libraries
because they were used both by the old C backend and by
IRCanonicalization.

Now that the old C backend is dead, they have been incorporated into
IRCanonicalization.
Further changes are necessary to strip away the last leftovers of the
old C backend from MarkAnalysis.
2022-04-21 09:51:45 +02:00
Pietro Fezzardi 8fd5b66296 Drop now unused ThreadSafeClangTooling
The only user was the old clang-based decompiler backend, which is now
gone.
2022-04-21 07:46:38 +02:00
Pietro Fezzardi c6f8a5d375 Drop old C decompiler backend 2022-04-20 18:06:26 +02:00
Pietro Fezzardi 0ff8a6933b Add StringMapContainer 2022-04-20 17:39:59 +02:00
Alvise de Faveri e875b7f1c6 Add string-based C backend 2022-04-20 17:35:05 +02:00
Alvise de Faveri 96074c7938 ModelHelpers: Make dropPointer recursive 2022-04-20 17:35:05 +02:00
Alvise de Faveri beba244641 TypeNames: add getTypeName() for QualifiedType 2022-04-20 17:35:05 +02:00
Alvise de Faveri c542f6009e GHAST: Improve constness 2022-04-20 17:35:05 +02:00
Alvise de Faveri 3fe9f687cc Move TypeMap initialization to InitModelTypes
Move the code that initializes the TypeMap in a separate library,
that will be shared between ModelGEP and the backend.
2022-04-20 17:35:05 +02:00
Alvise de Faveri 2c37f73064 Add VariableScopeAnalysis pass 2022-04-20 17:35:05 +02:00
Alvise de Faveri a3110c0b59 Add QualifiedType::is(TypeKind) 2022-04-20 11:25:46 +02:00
Giacomo Vercesi d81dc49809 revng-check-conventions: license check 2022-04-20 09:55:18 +02:00
Giacomo Vercesi ab125b35b0 Fix License headers
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
2022-04-19 12:17:59 +02:00
Ivan Krysak 66c96fb128 ABI: improve RegisterStateDeductions
Split the interface into two functions: `enforce.*` returning the map by
value and `tryApply.*` returning an `std::optional`.

Improve non-positional single deduction function to better reflect
some corner cases (for example how a required `NoOrDead` register
argument is handled).

Enforce a position-based deduction corner case where it's impossible to
deduce whether the argument is passed in the GPR or the vector one -
now GPR takes precedence in those cases.
2022-04-15 18:25:11 +02:00
Ivan Krysak c374f8013a ABI: separate mips and mipsel ABIs 2022-04-15 18:25:11 +02:00
Ivan Krysak ddd2968faa ABI: make abi::RegisterState::Map assignable 2022-04-15 18:25:11 +02:00