Implement support for branch instruction operands.
PiperOrigin-RevId: 205666777
diff --git a/lib/IR/Instructions.cpp b/lib/IR/Instructions.cpp
index 428523e..9374933 100644
--- a/lib/IR/Instructions.cpp
+++ b/lib/IR/Instructions.cpp
@@ -207,3 +207,15 @@
for (auto &operand : getInstOperands())
operand.~InstOperand();
}
+
+/// Add one value to the operand list.
+void BranchInst::addOperand(CFGValue *value) {
+ operands.emplace_back(InstOperand(this, value));
+}
+
+/// Add a list of values to the operand list.
+void BranchInst::addOperands(ArrayRef<CFGValue *> values) {
+ operands.reserve(operands.size() + values.size());
+ for (auto *value : values)
+ addOperand(value);
+}