Commit Graph

58 Commits

Author SHA1 Message Date
Ivan Krysak 76ed261375 Use revng_undefined_ instead of init_
Current `init_` prefix used to set the default values of SCVs
is very common in typical code, hence it would cause a lot of
collisions.
2025-04-17 11:19:17 +03:00
Ivan Krysak 57b5eb7f98 NameBuilder: allow different name checkers 2025-04-17 11:19:17 +03:00
Ivan Krysak 8841bc7144 Don't include model::NameBuilder from the binary 2025-02-13 13:09:50 +02:00
Pietro Fezzardi 18ec6ac53c MakeSegmentRef: use hasSegmentKeyMetadata helper 2025-01-29 15:17:15 +01:00
Pietro Fezzardi 1fb613579f Drop leftover useless files 2025-01-29 15:17:15 +01:00
Alessandro Di Federico 36edf810ef Introduce support for function pointers 2025-01-28 15:20:45 +01:00
Pietro Fezzardi 6ceca5891b MakeSegmentRef: ignore args of OpaqueExtractValue 2025-01-10 16:47:05 +01:00
Alessandro Di Federico 143c315196 Merge revng-c into revng 2024-11-21 10:50:55 +01:00
Alessandro Di Federico 8cd4ee3b59 Move Kinds.h to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 4e670ac8e6 Either link revngcSupport or revngSupport 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 2e4f4d09b9 Remaining FunctionTags have been moved to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico e239e18b0c Adopt FunctionPoolTag 2024-11-04 15:09:56 +01:00
Alessandro Di Federico 800340d6e8 IRHelpers.cpp has been moved to revng 2024-11-04 15:09:56 +01:00
Alessandro Di Federico a1889b77b3 s/(LLVMContainer &)TargetsList/\1ModuleContainer/ 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 8a5ae5f9c1 s/ExecutionContext &Ctx/ExecutionContext &EC/g 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 9c99ac33ac s/serializeToLLVMString/toLLVMString/ 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 08e1dc0f05 Drop no-op Pipe::checkPrecondition 2024-09-27 10:35:10 +02:00
Alessandro Di Federico 4653796008 Drop Pipe::print 2024-09-27 10:35:10 +02:00
Alessandro Di Federico ca99bbbb66 Adopt toString() 2024-09-26 17:51:08 +02:00
Alessandro Di Federico e1f46264f8 Ensure every pipe commits what it should 2024-09-26 17:51:07 +02:00
Alessandro Di Federico 0cb3eedd37 Do not use CallBase::getCalledFunction
Use our wrapper, which does not return nullptr if the `FunctionType`s do
not match.
2024-08-07 15:40:56 +02:00
Pietro Fezzardi a12b621832 Add CleanupIRPass 2024-06-27 17:14:28 -04:00
Ivan Krysak 94a0ad6b93 Adopt reworked model::Type 2024-06-27 11:07:01 +02:00
Ivan Krysak c2b4fb70bb Model: rename TypePath to DefinitionReference 2024-06-27 11:07:01 +02:00
Ivan Krysak 3705906074 Model: rename Type into TypeDefinition 2024-06-27 11:07:01 +02:00
Alessandro Di Federico 988af25a7d Adopt UniquedBy* FunctionTags for deduplication 2024-06-26 12:21:58 +02:00
Alessandro Di Federico e22ea4b2d8 Minor changes 2024-05-29 12:23:32 +02:00
Pietro Fezzardi 847cad3422 MakeSegmentRef: fix checks on pointer size 2024-03-19 09:44:00 +01:00
Alessandro Di Federico 308e7eccd9 MakeSegmentRef: limit strings to pointer-sized int 2024-03-01 16:11:28 +01:00
Alessandro Di Federico 0c212b66d9 Relicense to MIT 2024-02-29 17:03:36 +01:00
Alessandro Di Federico b997e24280 PromoteInitCSVToUndef: preserve link register only 2024-02-09 09:04:25 +01:00
Alessandro Di Federico f6f542769b Convert all public strings to kebab-case 2024-02-09 09:04:25 +01:00
Pietro Fezzardi 8acf6c2f94 Allow type-less Segments in the Model 2024-02-09 09:04:23 +01:00
Massimo Fioravanti 86e45461a0 Introduce pipeline execution context 2024-01-02 11:05:50 +01:00
Alessandro Di Federico 9d4cea6d7f RemoveLiftingArtifacts: update what gets purged
We used to manually purge `raise_exception_helper`, which has now been
split in `_abort` and `_unreachable`.  We want to purge the latter but
keep the former. The latter is marked as `Exceptional`, so this commit
updates the logic to purge all functions with `Exceptional` tag.

