Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico de90eea243 Adopt get{Max,}PointerSizeInBits 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 53715af613 Adopt {PassBuilder::,}OptimizationLevel::O2 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 5be2c94a1b Fix literal signedness in comparisons 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 0570db6873 Drop dead llvm::initialize* invocations 2023-04-08 08:42:24 +02:00
Alessandro Di Federico daafc6a1e7 AVI: handle SCEV's scSequentialUMinExpr 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 348ccec09b Adopt new llvm::MCContext constructor 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 171ba353e5 Adopt llvm/{Support,MC}/TargetRegistry.h 2023-04-08 08:42:24 +02:00
Alessandro Di Federico bcd374038c s/zextOrSelf/zext/g 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 6c115da619 Update pass names 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 4182a94346 Adopt MemoryEffects::none 2023-04-08 08:42:24 +02:00
Alessandro Di Federico ae871f5062 Adopt setOnlyReadsMemory 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 43fd690ea8 InaccessibleMemOnly: adopt MemoryEffects 2023-04-08 08:42:24 +02:00
Alessandro Di Federico e131817334 Drop usage of Type::getPointerElementType 2023-04-08 08:42:24 +02:00
Alessandro Di Federico a0fa150576 Drop usages of LoadInst::getPointerOperandType 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 7a08d51816 Drop usages of PointerType::getElementType 2023-04-08 08:42:24 +02:00
Alessandro Di Federico f777ccc4d3 Replace llvm::sys::fs::F_None with OF_None 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 26765f3d84 Drop usages of getBasicBlockList 2023-04-08 08:42:24 +02:00
Alessandro Di Federico a99d54457b Drop usages of getInstList 2023-04-08 08:42:24 +02:00
Alessandro Di Federico aa6a60c5b8 Adopt new InlineFunction prototype 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 449e95021a Replace CallBase::getNumArgOperands with arg_size 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 06f9bca598 Adopt {add,remove}FnAttribute 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 394111ed40 Add missing includes 2023-04-08 08:42:24 +02:00
Alessandro Di Federico d2caa1fad0 Make CreateLoad usages opaque pointers-compatible 2023-04-08 08:42:24 +02:00
Alessandro Di Federico dbcdad0a4d Switch from llvm::Optional to std::optional 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 389342411a Drop makeArrayRef 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 1454ba6ebb Link to the LLVMTargetParser library 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 5ed9432a68 Fix ambiguous template function
Bumping LLVM version turned these into compiler errors.
2023-04-08 08:42:23 +02:00
Alessandro Di Federico 564519b6f9 Explicitly add -L for LLVM libraries path 2023-04-08 08:42:23 +02:00
Alessandro Di Federico e3f9519ffc Get rid of std::iterator 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 31b46de38c Remove dead code and fix spurious warnings
Remove some dead code or introduce suppressions for spurious.
These are results of more accurate warnings in clang 16.
2023-04-08 08:42:23 +02:00
Alessandro Di Federico 74ae629853 Drop experimental from coroutines 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 52521f8cac Adopt more standard library's features 2023-04-08 08:42:23 +02:00
Alessandro Di Federico b2f22c168f Adopt clang-format 16 2023-04-08 08:42:23 +02:00
Alessandro Di Federico 79bbd8b260 commands_registry.py: drop dict comprehension 2023-04-08 08:42:23 +02:00
Massimo Fioravanti fc3f106640 Pipeline: fix accidental container materialization
Pipeline lazy containers were incorrectly materialized when it was not
necessary.
2023-04-07 14:37:14 +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
Pietro Fezzardi 28713ba7fe MakeModelGEPPass.cpp: drop leftover debug log 2023-04-06 22:54:25 +02:00
Pietro Fezzardi f53ed2cdbd Merge branch 'feature/backend-memory-usage' 2023-04-06 14:58:17 +02:00
Pietro Fezzardi b1e357eb36 Forbid use of llvm::GlobalVariables in C backend
With the new backend design we should never need to emit C code for
a llvm::GlobalVariable.
The new backend prints a warning in C if that happens.
This commit adds a check in our recompilation tests to ensure that never
happens.
2023-04-06 14:56:14 +02:00
Pietro Fezzardi a37dc1cd77 DecompileFunction.cpp: statement-based emission
This commit refactors the C Backend as follows.
- The emission of basic blocks is now statement based.
  There are some instructions that are handled as statements.
  Those instructions are the points where the codegen starts from when
  emitting C.
  Conversely, all the other instructions are initially ignored when
  iterating on instructions in a basic block, and are only reached when
  traversing the dataflow that originates from statements.
- The TokenMap, that originally included all the string representing all
  the instructions, is now used only to store the names of funciton
  arguments and instructions representing local variables.
- Starting from each statement-like instruction, the C codegen is driven
  by a traversal of the dataflow of the operands. The dataflow is
  traversed recursively with the `getToken` method, materializing
  strings on the fly until the visit reaches "leaves" i.e. instruction
  that represent local variables, constants, or function arguments.

Adopting this approach allowed to reduce the peak memory consumption of
the backend, as well as making it faster on our benchmarks.
2023-04-06 14:56:14 +02:00
Pietro Fezzardi ca1fd101db Add opaque function to LLVM test helpers
This commits adds an opaque function that can be called by simple LLVM
IR snippets used in unit tests.
2023-04-06 14:25:18 +02:00
Pietro Fezzardi eec66f1880 AddAssignmentMarkerPass: stop ignoring helpers
Before this commit, the pass was never emitting assignments for helpers.
This was a leftover.
With this commit, the pass now handles calls to helpers in an
homogeneous way to calls to isolated functions.
2023-04-06 12:29:59 +02:00
Pietro Fezzardi 6776f1349b MarkAssignmentsTest: drop useless allocas 2023-04-06 12:04:57 +02:00
Pietro Fezzardi 7edc9eeecc Void instructions never needsTopScopeDeclarations 2023-04-06 12:01:48 +02:00
Alessandro Di Federico 2159dbbdc7 Merge branch 'feature/cstring-literals' 2023-04-04 11:03:21 +02:00
Pietro Fezzardi d7cfb96331 Improve hasSideEffects for llvm Intrinsics
Now a call to an llvm Intrinsic is detected has having side effects only
if it is not ReadNone nor ReadOnly.
2023-04-04 09:33:22 +02:00
Pietro Fezzardi 1dbc9b7e1b MarkAssignments.cpp: fix HasInterferingSideEffects
Before this commit, every time we decided to serialize an Instruction we
were considering other instructions that might have interfering side
effects with it.
This was resulting in many more instructions than necessary being marked
with HasInterferingSideEffects.

This commits fixes this problem, by only checking interfering side
effects when an Instruction is marked as having side effects.
2023-04-04 09:33:22 +02:00
Pietro Fezzardi fa2d721c81 DecompileFunction.cpp: drop support for load/store
Since when we added the -exit-ssa pass, loads and stores are never
supposed to reach the C backend anymore.
This commit drops the code that supports them, that was effectively dead
code since a quite long time.
2023-04-04 09:33:22 +02:00
Pietro Fezzardi 53c39d32f2 DecompileFunction.cpp: drop support for allocas
Since when we added the -exit-ssa pass, allocas are never supposed to
reach the C backend anymore.
This commit drops the code that supports them, that was effectively dead
code since a quite long time.
2023-04-04 09:33:22 +02:00
Pietro Fezzardi f2134c2966 Merge branch 'feature/cstring-literals' 2023-04-04 09:31:50 +02:00