diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-27 00:31:01 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-27 00:31:01 +0000 |
commit | 140549256fe5bc73827dc0a9e0bd8c0bfba16bd7 (patch) | |
tree | 8a38a6b077a44f5d3e6e74d7e43dcf123432f59d /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | ca1711a5b5fa082042c5d1a8ced10d72dba01528 (diff) | |
download | bcm5719-llvm-140549256fe5bc73827dc0a9e0bd8c0bfba16bd7.tar.gz bcm5719-llvm-140549256fe5bc73827dc0a9e0bd8c0bfba16bd7.zip |
Add support for fast isel of inttoptr and ptrtoint in the cases where truncation is not needed.
llvm-svn: 55399
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 59bc8c5b333..64843f8b558 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -388,6 +388,25 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin, if (!SelectConstantCast(I, ISD::SINT_TO_FP, ValueMap)) return I; break; + case Instruction::IntToPtr: // Deliberate fall-through. + case Instruction::PtrToInt: { + MVT SrcVT = TLI.getValueType(I->getOperand(0)->getType()); + MVT DstVT = TLI.getValueType(I->getType()); + if (SrcVT.getSimpleVT() == DstVT.getSimpleVT()) { + ValueMap[I] = ValueMap[I->getOperand(0)]; + break; + } else if (DstVT.bitsGT(SrcVT)) { + if (!isa<ConstantInt>(I->getOperand(0))) { + if (!SelectCast(I, ISD::ZERO_EXTEND, ValueMap)) return I; + } else + if (!SelectConstantCast(I, ISD::ZERO_EXTEND, ValueMap)) return I; + break; + } else { + // TODO: Handle SrcVT > DstVT, where truncation is needed. + return I; + } + } + default: // Unhandled instruction. Halt "fast" selection and bail. return I; |