| 1 | //===-- WebAssemblyCallLowering.cpp - Call lowering for GlobalISel -*- C++ -*-// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// \file |
| 10 | /// This file implements the lowering of LLVM calls to machine code calls for |
| 11 | /// GlobalISel. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "WebAssemblyCallLowering.h" |
| 16 | #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" |
| 17 | #include "WebAssemblyISelLowering.h" |
| 18 | #include "WebAssemblyMachineFunctionInfo.h" |
| 19 | #include "WebAssemblySubtarget.h" |
| 20 | #include "WebAssemblyUtilities.h" |
| 21 | #include "llvm/CodeGen/Analysis.h" |
| 22 | #include "llvm/IR/DataLayout.h" |
| 23 | #include "llvm/IR/DebugLoc.h" |
| 24 | #include "llvm/IR/Value.h" |
| 25 | |
| 26 | #define DEBUG_TYPE "wasm-call-lowering" |
| 27 | |
| 28 | using namespace llvm; |
| 29 | |
| 30 | WebAssemblyCallLowering::WebAssemblyCallLowering( |
| 31 | const WebAssemblyTargetLowering &TLI) |
| 32 | : CallLowering(&TLI) {} |
| 33 | |
| 34 | bool WebAssemblyCallLowering::canLowerReturn(MachineFunction &MF, |
| 35 | CallingConv::ID CallConv, |
| 36 | SmallVectorImpl<BaseArgInfo> &Outs, |
| 37 | bool IsVarArg) const { |
| 38 | return WebAssembly::canLowerReturn(ResultSize: Outs.size(), |
| 39 | Subtarget: &MF.getSubtarget<WebAssemblySubtarget>()); |
| 40 | } |
| 41 | |
| 42 | bool WebAssemblyCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, |
| 43 | const Value *Val, |
| 44 | ArrayRef<Register> VRegs, |
| 45 | FunctionLoweringInfo &FLI, |
| 46 | Register SwiftErrorVReg) const { |
| 47 | if (!Val) |
| 48 | return true; // allow only void returns for now |
| 49 | |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | bool WebAssemblyCallLowering::lowerFormalArguments( |
| 54 | MachineIRBuilder &MIRBuilder, const Function &F, |
| 55 | ArrayRef<ArrayRef<Register>> VRegs, FunctionLoweringInfo &FLI) const { |
| 56 | if (VRegs.empty()) |
| 57 | return true; // allow only empty signatures for now |
| 58 | |
| 59 | return false; |
| 60 | } |
| 61 | |
| 62 | bool WebAssemblyCallLowering::lowerCall(MachineIRBuilder &MIRBuilder, |
| 63 | CallLoweringInfo &Info) const { |
| 64 | return false; |
| 65 | } |
| 66 | |