LLVM  14.0.0git
Macros | Functions
CallLowering.cpp File Reference
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Target/TargetMachine.h"
Include dependency graph for CallLowering.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "call-lowering"
 

Functions

static void addFlagsUsingAttrFn (ISD::ArgFlagsTy &Flags, const std::function< bool(Attribute::AttrKind)> &AttrFn)
 Helper function which updates Flags when AttrFn returns true. More...
 
static MachineInstrBuilder mergeVectorRegsToResultRegs (MachineIRBuilder &B, ArrayRef< Register > DstRegs, ArrayRef< Register > SrcRegs)
 Pack values SrcRegs to cover the vector type result DstRegs. More...
 
static void buildCopyFromRegs (MachineIRBuilder &B, ArrayRef< Register > OrigRegs, ArrayRef< Register > Regs, LLT LLTy, LLT PartLLT, const ISD::ArgFlagsTy Flags)
 Create a sequence of instructions to combine pieces split into register typed values to the original IR value. More...
 
static void buildCopyToRegs (MachineIRBuilder &B, ArrayRef< Register > DstRegs, Register SrcReg, LLT SrcTy, LLT PartTy, unsigned ExtendOp=TargetOpcode::G_ANYEXT)
 Create a sequence of instructions to expand the value in SrcReg (of type SrcTy) to the types in DstRegs (of type PartTy). More...
 
static unsigned extendOpFromFlags (llvm::ISD::ArgFlagsTy Flags)
 
static bool isCopyCompatibleType (LLT SrcTy, LLT DstTy)
 Check if we can use a basic COPY instruction between the two types. More...
 

Detailed Description

This file implements some simple delegations needed for call lowering.

Definition in file CallLowering.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "call-lowering"

Definition at line 28 of file CallLowering.cpp.

Function Documentation

◆ addFlagsUsingAttrFn()

static void addFlagsUsingAttrFn ( ISD::ArgFlagsTy Flags,
const std::function< bool(Attribute::AttrKind)> &  AttrFn 
)
static

◆ buildCopyFromRegs()

static void buildCopyFromRegs ( MachineIRBuilder B,
ArrayRef< Register OrigRegs,
ArrayRef< Register Regs,
LLT  LLTy,
LLT  PartLLT,
const ISD::ArgFlagsTy  Flags 
)
static

◆ buildCopyToRegs()

static void buildCopyToRegs ( MachineIRBuilder B,
ArrayRef< Register DstRegs,
Register  SrcReg,
LLT  SrcTy,
LLT  PartTy,
unsigned  ExtendOp = TargetOpcode::G_ANYEXT 
)
static

Create a sequence of instructions to expand the value in SrcReg (of type SrcTy) to the types in DstRegs (of type PartTy).

ExtendOp should contain the type of scalar value extension if necessary.

This is used for outgoing values (vregs to physregs)

Definition at line 455 of file CallLowering.cpp.

References llvm::alignTo(), assert(), B, llvm::ArrayRef< T >::begin(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::numbers::e, llvm::ArrayRef< T >::end(), llvm::LLT::getElementType(), llvm::getGCDType(), llvm::getLCMType(), getReg(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), i, llvm::LLT::isScalar(), llvm::LLT::isVector(), MRI, llvm::LLT::scalar(), llvm::Check::Size, llvm::ArrayRef< T >::size(), and llvm::RegState::Undef.

Referenced by llvm::CallLowering::handleAssignments().

◆ extendOpFromFlags()

static unsigned extendOpFromFlags ( llvm::ISD::ArgFlagsTy  Flags)
static

◆ isCopyCompatibleType()

static bool isCopyCompatibleType ( LLT  SrcTy,
LLT  DstTy 
)
static

Check if we can use a basic COPY instruction between the two types.

We're currently building on top of the infrastructure using MVT, which loses pointer information in the CCValAssign. We accept copies from physical registers that have been reported as integers if it's to an equivalent sized pointer LLT.

Definition at line 1170 of file CallLowering.cpp.

References llvm::LLT::getScalarType(), llvm::LLT::getSizeInBits(), llvm::LLT::isPointer(), and llvm::LLT::isScalar().

Referenced by llvm::CallLowering::IncomingValueHandler::assignValueToReg().

◆ mergeVectorRegsToResultRegs()

static MachineInstrBuilder mergeVectorRegsToResultRegs ( MachineIRBuilder B,
ArrayRef< Register DstRegs,
ArrayRef< Register SrcRegs 
)
static