Add a SelectionDAG getTargetInsertSubreg convenience function,
authorBob Wilson <bob.wilson@apple.com>
Thu, 8 Oct 2009 18:49:46 +0000 (18:49 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 8 Oct 2009 18:49:46 +0000 (18:49 +0000)
similar to getTargetExtractSubreg.

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

include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index e1b9998ab1c6b4cc3bbb7e5db08001a33d6bd245..53d7f1fa34067e928fd916702a0f47d818cf2dc8 100644 (file)
@@ -708,6 +708,11 @@ public:
   SDValue getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT,
                                  SDValue Operand);
 
+  /// getTargetInsertSubreg - A convenience function for creating
+  /// TargetInstrInfo::INSERT_SUBREG nodes.
+  SDValue getTargetInsertSubreg(int SRIdx, DebugLoc DL, EVT VT,
+                                SDValue Operand, SDValue Subreg);
+
   /// getNodeIfExists - Get the specified node if it's already available, or
   /// else return NULL.
   SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs,
index f6fed2145d994b06bca6467c63d1530293f8c912..8c4421e235907b072bb433c0d3d2cf6f68839ca4 100644 (file)
@@ -4769,6 +4769,17 @@ SelectionDAG::getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT,
   return SDValue(Subreg, 0);
 }
 
+/// getTargetInsertSubreg - A convenience function for creating
+/// TargetInstrInfo::INSERT_SUBREG nodes.
+SDValue
+SelectionDAG::getTargetInsertSubreg(int SRIdx, DebugLoc DL, EVT VT,
+                                    SDValue Operand, SDValue Subreg) {
+  SDValue SRIdxVal = getTargetConstant(SRIdx, MVT::i32);
+  SDNode *Result = getMachineNode(TargetInstrInfo::INSERT_SUBREG, DL,
+                                  VT, Operand, Subreg, SRIdxVal);
+  return SDValue(Result, 0);
+}
+
 /// getNodeIfExists - Get the specified node if it's already available, or
 /// else return NULL.
 SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,