Commit Graph

144 Commits

Author SHA1 Message Date
Alessandro Di Federico 8d67f33ce5 IRHelpers: turn some functions into IRBuilder::* 2026-06-18 16:45:34 +02:00
Alessandro Di Federico ffd8710492 isolate: keep CSVs used by helpers
We used not to put CSVs in `declarations-only`, since `lift` is able to
create them. However, this led to have less CSVs than those we get
post-inlining (some are only used in helpers). This represents a problem
since sometimes we ignore non-existing registers.
2026-06-15 17:28:22 +02:00
Alessandro Di Federico ebad6c458e IsolateFunction: keep all register CSVs 2026-05-29 15:20:26 +02:00
Giacomo Vercesi 77d825ff59 isolate: whitelist more GVs to preserve
Also include any GV from `ProgramCounterHandler::affectsPC` to the list
of GVs that need to be preserved when splitting off the root module
into function modules.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 637e0771f9 isolate: further optimize isolated output
After eagerly splitting there's still some data remaining on the module
that should be deleted. Run a simple optimization pipeline on the split
module that should remove all the unneeded data and thus save memory.
2026-02-05 10:20:45 +01:00
Giacomo Vercesi d578bc6cd2 isolate: clone root module conservatively
In the new pipeline the root module is split off in its individual
isolated modules at the end of `isolate`. Before splitting, there are a
lot of global variables in the root module and only a small part is
going to be needed after splitting for each module. To avoid excessive
memory usage employ `ConservativeModuleCloner` in `Isolate` so that
only the needed global variables are actually cloned when splitting off.
2026-02-05 10:20:45 +01:00
Giacomo Vercesi 8654dafecd isolate: postpone dynamic function bodies
Postpone creating bodies of dynamic functions from the `isolate` pipe to
the `invoke-isolated-functions` pipe, since the body is only relevant in
the recompilation pipeline.
2026-02-05 10:20:45 +01:00
Giacomo Vercesi 723ae8d801 GCBI: rework members and constructor
Move member declaration to the top of the class definition of
`GeneratedCodeBasicInfo` and initialize primitive members.
Merge the `run` method into the constructor since all uses have them
happening close to each other.
2026-02-05 09:25:42 +01:00
Alessandro Di Federico ce4f6ef996 llvmName: turn into a free function 2025-12-22 11:34:46 +01:00
Alessandro Di Federico a1f9bd2d16 Minor changes 2025-12-22 11:34:46 +01:00
Giacomo Vercesi e8b55583e6 isolate: outline function splitting in function
Outline the code responsible for splitting an isolated function into its
own `llvm::Module` in a separate function.
2025-12-19 10:29:28 +01:00
Giacomo Vercesi 664eb497c1 isolate: selectively clone helpers
When performing `cloneFiltered`, instead of cloning all the helper
functions only clone those that are transitively called from the isolated
function.
2025-12-19 10:29:28 +01:00
Giacomo Vercesi 7f7f9571a8 pypeline: implement container discarding
Add infrastructure to pypeline that allows containers to be notified
when they are being used last, this allows two things:
* `Pipe`s eagerly clearing those containers once they are done reading
  their contents
* `ScheduledTask`s clearing those out at the end of their execution in
  case the pipe did not do it
This overall should improve memory usage as container no longer take up
memory if they are no longer used as part of a `Schedule`.
2025-12-19 10:29:28 +01:00
Giacomo Vercesi 3d2015a233 isolate: implement trivial memory optimizations
Implement trivial memory optimizations on the `isolate` pipe:
* Clone the `root` module right away to the correct context before
  performing isolation
* Delete the `root` function's body right after isolation
* Delete the isolated function body from the cloned module after it has
  been `cloneFiltered`-ed into the output container
