Path: blob/main/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVCallLowering.h
35269 views
//===--- SPIRVCallLowering.h - Call lowering --------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file describes how to lower LLVM calls to machine code calls.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVCALLLOWERING_H13#define LLVM_LIB_TARGET_SPIRV_SPIRVCALLLOWERING_H1415#include "SPIRVGlobalRegistry.h"16#include "llvm/CodeGen/GlobalISel/CallLowering.h"1718namespace llvm {1920class SPIRVGlobalRegistry;21class SPIRVTargetLowering;2223class SPIRVCallLowering : public CallLowering {24private:25// Used to create and assign function, argument, and return type information.26SPIRVGlobalRegistry *GR;2728// Used to postpone producing of indirect function pointer types29// after all indirect calls info is collected30struct SPIRVIndirectCall {31const Type *RetTy = nullptr;32SmallVector<Type *> ArgTys;33SmallVector<Register> ArgRegs;34Register Callee;35};36void produceIndirectPtrTypes(MachineIRBuilder &MIRBuilder) const;37mutable SmallVector<SPIRVIndirectCall> IndirectCalls;3839public:40SPIRVCallLowering(const SPIRVTargetLowering &TLI, SPIRVGlobalRegistry *GR);4142// Built OpReturn or OpReturnValue.43bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,44ArrayRef<Register> VRegs, FunctionLoweringInfo &FLI,45Register SwiftErrorVReg) const override;4647// Build OpFunction, OpFunctionParameter, and any EntryPoint or Linkage data.48bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,49ArrayRef<ArrayRef<Register>> VRegs,50FunctionLoweringInfo &FLI) const override;5152// Build OpCall, or replace with a builtin function.53bool lowerCall(MachineIRBuilder &MIRBuilder,54CallLoweringInfo &Info) const override;55};56} // end namespace llvm5758#endif // LLVM_LIB_TARGET_SPIRV_SPIRVCALLLOWERING_H596061