LLVM 19.0.0git
XtensaFrameLowering.cpp
Go to the documentation of this file.
1//===- XtensaFrameLowering.cpp - Xtensa Frame Information -----------------===//
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// This file contains the Xtensa implementation of TargetFrameLowering class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "XtensaFrameLowering.h"
14#include "XtensaInstrInfo.h"
15#include "XtensaSubtarget.h"
21#include "llvm/IR/Function.h"
22
23using namespace llvm;
24
26 : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(4), 0,
27 Align(4)) {}
28
30 const MachineFrameInfo &MFI = MF.getFrameInfo();
33}
34
36 MachineBasicBlock &MBB) const {}
37
39 MachineBasicBlock &MBB) const {}
40
41// Eliminate ADJCALLSTACKDOWN, ADJCALLSTACKUP pseudo instructions
45 const XtensaInstrInfo &TII =
46 *static_cast<const XtensaInstrInfo *>(MF.getSubtarget().getInstrInfo());
47
48 if (!hasReservedCallFrame(MF)) {
49 int64_t Amount = I->getOperand(0).getImm();
50
51 if (I->getOpcode() == Xtensa::ADJCALLSTACKDOWN)
52 Amount = -Amount;
53
54 unsigned SP = Xtensa::SP;
55 TII.adjustStackPtr(SP, Amount, MBB, I);
56 }
57
58 return MBB.erase(I);
59}
MachineBasicBlock & MBB
const HexagonInstrInfo * TII
#define I(x, y, z)
Definition: MD5.cpp:58
This file declares the machine register scavenger class.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Information about stack frame layout on the target.
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
TargetOptions Options
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
virtual const TargetInstrInfo * getInstrInfo() const
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
void emitPrologue(MachineFunction &, MachineBasicBlock &) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39