2015-11-07 02:17:45 +08:00
|
|
|
//===--------------------- SIFrameLowering.h --------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-11-07 02:17:45 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|
|
|
|
|
|
|
|
#include "AMDGPUFrameLowering.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2016-12-10 06:06:55 +08:00
|
|
|
|
2016-09-01 05:52:21 +08:00
|
|
|
class SIInstrInfo;
|
|
|
|
class SIMachineFunctionInfo;
|
|
|
|
class SIRegisterInfo;
|
2018-07-12 04:59:01 +08:00
|
|
|
class GCNSubtarget;
|
2015-11-07 02:17:45 +08:00
|
|
|
|
|
|
|
class SIFrameLowering final : public AMDGPUFrameLowering {
|
|
|
|
public:
|
|
|
|
SIFrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
|
|
|
unsigned TransAl = 1) :
|
|
|
|
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
2016-12-10 06:06:55 +08:00
|
|
|
~SIFrameLowering() override = default;
|
2015-11-07 02:17:45 +08:00
|
|
|
|
2017-05-18 05:56:25 +08:00
|
|
|
void emitEntryFunctionPrologue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const;
|
2015-12-01 05:15:53 +08:00
|
|
|
void emitPrologue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const override;
|
2016-06-24 14:30:11 +08:00
|
|
|
void emitEpilogue(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const override;
|
2017-03-11 03:39:07 +08:00
|
|
|
int getFrameIndexReference(const MachineFunction &MF, int FI,
|
|
|
|
unsigned &FrameReg) const override;
|
2015-12-01 05:15:53 +08:00
|
|
|
|
2017-09-14 07:47:01 +08:00
|
|
|
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
|
|
|
|
RegScavenger *RS = nullptr) const override;
|
2019-07-04 07:32:29 +08:00
|
|
|
void determineCalleeSavesSGPR(MachineFunction &MF, BitVector &SavedRegs,
|
|
|
|
RegScavenger *RS = nullptr) const;
|
2019-07-09 03:03:38 +08:00
|
|
|
bool
|
|
|
|
assignCalleeSavedSpillSlots(MachineFunction &MF,
|
|
|
|
const TargetRegisterInfo *TRI,
|
|
|
|
std::vector<CalleeSavedInfo> &CSI) const override;
|
2017-09-14 07:47:01 +08:00
|
|
|
|
2019-06-17 17:13:29 +08:00
|
|
|
bool isSupportedStackID(TargetStackID::Value ID) const override;
|
|
|
|
|
2015-11-07 02:17:45 +08:00
|
|
|
void processFunctionBeforeFrameFinalized(
|
|
|
|
MachineFunction &MF,
|
|
|
|
RegScavenger *RS = nullptr) const override;
|
2016-06-25 11:11:28 +08:00
|
|
|
|
2017-08-02 03:54:18 +08:00
|
|
|
MachineBasicBlock::iterator
|
|
|
|
eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const override;
|
|
|
|
|
2016-06-25 11:11:28 +08:00
|
|
|
private:
|
2018-07-12 04:59:01 +08:00
|
|
|
void emitFlatScratchInit(const GCNSubtarget &ST,
|
2016-09-01 05:52:21 +08:00
|
|
|
MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB) const;
|
|
|
|
|
|
|
|
unsigned getReservedPrivateSegmentBufferReg(
|
2018-07-12 04:59:01 +08:00
|
|
|
const GCNSubtarget &ST,
|
2016-09-01 05:52:21 +08:00
|
|
|
const SIInstrInfo *TII,
|
|
|
|
const SIRegisterInfo *TRI,
|
|
|
|
SIMachineFunctionInfo *MFI,
|
|
|
|
MachineFunction &MF) const;
|
|
|
|
|
[AMDGPU] Add the adjusted FP as a livein register.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64145
llvm-svn: 366223
2019-07-16 23:57:12 +08:00
|
|
|
std::pair<unsigned, bool> getReservedPrivateSegmentWaveByteOffsetReg(
|
2019-06-06 06:20:47 +08:00
|
|
|
const GCNSubtarget &ST, const SIInstrInfo *TII, const SIRegisterInfo *TRI,
|
|
|
|
SIMachineFunctionInfo *MFI, MachineFunction &MF) const;
|
2016-09-01 05:52:21 +08:00
|
|
|
|
2017-09-29 17:49:35 +08:00
|
|
|
// Emit scratch setup code for AMDPAL or Mesa, assuming ResourceRegUsed is set.
|
2018-07-12 04:59:01 +08:00
|
|
|
void emitEntryFunctionScratchSetup(const GCNSubtarget &ST, MachineFunction &MF,
|
2017-09-29 17:49:35 +08:00
|
|
|
MachineBasicBlock &MBB, SIMachineFunctionInfo *MFI,
|
|
|
|
MachineBasicBlock::iterator I, unsigned PreloadedPrivateBufferReg,
|
|
|
|
unsigned ScratchRsrcReg) const;
|
|
|
|
|
2017-06-27 01:53:59 +08:00
|
|
|
public:
|
|
|
|
bool hasFP(const MachineFunction &MF) const override;
|
2015-11-07 02:17:45 +08:00
|
|
|
};
|
|
|
|
|
2016-12-10 06:06:55 +08:00
|
|
|
} // end namespace llvm
|
2015-11-07 02:17:45 +08:00
|
|
|
|
2016-12-10 06:06:55 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
|