diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp')
| -rw-r--r-- | gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 299009fa667..283e703e1f6 100644 --- a/gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/gnu/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements the WebAssemblyTargetLowering class. +/// This file implements the WebAssemblyTargetLowering class. /// //===----------------------------------------------------------------------===// @@ -117,8 +117,7 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering( // As a special case, these operators use the type to mean the type to // sign-extend from. setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); - if (!Subtarget->hasAtomics()) { - // The Atomics feature includes signext intructions. + if (!Subtarget->hasSignExt()) { for (auto T : {MVT::i8, MVT::i16, MVT::i32}) setOperationAction(ISD::SIGN_EXTEND_INREG, T, Expand); } @@ -152,6 +151,9 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering( // Trap lowers to wasm unreachable setOperationAction(ISD::TRAP, MVT::Other, Legal); + // Exception handling intrinsics + setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom); + setMaxAtomicSizeInBitsSupported(64); } @@ -427,6 +429,15 @@ bool WebAssemblyTargetLowering::isIntDivCheap(EVT VT, return true; } +EVT WebAssemblyTargetLowering::getSetCCResultType(const DataLayout &DL, + LLVMContext &C, + EVT VT) const { + if (VT.isVector()) + return VT.changeVectorElementTypeToInteger(); + + return TargetLowering::getSetCCResultType(DL, C, VT); +} + //===----------------------------------------------------------------------===// // WebAssembly Lowering private implementation. //===----------------------------------------------------------------------===// @@ -485,6 +496,7 @@ SDValue WebAssemblyTargetLowering::LowerCall( SmallVectorImpl<ISD::OutputArg> &Outs = CLI.Outs; SmallVectorImpl<SDValue> &OutVals = CLI.OutVals; + unsigned NumFixedArgs = 0; for (unsigned i = 0; i < Outs.size(); ++i) { const ISD::OutputArg &Out = Outs[i]; SDValue &OutVal = OutVals[i]; @@ -510,11 +522,11 @@ SDValue WebAssemblyTargetLowering::LowerCall( /*isTailCall*/ false, MachinePointerInfo(), MachinePointerInfo()); OutVal = FINode; } + // Count the number of fixed args *after* legalization. + NumFixedArgs += Out.IsFixed; } bool IsVarArg = CLI.IsVarArg; - unsigned NumFixedArgs = CLI.NumFixedArgs; - auto PtrVT = getPointerTy(Layout); // Analyze operands of the call, assigning locations to each operand. @@ -738,6 +750,8 @@ SDValue WebAssemblyTargetLowering::LowerOperation(SDValue Op, return LowerFRAMEADDR(Op, DAG); case ISD::CopyToReg: return LowerCopyToReg(Op, DAG); + case ISD::INTRINSIC_WO_CHAIN: + return LowerINTRINSIC_WO_CHAIN(Op, DAG); } } @@ -870,6 +884,21 @@ SDValue WebAssemblyTargetLowering::LowerVASTART(SDValue Op, MachinePointerInfo(SV), 0); } +SDValue +WebAssemblyTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, + SelectionDAG &DAG) const { + unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue(); + SDLoc DL(Op); + switch (IntNo) { + default: + return {}; // Don't custom lower most intrinsics. + + case Intrinsic::wasm_lsda: + // TODO For now, just return 0 not to crash + return DAG.getConstant(0, DL, Op.getValueType()); + } +} + //===----------------------------------------------------------------------===// // WebAssembly Optimization Hooks //===----------------------------------------------------------------------===// |
