From: Derek Schuff Date: Wed, 10 Feb 2016 20:14:15 +0000 (+0000) Subject: [WebAssembly] Address comments left over from r260421 X-Git-Tag: llvmorg-3.9.0-rc1~14540 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=992d83fd0ddf45f218ee8fb6d88d13b4c6b0f512;p=platform%2Fupstream%2Fllvm.git [WebAssembly] Address comments left over from r260421 llvm-svn: 260429 --- diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp index c6c473c..bba4f31 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp @@ -44,6 +44,7 @@ using namespace llvm; /// register. bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { const MachineFrameInfo *MFI = MF.getFrameInfo(); + assert(!MFI->isFrameAddressTaken()); const auto *RegInfo = MF.getSubtarget().getRegisterInfo(); return MFI->hasVarSizedObjects() || MFI->hasStackMap() || @@ -75,7 +76,6 @@ void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, auto *MFI = MF.getFrameInfo(); assert(MFI->getCalleeSavedInfo().empty() && "WebAssembly should not have callee-saved registers"); - assert(!MFI->isFrameAddressTaken()); uint64_t StackSize = MFI->getStackSize(); if (!StackSize && !MFI->adjustsStack() && !hasFP(MF)) return; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index d3572b1..ad99d65 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -279,6 +279,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, SDValue Chain = CLI.Chain; SDValue Callee = CLI.Callee; MachineFunction &MF = DAG.getMachineFunction(); + auto Layout = MF.getDataLayout(); CallingConv::ID CallConv = CLI.CallConv; if (!CallingConvSupported(CallConv)) @@ -321,7 +322,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, /*isSS=*/false); SDValue SizeNode = DAG.getConstant(Out.Flags.getByValSize(), DL, MVT::i32); - SDValue FINode = DAG.getFrameIndex(FI, getPointerTy(DAG.getDataLayout())); + SDValue FINode = DAG.getFrameIndex(FI, getPointerTy(Layout)); Chain = DAG.getMemcpy( Chain, DL, FINode, OutVal, SizeNode, Out.Flags.getByValAlign(), /*isVolatile*/ false, /*AlwaysInline=*/true, @@ -332,7 +333,8 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, bool IsVarArg = CLI.IsVarArg; unsigned NumFixedArgs = CLI.NumFixedArgs; - auto PtrVT = getPointerTy(MF.getDataLayout()); + + auto PtrVT = getPointerTy(Layout); // Analyze operands of the call, assigning locations to each operand. SmallVector ArgLocs; @@ -346,9 +348,8 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, EVT VT = Arg.getValueType(); assert(VT != MVT::iPTR && "Legalized args should be concrete"); Type *Ty = VT.getTypeForEVT(*DAG.getContext()); - unsigned Offset = - CCInfo.AllocateStack(MF.getDataLayout().getTypeAllocSize(Ty), - MF.getDataLayout().getABITypeAlignment(Ty)); + unsigned Offset = CCInfo.AllocateStack(Layout.getTypeAllocSize(Ty), + Layout.getABITypeAlignment(Ty)); CCInfo.addLoc(CCValAssign::getMem(ArgLocs.size(), VT.getSimpleVT(), Offset, VT.getSimpleVT(), CCValAssign::Full)); @@ -361,7 +362,8 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, if (IsVarArg && NumBytes) { // For non-fixed arguments, next emit stores to store the argument values // to the stack buffer at the offsets computed above. - int FI = MF.getFrameInfo()->CreateStackObject(NumBytes, /*Alignment=*/16, + int FI = MF.getFrameInfo()->CreateStackObject(NumBytes, + Layout.getStackAlignment(), /*isSS=*/false); unsigned ValNo = 0; SmallVector Chains; @@ -370,7 +372,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, assert(ArgLocs[ValNo].getValNo() == ValNo && "ArgLocs should remain in order and only hold varargs args"); unsigned Offset = ArgLocs[ValNo++].getLocMemOffset(); - FINode = DAG.getFrameIndex(FI, getPointerTy(DAG.getDataLayout())); + FINode = DAG.getFrameIndex(FI, getPointerTy(Layout)); SDValue Add = DAG.getNode(ISD::ADD, DL, PtrVT, FINode, DAG.getConstant(Offset, DL, PtrVT)); Chains.push_back(DAG.getStore(