[llvm] r365516 - [unittest] Add bogus register info.
Michael Liao via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 10:19:01 PDT 2019
Author: hliao
Date: Tue Jul 9 10:19:01 2019
New Revision: 365516
URL: http://llvm.org/viewvc/llvm-project?rev=365516&view=rev
Log:
[unittest] Add bogus register info.
Reviewers: dstenb
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64421
Modified:
llvm/trunk/unittests/CodeGen/MachineInstrTest.cpp
Modified: llvm/trunk/unittests/CodeGen/MachineInstrTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/MachineInstrTest.cpp?rev=365516&r1=365515&r2=365516&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/MachineInstrTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/MachineInstrTest.cpp Tue Jul 9 10:19:01 2019
@@ -44,6 +44,55 @@ public:
bool hasFP(const MachineFunction &MF) const override { return false; }
};
+static TargetRegisterClass *const BogusRegisterClasses[] = {nullptr};
+
+class BogusRegisterInfo : public TargetRegisterInfo {
+public:
+ BogusRegisterInfo()
+ : TargetRegisterInfo(nullptr, BogusRegisterClasses, BogusRegisterClasses,
+ nullptr, nullptr, LaneBitmask(~0u), nullptr) {}
+
+ const MCPhysReg *
+ getCalleeSavedRegs(const MachineFunction *MF) const override {
+ return nullptr;
+ }
+ ArrayRef<const uint32_t *> getRegMasks() const override { return None; }
+ ArrayRef<const char *> getRegMaskNames() const override { return None; }
+ BitVector getReservedRegs(const MachineFunction &MF) const override {
+ return BitVector();
+ }
+ const RegClassWeight &
+ getRegClassWeight(const TargetRegisterClass *RC) const override {
+ static RegClassWeight Bogus{1, 16};
+ return Bogus;
+ }
+ unsigned getRegUnitWeight(unsigned RegUnit) const override { return 1; }
+ unsigned getNumRegPressureSets() const override { return 0; }
+ const char *getRegPressureSetName(unsigned Idx) const override {
+ return "bogus";
+ }
+ unsigned getRegPressureSetLimit(const MachineFunction &MF,
+ unsigned Idx) const override {
+ return 0;
+ }
+ const int *
+ getRegClassPressureSets(const TargetRegisterClass *RC) const override {
+ static const int Bogus[] = {0, -1};
+ return &Bogus[0];
+ }
+ const int *getRegUnitPressureSets(unsigned RegUnit) const override {
+ static const int Bogus[] = {0, -1};
+ return &Bogus[0];
+ }
+
+ Register getFrameRegister(const MachineFunction &MF) const override {
+ return 0;
+ }
+ void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
+ unsigned FIOperandNum,
+ RegScavenger *RS = nullptr) const override {}
+};
+
class BogusSubtarget : public TargetSubtargetInfo {
public:
BogusSubtarget(TargetMachine &TM)
@@ -58,8 +107,11 @@ public:
const TargetInstrInfo *getInstrInfo() const override { return &TII; }
+ const TargetRegisterInfo *getRegisterInfo() const override { return &TRI; }
+
private:
BogusFrameLowering FL;
+ BogusRegisterInfo TRI;
BogusTargetLowering TL;
TargetInstrInfo TII;
};
More information about the llvm-commits
mailing list