diff options
author | Lu Weining <luweining@loongson.cn> | 2022-02-10 09:14:18 +0000 |
---|---|---|
committer | Renato Golin <rengolin@systemcall.eu> | 2022-02-10 10:23:34 +0000 |
commit | 33388ae866cf76065b56490a8bafa676152b97f3 (patch) | |
tree | b164a62dc6e100c4ef2045449ce9a2def6c301a3 /llvm/lib/Target/LoongArch/LoongArchFrameLowering.h | |
parent | 444c6d261a913bc4f05ac166357af8afa584da73 (diff) | |
download | llvm-33388ae866cf76065b56490a8bafa676152b97f3.zip llvm-33388ae866cf76065b56490a8bafa676152b97f3.tar.gz llvm-33388ae866cf76065b56490a8bafa676152b97f3.tar.bz2 |
[LoongArch 4/6] Add basic tablegen infra for LoongArch
This patch introduces basic tablegen infra such as
LoongArch{InstrFormats,InstrInfo,RegisterInfo,CallingConv,}.td.
For now, only add instruction definitions for LoongArch basic integer
operations.
Our initial target is a working MC layer rather than codegen,
so appropriate SelectionDAG patterns will come later.
Differential revision: https://reviews.llvm.org/D115861
Diffstat (limited to 'llvm/lib/Target/LoongArch/LoongArchFrameLowering.h')
-rw-r--r-- | llvm/lib/Target/LoongArch/LoongArchFrameLowering.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/Target/LoongArch/LoongArchFrameLowering.h b/llvm/lib/Target/LoongArch/LoongArchFrameLowering.h new file mode 100644 index 0000000..25c53efc --- /dev/null +++ b/llvm/lib/Target/LoongArch/LoongArchFrameLowering.h @@ -0,0 +1,38 @@ +//=- LoongArchFrameLowering.h - TargetFrameLowering for LoongArch -*- C++ -*--// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// This class implements LoongArch-specific bits of TargetFrameLowering class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H +#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H + +#include "llvm/CodeGen/TargetFrameLowering.h" + +namespace llvm { +class LoongArchSubtarget; + +class LoongArchFrameLowering : public TargetFrameLowering { + const LoongArchSubtarget &STI; + +public: + explicit LoongArchFrameLowering(const LoongArchSubtarget &STI) + : TargetFrameLowering(StackGrowsDown, + /*StackAlignment=*/Align(16), + /*LocalAreaOffset=*/0), + STI(STI) {} + + void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; + void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; + + bool hasFP(const MachineFunction &MF) const override; + bool hasBP(const MachineFunction &MF) const; +}; +} // namespace llvm +#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H |