[llvm-branch-commits] [llvm] [mcp-frameinst: 3/4]: [MCP][NFC] Opinionated refactoring using new type (PR #186239)
Scott Linder via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 13 07:12:38 PDT 2026
================
@@ -94,6 +94,32 @@ static cl::opt<cl::boolOrDefault>
namespace {
+struct DefSrcPair {
+ const MachineOperand *Def;
+ const MachineOperand *Src;
+
+ DefSrcPair(const DestSourcePair &DSP)
+ : Def(DSP.Destination), Src(DSP.Source) {}
+
+ static DefSrcPair fromAssert(std::optional<DefSrcPair> DSP) {
----------------
slinder1 wrote:
I borrowed the `from` from `MCRegister::from`, but wanted it to be clear that the purpose of the helper is that it includes the `assert`.
In some sense I would say the instance is coming "via an assert": if you don't either check if the `optional` is engaged or `assert` that it is, how would you get to the instance? This is a helper to go the route of getting at it via an `assert` rather than a condition.
https://github.com/llvm/llvm-project/pull/186239
More information about the llvm-branch-commits
mailing list