aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-10-17 01:18:07 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-10-17 01:18:07 +0000
commita276c603b82a11b0bf0b59f0517a69e4b63adeab (patch)
tree0bf9c9f1be6d75c1fd4a5811844e196eec7636c9 /lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
parent3bdd8de2806e47f34369c1e6ce6e6b44a135bd29 (diff)
Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 9017e43596..adcc532272 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -5485,48 +5485,6 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
DAG.setRoot(Chain);
}
-
-void SelectionDAGLowering::visitMalloc(MallocInst &I) {
- SDValue Src = getValue(I.getOperand(0));
-
- // Scale up by the type size in the original i32 type width. Various
- // mid-level optimizers may make assumptions about demanded bits etc from the
- // i32-ness of the optimizer: we do not want to promote to i64 and then
- // multiply on 64-bit targets.
- // FIXME: Malloc inst should go away: PR715.
- uint64_t ElementSize = TD->getTypeAllocSize(I.getType()->getElementType());
- if (ElementSize != 1) {
- // Src is always 32-bits, make sure the constant fits.
- assert(Src.getValueType() == MVT::i32);
- ElementSize = (uint32_t)ElementSize;
- Src = DAG.getNode(ISD::MUL, getCurDebugLoc(), Src.getValueType(),
- Src, DAG.getConstant(ElementSize, Src.getValueType()));
- }
-
- EVT IntPtr = TLI.getPointerTy();
-
- Src = DAG.getZExtOrTrunc(Src, getCurDebugLoc(), IntPtr);
-
- TargetLowering::ArgListTy Args;
- TargetLowering::ArgListEntry Entry;
- Entry.Node = Src;
- Entry.Ty = TLI.getTargetData()->getIntPtrType(*DAG.getContext());
- Args.push_back(Entry);
-
- bool isTailCall = PerformTailCallOpt &&
- isInTailCallPosition(&I, Attribute::None, TLI);
- std::pair<SDValue,SDValue> Result =
- TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, false,
- 0, CallingConv::C, isTailCall,
- /*isReturnValueUsed=*/true,
- DAG.getExternalSymbol("malloc", IntPtr),
- Args, DAG, getCurDebugLoc());
- if (Result.first.getNode())
- setValue(&I, Result.first); // Pointers always fit in registers
- if (Result.second.getNode())
- DAG.setRoot(Result.second);
-}
-
void SelectionDAGLowering::visitFree(FreeInst &I) {
TargetLowering::ArgListTy Args;
TargetLowering::ArgListEntry Entry;