Ivan Krysak
033ccbe51a
Adopt FunctionType::Layout to improve CABI support
2022-11-30 18:16:13 +01:00
Ivan Krysak
654afbef0c
Move pointer creation away from model::Binary
2022-11-30 18:16:13 +01:00
Massimo Fioravanti
a057ce54a7
Avoids missing outputs when empty
...
FileContainer should not be used when we wish to produce a empty output
file rather than no file at all.
2022-11-22 15:21:03 +01:00
Massimo Fioravanti
335d402245
Change signatures to forward metadata cache.
2022-11-22 12:27:02 +01:00
Pietro Fezzardi
e72a578743
Refactor PTML generation for local variables
2022-11-16 11:24:37 +01:00
Pietro Fezzardi
a23d4f8dcf
Ranks.h: simplify ranks, delete unnecessary ranks
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
7ab10df8f9
Remove useless location definitions for arguments
...
The actual ptml::attributes::LocationDefinition for arguments is already
generated when emitting the prototype of the functions.
The removed calls were just serializing the location definition once
more and disposing of it without serializing it anywhere.
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
ff631c5364
PTMLC.h: switch to string-based return values
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
c93392fa3b
Refactor PTML generation for helpers
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
e1ded3a479
HelpersToHeader: refactor PTML Tags
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
690056a4a6
DecompileFunction.cpp: refactor PTML Tags
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
2ec8b7e32c
ModelToHeader: refactor creation of PTML Tags
2022-11-15 15:54:20 +01:00
Pietro Fezzardi
4b4531027b
DecompileFunction.cpp: support PoisonValue
2022-11-10 13:05:51 +01:00
Pietro Fezzardi
0f8c07e71a
DecompileFunction.cpp: fix typedef traversal
...
Before this commit, to emit field member accesses and array accesses in
C we performed a broken traversal of typedefs.
It was buggy since its inception but it was never triggered because no
typedefs actually reached this point.
This commit fixes that using the reworked peelConstAndTypedefs
machinery.
2022-11-09 12:02:26 +01:00
Pietro Fezzardi
25119c4377
Drop bugged addPointerQualifier for getPointerTo
...
This commit removes the bugged addPointerQualifier helper function,
that was wrongly pushing the pointer qualifier at the end.
Instead, we now use the correct model::Binary::getPointerTo method.
2022-10-21 09:45:28 +02:00
Giacomo Vercesi
72050274e2
getNamedCInstance: drop declaration parameter
...
In all cases this is false
2022-10-11 17:36:29 +02:00
Giacomo Vercesi
e53033d0b8
Ranks: remove use of TypeField in locations
...
Use the new Ranks made available by revng
2022-10-11 17:36:29 +02:00
Massimo Fioravanti
fd66c32727
Add Container type registry
2022-10-03 14:26:06 +02:00
Massimo Fioravanti
f1852166ab
Pipeline: reworked cpp container types
2022-10-03 14:26:06 +02:00
Alessandro Di Federico
e430891ef6
CCodeGenerator: do not generate %name
...
In certain code paths, CCodeGenerator would trigger the emission of
`%[number]`, which is very expensive since it requires to assign an ID
to a large amount of `llvm::Value`.
This commit ensure this doesn't happen, unless a logger is active.
2022-09-27 11:47:26 +02:00
Giacomo Vercesi
8e996d2394
Output PTML in revng-c
...
Change the output of the backend of revng-c to PTML
2022-09-01 16:59:29 +02:00
Massimo Fioravanti
14d4d4e11a
Rename pipes contained in namespace pipes
2022-08-25 18:17:46 +02:00
Massimo Fioravanti
370b081c0e
Moved kinds to kinds namespace
2022-08-25 17:09:15 +02:00
Antonio Frighetto
19d7f8b2c9
Late decompilation: support model::Segment
...
Backend and InitModelTypes now handle the opaque `segmentRef` marker.
2022-07-19 13:53:21 +02:00
Alvise de Faveri
557b43d525
Never include RecursiveCoroutine-coroutine.h
2022-07-15 17:17:04 +02:00
Alvise de Faveri
cbeb006e11
Backend: Check that AddressOf is never a cast
2022-07-15 17:17:04 +02:00
Alvise de Faveri
c2481aeb7b
Support: Add deserializeFromLLVMString
...
Instead of having `paseQualifiedType` and `parseAndDeserialize`,
we now have a single function that is symmetric to
`serializeToLLVMString`.
2022-07-15 17:17:04 +02:00
Giacomo Vercesi
1f69e58af8
DecompileFunction: Add indentation to C code
...
Add proper indentation to the generated C code with the use of
mlir::raw_indented_ostream
2022-06-28 11:26:41 +02:00
Alvise de Faveri
2ffa537605
IRCanonicalization: Add Copy()
...
Use the `Copy` opcode to substitute load instructiobs.
2022-06-28 10:28:38 +02:00
Pietro Fezzardi
d9d9294fe5
MarkAssignment: fix taint set and aggregate types
2022-06-28 10:28:08 +02:00
Alvise de Faveri
6b258c83a1
IRCanonicalization: Fold ModelGEP(AddressOf())
...
- `FoldModelGEP` folds `ModelGEP(AddressOf())` into `ModelGEPRef`
- `RemoveRefDeref` remove `ModelGEPRef`s with no arguments
2022-06-28 10:26:50 +02:00
Alvise de Faveri
123a1777cd
IRCanonicalization: Add RemoveLoadStore pass
2022-06-28 10:25:49 +02:00
Alvise de Faveri
f7866ddd85
IRCanonicalization: Add MakeLocalVariables pass
2022-06-28 10:24:48 +02:00
Alvise de Faveri
da46b38644
Backend: Various improvements to variables declaration
2022-06-28 10:24:18 +02:00
Alvise de Faveri
a31fd8587d
AssignmentMarker: Handle variables scoping
...
If we find values to be used outside their scope, we need to always
mark them for assignment, so that they have a dedicated variable that
is declared in the right scope. To do this we:
1. Export the logic that decides if a value needs a top-scope variable
in a public header, to be used by both `VariableScopeAnalysis` and
`MarkAssignments`.
2. Add the `HasUsesOutsideBB` reason for assignment markers
2022-06-28 10:13:07 +02:00
Alvise de Faveri
de334a92e9
Backend: Make IntToPtr and PtrToInt transparent
2022-06-28 10:12:22 +02:00
Alvise de Faveri
66c243c46d
Backend: Don't emit "undef" when logging
...
Since the InlineLogger is emitted inside a `/* */` comment, we should
not emit the undef comment there.
2022-06-23 11:23:34 +02:00
Antonio Frighetto
97e79783ae
Backend: handle Parentheses and ModelCast markers
...
`DecompileFunction` now handles the opaque `parentheses` and
`ModelCast` markers as part of beautifying the decompiled code
with proper parenthesized expressions. Should OPRP not be enabled,
we fallback to the case in which parentheses are always emitted.
2022-06-15 10:28:50 +02:00
Pietro Fezzardi
ad81bc7020
Enable addtional compilation warnings
...
These warnings are not enabled by default with -Wall nor with -Wextra.
2022-06-14 12:48:54 +02:00
Alvise de Faveri
b13286cf04
Backend: Fix buildCastExpr() conditions
2022-06-13 15:20:57 +02:00
Alvise de Faveri
c65b172af6
Backend: Emit '\n' after while loops
2022-06-13 15:18:22 +02:00
Alvise de Faveri
fe09f519f7
Backend: Fix callee parentheses in indirect calls
2022-06-13 15:16:51 +02:00
Alvise de Faveri
91f9a17e4a
Backend: Add cast to return value
2022-06-01 11:37:25 +02:00
Alvise de Faveri
dd6ef1d4a8
Backend: Improve parenthesis
2022-06-01 11:35:50 +02:00
Alvise de Faveri
06d72f1cd9
Backend: Improve logging
2022-06-01 11:34:18 +02:00
Alvise de Faveri
51df8ad64d
Backend: Fix select emission
2022-06-01 11:29:09 +02:00
Pietro Fezzardi
18b9e481c8
Backend: fix emission of integer constants
...
Before this commit we were using a suboptimal API that often resulted in
expressions with many zeros for the 0 constant, e.g. 0000000 instead of
just 0.
This commit fixes the problem.
2022-05-31 12:40:52 +02:00
Pietro Fezzardi
229648a6cb
Backend: fix casts in assignments expressions
...
Before this commit source and destination types were swapped.
2022-05-31 12:40:52 +02:00
Pietro Fezzardi
4ed636cbba
Support emission in C of null pointers
2022-05-31 12:40:52 +02:00
Pietro Fezzardi
35e0e688d2
Support emission in C of integer or pointers undef
2022-05-31 12:40:52 +02:00