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 | 9eb7a829e67bad64cfb3907f8ab037c3aae1ed07 (patch) | |
| tree | 89479880390299870722908d16918a070f8d7594 /llvm/lib | |
| parent | 9d5b131e70046d4123f4df7496083baf64d4f1f1 (diff) | |
| download | bcm5719-llvm-9eb7a829e67bad64cfb3907f8ab037c3aae1ed07.tar.gz bcm5719-llvm-9eb7a829e67bad64cfb3907f8ab037c3aae1ed07.zip | |
add a new CreateStackTemporary helper method.
llvm-svn: 42994
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 9a1ea7cb386..b1b3bd4fb85 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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. |

