Commit Graph

3168 Commits

Author SHA1 Message Date
Giacomo Vercesi 24c51f385a CMake: generate model.ts 2022-05-09 13:37:58 +02:00
Ivan Krysak 282b4e238d Add yield-assembly pipeline 2022-05-06 18:51:47 +02:00
Ivan Krysak cf3845b78d Add a way to output assembly as plain text 2022-05-06 18:51:47 +02:00
Ivan Krysak 1adc74e660 Import an assembly to html converter from caliban 2022-05-06 18:51:47 +02:00
Ivan Krysak 6e81dbe06c Add a disassembly helper 2022-05-06 18:51:47 +02:00
Ivan Krysak 36c63c1bb9 Implement the disassembler interface 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 2a6a7943f4 Fix a couple of minor typos 2022-05-06 18:51:47 +02:00
Alessandro Di Federico 1764f6120c EFA: update Block.End when appropriate
This change handles the situation in which getLastPC returns an invalid
MetaAddress. This is a new behavior introduces to handle queries on
`llvm::BasicBlock`s whose last PC is ambiguous.
2022-05-06 16:04:22 +02:00
Alessandro Di Federico 9fcdc3393a getLastNewPC: return nullptr when ambiguous 2022-05-06 16:04:22 +02:00
Pietro Fezzardi a4dae8c903 Add LoadGHASTWrapperPass 2022-05-05 14:53:30 +02:00
Alessandro Di Federico 2e434dbd7e DLA: relax handling of stack arguments
This commit improves how DLA commits its results into
`model::RawFunctionType::StackArgumentsType`.
2022-05-03 21:48:07 +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 3c2a7dd5f2 EnforceABI: in case of no prototype, use default 2022-04-29 17:57:49 +02:00
Alessandro Di Federico a4d7e78856 Stop registering Invalid model::Functions 2022-04-29 17:57:49 +02:00
Alessandro Di Federico 305a6ba69c Isolate: use Attribute::NullPointerIsValid
This enables us to handle memory accesses at nullptr.
2022-04-29 17:57:49 +02:00
Alessandro Di Federico 0e907021e3 EnforceABI: preserve metadata
This is particularly useful for preserving `FunctionTag`s.
2022-04-29 17:57:49 +02:00
Alessandro Di Federico 2e933cde6b Dynamic functions: use OriginalName
`OriginalName` is the key.
2022-04-29 17:57:49 +02:00
Alessandro Di Federico 0f3c29fa1b Split moveToNewFunctionType off changeFunctionType 2022-04-29 17:57:49 +02:00
Pietro Fezzardi 0b64b58e84 Unify recompilation tests
Before this commit we were using xargs to speed-up recompilation tests,
which kinda sucked because:
- it spawned a lot of processes, one for each file to recompile
- the runtime of each test was dominated by parsing the headers, that
  were included over and over again in each C file

Now we collapse all the C files together, which gives us 2 benefits:
- we only spawn a single process for each recompilation test, meaning
  that cmake can do a better job at parallelizing without starving
  others
- the headers are included and parsed only once, speeding up the
  compilation further
2022-04-29 15:04:27 +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
Giacomo Vercesi 91067a8886 getCurrentExecutableFullPath: assert on error
`getCurrentExecutableFullPath` now aborts if it cannot determine the
real path instead of returning an empty string.
2022-04-28 22:10:14 +02:00
Giacomo Vercesi d109a68bc4 Remove BUILD_PATH
It has not been relevant for a long time.
2022-04-28 22:10:02 +02:00
Pietro Fezzardi da44302bba Fix StringMapContainer::remove on isAll target
Before this commit, the container did not properly remove everything
when removing a wildcard * target.
2022-04-27 17:08:13 +02:00
Pietro Fezzardi 2c9829f042 Backend: skip dumpToString call when Loggers off
This brings a huge speedup to the new decompiler backend.
2022-04-26 18:12:08 +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 b90773b642 Move librevngRecompile to analyses 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 1bab3d8137 PipelineC: fix returning reference to local
'PathComponents` was copied on the stack by the assignment and then a
pointer to it is returned by `c_str`, leading to a use-after-free since
it is freed when going out of scope
2022-04-26 15:05:30 +02:00
Filippo Cremonese 19ff90e499 PipelineC: fix off-by-! in LoadLibraryPermanently 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 350af8abc7 Add RemoveLiftingArtifacts Pass
This pass integrates all the other passes that were previously part of
the RemoveLifingArtifacts library.
2022-04-26 11:50:42 +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 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 55a23079da DecompileFunction: fix switch state variables 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 d95b08df98 Drop old clang-specific SerializationReason
Over time, SerializationReason had accumlated a bunch of values that
were designed to work around the limitation of the clang-based C
decompiler backend.

Now that the clang-based C decompiler backend is gone, these workarounds
can be removed.
2022-04-21 10:19:06 +02:00
Pietro Fezzardi 54045334b6 Better encapsulate LivenessAnalysis 2022-04-21 10:14:19 +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 65c3460be1 Fix coding conventions 2022-04-20 18:06:53 +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