]> granicus.if.org Git - llvm/commitdiff
[MachineIRBuilder] Add buildOr helper. NFC.
authorDiana Picus <diana.picus@linaro.org>
Wed, 5 Jul 2017 11:32:12 +0000 (11:32 +0000)
committerDiana Picus <diana.picus@linaro.org>
Wed, 5 Jul 2017 11:32:12 +0000 (11:32 +0000)
This isn't used anywhere yet, but I need it for a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307141 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
lib/CodeGen/GlobalISel/MachineIRBuilder.cpp

index 72a21bf9fbde686a3756d54df967b987a83f742f..46ef0af303d7ade6ed4b253229b653820b62820d 100644 (file)
@@ -296,6 +296,19 @@ public:
   MachineInstrBuilder buildAnd(unsigned Res, unsigned Op0,
                                unsigned Op1);
 
+  /// Build and insert \p Res<def> = G_OR \p Op0, \p Op1
+  ///
+  /// G_OR sets \p Res to the bitwise or of integer parameters \p Op0 and \p
+  /// Op1.
+  ///
+  /// \pre setBasicBlock or setMI must have been called.
+  /// \pre \p Res, \p Op0 and \p Op1 must be generic virtual registers
+  ///      with the same (scalar or vector) type).
+  ///
+  /// \return a MachineInstrBuilder for the newly created instruction.
+  MachineInstrBuilder buildOr(unsigned Res, unsigned Op0,
+                              unsigned Op1);
+
   /// Build and insert \p Res<def> = G_ANYEXT \p Op0
   ///
   /// G_ANYEXT produces a register of the specified width, with bits 0 to
index c0066f67ac67a2c7dff7771c0bfe6cf858980159..9dcc63164b3af8de3e98f7f68a7239ad4eb56e03 100644 (file)
@@ -240,6 +240,10 @@ MachineInstrBuilder MachineIRBuilder::buildAnd(unsigned Res, unsigned Op0,
   return buildBinaryOp(TargetOpcode::G_AND, Res, Op0, Op1);
 }
 
+MachineInstrBuilder MachineIRBuilder::buildOr(unsigned Res, unsigned Op0,
+                                               unsigned Op1) {
+  return buildBinaryOp(TargetOpcode::G_OR, Res, Op0, Op1);
+}
 
 MachineInstrBuilder MachineIRBuilder::buildBr(MachineBasicBlock &Dest) {
   return buildInstr(TargetOpcode::G_BR).addMBB(&Dest);