diff options
author | Chris Lattner <sabre@nondot.org> | 2007-10-15 17:47:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-10-15 17:47:20 +0000 |
commit | 37ce9df0da6cddc3b8bfef9b63d33d058a0f2f15 (patch) | |
tree | cec87cf4d6c48ba9d7d16c486ab9bd8fa9712fea /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | cfc24007b13564c6720571a2e809cf84fda67737 (diff) |
add a new CreateStackTemporary helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 9a1ea7cb38..b1b3bd4fb8 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -19,6 +19,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetData.h" @@ -913,6 +914,18 @@ SDOperand SelectionDAG::getSrcValue(const Value *V, int Offset) { return SDOperand(N, 0); } +/// CreateStackTemporary - Create a stack temporary, suitable for holding the +/// specified value type. +SDOperand SelectionDAG::CreateStackTemporary(MVT::ValueType VT) { + MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); + unsigned ByteSize = MVT::getSizeInBits(VT)/8; + const Type *Ty = MVT::getTypeForValueType(VT); + unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); + return getFrameIndex(FrameIdx, TLI.getPointerTy()); +} + + SDOperand SelectionDAG::FoldSetCC(MVT::ValueType VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. |