2025-12-19 10:28:29 +01:00
Alessandro Di Federico 5820908675 Remove and ban \file 2025-12-16 17:41:55 +01:00
Giacomo Vercesi 0df05f97b7 Add Isolate to pypeline 2025-11-18 17:47:54 +01:00
Alessandro Di Federico c883bed765 Drop Logger's StaticEnabled feature 2025-10-31 17:25:03 +01:00
Alessandro Di Federico ecc88b156d IsolateFunctions: Unexpected is no direct branch 2025-10-29 15:10:18 +01:00
Alessandro Di Federico e81dbfd898 Minor changes 2025-10-29 10:56:50 +01:00
Alessandro Di Federico 1e55635b65 Introduce efa::FunctionEdgeType::Unexpected 2025-10-24 18:23:23 +02:00
Alessandro Di Federico 4fb6b5f4e1 Minor changes 2025-10-24 18:20:48 +02: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 2ba5ca3e3d Suppress selected IRBuilder checks 2025-10-21 19:17:37 +03:00
Ivan Krysak 3561c2b907 Adopt IRBuilder wrapper 2025-10-21 19:17:01 +03:00
Ivan Krysak e56f543b1a Split module.bc.zstd 2025-10-13 10:26:41 +03:00
Ivan Krysak dadd836035 MetaAddress: assert validity 2025-10-08 12:22:34 +03:00
Ivan Krysak a285ad2785 IRHelperRegister: get a comment from Description 2025-07-23 11:38:53 +02:00
Ivan Krysak 5d0986c315 FunctionIsolation: adopt helper registry 2025-04-17 11:19:17 +03:00
Ivan Krysak aa15d8ca21 Standardize abort-like function usage 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 f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00
Ivan Krysak 8841bc7144 Don't include model::NameBuilder from the binary 2025-02-13 13:09:50 +02:00
Ivan Krysak a67ba96644 Adopt name builder across the model users 2024-11-06 15:43:13 +02:00
Alessandro Di Federico fbf79b5d1b Make Pipe::checkPrecondition optional 2024-09-27 12:07:18 +02:00
Alessandro Di Federico 2cdedc71f4 s/serialize/toString/
We keep serialize for method dealing with streams.
If it returns a `std::string`, let's use `toString`.
2024-09-27 12:07:17 +02:00
Alessandro Di Federico c8d4381297 s/Context &Ctx/Context &Context/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 9bdce8e5c4 s/ExecutionContext &Ctx/ExecutionContext &EC/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico 12a0a89e15 Ensure every pipe commits what it should
This commit is the final step in ensuring all the pipes commit what they
should. It also asserts this actually happens, enabling us to easily
catch future problems.
2024-09-27 12:07:16 +02:00
Alessandro Di Federico ae7e7a0bc7 IsolateFunctions: add tracing 2024-08-07 16:07:59 +02:00
Alessandro Di Federico fa6249edc0 Isolate: add FunctionTag to declared functions 2024-08-05 17:42:04 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Alessandro Di Federico b62bc8df91 s/FunctionMetadata/ControlFlowGraph/g 2024-06-20 10:24:51 +02:00
Alessandro Di Federico 148e6b1979 Rename all LLVMContainer arguments 2024-06-20 10:24:51 +02:00
Alessandro Di Federico bce1d6c0f3 Adopt invalidation along the core pipeline 2024-06-20 10:24:50 +02:00
Alessandro Di Federico 6cff5416d6 InvokeIsolatedFunctions should add IsolatedRoot
Before this commit, it was added by `IsolateFunctions` instead.
2024-06-20 10:24:50 +02:00
Lauri Vasama 185afcf4c0 Fix spelling of FunctionEntryMDName 2024-05-29 15:42:15 +02:00
Alessandro Di Federico 38ea8f5237 Handle calls to non-functions 2024-05-15 13:19:40 +02:00
Alessandro Di Federico 0459b9d084 Introduce RegisterUsageAnalyses 2024-04-19 18:33:00 +02:00
Ivan Krysak 6b7650276e EFA: split importModel into multiple methods 2024-03-18 19:32:34 +01:00