Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/RISCV/RISCVFrameLowering.h
//===-- RISCVFrameLowering.h - Define frame lowering for RISCV -*- C++ -*--===// | //===-- RISCVFrameLowering.h - Define frame lowering for RISCV -*- C++ -*--===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// This class implements RISCV-specific bits of TargetFrameLowering class. | // This class implements RISCV-specific bits of TargetFrameLowering class. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H | #ifndef LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H | ||||
#define LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H | #define LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H | ||||
#include "llvm/ADT/Optional.h" | |||||
#include "llvm/CodeGen/TargetFrameLowering.h" | #include "llvm/CodeGen/TargetFrameLowering.h" | ||||
namespace llvm { | namespace llvm { | ||||
class RISCVSubtarget; | class RISCVSubtarget; | ||||
class RISCVFrameLowering : public TargetFrameLowering { | class RISCVFrameLowering : public TargetFrameLowering { | ||||
public: | public: | ||||
explicit RISCVFrameLowering(const RISCVSubtarget &STI) | explicit RISCVFrameLowering(const RISCVSubtarget &STI) | ||||
Show All 27 Lines | bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, | ||||
ArrayRef<CalleeSavedInfo> CSI, | ArrayRef<CalleeSavedInfo> CSI, | ||||
const TargetRegisterInfo *TRI) const override; | const TargetRegisterInfo *TRI) const override; | ||||
bool | bool | ||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB, | restoreCalleeSavedRegisters(MachineBasicBlock &MBB, | ||||
MachineBasicBlock::iterator MI, | MachineBasicBlock::iterator MI, | ||||
MutableArrayRef<CalleeSavedInfo> CSI, | MutableArrayRef<CalleeSavedInfo> CSI, | ||||
const TargetRegisterInfo *TRI) const override; | const TargetRegisterInfo *TRI) const override; | ||||
// Get the first stack adjustment amount for SplitSPAdjust. | /** | ||||
asb: Should use a C++ style comment | |||||
lenaryUnsubmitted Actually I want to keep this as a doc comment, given it's in the header. lenary: Actually I want to keep this as a doc comment, given it's in the header. | |||||
jrtc27Unsubmitted So /// then? jrtc27: So `///` then? | |||||
lenaryUnsubmitted Ah, I didn't realise LLVM had a preference, because there are both styles in the repository. lenary: Ah, I didn't realise LLVM had a preference, because there are both styles in the repository. | |||||
// Return 0 if we don't want to to split the SP adjustment in prologue and | * Returns if we want to adjust the SP in two adjustments in the prolog and | ||||
asbUnsubmitted Nit: LLVM seems to mostly use prologue and epilogue spellings asb: Nit: LLVM seems to mostly use prologue and epilogue spellings | |||||
// epilogue. | * epilog, or keep it as just one. | ||||
uint64_t getFirstSPAdjustAmount(const MachineFunction &MF) const; | * | ||||
* The result will be `None` if the SP adjustment should not be split, or an | |||||
* optional containing the first SP adjustment amount if it should be split. | |||||
asbUnsubmitted Nit: optional => Opetional asb: Nit: optional => Opetional | |||||
asbUnsubmitted Oh dear, I managed to typo my suggested correction! optional => Optional asb: Oh dear, I managed to typo my suggested correction!
optional => Optional | |||||
*/ | |||||
Optional<uint64_t> | |||||
getFirstSPAdjustmentAmount(const MachineFunction &MF) const; | |||||
bool canUseAsPrologue(const MachineBasicBlock &MBB) const override; | bool canUseAsPrologue(const MachineBasicBlock &MBB) const override; | ||||
bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override; | bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override; | ||||
protected: | protected: | ||||
const RISCVSubtarget &STI; | const RISCVSubtarget &STI; | ||||
private: | private: | ||||
void determineFrameLayout(MachineFunction &MF) const; | void determineFrameLayout(MachineFunction &MF) const; | ||||
void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, | void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, | ||||
const DebugLoc &DL, Register DestReg, Register SrcReg, | const DebugLoc &DL, Register DestReg, Register SrcReg, | ||||
int64_t Val, MachineInstr::MIFlag Flag) const; | int64_t Val, MachineInstr::MIFlag Flag) const; | ||||
}; | }; | ||||
} | } | ||||
#endif | #endif |
Should use a C++ style comment