Commit Graph

6113 Commits

Author SHA1 Message Date
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
Filippo Cremonese 1af425c730 Minor changes 2022-04-26 15:05:30 +02:00
Pietro Fezzardi e1c762c70a Merge feature/initial-migration-to-revng-pipeline 2022-04-26 14:44:02 +02:00
Pietro Fezzardi 4222a1c733 Add LateOptimizeForDecompilation Step 2022-04-26 14:36:22 +02:00
Pietro Fezzardi fbe4f7520c Add SegregateStackAccessesPipe 2022-04-26 14:33:05 +02:00
Pietro Fezzardi 04c8d7c8ae Add EaryOptimizeForDecompilation pipeline step 2022-04-26 14:25:29 +02:00
Pietro Fezzardi 234f9cf401 Add PromoteStackPointerPipe 2022-04-26 14:21:59 +02:00
Pietro Fezzardi 4207092c9e Add RemoveLiftingArtifacts pipeline 2022-04-26 12:20:07 +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 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 0703f6e765 CMakeLists: improve decompilation tests
- Re-use generated headers for decompilation
- Drop the 'string_based' prefix, since the string-based C decompiler
  backend is not the only decompiler backend and we don't need to
  distinguish from the other anymore.
2022-04-26 11:45:41 +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 2f0105149e Merge feature/drop-old-c-backend 2022-04-21 18:18:54 +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
Alessandro Di Federico 3cb0100976 Merge branch 'feature/string-map-container' 2022-04-21 14:46:18 +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 93852f92d4 Rename tests/Unit to tests/unit
This is more uniform with the directory structure we have in revng
2022-04-21 09:56:56 +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 03ae412f94 Remove redundant IR from .ll tests 2022-04-21 08:06:27 +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 59fbc7af4e Merge feature/string-based-decompiler 2022-04-20 17:41:00 +02:00
Pietro Fezzardi 0ff8a6933b Add StringMapContainer 2022-04-20 17:39:59 +02:00
Pietro Fezzardi d70eec060c Fix test implementation of mergeBackImpl
The previous implementation worked like `insert`, while the proper
semantics is `insert_or_assign`
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 827d5605f4 llvmIntToModelType: Handle nested pointer types 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 72461f6329 Add attributes to revng_init_local_sp() 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 8ccb2c0f3b Add void to primitive types 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
Pietro Fezzardi 7c0b464c61 Merge feature/revng-check-conventions-improvements 2022-04-20 10:16:26 +02:00
Alessandro Di Federico 58c8f96317 Merge branch 'feature/revng-check-conventions-improvements' 2022-04-20 09:57:31 +02:00
Giacomo Vercesi bbce0b33e5 revng-check-conventions: introduce isort 2022-04-20 09:57:08 +02:00
Giacomo Vercesi 46821cee5f revng-check-conventions: introduce mypy 2022-04-20 09:57:01 +02:00
Giacomo Vercesi 31a836e48c revng-check-conventions: introduce flake8 2022-04-20 09:56:44 +02:00
Giacomo Vercesi daa3388389 Add commit range option to revng-check-conventions
This commit also introduces `--HEAD` which is useful for `git rebase -x`
checks.
2022-04-20 09:56:06 +02:00
Giacomo Vercesi 8758c7fcc3 Print header for run_revng_checks 2022-04-20 09:55:41 +02:00
Giacomo Vercesi d81dc49809 revng-check-conventions: license check 2022-04-20 09:55:18 +02:00