31 M68kFormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &
MRI)
32 : M68kIncomingValueHandler(MIRBuilder,
MRI) {}
36 CallReturnHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &
MRI,
37 MachineInstrBuilder &MIB)
38 : M68kIncomingValueHandler(MIRBuilder,
MRI), MIB(MIB) {}
42 const CCValAssign &VA)
override;
44 MachineInstrBuilder &MIB;
82 Register StackReg =
STI.getRegisterInfo()->getStackRegister();
87 return AddrReg.getReg(0);
105 TLI.getCCAssignFn(
F.getCallingConv(),
true,
F.isVarArg());
106 auto &
DL =
F.getDataLayout();
107 if (!VRegs.
empty()) {
115 MIRBuilder,
F.getCallingConv(),
128 const auto &
DL =
F.getDataLayout();
133 for (
const auto &Arg :
F.args()) {
134 ArgInfo OrigArg{VRegs[
I], Arg.getType(),
I};
141 TLI.getCCAssignFn(
F.getCallingConv(),
false,
F.isVarArg());
143 M68kFormalArgHandler ArgHandler(MIRBuilder,
MRI);
145 MIRBuilder,
F.getCallingConv(),
149void M68kIncomingValueHandler::assignValueToReg(
Register ValVReg,
154 IncomingValueHandler::assignValueToReg(ValVReg, PhysReg, VA);
157void M68kIncomingValueHandler::assignValueToAddress(
166Register M68kIncomingValueHandler::getStackAddress(uint64_t
Size,
170 auto &MFI =
MIRBuilder.getMF().getFrameInfo();
171 const bool IsImmutable = !
Flags.isByVal();
172 int FI = MFI.CreateFixedObject(
Size,
Offset, IsImmutable);
177 0,
MIRBuilder.getMF().getDataLayout().getPointerSizeInBits());
186 MIRBuilder.buildCopy(ValVReg, PhysReg);
194 auto &
DL =
F.getDataLayout();
201 for (
auto &OrigArg : Info.OrigArgs)
205 if (!Info.OrigRet.Ty->isVoidTy())
208 unsigned AdjStackDown =
TII.getCallFrameSetupOpcode();
209 auto CallSeqStart = MIRBuilder.
buildInstr(AdjStackDown);
211 unsigned Opc = TLI.getTargetMachine().isPositionIndependent() ? M68k::CALLq
212 : Info.Callee.isReg() ? M68k::CALLj
219 CCAssignFn *AssignFn = TLI.getCCAssignFn(Info.CallConv,
false, Info.IsVarArg);
223 Info.CallConv, Info.IsVarArg))
226 if (Info.Callee.isReg())
233 if (!Info.OrigRet.Ty->isVoidTy()) {
235 TLI.getCCAssignFn(Info.CallConv,
true, Info.IsVarArg);
238 CallReturnHandler Handler(MIRBuilder,
MRI, MIB);
240 Info.CallConv, Info.IsVarArg))
246 unsigned AdjStackUp =
TII.getCallFrameDestroyOpcode();
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file describes how to lower LLVM calls to machine code calls.
const HexagonInstrInfo * TII
This file implements the lowering of LLVM calls to machine code calls for GlobalISel.
This file defines the interfaces that M68k uses to lower LLVM code into a selection DAG.
This file contains the M68k implementation of the TargetInstrInfo class.
This file declares the M68k specific subclass of TargetSubtargetInfo.
This file declares the M68k specific subclass of TargetMachine.
This file declares the MachineIRBuilder class.
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static constexpr MCPhysReg SPReg
static const unsigned FramePtr
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
CCValAssign - Represent assignment of one arg/retval to a location.
void splitToValueTypes(const ArgInfo &OrigArgInfo, SmallVectorImpl< ArgInfo > &SplitArgs, const DataLayout &DL, CallingConv::ID CallConv, SmallVectorImpl< uint64_t > *Offsets=nullptr) const
Break OrigArgInfo into one or more pieces the calling convention can process, returned in SplitArgs.
bool determineAndHandleAssignments(ValueHandler &Handler, ValueAssigner &Assigner, SmallVectorImpl< ArgInfo > &Args, MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, bool IsVarArg, ArrayRef< Register > ThisReturnRegs={}) const
Invoke ValueAssigner::assignArg on each of the given Args and then use Handler to move them to the as...
CallLowering(const TargetLowering *TLI)
const TargetLowering * getTLI() const
Getter for generic TargetLowering class.
void setArgFlags(ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
A parsed version of the target data layout string in and methods for querying it.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
static constexpr LLT pointer(unsigned AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space.
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register > > VRegs, FunctionLoweringInfo &FLI) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs,...
M68kCallLowering(const M68kTargetLowering &TLI)
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI, Register SwiftErrorVReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
bool enableBigEndian() const override
For targets which want to use big-endian can enable it with enableBigEndian() hook.
const RegisterBankInfo * getRegBankInfo() const override
const M68kInstrInfo * getInstrInfo() const override
const M68kRegisterInfo * getRegisterInfo() const override
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Helper class to build MachineInstr.
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
MachineInstrBuilder buildLoad(const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
MachineFunction & getMF()
Getter for the function we currently build.
const MachineBasicBlock & getMBB() const
Getter for the basic block we currently build.
MachineRegisterInfo * getMRI()
Getter for MRI.
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
Register getReg(unsigned Idx) const
Get the register for the operand index.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetInstrInfo - Interface to description of machine instruction set.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI Register constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const TargetRegisterClass &RegClass, MachineOperand &RegMO)
Constrain the Register operand OpIdx, so that it is now constrained to the TargetRegisterClass passed...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
@ Success
The lock was released successfully.
LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO)
Register getStackAddress(uint64_t Size, int64_t Offset, MachinePointerInfo &MPO, ISD::ArgFlagsTy Flags) override
Materialize a VReg containing the address of the specified stack-based object.
M68kOutgoingArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI, MachineInstrBuilder MIB)
void assignValueToAddress(Register ValVReg, Register Addr, LLT MemTy, const MachinePointerInfo &MPO, const CCValAssign &VA) override
The specified value has been assigned to a stack location.
const M68kSubtarget & STI
void assignValueToReg(Register ValVReg, Register PhysReg, const CCValAssign &VA) override
The specified value has been assigned to a physical register, handle the appropriate COPY (either to ...
Base class for ValueHandlers used for arguments passed to a function call, or for return values.
OutgoingValueHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
uint64_t StackSize
The size of the currently allocated portion of the stack.
MachineIRBuilder & MIRBuilder
MachineRegisterInfo & MRI
Register extendRegister(Register ValReg, const CCValAssign &VA, unsigned MaxSizeBits=0)
Extend a register to the location type given in VA, capped at extending to at most MaxSize bits.
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.