summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2008-03-11 10:09:17 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2008-03-11 10:09:17 +0000
commitaa7c2105de86c58e388ed4b221a860d667d7719e (patch)
treef6451080f6b551f48881d01f47615f02ba138e3b /llvm/lib/CodeGen/SelectionDAG
parenta731239c30c76bd1e774b5a462b45db590303d24 (diff)
downloadbcm5719-llvm-aa7c2105de86c58e388ed4b221a860d667d7719e.tar.gz
bcm5719-llvm-aa7c2105de86c58e388ed4b221a860d667d7719e.zip
Recommitting parts of r48130. These do not appear to cause the observed failures.
llvm-svn: 48223
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index c042acb4dd9..5b0d48df467 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -695,19 +695,11 @@ void ScheduleDAG::EmitSubregNode(SDNode *Node,
MI->addOperand(MachineOperand::CreateImm(SubIdx));
} else if (Opc == TargetInstrInfo::INSERT_SUBREG) {
- assert((Node->getNumOperands() == 2 || Node->getNumOperands() == 3) &&
- "Malformed insert_subreg node");
- bool isUndefInput = (Node->getNumOperands() == 2);
- unsigned SubReg = 0;
- unsigned SubIdx = 0;
-
- if (isUndefInput) {
- SubReg = getVR(Node->getOperand(0), VRBaseMap);
- SubIdx = cast<ConstantSDNode>(Node->getOperand(1))->getValue();
- } else {
- SubReg = getVR(Node->getOperand(1), VRBaseMap);
- SubIdx = cast<ConstantSDNode>(Node->getOperand(2))->getValue();
- }
+ SDOperand N0 = Node->getOperand(0);
+ SDOperand N1 = Node->getOperand(1);
+ SDOperand N2 = Node->getOperand(2);
+ unsigned SubReg = getVR(N1, VRBaseMap);
+ unsigned SubIdx = cast<ConstantSDNode>(N2)->getValue();
// TODO: Add tracking info to MachineRegisterInfo of which vregs are subregs
// to allow coalescing in the allocator
@@ -745,9 +737,15 @@ void ScheduleDAG::EmitSubregNode(SDNode *Node,
}
MI->addOperand(MachineOperand::CreateReg(VRBase, true));
- AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap);
- if (!isUndefInput)
- AddOperand(MI, Node->getOperand(1), 0, 0, VRBaseMap);
+
+ // If N0 is a constant then it indicates the insert is being done
+ // into a target specific constant value, not a register.
+ if (const ConstantSDNode *SD = dyn_cast<ConstantSDNode>(N0))
+ MI->addOperand(MachineOperand::CreateImm(SD->getValue()));
+ else
+ AddOperand(MI, N0, 0, 0, VRBaseMap);
+ // Add the subregster being inserted
+ AddOperand(MI, N1, 0, 0, VRBaseMap);
MI->addOperand(MachineOperand::CreateImm(SubIdx));
} else
assert(0 && "Node is not a subreg insert or extract");
OpenPOWER on IntegriCloud