[llvm-commits] [llvm] r37935 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Evan Cheng evan.cheng at apple.com
Thu Jul 5 18:47:35 PDT 2007


Author: evancheng
Date: Thu Jul  5 20:47:35 2007
New Revision: 37935

URL: http://llvm.org/viewvc/llvm-project?rev=37935&view=rev
Log:
Workaround of getCopyToRegs and getCopyFromRegs bugs for big-endian machines.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=37935&r1=37934&r2=37935&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Jul  5 20:47:35 2007
@@ -2984,8 +2984,10 @@
 /// If the Flag pointer is NULL, no flag is used.
 SDOperand RegsForValue::getCopyFromRegs(SelectionDAG &DAG,
                                         SDOperand &Chain, SDOperand *Flag)const{
-  // Get the list of registers.
+  // Get the list of registers, in the appropriate order.
   std::vector<unsigned> R(Regs);
+  if (!DAG.getTargetLoweringInfo().isLittleEndian())
+    std::reverse(R.begin(), R.end());
 
   // Copy the legal parts from the registers.
   unsigned NumParts = Regs.size();
@@ -3001,7 +3003,7 @@
   }
   
   // Assemble the legal parts into the final value.
-  return getCopyFromParts(DAG, &Parts[0], NumParts, RegVT, ValueVT, true);
+  return getCopyFromParts(DAG, &Parts[0], NumParts, RegVT, ValueVT, false);
 }
 
 /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the
@@ -3010,13 +3012,15 @@
 /// If the Flag pointer is NULL, no flag is used.
 void RegsForValue::getCopyToRegs(SDOperand Val, SelectionDAG &DAG,
                                  SDOperand &Chain, SDOperand *Flag) const {
-  // Get the list of registers.
+  // Get the list of registers, in the appropriate order.
   std::vector<unsigned> R(Regs);
+  if (!DAG.getTargetLoweringInfo().isLittleEndian())
+    std::reverse(R.begin(), R.end());
 
   // Get the list of the values's legal parts.
   unsigned NumParts = Regs.size();
   SmallVector<SDOperand, 8> Parts(NumParts);
-  getCopyToParts(DAG, Val, &Parts[0], NumParts, RegVT, true);
+  getCopyToParts(DAG, Val, &Parts[0], NumParts, RegVT, false);
 
   // Copy the parts into the registers.
   for (unsigned i = 0; i != NumParts; ++i) {





More information about the llvm-commits mailing list