Also, due to the inability of the backend to emit globals of `struct`
type, we ban `set_PlainMetaAddress`, which is not critical for
decompiled code.
2023-12-12 10:58:58 +01:00
Pietro Fezzardi 842b5e1075 Make Segment::Type a TupleTreeReference
This is homogeneous with all other nullable references to types in the
model, such as the StackFrameType in model::Function, and others.
2023-12-05 16:56:52 +01:00
Massimo Fioravanti fdf5cf0325 Fix incorrect usage of TaggedFunctionKinds
A bug in revng allowed to use any TaggedFunctionKinds in place of any
other one. That bug has been fixed and the wrong usages in revng-c have
been updated.
2023-11-06 14:35:06 +01:00
Alessandro Di Federico cb8aa3d929 Adopt .prototype()
Also adopt `QualifiedType::getFunctionType` where appropriate in order
to unwrap typedefs.
2023-10-05 19:18:38 +02:00
Alessandro Di Federico a823db7ea7 Adopt revng::verify 2023-04-28 13:54:12 +02:00
Pietro Fezzardi 663bed90cc Avoid cstringLiteral in operands of local variable
Custom opcodes that are tagged AllocatesLocalVariable never have
arguments that should be replaced with SegmentRef or cstringLiteral.

Constant arguments or those custom opcodes are actually used to encode
another kinds of informations so they should be preserved.

This commit prevents that replacements to happen.
2023-04-06 23:32:08 +02:00
Kacper Kołodziej 2445c5e740 MakeSegmentRefPass: emit cstringLiteral
This commit changes MakeSegmentRefPass so that it's now a ModulePass and
it uses the binary to detect integer constants that represent the
address of strings.
When it detects address of constant strings, instead of injecting calls
to SegmentRef, we now inject calls to cstringLiteral, so that we can
later emit them as inline string literals in C.

In segmentRef we use integer type meaning address in memory, so we
generate segmentRef function with non-pointer type. For cstringLiteral
function we need real pointer type of operand.

Save MetaAddress, size, offset and original type for every
cstringLiteral call in metadata as we do for segmentRef calls.

For cstringLiteral "revng.cstring_literal" metadata name is used.

StringLiteralPool needs tuple of address, size, offset and type to
keep distinct string decorator functions for each string. This tuple is
represented by StringLiteralPoolKey struct.

Pipe for MakeSegmentRefPass needs to be defined explicitly, because
additional wrapper passes are required in MakeSegmentRef:

 1. LoadModelWrapperPass
 2. LoadBinaryWrapperPass

MakeSegmentRefPass requires access to RawBinaryView to detect cstring
literals in binary.

Fix printed command in MakeSegmentRefPipe

This printed command might not work. @ale commented it will be replaced
with `revng pipe run-pipe` once we will have it.

Update IRHelpers to new revng API

Switch String and Namespace arguments in getUniqueString
2023-04-04 09:31:10 +02:00
Ivan Krysak c2f0fc19e5 ABI: FunctionType.h -> FunctionType/Layout.h 2023-03-15 10:28:24 +01:00
Alessandro Di Federico f6cdd8ad6d s/revng.register/revng.abi_register/ 2023-03-13 13:42:33 +01:00
Alessandro Di Federico deddd8ebd1 PromoteInitCSVToUndef: only preserved registers
Do not promote registers to `undef` initializers of registers not marked
as being preserved by the current function.

This is useful to highlight usages of registers that are not an
argument, nor a callee saved register. Mainly this has been introduced
to preserved reads from x86-64 `fs` register.
2023-02-21 16:48:35 +01:00
Alessandro Di Federico dfb18bd1cf RemoveLiftingArtifacts: drop makeInitRegsUndef
Redundant w.r.t. PromoteInitCSVToUndef.
2023-02-21 16:48:35 +01:00
Pietro Fezzardi 66434db5f9 Don't use named metadata revng.segment_ref
Using a named metadata is simply wrong, because we need to have many of
these metadata alive at the same time with different values.
Using a named metadata has the unpleasant side effect of making all the
`SegmentRef` functions to refer to the same segment.
2023-02-07 18:03:34 +01:00
Kacper Kołodziej 5b94a5a649 HelpersToHeaders: skip unnecessary helpers 2023-02-07 17:43:05 +01:00
Massimo Fioravanti 87aef3fbad revng-c now uses Model accessors 2022-12-12 11:35:52 +01:00
Massimo Fioravanti 5d730d1411 Upgrade to support starless revng 2022-10-20 16:06:13 +02:00
Alessandro Di Federico c14677b162 RemoveLiftingArtifacts: do not fail, if env is absent 2022-09-26 17:02:38 +02:00