23 Commits

Author SHA1 Message Date
vporpo
eba106d461
[SandboxIR][NFC] Move Instruction classes into a separate file (#110294) 2024-09-27 10:54:11 -07:00
Vasileios Porpodas
b30880e975 [SandboxIR] Fix linking error caused by 840da2e8ba7e0f77938adfc6f6d315137542a1b8 2024-09-04 11:25:40 -07:00
Sterling-Augustine
840da2e8ba
[SandboxIR] Implement CmpInst, FCmpInst, and ICmpInst (#106301)
As in the description.

Not sure the macros for "WRAP_XXX" add value or not, but do save some
boiler plate. Maybe there is a better way.
2024-09-04 10:54:17 -07:00
Jorge Gorbe Moya
b5ba726577
[SandboxIR] Add tracking for ShuffleVectorInst::setShuffleMask. (#105590) 2024-08-21 15:56:55 -07:00
vporpo
6e8c97035c
[SandboxIR] Implement CatchSwitchInst (#104652)
This patch implements sandboxir::CatchSwitchInst mirroring
llvm::CatchSwitchInst.
2024-08-20 12:30:04 -07:00
vporpo
516c1a0e9a
[SandboxIR] Implement SwitchInst (#104641)
This patch implements sandboxir::SwitchInst mirroring llvm::SwitchInst.
2024-08-16 16:43:01 -07:00
vporpo
8c5d76ac50
[SandboxIR][Tracker][NFC] GenericSetterWithIdx (#104615)
This patch adds a generic change tracker class, similar to
GenericSetter, but for getter/setter functions that also take an index
argument. For example: `Foo:get(Idx)` and `Foo::set(Idx, Val)`. These
setter/getter patterns are common enough that using a common
implementation seems beneficial.
2024-08-16 13:16:43 -07:00
Vasileios Porpodas
44f30c8019 [SandboxIR][NFC] Use Tracker.emplaceIfTracking()
This patch replaces some of the remaining uses of Tracker::track() to
Tracker::emplaceIfTracking().
2024-08-09 16:04:56 -07:00
vporpo
f7ad495a59
[SandboxIR] Clean up tracking code with the help of emplaceIfTracking() (#102406)
This patch introduces Tracker::emplaceIfTracking(), a wrapper of Tracker::track() that will conditionally create the change object if tracking is enabled.
This patch also removes the `Parent` member field of `IRChangeBase`.
2024-08-09 14:32:34 -07:00
vporpo
4fe33d067c
[SandboxIR][NFC] GenericSetter tracker class (#102260)
This patch introduces the `GenericSetter` tracker class that can be used
to track and revert simple instruction setters.

This patch also replaces several setter tracker classes with the generic
one.
2024-08-07 17:17:19 -07:00
vporpo
36f0d64818
[SandboxIR] Implement AllocaInst (#102027)
This patch implements sandboxir::AllocaInst which mirrors
llvm::AllocaInst.
2024-08-06 11:24:13 -07:00
vporpo
0959e58fbe
[SandboxIR][Tracker] Track creation of instructions (#102013)
This patch adds tracking support for the creation of SandboxIR
instructions. This allows us to undo the creation of instructions during
revert().

Please note that we don't allow creation of detached instructions,
meaning that the instructions need to be inserted into a block upon
creation. This is why the tracker class combines creation and insertion.
2024-08-05 10:23:36 -07:00
vporpo
85da96115e
[SandboxIR][Tracker] Track InsertIntoBB (#101595)
This patch implements tracking for the insertion of a
sandboxir::Instruction into a sandboxir::BasicBlock.
2024-08-03 12:19:46 -07:00
Julius Alexandre
95b366cad2
[SandboxIR] Add setVolatile function to LoadInst and StoreInst (#101759)
This patch adds sandboxir::LoadInst::setVolatile() and sandboxir::StoreInst::setVolatile()
and the corresponding tracking class.
2024-08-02 21:33:13 -07:00
Sterling-Augustine
3403b593ae
[SandboxIR] Implement PHINodes (#101111)
This patch implements sandboxir::PHINode which mirrors llvm::PHINode.

Based almost entirely on work by vporpo.
2024-07-31 23:41:15 +00:00
vporpo
cfb92be0a9
[SandboxIR] Implement CallBrInst (#100823)
This patch implements sandboxir::CallBrInst which mirrors
llvm::CallBrInst.

LLVM IR does not expose the Uses to DefaultDest and IndirectDest so we
need special Tracker objects for both of setters.
2024-07-29 13:01:40 -07:00
Vasileios Porpodas
c444548bda Reapply "[SandboxIR] Implement BranchInst (#100063)"
This reverts commit c312a1a9c1beb407506cb1f76eb4ba05e92e5ab4.
2024-07-23 12:32:46 -07:00
Vasileios Porpodas
c312a1a9c1 Revert "[SandboxIR] Implement BranchInst (#100063)"
This reverts commit 3993da23daa0ae75e9e80def76854534903e3761.
2024-07-23 12:00:20 -07:00
vporpo
3993da23da
[SandboxIR] Implement BranchInst (#100063)
This patch implements sandboxir::BranchInst which mirrors
llvm::BranchInst.

BranchInst::swapSuccessors() relies on User::swapOperandsInternal() so
this patch also adds Use::swap() and the corresponding tracking code and
test.
2024-07-23 11:50:33 -07:00
vporpo
cbbd153234
[SandboxIR][Tracker] Track Instruction::moveBefore() (#99568)
This implements tracking of moving instrs with `moveBefore()`.
2024-07-18 19:03:55 -07:00
vporpo
4f786c6823
[SandboxIR][Tracker] Track Instruction::removeFromParent() (#99541)
This patch adds the necessary functionality to the Tracker and to the
Sandbox IR API functions for tracking calls to removeFromParent().
2024-07-18 13:54:54 -07:00
vporpo
c5432d31cb
[SandboxIR][Tracker] Track eraseFromParent() (#99431)
This patch adds tracking support for Instruction::eraseFromParent(). The
Instruction is not actually being erased, but instead it is detached
from the instruction list and drops its Use edges. The original
instruction position and Use edges are saved in the `EraseFromParent`
change object, and are being used during `revert()` to restore the
original state.
2024-07-18 11:06:33 -07:00
vporpo
5338bd3c8a
[SandboxIR] IR Tracker (#99238)
This is the first patch in a series of patches for the IR change
tracking component of SandboxIR.
The tracker collects changes in a vector of `IRChangeBase` objects and
provides a `save()`/`accept()`/`revert()` API.

Each type of IR changing event is captured by a dedicated subclass of
`IRChangeBase`. This patch implements only one of them, that for
updating a `sandboxir::Use` source value, named `UseSet`.
2024-07-17 21:57:52 -07:00