forked from OSchip/llvm-project
[SystemZ] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 292983
This commit is contained in:
parent
7aad8fd8f4
commit
3943d2b0d7
|
@ -7,12 +7,16 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
||||||
#include "SystemZ.h"
|
#include "SystemZ.h"
|
||||||
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
|
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
|
||||||
#include "llvm/MC/MCFixedLenDisassembler.h"
|
#include "llvm/MC/MCFixedLenDisassembler.h"
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
#include "llvm/MC/MCSubtargetInfo.h"
|
#include "llvm/MC/MCSubtargetInfo.h"
|
||||||
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -21,17 +25,19 @@ using namespace llvm;
|
||||||
typedef MCDisassembler::DecodeStatus DecodeStatus;
|
typedef MCDisassembler::DecodeStatus DecodeStatus;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class SystemZDisassembler : public MCDisassembler {
|
class SystemZDisassembler : public MCDisassembler {
|
||||||
public:
|
public:
|
||||||
SystemZDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
|
SystemZDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
|
||||||
: MCDisassembler(STI, Ctx) {}
|
: MCDisassembler(STI, Ctx) {}
|
||||||
~SystemZDisassembler() override {}
|
~SystemZDisassembler() override = default;
|
||||||
|
|
||||||
DecodeStatus getInstruction(MCInst &instr, uint64_t &Size,
|
DecodeStatus getInstruction(MCInst &instr, uint64_t &Size,
|
||||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||||
raw_ostream &VStream,
|
raw_ostream &VStream,
|
||||||
raw_ostream &CStream) const override;
|
raw_ostream &CStream) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
static MCDisassembler *createSystemZDisassembler(const Target &T,
|
static MCDisassembler *createSystemZDisassembler(const Target &T,
|
||||||
|
|
|
@ -11,20 +11,28 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
|
||||||
#include "MCTargetDesc/SystemZMCFixups.h"
|
#include "MCTargetDesc/SystemZMCFixups.h"
|
||||||
|
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/MC/MCCodeEmitter.h"
|
#include "llvm/MC/MCCodeEmitter.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCExpr.h"
|
#include "llvm/MC/MCExpr.h"
|
||||||
|
#include "llvm/MC/MCFixup.h"
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
#include "llvm/MC/MCInstrInfo.h"
|
#include "llvm/MC/MCInstrInfo.h"
|
||||||
#include "llvm/MC/MCRegisterInfo.h"
|
#include "llvm/MC/MCRegisterInfo.h"
|
||||||
|
#include "llvm/MC/MCSubtargetInfo.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
#define DEBUG_TYPE "mccodeemitter"
|
#define DEBUG_TYPE "mccodeemitter"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class SystemZMCCodeEmitter : public MCCodeEmitter {
|
class SystemZMCCodeEmitter : public MCCodeEmitter {
|
||||||
const MCInstrInfo &MCII;
|
const MCInstrInfo &MCII;
|
||||||
MCContext &Ctx;
|
MCContext &Ctx;
|
||||||
|
@ -34,7 +42,7 @@ public:
|
||||||
: MCII(mcii), Ctx(ctx) {
|
: MCII(mcii), Ctx(ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~SystemZMCCodeEmitter() override {}
|
~SystemZMCCodeEmitter() override = default;
|
||||||
|
|
||||||
// OVerride MCCodeEmitter.
|
// OVerride MCCodeEmitter.
|
||||||
void encodeInstruction(const MCInst &MI, raw_ostream &OS,
|
void encodeInstruction(const MCInst &MI, raw_ostream &OS,
|
||||||
|
@ -137,13 +145,8 @@ private:
|
||||||
void verifyInstructionPredicates(const MCInst &MI,
|
void verifyInstructionPredicates(const MCInst &MI,
|
||||||
uint64_t AvailableFeatures) const;
|
uint64_t AvailableFeatures) const;
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
MCCodeEmitter *llvm::createSystemZMCCodeEmitter(const MCInstrInfo &MCII,
|
} // end anonymous namespace
|
||||||
const MCRegisterInfo &MRI,
|
|
||||||
MCContext &Ctx) {
|
|
||||||
return new SystemZMCCodeEmitter(MCII, Ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemZMCCodeEmitter::
|
void SystemZMCCodeEmitter::
|
||||||
encodeInstruction(const MCInst &MI, raw_ostream &OS,
|
encodeInstruction(const MCInst &MI, raw_ostream &OS,
|
||||||
|
@ -282,3 +285,9 @@ SystemZMCCodeEmitter::getPCRelEncoding(const MCInst &MI, unsigned OpNum,
|
||||||
|
|
||||||
#define ENABLE_INSTR_PREDICATE_VERIFIER
|
#define ENABLE_INSTR_PREDICATE_VERIFIER
|
||||||
#include "SystemZGenMCCodeEmitter.inc"
|
#include "SystemZGenMCCodeEmitter.inc"
|
||||||
|
|
||||||
|
MCCodeEmitter *llvm::createSystemZMCCodeEmitter(const MCInstrInfo &MCII,
|
||||||
|
const MCRegisterInfo &MRI,
|
||||||
|
MCContext &Ctx) {
|
||||||
|
return new SystemZMCCodeEmitter(MCII, Ctx);
|
||||||
|
}
|
||||||
|
|
|
@ -7,35 +7,38 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
|
||||||
#include "MCTargetDesc/SystemZMCFixups.h"
|
#include "MCTargetDesc/SystemZMCFixups.h"
|
||||||
|
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
||||||
#include "llvm/MC/MCELFObjectWriter.h"
|
#include "llvm/MC/MCELFObjectWriter.h"
|
||||||
#include "llvm/MC/MCExpr.h"
|
#include "llvm/MC/MCExpr.h"
|
||||||
|
#include "llvm/MC/MCFixup.h"
|
||||||
#include "llvm/MC/MCValue.h"
|
#include "llvm/MC/MCValue.h"
|
||||||
|
#include "llvm/Support/ELF.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class SystemZObjectWriter : public MCELFObjectTargetWriter {
|
class SystemZObjectWriter : public MCELFObjectTargetWriter {
|
||||||
public:
|
public:
|
||||||
SystemZObjectWriter(uint8_t OSABI);
|
SystemZObjectWriter(uint8_t OSABI);
|
||||||
|
~SystemZObjectWriter() override = default;
|
||||||
~SystemZObjectWriter() override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Override MCELFObjectTargetWriter.
|
// Override MCELFObjectTargetWriter.
|
||||||
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
|
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
|
||||||
const MCFixup &Fixup, bool IsPCRel) const override;
|
const MCFixup &Fixup, bool IsPCRel) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
SystemZObjectWriter::SystemZObjectWriter(uint8_t OSABI)
|
SystemZObjectWriter::SystemZObjectWriter(uint8_t OSABI)
|
||||||
: MCELFObjectTargetWriter(/*Is64Bit=*/true, OSABI, ELF::EM_S390,
|
: MCELFObjectTargetWriter(/*Is64Bit=*/true, OSABI, ELF::EM_S390,
|
||||||
/*HasRelocationAddend=*/ true) {}
|
/*HasRelocationAddend=*/ true) {}
|
||||||
|
|
||||||
SystemZObjectWriter::~SystemZObjectWriter() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the relocation type for an absolute value of MCFixupKind Kind.
|
// Return the relocation type for an absolute value of MCFixupKind Kind.
|
||||||
static unsigned getAbsoluteReloc(unsigned Kind) {
|
static unsigned getAbsoluteReloc(unsigned Kind) {
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
|
|
|
@ -13,15 +13,23 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "SystemZ.h"
|
||||||
|
#include "SystemZInstrInfo.h"
|
||||||
#include "SystemZTargetMachine.h"
|
#include "SystemZTargetMachine.h"
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/CodeGen/MachineOperand.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/MC/MCInstrDesc.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
|
||||||
#include "llvm/Target/TargetMachine.h"
|
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -33,11 +41,11 @@ STATISTIC(EliminatedComparisons, "Number of eliminated comparisons");
|
||||||
STATISTIC(FusedComparisons, "Number of fused compare-and-branch instructions");
|
STATISTIC(FusedComparisons, "Number of fused compare-and-branch instructions");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Represents the references to a particular register in one or more
|
// Represents the references to a particular register in one or more
|
||||||
// instructions.
|
// instructions.
|
||||||
struct Reference {
|
struct Reference {
|
||||||
Reference()
|
Reference() = default;
|
||||||
: Def(false), Use(false) {}
|
|
||||||
|
|
||||||
Reference &operator|=(const Reference &Other) {
|
Reference &operator|=(const Reference &Other) {
|
||||||
Def |= Other.Def;
|
Def |= Other.Def;
|
||||||
|
@ -49,15 +57,16 @@ struct Reference {
|
||||||
|
|
||||||
// True if the register is defined or used in some form, either directly or
|
// True if the register is defined or used in some form, either directly or
|
||||||
// via a sub- or super-register.
|
// via a sub- or super-register.
|
||||||
bool Def;
|
bool Def = false;
|
||||||
bool Use;
|
bool Use = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemZElimCompare : public MachineFunctionPass {
|
class SystemZElimCompare : public MachineFunctionPass {
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
SystemZElimCompare(const SystemZTargetMachine &tm)
|
SystemZElimCompare(const SystemZTargetMachine &tm)
|
||||||
: MachineFunctionPass(ID), TII(nullptr), TRI(nullptr) {}
|
: MachineFunctionPass(ID) {}
|
||||||
|
|
||||||
StringRef getPassName() const override {
|
StringRef getPassName() const override {
|
||||||
return "SystemZ Comparison Elimination";
|
return "SystemZ Comparison Elimination";
|
||||||
|
@ -65,6 +74,7 @@ public:
|
||||||
|
|
||||||
bool processBlock(MachineBasicBlock &MBB);
|
bool processBlock(MachineBasicBlock &MBB);
|
||||||
bool runOnMachineFunction(MachineFunction &F) override;
|
bool runOnMachineFunction(MachineFunction &F) override;
|
||||||
|
|
||||||
MachineFunctionProperties getRequiredProperties() const override {
|
MachineFunctionProperties getRequiredProperties() const override {
|
||||||
return MachineFunctionProperties().set(
|
return MachineFunctionProperties().set(
|
||||||
MachineFunctionProperties::Property::NoVRegs);
|
MachineFunctionProperties::Property::NoVRegs);
|
||||||
|
@ -84,16 +94,13 @@ private:
|
||||||
bool fuseCompareOperations(MachineInstr &Compare,
|
bool fuseCompareOperations(MachineInstr &Compare,
|
||||||
SmallVectorImpl<MachineInstr *> &CCUsers);
|
SmallVectorImpl<MachineInstr *> &CCUsers);
|
||||||
|
|
||||||
const SystemZInstrInfo *TII;
|
const SystemZInstrInfo *TII = nullptr;
|
||||||
const TargetRegisterInfo *TRI;
|
const TargetRegisterInfo *TRI = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
char SystemZElimCompare::ID = 0;
|
char SystemZElimCompare::ID = 0;
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
FunctionPass *llvm::createSystemZElimComparePass(SystemZTargetMachine &TM) {
|
} // end anonymous namespace
|
||||||
return new SystemZElimCompare(TM);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return true if CC is live out of MBB.
|
// Return true if CC is live out of MBB.
|
||||||
static bool isCCLiveOut(MachineBasicBlock &MBB) {
|
static bool isCCLiveOut(MachineBasicBlock &MBB) {
|
||||||
|
@ -366,10 +373,8 @@ static bool isCompareZero(MachineInstr &Compare) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
if (isLoadAndTestAsCmp(Compare))
|
if (isLoadAndTestAsCmp(Compare))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return Compare.getNumExplicitOperands() == 2 &&
|
return Compare.getNumExplicitOperands() == 2 &&
|
||||||
Compare.getOperand(1).isImm() && Compare.getOperand(1).getImm() == 0;
|
Compare.getOperand(1).isImm() && Compare.getOperand(1).getImm() == 0;
|
||||||
}
|
}
|
||||||
|
@ -571,3 +576,7 @@ bool SystemZElimCompare::runOnMachineFunction(MachineFunction &F) {
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FunctionPass *llvm::createSystemZElimComparePass(SystemZTargetMachine &TM) {
|
||||||
|
return new SystemZElimCompare(TM);
|
||||||
|
}
|
||||||
|
|
|
@ -11,12 +11,34 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "SystemZInstrInfo.h"
|
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
||||||
|
#include "SystemZ.h"
|
||||||
#include "SystemZInstrBuilder.h"
|
#include "SystemZInstrBuilder.h"
|
||||||
#include "SystemZTargetMachine.h"
|
#include "SystemZInstrInfo.h"
|
||||||
#include "llvm/CodeGen/LiveVariables.h"
|
#include "SystemZSubtarget.h"
|
||||||
|
#include "llvm/CodeGen/LiveInterval.h"
|
||||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||||
|
#include "llvm/CodeGen/LiveVariables.h"
|
||||||
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||||
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
|
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||||
|
#include "llvm/CodeGen/MachineOperand.h"
|
||||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||||
|
#include "llvm/CodeGen/SlotIndexes.h"
|
||||||
|
#include "llvm/MC/MCInstrDesc.h"
|
||||||
|
#include "llvm/MC/MCRegisterInfo.h"
|
||||||
|
#include "llvm/Support/BranchProbability.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/MathExtras.h"
|
||||||
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -255,7 +277,6 @@ void SystemZInstrInfo::emitGRX32Move(MachineBasicBlock &MBB,
|
||||||
.addImm(32 - Size).addImm(128 + 31).addImm(Rotate);
|
.addImm(32 - Size).addImm(128 + 31).addImm(Rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MachineInstr *SystemZInstrInfo::commuteInstructionImpl(MachineInstr &MI,
|
MachineInstr *SystemZInstrInfo::commuteInstructionImpl(MachineInstr &MI,
|
||||||
bool NewMI,
|
bool NewMI,
|
||||||
unsigned OpIdx1,
|
unsigned OpIdx1,
|
||||||
|
@ -284,7 +305,6 @@ MachineInstr *SystemZInstrInfo::commuteInstructionImpl(MachineInstr &MI,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If MI is a simple load or store for a frame object, return the register
|
// If MI is a simple load or store for a frame object, return the register
|
||||||
// it loads or stores and set FrameIndex to the index of the frame object.
|
// it loads or stores and set FrameIndex to the index of the frame object.
|
||||||
// Return 0 otherwise.
|
// Return 0 otherwise.
|
||||||
|
@ -588,7 +608,6 @@ bool SystemZInstrInfo::optimizeCompareInstr(
|
||||||
removeIPMBasedCompare(Compare, SrcReg, MRI, &RI);
|
removeIPMBasedCompare(Compare, SrcReg, MRI, &RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SystemZInstrInfo::canInsertSelect(const MachineBasicBlock &MBB,
|
bool SystemZInstrInfo::canInsertSelect(const MachineBasicBlock &MBB,
|
||||||
ArrayRef<MachineOperand> Pred,
|
ArrayRef<MachineOperand> Pred,
|
||||||
unsigned TrueReg, unsigned FalseReg,
|
unsigned TrueReg, unsigned FalseReg,
|
||||||
|
@ -892,15 +911,19 @@ static bool isSimpleBD12Move(const MachineInstr *MI, unsigned Flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct LogicOp {
|
struct LogicOp {
|
||||||
LogicOp() : RegSize(0), ImmLSB(0), ImmSize(0) {}
|
LogicOp() = default;
|
||||||
LogicOp(unsigned regSize, unsigned immLSB, unsigned immSize)
|
LogicOp(unsigned regSize, unsigned immLSB, unsigned immSize)
|
||||||
: RegSize(regSize), ImmLSB(immLSB), ImmSize(immSize) {}
|
: RegSize(regSize), ImmLSB(immLSB), ImmSize(immSize) {}
|
||||||
|
|
||||||
explicit operator bool() const { return RegSize; }
|
explicit operator bool() const { return RegSize; }
|
||||||
|
|
||||||
unsigned RegSize, ImmLSB, ImmSize;
|
unsigned RegSize = 0;
|
||||||
|
unsigned ImmLSB = 0;
|
||||||
|
unsigned ImmSize = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
static LogicOp interpretAndImmediate(unsigned Opcode) {
|
static LogicOp interpretAndImmediate(unsigned Opcode) {
|
||||||
|
|
|
@ -16,16 +16,21 @@
|
||||||
|
|
||||||
#include "SystemZ.h"
|
#include "SystemZ.h"
|
||||||
#include "SystemZRegisterInfo.h"
|
#include "SystemZRegisterInfo.h"
|
||||||
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#define GET_INSTRINFO_HEADER
|
#define GET_INSTRINFO_HEADER
|
||||||
#include "SystemZGenInstrInfo.inc"
|
#include "SystemZGenInstrInfo.inc"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class SystemZTargetMachine;
|
class SystemZSubtarget;
|
||||||
|
|
||||||
namespace SystemZII {
|
namespace SystemZII {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
// See comments in SystemZInstrFormats.td.
|
// See comments in SystemZInstrFormats.td.
|
||||||
SimpleBDXLoad = (1 << 0),
|
SimpleBDXLoad = (1 << 0),
|
||||||
|
@ -43,12 +48,15 @@ enum {
|
||||||
CCMaskLast = (1 << 19),
|
CCMaskLast = (1 << 19),
|
||||||
IsLogical = (1 << 20)
|
IsLogical = (1 << 20)
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline unsigned getAccessSize(unsigned int Flags) {
|
static inline unsigned getAccessSize(unsigned int Flags) {
|
||||||
return (Flags & AccessSizeMask) >> AccessSizeShift;
|
return (Flags & AccessSizeMask) >> AccessSizeShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned getCCValues(unsigned int Flags) {
|
static inline unsigned getCCValues(unsigned int Flags) {
|
||||||
return (Flags & CCValuesMask) >> CCValuesShift;
|
return (Flags & CCValuesMask) >> CCValuesShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned getCompareZeroCCMask(unsigned int Flags) {
|
static inline unsigned getCompareZeroCCMask(unsigned int Flags) {
|
||||||
return (Flags & CompareZeroCCMaskMask) >> CompareZeroCCMaskShift;
|
return (Flags & CompareZeroCCMaskMask) >> CompareZeroCCMaskShift;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +72,7 @@ enum {
|
||||||
// @INDNTPOFF
|
// @INDNTPOFF
|
||||||
MO_INDNTPOFF = (2 << 0)
|
MO_INDNTPOFF = (2 << 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Classifies a branch.
|
// Classifies a branch.
|
||||||
enum BranchType {
|
enum BranchType {
|
||||||
// An instruction that branches on the current value of CC.
|
// An instruction that branches on the current value of CC.
|
||||||
|
@ -93,6 +102,7 @@ enum BranchType {
|
||||||
// the result is nonzero.
|
// the result is nonzero.
|
||||||
BranchCTG
|
BranchCTG
|
||||||
};
|
};
|
||||||
|
|
||||||
// Information about a branch instruction.
|
// Information about a branch instruction.
|
||||||
struct Branch {
|
struct Branch {
|
||||||
// The type of the branch.
|
// The type of the branch.
|
||||||
|
@ -111,6 +121,7 @@ struct Branch {
|
||||||
const MachineOperand *target)
|
const MachineOperand *target)
|
||||||
: Type(type), CCValid(ccValid), CCMask(ccMask), Target(target) {}
|
: Type(type), CCValid(ccValid), CCMask(ccMask), Target(target) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Kinds of fused compares in compare-and-* instructions. Together with type
|
// Kinds of fused compares in compare-and-* instructions. Together with type
|
||||||
// of the converted compare, this identifies the compare-and-*
|
// of the converted compare, this identifies the compare-and-*
|
||||||
// instruction.
|
// instruction.
|
||||||
|
@ -127,9 +138,9 @@ enum FusedCompareType {
|
||||||
// Trap
|
// Trap
|
||||||
CompareAndTrap
|
CompareAndTrap
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace SystemZII
|
} // end namespace SystemZII
|
||||||
|
|
||||||
class SystemZSubtarget;
|
|
||||||
class SystemZInstrInfo : public SystemZGenInstrInfo {
|
class SystemZInstrInfo : public SystemZGenInstrInfo {
|
||||||
const SystemZRegisterInfo RI;
|
const SystemZRegisterInfo RI;
|
||||||
SystemZSubtarget &STI;
|
SystemZSubtarget &STI;
|
||||||
|
@ -305,6 +316,7 @@ public:
|
||||||
areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
|
areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
|
||||||
AliasAnalysis *AA = nullptr) const override;
|
AliasAnalysis *AA = nullptr) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRINFO_H
|
||||||
|
|
|
@ -53,15 +53,21 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "SystemZ.h"
|
||||||
|
#include "SystemZInstrInfo.h"
|
||||||
#include "SystemZTargetMachine.h"
|
#include "SystemZTargetMachine.h"
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/DebugLoc.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include <cassert>
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include <cstdint>
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -70,72 +76,72 @@ using namespace llvm;
|
||||||
STATISTIC(LongBranches, "Number of long branches.");
|
STATISTIC(LongBranches, "Number of long branches.");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Represents positional information about a basic block.
|
// Represents positional information about a basic block.
|
||||||
struct MBBInfo {
|
struct MBBInfo {
|
||||||
// The address that we currently assume the block has.
|
// The address that we currently assume the block has.
|
||||||
uint64_t Address;
|
uint64_t Address = 0;
|
||||||
|
|
||||||
// The size of the block in bytes, excluding terminators.
|
// The size of the block in bytes, excluding terminators.
|
||||||
// This value never changes.
|
// This value never changes.
|
||||||
uint64_t Size;
|
uint64_t Size = 0;
|
||||||
|
|
||||||
// The minimum alignment of the block, as a log2 value.
|
// The minimum alignment of the block, as a log2 value.
|
||||||
// This value never changes.
|
// This value never changes.
|
||||||
unsigned Alignment;
|
unsigned Alignment = 0;
|
||||||
|
|
||||||
// The number of terminators in this block. This value never changes.
|
// The number of terminators in this block. This value never changes.
|
||||||
unsigned NumTerminators;
|
unsigned NumTerminators = 0;
|
||||||
|
|
||||||
MBBInfo()
|
MBBInfo() = default;
|
||||||
: Address(0), Size(0), Alignment(0), NumTerminators(0) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Represents the state of a block terminator.
|
// Represents the state of a block terminator.
|
||||||
struct TerminatorInfo {
|
struct TerminatorInfo {
|
||||||
// If this terminator is a relaxable branch, this points to the branch
|
// If this terminator is a relaxable branch, this points to the branch
|
||||||
// instruction, otherwise it is null.
|
// instruction, otherwise it is null.
|
||||||
MachineInstr *Branch;
|
MachineInstr *Branch = nullptr;
|
||||||
|
|
||||||
// The address that we currently assume the terminator has.
|
// The address that we currently assume the terminator has.
|
||||||
uint64_t Address;
|
uint64_t Address = 0;
|
||||||
|
|
||||||
// The current size of the terminator in bytes.
|
// The current size of the terminator in bytes.
|
||||||
uint64_t Size;
|
uint64_t Size = 0;
|
||||||
|
|
||||||
// If Branch is nonnull, this is the number of the target block,
|
// If Branch is nonnull, this is the number of the target block,
|
||||||
// otherwise it is unused.
|
// otherwise it is unused.
|
||||||
unsigned TargetBlock;
|
unsigned TargetBlock = 0;
|
||||||
|
|
||||||
// If Branch is nonnull, this is the length of the longest relaxed form,
|
// If Branch is nonnull, this is the length of the longest relaxed form,
|
||||||
// otherwise it is zero.
|
// otherwise it is zero.
|
||||||
unsigned ExtraRelaxSize;
|
unsigned ExtraRelaxSize = 0;
|
||||||
|
|
||||||
TerminatorInfo() : Branch(nullptr), Size(0), TargetBlock(0),
|
TerminatorInfo() = default;
|
||||||
ExtraRelaxSize(0) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used to keep track of the current position while iterating over the blocks.
|
// Used to keep track of the current position while iterating over the blocks.
|
||||||
struct BlockPosition {
|
struct BlockPosition {
|
||||||
// The address that we assume this position has.
|
// The address that we assume this position has.
|
||||||
uint64_t Address;
|
uint64_t Address = 0;
|
||||||
|
|
||||||
// The number of low bits in Address that are known to be the same
|
// The number of low bits in Address that are known to be the same
|
||||||
// as the runtime address.
|
// as the runtime address.
|
||||||
unsigned KnownBits;
|
unsigned KnownBits;
|
||||||
|
|
||||||
BlockPosition(unsigned InitialAlignment)
|
BlockPosition(unsigned InitialAlignment) : KnownBits(InitialAlignment) {}
|
||||||
: Address(0), KnownBits(InitialAlignment) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemZLongBranch : public MachineFunctionPass {
|
class SystemZLongBranch : public MachineFunctionPass {
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
SystemZLongBranch(const SystemZTargetMachine &tm)
|
SystemZLongBranch(const SystemZTargetMachine &tm)
|
||||||
: MachineFunctionPass(ID), TII(nullptr) {}
|
: MachineFunctionPass(ID) {}
|
||||||
|
|
||||||
StringRef getPassName() const override { return "SystemZ Long Branch"; }
|
StringRef getPassName() const override { return "SystemZ Long Branch"; }
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &F) override;
|
bool runOnMachineFunction(MachineFunction &F) override;
|
||||||
|
|
||||||
MachineFunctionProperties getRequiredProperties() const override {
|
MachineFunctionProperties getRequiredProperties() const override {
|
||||||
return MachineFunctionProperties().set(
|
return MachineFunctionProperties().set(
|
||||||
MachineFunctionProperties::Property::NoVRegs);
|
MachineFunctionProperties::Property::NoVRegs);
|
||||||
|
@ -155,7 +161,7 @@ private:
|
||||||
void relaxBranch(TerminatorInfo &Terminator);
|
void relaxBranch(TerminatorInfo &Terminator);
|
||||||
void relaxBranches();
|
void relaxBranches();
|
||||||
|
|
||||||
const SystemZInstrInfo *TII;
|
const SystemZInstrInfo *TII = nullptr;
|
||||||
MachineFunction *MF;
|
MachineFunction *MF;
|
||||||
SmallVector<MBBInfo, 16> MBBs;
|
SmallVector<MBBInfo, 16> MBBs;
|
||||||
SmallVector<TerminatorInfo, 16> Terminators;
|
SmallVector<TerminatorInfo, 16> Terminators;
|
||||||
|
@ -165,11 +171,8 @@ char SystemZLongBranch::ID = 0;
|
||||||
|
|
||||||
const uint64_t MaxBackwardRange = 0x10000;
|
const uint64_t MaxBackwardRange = 0x10000;
|
||||||
const uint64_t MaxForwardRange = 0xfffe;
|
const uint64_t MaxForwardRange = 0xfffe;
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
FunctionPass *llvm::createSystemZLongBranchPass(SystemZTargetMachine &TM) {
|
} // end anonymous namespace
|
||||||
return new SystemZLongBranch(TM);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Position describes the state immediately before Block. Update Block
|
// Position describes the state immediately before Block. Update Block
|
||||||
// accordingly and move Position to the end of the block's non-terminator
|
// accordingly and move Position to the end of the block's non-terminator
|
||||||
|
@ -463,3 +466,7 @@ bool SystemZLongBranch::runOnMachineFunction(MachineFunction &F) {
|
||||||
relaxBranches();
|
relaxBranches();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FunctionPass *llvm::createSystemZLongBranchPass(SystemZTargetMachine &TM) {
|
||||||
|
return new SystemZLongBranch(TM);
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//==-- SystemZMachineScheduler.h - SystemZ Scheduler Interface -*- C++ -*---==//
|
//==- SystemZMachineScheduler.h - SystemZ Scheduler Interface ----*- C++ -*-==//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
// usage of processor resources.
|
// usage of processor resources.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "SystemZInstrInfo.h"
|
|
||||||
#include "SystemZHazardRecognizer.h"
|
#include "SystemZHazardRecognizer.h"
|
||||||
#include "llvm/CodeGen/MachineScheduler.h"
|
#include "llvm/CodeGen/MachineScheduler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
||||||
#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
||||||
|
@ -32,22 +32,22 @@ class SystemZPostRASchedStrategy : public MachineSchedStrategy {
|
||||||
|
|
||||||
/// A candidate during instruction evaluation.
|
/// A candidate during instruction evaluation.
|
||||||
struct Candidate {
|
struct Candidate {
|
||||||
SUnit *SU;
|
SUnit *SU = nullptr;
|
||||||
|
|
||||||
/// The decoding cost.
|
/// The decoding cost.
|
||||||
int GroupingCost;
|
int GroupingCost = 0;
|
||||||
|
|
||||||
/// The processor resources cost.
|
/// The processor resources cost.
|
||||||
int ResourcesCost;
|
int ResourcesCost = 0;
|
||||||
|
|
||||||
Candidate() : SU(nullptr), GroupingCost(0), ResourcesCost(0) {}
|
Candidate() = default;
|
||||||
Candidate(SUnit *SU_, SystemZHazardRecognizer &HazardRec);
|
Candidate(SUnit *SU_, SystemZHazardRecognizer &HazardRec);
|
||||||
|
|
||||||
// Compare two candidates.
|
// Compare two candidates.
|
||||||
bool operator<(const Candidate &other);
|
bool operator<(const Candidate &other);
|
||||||
|
|
||||||
// Check if this node is free of cost ("as good as any").
|
// Check if this node is free of cost ("as good as any").
|
||||||
bool inline noCost() {
|
bool noCost() const {
|
||||||
return (GroupingCost <= 0 && !ResourcesCost);
|
return (GroupingCost <= 0 && !ResourcesCost);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -107,6 +107,6 @@ class SystemZPostRASchedStrategy : public MachineSchedStrategy {
|
||||||
void releaseBottomNode(SUnit *SU) override {};
|
void releaseBottomNode(SUnit *SU) override {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif /* LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H */
|
#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
||||||
|
|
|
@ -7,14 +7,25 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "MCTargetDesc/SystemZMCTargetDesc.h"
|
||||||
|
#include "SystemZ.h"
|
||||||
|
#include "SystemZMachineScheduler.h"
|
||||||
#include "SystemZTargetMachine.h"
|
#include "SystemZTargetMachine.h"
|
||||||
#include "SystemZTargetTransformInfo.h"
|
#include "SystemZTargetTransformInfo.h"
|
||||||
#include "SystemZMachineScheduler.h"
|
#include "llvm/ADT/Optional.h"
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
#include "llvm/CodeGen/Passes.h"
|
#include "llvm/CodeGen/Passes.h"
|
||||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
|
||||||
#include "llvm/Transforms/Scalar.h"
|
|
||||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||||
|
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||||
|
#include "llvm/IR/DataLayout.h"
|
||||||
|
#include "llvm/Support/CodeGen.h"
|
||||||
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
|
#include "llvm/Transforms/Scalar.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -48,7 +59,7 @@ static bool UsesVectorABI(StringRef CPU, StringRef FS) {
|
||||||
static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
||||||
StringRef FS) {
|
StringRef FS) {
|
||||||
bool VectorABI = UsesVectorABI(CPU, FS);
|
bool VectorABI = UsesVectorABI(CPU, FS);
|
||||||
std::string Ret = "";
|
std::string Ret;
|
||||||
|
|
||||||
// Big endian.
|
// Big endian.
|
||||||
Ret += "E";
|
Ret += "E";
|
||||||
|
@ -96,14 +107,15 @@ SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Triple &TT,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, FS), TT, CPU, FS, Options,
|
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, FS), TT, CPU, FS, Options,
|
||||||
getEffectiveRelocModel(RM), CM, OL),
|
getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
TLOF(llvm::make_unique<TargetLoweringObjectFileELF>()),
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemZTargetMachine::~SystemZTargetMachine() {}
|
SystemZTargetMachine::~SystemZTargetMachine() = default;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/// SystemZ Code Generator Pass Configuration Options.
|
/// SystemZ Code Generator Pass Configuration Options.
|
||||||
class SystemZPassConfig : public TargetPassConfig {
|
class SystemZPassConfig : public TargetPassConfig {
|
||||||
public:
|
public:
|
||||||
|
@ -116,7 +128,8 @@ public:
|
||||||
|
|
||||||
ScheduleDAGInstrs *
|
ScheduleDAGInstrs *
|
||||||
createPostMachineScheduler(MachineSchedContext *C) const override {
|
createPostMachineScheduler(MachineSchedContext *C) const override {
|
||||||
return new ScheduleDAGMI(C, make_unique<SystemZPostRASchedStrategy>(C),
|
return new ScheduleDAGMI(C,
|
||||||
|
llvm::make_unique<SystemZPostRASchedStrategy>(C),
|
||||||
/*RemoveKillFlags=*/true);
|
/*RemoveKillFlags=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +139,7 @@ public:
|
||||||
void addPreSched2() override;
|
void addPreSched2() override;
|
||||||
void addPreEmitPass() override;
|
void addPreEmitPass() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
void SystemZPassConfig::addIRPasses() {
|
void SystemZPassConfig::addIRPasses() {
|
||||||
|
@ -157,7 +171,6 @@ void SystemZPassConfig::addPreSched2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemZPassConfig::addPreEmitPass() {
|
void SystemZPassConfig::addPreEmitPass() {
|
||||||
|
|
||||||
// Do instruction shortening before compare elimination because some
|
// Do instruction shortening before compare elimination because some
|
||||||
// vector instructions will be shortened into opcodes that compare
|
// vector instructions will be shortened into opcodes that compare
|
||||||
// elimination recognizes.
|
// elimination recognizes.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//==- SystemZTargetMachine.h - Define TargetMachine for SystemZ ---*- C++ -*-=//
|
//=- SystemZTargetMachine.h - Define TargetMachine for SystemZ ----*- C++ -*-=//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -16,12 +16,15 @@
|
||||||
#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
|
#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
|
||||||
|
|
||||||
#include "SystemZSubtarget.h"
|
#include "SystemZSubtarget.h"
|
||||||
|
#include "llvm/ADT/Optional.h"
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
|
#include "llvm/Support/CodeGen.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class TargetFrameLowering;
|
|
||||||
|
|
||||||
class SystemZTargetMachine : public LLVMTargetMachine {
|
class SystemZTargetMachine : public LLVMTargetMachine {
|
||||||
std::unique_ptr<TargetLoweringObjectFile> TLOF;
|
std::unique_ptr<TargetLoweringObjectFile> TLOF;
|
||||||
SystemZSubtarget Subtarget;
|
SystemZSubtarget Subtarget;
|
||||||
|
@ -34,20 +37,22 @@ public:
|
||||||
~SystemZTargetMachine() override;
|
~SystemZTargetMachine() override;
|
||||||
|
|
||||||
const SystemZSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
const SystemZSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
||||||
|
|
||||||
const SystemZSubtarget *getSubtargetImpl(const Function &) const override {
|
const SystemZSubtarget *getSubtargetImpl(const Function &) const override {
|
||||||
return &Subtarget;
|
return &Subtarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override LLVMTargetMachine
|
// Override LLVMTargetMachine
|
||||||
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
||||||
TargetIRAnalysis getTargetIRAnalysis() override;
|
TargetIRAnalysis getTargetIRAnalysis() override;
|
||||||
|
|
||||||
TargetLoweringObjectFile *getObjFileLowering() const override {
|
TargetLoweringObjectFile *getObjFileLowering() const override {
|
||||||
return TLOF.get();
|
return TLOF.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool targetSchedulesPostRAScheduling() const override { return true; };
|
bool targetSchedulesPostRAScheduling() const override { return true; };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
|
||||||
|
|
Loading…
Reference in New Issue