Skip to content

Commit 1c601e3

Browse files
committed
fix z80 Target
1 parent 57e75e7 commit 1c601e3

23 files changed

+95
-76
lines changed

llvm/lib/Target/Z80/GISel/Z80CallLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/CodeGen/Analysis.h"
2424
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
2525
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
26+
#include "llvm/CodeGen/MachineFrameInfo.h"
2627
#include "llvm/Support/Debug.h"
2728
#include "llvm/Target/TargetMachine.h"
2829
using namespace llvm;

llvm/lib/Target/Z80/GISel/Z80InstructionSelector.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
2323
#include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
2424
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
25+
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
26+
#include "llvm/CodeGen/MachineFrameInfo.h"
2527
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2628
#include "llvm/Support/Debug.h"
2729

@@ -810,8 +812,8 @@ bool Z80InstructionSelector::selectLoadStore(MachineInstr &I,
810812
}
811813
}
812814

813-
I.RemoveOperand(1);
814-
I.RemoveOperand(0);
815+
I.removeOperand(1);
816+
I.removeOperand(0);
815817
MachineInstrBuilder MIB(MF, I);
816818
SmallVector<MachineOperand, 2> MOs;
817819
int32_t Off = 0;
@@ -976,7 +978,7 @@ bool Z80InstructionSelector::selectLoadStore(MachineInstr &I,
976978
MachineInstr &LoadMI = *MemMOs[1];
977979
LoadMI.setDesc(TII.get(TargetOpcode::IMPLICIT_DEF));
978980
while (LoadMI.getNumOperands() > 1)
979-
LoadMI.RemoveOperand(1);
981+
LoadMI.removeOperand(1);
980982
LoadMI.dropMemRefs(MF);
981983
}
982984
}
@@ -1012,7 +1014,7 @@ bool Z80InstructionSelector::selectFrameIndexOrGep(MachineInstr &I,
10121014
if (I.getOpcode() == TargetOpcode::G_PTR_ADD) {
10131015
auto OffConst = getIConstantVRegVal(I.getOperand(2).getReg(), MRI);
10141016
if (OffConst && OffConst->sge(-1) && OffConst->sle(1)) {
1015-
I.RemoveOperand(2);
1017+
I.removeOperand(2);
10161018
if (OffConst->isNullValue()) {
10171019
I.setDesc(TII.get(TargetOpcode::COPY));
10181020
return selectCopy(I, MRI);

llvm/lib/Target/Z80/GISel/Z80RegisterBankInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include "Z80RegisterBankInfo.h"
1414
#include "Z80RegisterInfo.h"
1515
#include "MCTargetDesc/Z80MCTargetDesc.h"
16-
#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
17-
#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
16+
#include "llvm/CodeGen/RegisterBankInfo.h"
1817
#include "llvm/CodeGen/MachineRegisterInfo.h"
1918
#include "llvm/CodeGen/TargetRegisterInfo.h"
2019

llvm/lib/Target/Z80/GISel/Z80RegisterBankInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_LIB_TARGET_Z80_Z80REGISTERBANKINFO_H
1414
#define LLVM_LIB_TARGET_Z80_Z80REGISTERBANKINFO_H
1515

16-
#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
16+
#include "llvm/CodeGen/RegisterBankInfo.h"
1717

1818
#define GET_REGBANK_DECLARATIONS
1919
#include "Z80GenRegisterBank.inc"

llvm/lib/Target/Z80/MCTargetDesc/EZ80InstPrinter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "Z80InstPrinterCommon.h"
1818

19+
#include <llvm/MC/MCRegister.h>
20+
1921
namespace llvm {
2022
class Z80EInstPrinter final : public Z80InstPrinterCommon {
2123
public:
@@ -27,10 +29,10 @@ namespace llvm {
2729
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
2830
void printInstruction(const MCInst *MI, uint64_t Address,
2931
raw_ostream &OS) override;
30-
static const char *getRegisterName(unsigned RegNo);
32+
static const char *getRegisterName(MCRegister Reg);
3133

32-
StringRef getRegName(unsigned RegNo) const override {
33-
return getRegisterName(RegNo);
34+
StringRef getRegName(MCRegister Reg) const override {
35+
return getRegisterName(Reg);
3436
}
3537
};
3638
}

llvm/lib/Target/Z80/MCTargetDesc/Z80InstPrinter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "Z80InstPrinterCommon.h"
1818

19+
#include "llvm/MC/MCRegister.h"
20+
1921
namespace llvm {
2022
class Z80InstPrinter final : public Z80InstPrinterCommon {
2123
public:
@@ -27,10 +29,10 @@ namespace llvm {
2729
std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
2830
void printInstruction(const MCInst *MI, uint64_t Address,
2931
raw_ostream &OS) override;
30-
static const char *getRegisterName(unsigned RegNo);
32+
static const char *getRegisterName(MCRegister Reg);
3133

32-
StringRef getRegName(unsigned RegNo) const override {
33-
return getRegisterName(RegNo);
34+
StringRef getRegName(MCRegister Reg) const override {
35+
return getRegisterName(Reg);
3436
}
3537
};
3638
}

llvm/lib/Target/Z80/MCTargetDesc/Z80InstPrinterCommon.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
#include "Z80InstPrinter.h"
1717
#include "llvm/MC/MCExpr.h"
1818
#include "llvm/MC/MCInst.h"
19+
#include "llvm/MC/MCRegister.h"
1920
#include "llvm/Support/CommandLine.h"
2021
#include "llvm/Support/ErrorHandling.h"
2122
#include "llvm/Support/FormattedStream.h"
23+
2224
using namespace llvm;
2325

2426
#define DEBUG_TYPE "asm-printer"
@@ -60,8 +62,8 @@ bool Z80InstPrinterCommon::applyTargetSpecificCLOption(StringRef Opt) {
6062
return false;
6163
}
6264

63-
void Z80InstPrinterCommon::printRegName(raw_ostream &OS, unsigned RegNo) const {
64-
OS << markup("<reg:") << getRegName(RegNo) << markup(">");
65+
void Z80InstPrinterCommon::printRegName(raw_ostream &OS, MCRegister Reg) const {
66+
OS << markup("<reg:") << getRegName(Reg) << markup(">");
6567
}
6668

6769
void Z80InstPrinterCommon::printInst(const MCInst *MI, uint64_t Address,

llvm/lib/Target/Z80/MCTargetDesc/Z80InstPrinterCommon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class Z80InstPrinterCommon : public MCInstPrinter {
2525

2626
bool applyTargetSpecificCLOption(StringRef Opt) override;
2727

28-
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
28+
void printRegName(raw_ostream &OS, MCRegister Reg) const override;
2929
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
3030
const MCSubtargetInfo &STI, raw_ostream &OS) override;
3131

3232
// Autogenerated by tblgen.
3333
virtual void printInstruction(const MCInst *MI, uint64_t Address,
3434
raw_ostream &OS) = 0;
35-
virtual StringRef getRegName(unsigned RegNo) const = 0;
35+
virtual StringRef getRegName(MCRegister Reg) const = 0;
3636

3737
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
3838
void printOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,

llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "llvm/MC/MCContext.h"
1616
#include "llvm/Support/FormattedStream.h"
1717

18+
#include <llvm/MC/MCSymbol.h>
19+
1820
using namespace llvm;
1921

2022
Z80TargetStreamer::Z80TargetStreamer(MCStreamer &S)

llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/Support/Alignment.h"
2121

2222
namespace llvm {
23+
class MCAsmInfo;
2324
class formatted_raw_ostream;
2425

2526
class Z80TargetStreamer : public MCTargetStreamer {

0 commit comments

Comments
 (0)