Backed out 53031.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2008-07-03 18:20:14 +00:00
parent cb2627395d
commit a122f2f51e
3 changed files with 14 additions and 22 deletions

View File

@ -589,9 +589,8 @@ public:
void dump() const; void dump() const;
/// CreateStackTemporary - Create a stack temporary, suitable for holding the /// CreateStackTemporary - Create a stack temporary, suitable for holding the
/// specified value type. If minAlign is specified, the slot size will have /// specified value type.
/// at least that alignment. SDOperand CreateStackTemporary(MVT VT);
SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1);
/// FoldSetCC - Constant fold a setcc to true or false. /// FoldSetCC - Constant fold a setcc to true or false.
SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand FoldSetCC(MVT VT, SDOperand N1,

View File

@ -4871,41 +4871,35 @@ SDOperand SelectionDAGLegalize::EmitStackConvert(SDOperand SrcOp,
MVT SlotVT, MVT SlotVT,
MVT DestVT) { MVT DestVT) {
// Create the stack frame object. // Create the stack frame object.
unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT);
SrcOp.getValueType().getTypeForMVT());
SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign);
FrameIndexSDNode *StackPtrFI = cast<FrameIndexSDNode>(FIPtr); FrameIndexSDNode *StackPtrFI = cast<FrameIndexSDNode>(FIPtr);
int SPFI = StackPtrFI->getIndex(); int SPFI = StackPtrFI->getIndex();
unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SrcSize = SrcOp.getValueType().getSizeInBits();
unsigned SlotSize = SlotVT.getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits();
unsigned DestSize = DestVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits();
const Type* SlotTy = SlotVT.getTypeForMVT();
unsigned SlotAlign = TLI.getTargetData()->getPrefTypeAlignment(SlotTy);
// Emit a store to the stack slot. Use a truncstore if the input value is // Emit a store to the stack slot. Use a truncstore if the input value is
// later than DestVT. // later than DestVT.
SDOperand Store; SDOperand Store;
if (SrcSize > SlotSize) if (SrcSize > SlotSize)
Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr,
PseudoSourceValue::getFixedStack(), SPFI, SlotVT, PseudoSourceValue::getFixedStack(),
false, SlotAlign); SPFI, SlotVT);
else { else {
assert(SrcSize == SlotSize && "Invalid store"); assert(SrcSize == SlotSize && "Invalid store");
Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr,
PseudoSourceValue::getFixedStack(), SPFI, PseudoSourceValue::getFixedStack(),
false, SlotAlign); SPFI);
} }
// Result is a load from the stack slot. // Result is a load from the stack slot.
if (SlotSize == DestSize) if (SlotSize == DestSize)
return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, SlotAlign); return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0);
assert(SlotSize < DestSize && "Unknown extension!"); assert(SlotSize < DestSize && "Unknown extension!");
return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT, return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT);
false, SlotAlign);
} }
SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) {

View File

@ -1080,17 +1080,16 @@ SDOperand SelectionDAG::getMemOperand(const MachineMemOperand &MO) {
/// CreateStackTemporary - Create a stack temporary, suitable for holding the /// CreateStackTemporary - Create a stack temporary, suitable for holding the
/// specified value type. /// specified value type.
SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { SDOperand SelectionDAG::CreateStackTemporary(MVT VT) {
MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
unsigned ByteSize = VT.getSizeInBits()/8; unsigned ByteSize = VT.getSizeInBits()/8;
const Type *Ty = VT.getTypeForMVT(); const Type *Ty = VT.getTypeForMVT();
unsigned StackAlign = unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty);
std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign);
int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign);
return getFrameIndex(FrameIdx, TLI.getPointerTy()); return getFrameIndex(FrameIdx, TLI.getPointerTy());
} }
SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1,
SDOperand N2, ISD::CondCode Cond) { SDOperand N2, ISD::CondCode Cond) {
// These setcc operations always fold. // These setcc operations always fold.