Commit Graph

22 Commits

Author SHA1 Message Date
Pietro Fezzardi 197219673f STS: drop dependency from LVB in non-legacy mode
After we drop legacy mode, the only user of LocalVariableBuilder will be
SegregateStackAccesses. This is possible thanks to the fact that
dropping the legacy mode will demistify local variables and turn them
into plain allocas accessed via loads/stores. This will end the need for
a centralized place to deal with local variable creation, that is caused
by the various ad-hoc manipulations we've been doing for a long time in
legacy mode.
2026-06-03 16:33:15 +02:00
Pietro Fezzardi bbb713f548 LegacyStackAllocators: only depend on input intptr 2026-06-03 16:33:15 +02:00
Pietro Fezzardi da3ee051b9 Turn revng.stack_type into revng.stack_frame
The new named metadata doesn't embed the type of the stack anymore.
It's just a marker of the alloca that represents the stack frame.
2026-05-08 17:30:04 +02:00
Pietro Fezzardi 8ee6edfd15 Restructure LocalVariableBuilder
Reorganise LocalVariableBuilder so that the legacy and non-legacy
code paths are separated into two specialisations, and so that the
non-legacy specialisation does not need a model::Binary to operate.

This is a prerequisite for using LocalVariableBuilder from passes
that do not know about the model, e.g. unit tests for the new-PM
SwitchToStatements and the upcoming non-legacy decompilation
pipeline.
2026-05-08 11:37:09 +02:00
Pietro Fezzardi 24ed2597e2 LVB: don't emit !revng.variable_type metadata
createLocalVariable no longer attaches the !revng.variable_type
metadata to the alloca. The model variable type can be reconstructed
from the array-typed alloca alone, so the metadata is redundant. The
metadata itself will be dropped from the codebase in a follow-up
commit.
2026-05-08 11:37:09 +02:00
Pietro Fezzardi 513b51e82d LVB: use NonDebugInfoCheckingIRBuilder
Switch the IRBuilder used by createCallStackArgumentVariable and
createStackFrameVariable to revng::NonDebugInfoCheckingIRBuilder, in
line with the rest of the LocalVariableBuilder code paths. There is
no functional change for builds that already attach debug info, just
a stricter check on builds where it is unexpectedly missing.
2026-05-08 11:37:09 +02:00
Ivan Krysak f0e00d66ab Do not use doxygen for TODOs 2026-02-25 12:47:27 +01:00
Ivan Krysak 22fe32afa2 Minor improvements 2026-02-25 12:47:27 +01:00
Lauri Vasama aa2597d13b model::Function: add stack frame name and comment
* StackFrameType() is removed.
* StackFrame() is introduced in its place.
* Use StackFrame().Type() to acess the stack frame type.
2026-02-13 08:41:39 +02:00
Alessandro Di Federico 0bf97a9e68 getPointerSizedInteger: use model::Architecture
No need to get model::Binary.
2025-12-22 11:34:47 +01:00
Alessandro Di Federico f281a12088 LocalVariableBuilder: less debug info checks 2025-12-03 17:59:19 +01:00
Ivan Krysak 5b419540cc Disable IRBuilder checks in some additional places 2025-10-31 09:04:59 +01:00
Alessandro Di Federico f8bd4c3bac Move around some files in preparation for libtcg
* Make the following private headers public:
  * Lift/CPUStateAccessAnalysisPass.h
  * Lift/CSVOffsets.h
  * Lift/PTCDump.h
  * Lift/VariableManager.h
* Move from revngSupport to revngLift:
  * IRAnnotators.{h,cpp}
  * SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
  * FunctionTags.{h,cpp}
  * ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
  * OriginalAssemblyAnnotationWriter.{h,cpp}
2025-10-24 15:34:11 +02:00
Ivan Krysak 0392f94406 LocalVariableBuilder: improve debug info handling 2025-10-21 19:17:11 +03:00
Ivan Krysak 3561c2b907 Adopt IRBuilder wrapper 2025-10-21 19:17:01 +03:00
Pietro Fezzardi 03e0de9458 Improve debug info propagation in legacy pipeline 2025-09-10 17:44:02 +02:00
Ivan Krysak ef434e46f8 LocalVariableBuilder: preserve debug information 2025-09-10 17:44:01 +02:00
Ivan Krysak a285ad2785 IRHelperRegister: get a comment from Description 2025-07-23 11:38:53 +02:00
Ivan Krysak 743998c956 LocalVariables: adopt IR helper registry 2025-07-23 11:38:51 +02:00
Pietro Fezzardi 0cb3abc9c3 LocalVariableBuilder: make array-typed allocas
This reduces the occasions where some LLVM optimization passes rewrite
the allocas, reducing the chances that the model type metadata is
discarded by LLVM passes that we don't control.
A pass that was doing this was InstCombine.
2025-04-22 15:24:30 +02:00
Alessandro Di Federico c5b9728289 LocalVariableBuilder: add pointer size assumption
This commit further centralizes the creation of allocas + ptrtoint.  The
creation of these pair of instructions is problematic when the size of a
pointer in the input and target architecture differ.

In fact, in such cases, LLVM turns trunc into masking the integer to
suppresse the high bits. This results in problematic code.

This commit introduces an assumption that ensures LLVM does not do that.
2025-03-17 08:51:29 +01:00
Pietro Fezzardi 189693140d Add LocalVariableBuilder 2025-01-29 15:17:15 +01:00