[AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 289282
This commit is contained in:
Eugene Zelenko
2016-12-09 22:06:55 +00:00
parent 5e0bfa4a54
commit 2bc2f33ba2
16 changed files with 257 additions and 163 deletions

View File

@@ -10,23 +10,22 @@
// Interface to describe a layout of a stack frame on a AMDGPU target machine. // Interface to describe a layout of a stack frame on a AMDGPU target machine.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AMDGPUFrameLowering.h" #include "AMDGPUFrameLowering.h"
#include "AMDGPURegisterInfo.h" #include "AMDGPURegisterInfo.h"
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/Support/MathExtras.h"
#include "llvm/IR/Instructions.h"
using namespace llvm; using namespace llvm;
AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, unsigned StackAl, AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, unsigned StackAl,
int LAO, unsigned TransAl) int LAO, unsigned TransAl)
: TargetFrameLowering(D, StackAl, LAO, TransAl) { } : TargetFrameLowering(D, StackAl, LAO, TransAl) { }
AMDGPUFrameLowering::~AMDGPUFrameLowering() { } AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;
unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const { unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const {
// XXX: Hardcoding to 1 for now. // XXX: Hardcoding to 1 for now.
// //
// I think the StackWidth should stored as metadata associated with the // I think the StackWidth should stored as metadata associated with the
@@ -101,4 +100,3 @@ int AMDGPUFrameLowering::getFrameIndexReference(const MachineFunction &MF,
return OffsetBytes / (getStackWidth(MF) * 4); return OffsetBytes / (getStackWidth(MF) * 4);
} }

View File

@@ -11,6 +11,7 @@
/// \brief Interface to describe a layout of a stack frame on an AMDGPU target. /// \brief Interface to describe a layout of a stack frame on an AMDGPU target.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUFRAMELOWERING_H #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUFRAMELOWERING_H
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUFRAMELOWERING_H #define LLVM_LIB_TARGET_AMDGPU_AMDGPUFRAMELOWERING_H
@@ -27,7 +28,7 @@ class AMDGPUFrameLowering : public TargetFrameLowering {
public: public:
AMDGPUFrameLowering(StackDirection D, unsigned StackAl, int LAO, AMDGPUFrameLowering(StackDirection D, unsigned StackAl, int LAO,
unsigned TransAl = 1); unsigned TransAl = 1);
virtual ~AMDGPUFrameLowering(); ~AMDGPUFrameLowering() override;
/// \returns The number of 32-bit sub-registers that are used when storing /// \returns The number of 32-bit sub-registers that are used when storing
/// values to the stack. /// values to the stack.
@@ -40,5 +41,7 @@ public:
return false; return false;
} }
}; };
} // namespace llvm
#endif } // end namespace llvm
#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUFRAMELOWERING_H

View File

@@ -12,25 +12,48 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AMDGPU.h"
#include "AMDGPUInstrInfo.h" #include "AMDGPUInstrInfo.h"
#include "AMDGPUIntrinsicInfo.h" #include "AMDGPURegisterInfo.h"
#include "AMDGPUISelLowering.h" // For AMDGPUISD #include "AMDGPUISelLowering.h" // For AMDGPUISD
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "SIDefines.h"
#include "SIInstrInfo.h"
#include "SIRegisterInfo.h"
#include "SIISelLowering.h" #include "SIISelLowering.h"
#include "SIMachineFunctionInfo.h" #include "SIMachineFunctionInfo.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/ValueTracking.h" #include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h" #include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/IR/DiagnosticInfo.h" #include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instruction.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
#include <new>
#include <vector>
using namespace llvm; using namespace llvm;
namespace llvm { namespace llvm {
class R600InstrInfo; class R600InstrInfo;
}
} // end namespace llvm
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Instruction Selector Implementation // Instruction Selector Implementation
@@ -48,8 +71,8 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel {
public: public:
explicit AMDGPUDAGToDAGISel(TargetMachine &TM, CodeGenOpt::Level OptLevel) explicit AMDGPUDAGToDAGISel(TargetMachine &TM, CodeGenOpt::Level OptLevel)
: SelectionDAGISel(TM, OptLevel) {} : SelectionDAGISel(TM, OptLevel) {}
~AMDGPUDAGToDAGISel() override = default;
virtual ~AMDGPUDAGToDAGISel();
bool runOnMachineFunction(MachineFunction &MF) override; bool runOnMachineFunction(MachineFunction &MF) override;
void Select(SDNode *N) override; void Select(SDNode *N) override;
StringRef getPassName() const override; StringRef getPassName() const override;
@@ -149,6 +172,7 @@ private:
// Include the pieces autogenerated from the target description. // Include the pieces autogenerated from the target description.
#include "AMDGPUGenDAGISel.inc" #include "AMDGPUGenDAGISel.inc"
}; };
} // end anonymous namespace } // end anonymous namespace
/// \brief This pass converts a legalized DAG into a AMDGPU-specific /// \brief This pass converts a legalized DAG into a AMDGPU-specific
@@ -163,9 +187,6 @@ bool AMDGPUDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
return SelectionDAGISel::runOnMachineFunction(MF); return SelectionDAGISel::runOnMachineFunction(MF);
} }
AMDGPUDAGToDAGISel::~AMDGPUDAGToDAGISel() {
}
bool AMDGPUDAGToDAGISel::isInlineImmediate(const SDNode *N) const { bool AMDGPUDAGToDAGISel::isInlineImmediate(const SDNode *N) const {
const SIInstrInfo *TII const SIInstrInfo *TII
= static_cast<const SISubtarget *>(Subtarget)->getInstrInfo(); = static_cast<const SISubtarget *>(Subtarget)->getInstrInfo();
@@ -902,7 +923,6 @@ bool AMDGPUDAGToDAGISel::SelectMUBUF(SDValue Addr, SDValue &Ptr,
Ptr = N2; Ptr = N2;
VAddr = N3; VAddr = N3;
} else { } else {
// (add N0, C1) -> offset // (add N0, C1) -> offset
VAddr = CurDAG->getTargetConstant(0, DL, MVT::i32); VAddr = CurDAG->getTargetConstant(0, DL, MVT::i32);
Ptr = N0; Ptr = N0;
@@ -1205,7 +1225,6 @@ bool AMDGPUDAGToDAGISel::SelectSMRDOffset(SDValue ByteOffsetNode,
bool AMDGPUDAGToDAGISel::SelectSMRD(SDValue Addr, SDValue &SBase, bool AMDGPUDAGToDAGISel::SelectSMRD(SDValue Addr, SDValue &SBase,
SDValue &Offset, bool &Imm) const { SDValue &Offset, bool &Imm) const {
SDLoc SL(Addr); SDLoc SL(Addr);
if (CurDAG->isBaseWithConstantOffset(Addr)) { if (CurDAG->isBaseWithConstantOffset(Addr)) {
SDValue N0 = Addr.getOperand(0); SDValue N0 = Addr.getOperand(0);
@@ -1451,7 +1470,6 @@ void AMDGPUDAGToDAGISel::SelectBRCOND(SDNode *N) {
CurDAG->SelectNodeTo(N, AMDGPU::S_CBRANCH_VCCNZ, MVT::Other, CurDAG->SelectNodeTo(N, AMDGPU::S_CBRANCH_VCCNZ, MVT::Other,
N->getOperand(2), // Basic Block N->getOperand(2), // Basic Block
VCC.getValue(0)); VCC.getValue(0));
return;
} }
// This is here because there isn't a way to use the generated sub0_sub1 as the // This is here because there isn't a way to use the generated sub0_sub1 as the
@@ -1522,7 +1540,6 @@ void AMDGPUDAGToDAGISel::SelectATOMIC_CMP_SWAP(SDNode *N) {
bool AMDGPUDAGToDAGISel::SelectVOP3Mods(SDValue In, SDValue &Src, bool AMDGPUDAGToDAGISel::SelectVOP3Mods(SDValue In, SDValue &Src,
SDValue &SrcMods) const { SDValue &SrcMods) const {
unsigned Mods = 0; unsigned Mods = 0;
Src = In; Src = In;

View File

@@ -23,16 +23,22 @@
#include "SIISelLowering.h" #include "SIISelLowering.h"
#include "SIFrameLowering.h" #include "SIFrameLowering.h"
#include "Utils/AMDGPUBaseInfo.h" #include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/Triple.h"
#include "llvm/CodeGen/GlobalISel/GISelAccessor.h" #include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/SelectionDAGTargetInfo.h" #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
#include <memory>
#include <utility>
#define GET_SUBTARGETINFO_HEADER #define GET_SUBTARGETINFO_HEADER
#include "AMDGPUGenSubtargetInfo.inc" #include "AMDGPUGenSubtargetInfo.inc"
namespace llvm { namespace llvm {
class SIMachineFunctionInfo;
class StringRef; class StringRef;
class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo { class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
@@ -125,7 +131,8 @@ protected:
public: public:
AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS, AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
const TargetMachine &TM); const TargetMachine &TM);
virtual ~AMDGPUSubtarget(); ~AMDGPUSubtarget() override;
AMDGPUSubtarget &initializeSubtargetDependencies(const Triple &TT, AMDGPUSubtarget &initializeSubtargetDependencies(const Triple &TT,
StringRef GPU, StringRef FS); StringRef GPU, StringRef FS);
@@ -595,6 +602,6 @@ public:
unsigned getMaxNumSGPRs() const; unsigned getMaxNumSGPRs() const;
}; };
} // End namespace llvm } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H

View File

@@ -17,6 +17,13 @@
#include "AMDGPUIntrinsicInfo.h" #include "AMDGPUIntrinsicInfo.h"
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Target/TargetMachine.h"
#include <memory>
namespace llvm { namespace llvm {
@@ -37,7 +44,7 @@ public:
StringRef FS, TargetOptions Options, StringRef FS, TargetOptions Options,
Optional<Reloc::Model> RM, CodeModel::Model CM, Optional<Reloc::Model> RM, CodeModel::Model CM,
CodeGenOpt::Level OL); CodeGenOpt::Level OL);
~AMDGPUTargetMachine(); ~AMDGPUTargetMachine() override;
const AMDGPUSubtarget *getSubtargetImpl() const; const AMDGPUSubtarget *getSubtargetImpl() const;
const AMDGPUSubtarget *getSubtargetImpl(const Function &) const override = 0; const AMDGPUSubtarget *getSubtargetImpl(const Function &) const override = 0;
@@ -91,6 +98,6 @@ public:
const SISubtarget *getSubtargetImpl(const Function &) const override; const SISubtarget *getSubtargetImpl(const Function &) const override;
}; };
} // End namespace llvm } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUTARGETMACHINE_H

View File

@@ -15,30 +15,45 @@
#include "Utils/AMDKernelCodeTUtils.h" #include "Utils/AMDKernelCodeTUtils.h"
#include "Utils/AMDGPUAsmUtils.h" #include "Utils/AMDGPUAsmUtils.h"
#include "llvm/ADT/APFloat.h" #include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallBitVector.h" #include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/MachineValueType.h" #include "llvm/CodeGen/MachineValueType.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h" #include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/ELF.h" #include "llvm/Support/ELF.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/TargetRegistry.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <map>
#include <memory>
#include <string>
#include <vector>
using namespace llvm; using namespace llvm;
using namespace llvm::AMDGPU; using namespace llvm::AMDGPU;
@@ -46,7 +61,6 @@ using namespace llvm::AMDGPU;
namespace { namespace {
class AMDGPUAsmParser; class AMDGPUAsmParser;
struct OptionalOperand;
enum RegisterKind { IS_UNKNOWN, IS_VGPR, IS_SGPR, IS_TTMP, IS_SPECIAL }; enum RegisterKind { IS_UNKNOWN, IS_VGPR, IS_SGPR, IS_TTMP, IS_SPECIAL };
@@ -365,7 +379,6 @@ public:
return S->getSymbol().getName(); return S->getSymbol().getName();
} }
StringRef getToken() const { StringRef getToken() const {
assert(isToken()); assert(isToken());
@@ -715,13 +728,15 @@ public:
//bool ProcessInstruction(MCInst &Inst); //bool ProcessInstruction(MCInst &Inst);
OperandMatchResultTy parseIntWithPrefix(const char *Prefix, int64_t &Int); OperandMatchResultTy parseIntWithPrefix(const char *Prefix, int64_t &Int);
OperandMatchResultTy parseIntWithPrefix(const char *Prefix, OperandMatchResultTy
OperandVector &Operands, parseIntWithPrefix(const char *Prefix, OperandVector &Operands,
enum AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone, enum AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone,
bool (*ConvertResult)(int64_t&) = 0); bool (*ConvertResult)(int64_t &) = nullptr);
OperandMatchResultTy parseNamedBit(const char *Name, OperandVector &Operands, OperandMatchResultTy
enum AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone); parseNamedBit(const char *Name, OperandVector &Operands,
OperandMatchResultTy parseStringWithPrefix(StringRef Prefix, StringRef &Value); enum AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone);
OperandMatchResultTy parseStringWithPrefix(StringRef Prefix,
StringRef &Value);
OperandMatchResultTy parseImm(OperandVector &Operands); OperandMatchResultTy parseImm(OperandVector &Operands);
OperandMatchResultTy parseRegOrImm(OperandVector &Operands); OperandMatchResultTy parseRegOrImm(OperandVector &Operands);
@@ -808,6 +823,8 @@ struct OptionalOperand {
bool (*ConvertResult)(int64_t&); bool (*ConvertResult)(int64_t&);
}; };
} // end anonymous namespace
// May be called with integer type with equivalent bitwidth. // May be called with integer type with equivalent bitwidth.
static const fltSemantics *getFltSemantics(MVT VT) { static const fltSemantics *getFltSemantics(MVT VT) {
switch (VT.getSizeInBits()) { switch (VT.getSizeInBits()) {
@@ -822,8 +839,6 @@ static const fltSemantics *getFltSemantics(MVT VT) {
} }
} }
}
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Operand // Operand
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -1556,7 +1571,6 @@ bool AMDGPUAsmParser::ParseDirectiveHSACodeObjectVersion() {
} }
bool AMDGPUAsmParser::ParseDirectiveHSACodeObjectISA() { bool AMDGPUAsmParser::ParseDirectiveHSACodeObjectISA() {
uint32_t Major; uint32_t Major;
uint32_t Minor; uint32_t Minor;
uint32_t Stepping; uint32_t Stepping;
@@ -1573,7 +1587,6 @@ bool AMDGPUAsmParser::ParseDirectiveHSACodeObjectISA() {
return false; return false;
} }
if (ParseDirectiveMajorMinor(Major, Minor)) if (ParseDirectiveMajorMinor(Major, Minor))
return true; return true;
@@ -1624,12 +1637,10 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
} }
bool AMDGPUAsmParser::ParseDirectiveAMDKernelCodeT() { bool AMDGPUAsmParser::ParseDirectiveAMDKernelCodeT() {
amd_kernel_code_t Header; amd_kernel_code_t Header;
AMDGPU::initDefaultAMDKernelCodeT(Header, getSTI().getFeatureBits()); AMDGPU::initDefaultAMDKernelCodeT(Header, getSTI().getFeatureBits());
while (true) { while (true) {
// Lex EndOfStatement. This is in a while loop, because lexing a comment // Lex EndOfStatement. This is in a while loop, because lexing a comment
// will set the current token to EndOfStatement. // will set the current token to EndOfStatement.
while(getLexer().is(AsmToken::EndOfStatement)) while(getLexer().is(AsmToken::EndOfStatement))
@@ -1998,7 +2009,6 @@ AMDGPUAsmParser::parseStringWithPrefix(StringRef Prefix, StringRef &Value) {
void AMDGPUAsmParser::cvtDSOffset01(MCInst &Inst, void AMDGPUAsmParser::cvtDSOffset01(MCInst &Inst,
const OperandVector &Operands) { const OperandVector &Operands) {
OptionalImmIndexMap OptionalIdx; OptionalImmIndexMap OptionalIdx;
for (unsigned i = 1, e = Operands.size(); i != e; ++i) { for (unsigned i = 1, e = Operands.size(); i != e; ++i) {
@@ -2022,7 +2032,6 @@ void AMDGPUAsmParser::cvtDSOffset01(MCInst &Inst,
} }
void AMDGPUAsmParser::cvtDS(MCInst &Inst, const OperandVector &Operands) { void AMDGPUAsmParser::cvtDS(MCInst &Inst, const OperandVector &Operands) {
std::map<enum AMDGPUOperand::ImmTy, unsigned> OptionalIdx; std::map<enum AMDGPUOperand::ImmTy, unsigned> OptionalIdx;
bool GDSOnly = false; bool GDSOnly = false;
@@ -2517,7 +2526,7 @@ AMDGPUAsmParser::parseSendMsgOp(OperandVector &Operands) {
} }
Imm16Val |= (StreamId << STREAM_ID_SHIFT_); Imm16Val |= (StreamId << STREAM_ID_SHIFT_);
} }
} while (0); } while (false);
} }
break; break;
} }
@@ -3224,24 +3233,24 @@ void AMDGPUAsmParser::cvtSDWA(MCInst &Inst, const OperandVector &Operands,
if (Inst.getOpcode() != AMDGPU::V_NOP_sdwa) { if (Inst.getOpcode() != AMDGPU::V_NOP_sdwa) {
// V_NOP_sdwa has no optional sdwa arguments // V_NOP_sdwa has no optional sdwa arguments
switch (BasicInstType) { switch (BasicInstType) {
case SIInstrFlags::VOP1: { case SIInstrFlags::VOP1:
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstSel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstSel, 6);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstUnused, 2); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstUnused, 2);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6);
break; break;
}
case SIInstrFlags::VOP2: { case SIInstrFlags::VOP2:
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstSel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstSel, 6);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstUnused, 2); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstUnused, 2);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, 6);
break; break;
}
case SIInstrFlags::VOPC: { case SIInstrFlags::VOPC:
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, 6);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, 6); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, 6);
break; break;
}
default: default:
llvm_unreachable("Invalid instruction type. Only VOP1, VOP2 and VOPC allowed"); llvm_unreachable("Invalid instruction type. Only VOP1, VOP2 and VOPC allowed");
} }
@@ -3269,7 +3278,6 @@ extern "C" void LLVMInitializeAMDGPUAsmParser() {
#define GET_MATCHER_IMPLEMENTATION #define GET_MATCHER_IMPLEMENTATION
#include "AMDGPUGenAsmMatcher.inc" #include "AMDGPUGenAsmMatcher.inc"
// This fuction should be defined after auto-generated include so that we have // This fuction should be defined after auto-generated include so that we have
// MatchClassKind enum defined // MatchClassKind enum defined
unsigned AMDGPUAsmParser::validateTargetOperandClass(MCParsedAsmOperand &Op, unsigned AMDGPUAsmParser::validateTargetOperandClass(MCParsedAsmOperand &Op,

View File

@@ -18,7 +18,11 @@
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
#include "llvm/MC/MCDisassembler/MCSymbolizer.h" #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
#include <cstdint>
#include <algorithm>
#include <memory>
namespace llvm { namespace llvm {
@@ -40,7 +44,7 @@ public:
AMDGPUDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx) : AMDGPUDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx) :
MCDisassembler(STI, Ctx) {} MCDisassembler(STI, Ctx) {}
~AMDGPUDisassembler() {} ~AMDGPUDisassembler() override = default;
DecodeStatus getInstruction(MCInst &MI, uint64_t &Size, DecodeStatus getInstruction(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes, uint64_t Address, ArrayRef<uint8_t> Bytes, uint64_t Address,
@@ -52,7 +56,7 @@ public:
MCOperand createRegOperand(unsigned RegClassID, unsigned Val) const; MCOperand createRegOperand(unsigned RegClassID, unsigned Val) const;
MCOperand createSRegOperand(unsigned SRegClassID, unsigned Val) const; MCOperand createSRegOperand(unsigned SRegClassID, unsigned Val) const;
MCOperand errOperand(unsigned V, const llvm::Twine& ErrMsg) const; MCOperand errOperand(unsigned V, const Twine& ErrMsg) const;
DecodeStatus tryDecodeInst(const uint8_t* Table, DecodeStatus tryDecodeInst(const uint8_t* Table,
MCInst &MI, MCInst &MI,
@@ -82,6 +86,7 @@ public:
OPW_LAST_, OPW_LAST_,
OPW_FIRST_ = OPW32 OPW_FIRST_ = OPW32
}; };
unsigned getVgprClassId(const OpWidthTy Width) const; unsigned getVgprClassId(const OpWidthTy Width) const;
unsigned getSgprClassId(const OpWidthTy Width) const; unsigned getSgprClassId(const OpWidthTy Width) const;
unsigned getTtmpClassId(const OpWidthTy Width) const; unsigned getTtmpClassId(const OpWidthTy Width) const;
@@ -118,6 +123,6 @@ public:
uint64_t Address) override; uint64_t Address) override;
}; };
} // namespace llvm } // end namespace llvm
#endif //LLVM_LIB_TARGET_AMDGPU_DISASSEMBLER_AMDGPUDISASSEMBLER_H #endif // LLVM_LIB_TARGET_AMDGPU_DISASSEMBLER_AMDGPUDISASSEMBLER_H

View File

@@ -19,12 +19,14 @@ public:
R600FrameLowering(StackDirection D, unsigned StackAl, int LAO, R600FrameLowering(StackDirection D, unsigned StackAl, int LAO,
unsigned TransAl = 1) : unsigned TransAl = 1) :
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {} AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
virtual ~R600FrameLowering(); ~R600FrameLowering() override;
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const {} void emitPrologue(MachineFunction &MF,
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const {} MachineBasicBlock &MBB) const override {}
void emitEpilogue(MachineFunction &MF,
MachineBasicBlock &MBB) const override {}
}; };
} } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_AMDGPU_R600FRAMELOWERING_H

View File

@@ -17,16 +17,36 @@
#include "AMDGPUIntrinsicInfo.h" #include "AMDGPUIntrinsicInfo.h"
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "R600Defines.h" #include "R600Defines.h"
#include "R600FrameLowering.h"
#include "R600InstrInfo.h" #include "R600InstrInfo.h"
#include "R600MachineFunctionInfo.h" #include "R600MachineFunctionInfo.h"
#include "llvm/Analysis/ValueTracking.h" #include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/CallingConvLower.h" #include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/DAGCombine.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/IR/Argument.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h" #include "llvm/IR/DerivedTypes.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <utility>
#include <vector>
using namespace llvm; using namespace llvm;
@@ -72,7 +92,6 @@ R600TargetLowering::R600TargetLowering(const TargetMachine &TM,
setLoadExtAction(ISD::SEXTLOAD, MVT::v4i32, MVT::v4i1, Expand); setLoadExtAction(ISD::SEXTLOAD, MVT::v4i32, MVT::v4i1, Expand);
setLoadExtAction(ISD::ZEXTLOAD, MVT::v4i32, MVT::v4i1, Expand); setLoadExtAction(ISD::ZEXTLOAD, MVT::v4i32, MVT::v4i1, Expand);
setOperationAction(ISD::STORE, MVT::i8, Custom); setOperationAction(ISD::STORE, MVT::i8, Custom);
setOperationAction(ISD::STORE, MVT::i32, Custom); setOperationAction(ISD::STORE, MVT::i32, Custom);
setOperationAction(ISD::STORE, MVT::v2i32, Custom); setOperationAction(ISD::STORE, MVT::v2i32, Custom);
@@ -192,7 +211,6 @@ R600TargetLowering::R600TargetLowering(const TargetMachine &TM,
setSchedulingPreference(Sched::Source); setSchedulingPreference(Sched::Source);
setTargetDAGCombine(ISD::FP_ROUND); setTargetDAGCombine(ISD::FP_ROUND);
setTargetDAGCombine(ISD::FP_TO_SINT); setTargetDAGCombine(ISD::FP_TO_SINT);
setTargetDAGCombine(ISD::EXTRACT_VECTOR_ELT); setTargetDAGCombine(ISD::EXTRACT_VECTOR_ELT);
@@ -214,7 +232,7 @@ static inline bool isEOP(MachineBasicBlock::iterator I) {
MachineBasicBlock * MachineBasicBlock *
R600TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI, R600TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
MachineBasicBlock *BB) const { MachineBasicBlock *BB) const {
MachineFunction * MF = BB->getParent(); MachineFunction *MF = BB->getParent();
MachineRegisterInfo &MRI = MF->getRegInfo(); MachineRegisterInfo &MRI = MF->getRegInfo();
MachineBasicBlock::iterator I = MI; MachineBasicBlock::iterator I = MI;
const R600InstrInfo *TII = getSubtarget()->getInstrInfo(); const R600InstrInfo *TII = getSubtarget()->getInstrInfo();
@@ -281,10 +299,12 @@ R600TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
.bitcastToAPInt() .bitcastToAPInt()
.getZExtValue()); .getZExtValue());
break; break;
case AMDGPU::MOV_IMM_I32: case AMDGPU::MOV_IMM_I32:
TII->buildMovImm(*BB, I, MI.getOperand(0).getReg(), TII->buildMovImm(*BB, I, MI.getOperand(0).getReg(),
MI.getOperand(1).getImm()); MI.getOperand(1).getImm());
break; break;
case AMDGPU::MOV_IMM_GLOBAL_ADDR: { case AMDGPU::MOV_IMM_GLOBAL_ADDR: {
//TODO: Perhaps combine this instruction with the next if possible //TODO: Perhaps combine this instruction with the next if possible
auto MIB = TII->buildDefaultInstruction( auto MIB = TII->buildDefaultInstruction(
@@ -294,6 +314,7 @@ R600TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
MIB->getOperand(Idx) = MI.getOperand(1); MIB->getOperand(Idx) = MI.getOperand(1);
break; break;
} }
case AMDGPU::CONST_COPY: { case AMDGPU::CONST_COPY: {
MachineInstr *NewMI = TII->buildDefaultInstruction( MachineInstr *NewMI = TII->buildDefaultInstruction(
*BB, MI, AMDGPU::MOV, MI.getOperand(0).getReg(), AMDGPU::ALU_CONST); *BB, MI, AMDGPU::MOV, MI.getOperand(0).getReg(), AMDGPU::ALU_CONST);
@@ -304,21 +325,21 @@ R600TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
case AMDGPU::RAT_WRITE_CACHELESS_32_eg: case AMDGPU::RAT_WRITE_CACHELESS_32_eg:
case AMDGPU::RAT_WRITE_CACHELESS_64_eg: case AMDGPU::RAT_WRITE_CACHELESS_64_eg:
case AMDGPU::RAT_WRITE_CACHELESS_128_eg: { case AMDGPU::RAT_WRITE_CACHELESS_128_eg:
BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(MI.getOpcode())) BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(MI.getOpcode()))
.addOperand(MI.getOperand(0)) .addOperand(MI.getOperand(0))
.addOperand(MI.getOperand(1)) .addOperand(MI.getOperand(1))
.addImm(isEOP(I)); // Set End of program bit .addImm(isEOP(I)); // Set End of program bit
break; break;
}
case AMDGPU::RAT_STORE_TYPED_eg: { case AMDGPU::RAT_STORE_TYPED_eg:
BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(MI.getOpcode())) BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(MI.getOpcode()))
.addOperand(MI.getOperand(0)) .addOperand(MI.getOperand(0))
.addOperand(MI.getOperand(1)) .addOperand(MI.getOperand(1))
.addOperand(MI.getOperand(2)) .addOperand(MI.getOperand(2))
.addImm(isEOP(I)); // Set End of program bit .addImm(isEOP(I)); // Set End of program bit
break; break;
}
case AMDGPU::BRANCH: case AMDGPU::BRANCH:
BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDGPU::JUMP)) BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDGPU::JUMP))
.addOperand(MI.getOperand(0)); .addOperand(MI.getOperand(0));
@@ -619,14 +640,12 @@ void R600TargetLowering::ReplaceNodeResults(SDNode *N,
SDValue R600TargetLowering::vectorToVerticalVector(SelectionDAG &DAG, SDValue R600TargetLowering::vectorToVerticalVector(SelectionDAG &DAG,
SDValue Vector) const { SDValue Vector) const {
SDLoc DL(Vector); SDLoc DL(Vector);
EVT VecVT = Vector.getValueType(); EVT VecVT = Vector.getValueType();
EVT EltVT = VecVT.getVectorElementType(); EVT EltVT = VecVT.getVectorElementType();
SmallVector<SDValue, 8> Args; SmallVector<SDValue, 8> Args;
for (unsigned i = 0, e = VecVT.getVectorNumElements(); for (unsigned i = 0, e = VecVT.getVectorNumElements(); i != e; ++i) {
i != e; ++i) {
Args.push_back(DAG.getNode( Args.push_back(DAG.getNode(
ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Vector, ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Vector,
DAG.getConstant(i, DL, getVectorIdxTy(DAG.getDataLayout())))); DAG.getConstant(i, DL, getVectorIdxTy(DAG.getDataLayout()))));
@@ -637,7 +656,6 @@ SDValue R600TargetLowering::vectorToVerticalVector(SelectionDAG &DAG,
SDValue R600TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op, SDValue R600TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
SelectionDAG &DAG) const { SelectionDAG &DAG) const {
SDLoc DL(Op); SDLoc DL(Op);
SDValue Vector = Op.getOperand(0); SDValue Vector = Op.getOperand(0);
SDValue Index = Op.getOperand(1); SDValue Index = Op.getOperand(1);
@@ -671,7 +689,6 @@ SDValue R600TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
SDValue R600TargetLowering::LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue R600TargetLowering::LowerGlobalAddress(AMDGPUMachineFunction *MFI,
SDValue Op, SDValue Op,
SelectionDAG &DAG) const { SelectionDAG &DAG) const {
GlobalAddressSDNode *GSD = cast<GlobalAddressSDNode>(Op); GlobalAddressSDNode *GSD = cast<GlobalAddressSDNode>(Op);
if (GSD->getAddressSpace() != AMDGPUAS::CONSTANT_ADDRESS) if (GSD->getAddressSpace() != AMDGPUAS::CONSTANT_ADDRESS)
return AMDGPUTargetLowering::LowerGlobalAddress(MFI, Op, DAG); return AMDGPUTargetLowering::LowerGlobalAddress(MFI, Op, DAG);
@@ -1130,7 +1147,7 @@ SDValue R600TargetLowering::LowerSTORE(SDValue Op, SelectionDAG &DAG) const {
// Private AS needs special fixes // Private AS needs special fixes
if (Align < MemVT.getStoreSize() && (AS != AMDGPUAS::PRIVATE_ADDRESS) && if (Align < MemVT.getStoreSize() && (AS != AMDGPUAS::PRIVATE_ADDRESS) &&
!allowsMisalignedMemoryAccesses(MemVT, AS, Align, NULL)) { !allowsMisalignedMemoryAccesses(MemVT, AS, Align, nullptr)) {
return expandUnalignedStore(StoreNode, DAG); return expandUnalignedStore(StoreNode, DAG);
} }
@@ -1710,7 +1727,6 @@ SDValue R600TargetLowering::OptimizeSwizzle(SDValue BuildVector, SDValue Swz[4],
return BuildVector; return BuildVector;
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Custom DAG Optimizations // Custom DAG Optimizations
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -2022,7 +2038,6 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
unsigned ImmReg = AMDGPU::ALU_LITERAL_X; unsigned ImmReg = AMDGPU::ALU_LITERAL_X;
uint64_t ImmValue = 0; uint64_t ImmValue = 0;
if (Src.getMachineOpcode() == AMDGPU::MOV_IMM_F32) { if (Src.getMachineOpcode() == AMDGPU::MOV_IMM_F32) {
ConstantFPSDNode *FPC = dyn_cast<ConstantFPSDNode>(Src.getOperand(0)); ConstantFPSDNode *FPC = dyn_cast<ConstantFPSDNode>(Src.getOperand(0));
float FloatValue = FPC->getValueAPF().convertToFloat(); float FloatValue = FPC->getValueAPF().convertToFloat();

View File

@@ -16,6 +16,7 @@
#define LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H #define LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H
#include "llvm/CodeGen/MachineScheduler.h" #include "llvm/CodeGen/MachineScheduler.h"
#include <vector>
using namespace llvm; using namespace llvm;
@@ -25,10 +26,10 @@ class R600InstrInfo;
struct R600RegisterInfo; struct R600RegisterInfo;
class R600SchedStrategy final : public MachineSchedStrategy { class R600SchedStrategy final : public MachineSchedStrategy {
const ScheduleDAGMILive *DAG; const ScheduleDAGMILive *DAG = nullptr;
const R600InstrInfo *TII; const R600InstrInfo *TII = nullptr;
const R600RegisterInfo *TRI; const R600RegisterInfo *TRI = nullptr;
MachineRegisterInfo *MRI; MachineRegisterInfo *MRI = nullptr;
enum InstKind { enum InstKind {
IDAlu, IDAlu,
@@ -66,11 +67,8 @@ class R600SchedStrategy final : public MachineSchedStrategy {
int OccupedSlotsMask; int OccupedSlotsMask;
public: public:
R600SchedStrategy() : R600SchedStrategy() = default;
DAG(nullptr), TII(nullptr), TRI(nullptr), MRI(nullptr) { ~R600SchedStrategy() override = default;
}
virtual ~R600SchedStrategy() {}
void initialize(ScheduleDAGMI *dag) override; void initialize(ScheduleDAGMI *dag) override;
SUnit *pickNode(bool &IsTopNode) override; SUnit *pickNode(bool &IsTopNode) override;
@@ -97,6 +95,6 @@ private:
void MoveUnits(std::vector<SUnit *> &QSrc, std::vector<SUnit *> &QDst); void MoveUnits(std::vector<SUnit *> &QSrc, std::vector<SUnit *> &QDst);
}; };
} // namespace llvm } // end namespace llvm
#endif /* R600MACHINESCHEDULER_H_ */ #endif // LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H

View File

@@ -13,6 +13,7 @@
#include "AMDGPUFrameLowering.h" #include "AMDGPUFrameLowering.h"
namespace llvm { namespace llvm {
class SIInstrInfo; class SIInstrInfo;
class SIMachineFunctionInfo; class SIMachineFunctionInfo;
class SIRegisterInfo; class SIRegisterInfo;
@@ -23,7 +24,7 @@ public:
SIFrameLowering(StackDirection D, unsigned StackAl, int LAO, SIFrameLowering(StackDirection D, unsigned StackAl, int LAO,
unsigned TransAl = 1) : unsigned TransAl = 1) :
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {} AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
~SIFrameLowering() override {} ~SIFrameLowering() override = default;
void emitPrologue(MachineFunction &MF, void emitPrologue(MachineFunction &MF,
MachineBasicBlock &MBB) const override; MachineBasicBlock &MBB) const override;
@@ -58,6 +59,6 @@ private:
void emitDebuggerPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const; void emitDebuggerPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const;
}; };
} } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H

View File

@@ -1,4 +1,4 @@
//===-- SIMachineScheduler.h - SI Scheduler Interface -*- C++ -*-------===// //===-- SIMachineScheduler.h - SI Scheduler Interface -----------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@@ -16,10 +16,16 @@
#define LLVM_LIB_TARGET_AMDGPU_SIMACHINESCHEDULER_H #define LLVM_LIB_TARGET_AMDGPU_SIMACHINESCHEDULER_H
#include "SIInstrInfo.h" #include "SIInstrInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineScheduler.h" #include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/CodeGen/RegisterPressure.h" #include "llvm/CodeGen/RegisterPressure.h"
#include "llvm/CodeGen/ScheduleDAG.h"
using namespace llvm; #include <cassert>
#include <cstdint>
#include <map>
#include <memory>
#include <set>
#include <vector>
namespace llvm { namespace llvm {
@@ -93,12 +99,10 @@ class SIScheduleBlock {
public: public:
SIScheduleBlock(SIScheduleDAGMI *DAG, SIScheduleBlockCreator *BC, SIScheduleBlock(SIScheduleDAGMI *DAG, SIScheduleBlockCreator *BC,
unsigned ID): unsigned ID):
DAG(DAG), BC(BC), SUnits(), TopReadySUs(), ScheduledSUnits(), DAG(DAG), BC(BC), TopRPTracker(TopPressure), Scheduled(false),
TopRPTracker(TopPressure), Scheduled(false), HighLatencyBlock(false), ID(ID), NumHighLatencySuccessors(0) {}
HighLatencyBlock(false), ID(ID),
Preds(), Succs(), NumHighLatencySuccessors(0) {};
~SIScheduleBlock() {}; ~SIScheduleBlock() = default;
unsigned getID() const { return ID; } unsigned getID() const { return ID; }
@@ -146,7 +150,6 @@ public:
bool isScheduled() { return Scheduled; } bool isScheduled() { return Scheduled; }
// Needs the block to be scheduled inside // Needs the block to be scheduled inside
// TODO: find a way to compute it. // TODO: find a way to compute it.
std::vector<unsigned> &getInternalAdditionnalRegUsage() { std::vector<unsigned> &getInternalAdditionnalRegUsage() {
@@ -161,7 +164,7 @@ public:
private: private:
struct SISchedCandidate : SISchedulerCandidate { struct SISchedCandidate : SISchedulerCandidate {
// The best SUnit candidate. // The best SUnit candidate.
SUnit *SU; SUnit *SU = nullptr;
unsigned SGPRUsage; unsigned SGPRUsage;
unsigned VGPRUsage; unsigned VGPRUsage;
@@ -169,8 +172,7 @@ private:
unsigned LowLatencyOffset; unsigned LowLatencyOffset;
bool HasLowLatencyNonWaitedParent; bool HasLowLatencyNonWaitedParent;
SISchedCandidate() SISchedCandidate() = default;
: SU(nullptr) {}
bool isValid() const { return SU; } bool isValid() const { return SU; }
@@ -341,17 +343,17 @@ public:
SIScheduleBlockScheduler(SIScheduleDAGMI *DAG, SIScheduleBlockScheduler(SIScheduleDAGMI *DAG,
SISchedulerBlockSchedulerVariant Variant, SISchedulerBlockSchedulerVariant Variant,
SIScheduleBlocks BlocksStruct); SIScheduleBlocks BlocksStruct);
~SIScheduleBlockScheduler() {}; ~SIScheduleBlockScheduler() = default;
std::vector<SIScheduleBlock*> getBlocks() { return BlocksScheduled; }; std::vector<SIScheduleBlock*> getBlocks() { return BlocksScheduled; }
unsigned getVGPRUsage() { return maxVregUsage; }; unsigned getVGPRUsage() { return maxVregUsage; }
unsigned getSGPRUsage() { return maxSregUsage; }; unsigned getSGPRUsage() { return maxSregUsage; }
private: private:
struct SIBlockSchedCandidate : SISchedulerCandidate { struct SIBlockSchedCandidate : SISchedulerCandidate {
// The best Block candidate. // The best Block candidate.
SIScheduleBlock *Block; SIScheduleBlock *Block = nullptr;
bool IsHighLatency; bool IsHighLatency;
int VGPRUsageDiff; int VGPRUsageDiff;
@@ -360,8 +362,7 @@ private:
unsigned LastPosHighLatParentScheduled; unsigned LastPosHighLatParentScheduled;
unsigned Height; unsigned Height;
SIBlockSchedCandidate() SIBlockSchedCandidate() = default;
: Block(nullptr) {}
bool isValid() const { return Block; } bool isValid() const { return Block; }
@@ -409,9 +410,9 @@ class SIScheduler {
SIScheduleBlockCreator BlockCreator; SIScheduleBlockCreator BlockCreator;
public: public:
SIScheduler(SIScheduleDAGMI *DAG) : DAG(DAG), BlockCreator(DAG) {}; SIScheduler(SIScheduleDAGMI *DAG) : DAG(DAG), BlockCreator(DAG) {}
~SIScheduler() {}; ~SIScheduler() = default;
struct SIScheduleBlockResult struct SIScheduleBlockResult
scheduleVariant(SISchedulerBlockCreatorVariant BlockVariant, scheduleVariant(SISchedulerBlockCreatorVariant BlockVariant,
@@ -445,13 +446,13 @@ public:
} }
MachineBasicBlock *getBB() { return BB; } MachineBasicBlock *getBB() { return BB; }
MachineBasicBlock::iterator getCurrentTop() { return CurrentTop; }; MachineBasicBlock::iterator getCurrentTop() { return CurrentTop; }
MachineBasicBlock::iterator getCurrentBottom() { return CurrentBottom; }; MachineBasicBlock::iterator getCurrentBottom() { return CurrentBottom; }
LiveIntervals *getLIS() { return LIS; } LiveIntervals *getLIS() { return LIS; }
MachineRegisterInfo *getMRI() { return &MRI; } MachineRegisterInfo *getMRI() { return &MRI; }
const TargetRegisterInfo *getTRI() { return TRI; } const TargetRegisterInfo *getTRI() { return TRI; }
SUnit& getEntrySU() { return EntrySU; }; SUnit& getEntrySU() { return EntrySU; }
SUnit& getExitSU() { return ExitSU; }; SUnit& getExitSU() { return ExitSU; }
void restoreSULinksLeft(); void restoreSULinksLeft();
@@ -459,13 +460,14 @@ public:
_Iterator End, _Iterator End,
unsigned &VgprUsage, unsigned &VgprUsage,
unsigned &SgprUsage); unsigned &SgprUsage);
std::set<unsigned> getInRegs() { std::set<unsigned> getInRegs() {
std::set<unsigned> InRegs; std::set<unsigned> InRegs;
for (const auto &RegMaskPair : RPTracker.getPressure().LiveInRegs) { for (const auto &RegMaskPair : RPTracker.getPressure().LiveInRegs) {
InRegs.insert(RegMaskPair.RegUnit); InRegs.insert(RegMaskPair.RegUnit);
} }
return InRegs; return InRegs;
}; }
unsigned getVGPRSetID() const { return VGPRSetID; } unsigned getVGPRSetID() const { return VGPRSetID; }
unsigned getSGPRSetID() const { return SGPRSetID; } unsigned getSGPRSetID() const { return SGPRSetID; }
@@ -486,6 +488,6 @@ public:
std::vector<int> BottomUpIndex2SU; std::vector<int> BottomUpIndex2SU;
}; };
} // namespace llvm } // end namespace llvm
#endif /* SIMACHINESCHEDULER_H_ */ #endif // LLVM_LIB_TARGET_AMDGPU_SIMACHINESCHEDULER_H

View File

@@ -53,10 +53,28 @@
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "SIInstrInfo.h" #include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h" #include "SIMachineFunctionInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.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/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include <cassert>
#include <vector>
using namespace llvm; using namespace llvm;
@@ -71,9 +89,9 @@ enum {
struct PrintState { struct PrintState {
public: public:
explicit PrintState(int State) : State(State) {}
int State; int State;
explicit PrintState(int State) : State(State) {}
}; };
static raw_ostream &operator<<(raw_ostream &OS, const PrintState &PS) { static raw_ostream &operator<<(raw_ostream &OS, const PrintState &PS) {
@@ -103,7 +121,7 @@ struct WorkItem {
MachineBasicBlock *MBB = nullptr; MachineBasicBlock *MBB = nullptr;
MachineInstr *MI = nullptr; MachineInstr *MI = nullptr;
WorkItem() {} WorkItem() = default;
WorkItem(MachineBasicBlock *MBB) : MBB(MBB) {} WorkItem(MachineBasicBlock *MBB) : MBB(MBB) {}
WorkItem(MachineInstr *MI) : MI(MI) {} WorkItem(MachineInstr *MI) : MI(MI) {}
}; };
@@ -162,7 +180,7 @@ public:
} }
}; };
} // End anonymous namespace } // end anonymous namespace
char SIWholeQuadMode::ID = 0; char SIWholeQuadMode::ID = 0;

View File

@@ -243,7 +243,7 @@ def VSPLTISB_get_imm : SDNodeXForm<build_vector, [{
return PPC::get_VSPLTI_elt(N, 1, *CurDAG); return PPC::get_VSPLTI_elt(N, 1, *CurDAG);
}]>; }]>;
def vecspltisb : PatLeaf<(build_vector), [{ def vecspltisb : PatLeaf<(build_vector), [{
return PPC::get_VSPLTI_elt(N, 1, *CurDAG).getNode() != 0; return PPC::get_VSPLTI_elt(N, 1, *CurDAG).getNode() != nullptr;
}], VSPLTISB_get_imm>; }], VSPLTISB_get_imm>;
// VSPLTISH_get_imm xform function: convert build_vector to VSPLTISH imm. // VSPLTISH_get_imm xform function: convert build_vector to VSPLTISH imm.
@@ -251,7 +251,7 @@ def VSPLTISH_get_imm : SDNodeXForm<build_vector, [{
return PPC::get_VSPLTI_elt(N, 2, *CurDAG); return PPC::get_VSPLTI_elt(N, 2, *CurDAG);
}]>; }]>;
def vecspltish : PatLeaf<(build_vector), [{ def vecspltish : PatLeaf<(build_vector), [{
return PPC::get_VSPLTI_elt(N, 2, *CurDAG).getNode() != 0; return PPC::get_VSPLTI_elt(N, 2, *CurDAG).getNode() != nullptr;
}], VSPLTISH_get_imm>; }], VSPLTISH_get_imm>;
// VSPLTISW_get_imm xform function: convert build_vector to VSPLTISW imm. // VSPLTISW_get_imm xform function: convert build_vector to VSPLTISW imm.
@@ -259,7 +259,7 @@ def VSPLTISW_get_imm : SDNodeXForm<build_vector, [{
return PPC::get_VSPLTI_elt(N, 4, *CurDAG); return PPC::get_VSPLTI_elt(N, 4, *CurDAG);
}]>; }]>;
def vecspltisw : PatLeaf<(build_vector), [{ def vecspltisw : PatLeaf<(build_vector), [{
return PPC::get_VSPLTI_elt(N, 4, *CurDAG).getNode() != 0; return PPC::get_VSPLTI_elt(N, 4, *CurDAG).getNode() != nullptr;
}], VSPLTISW_get_imm>; }], VSPLTISW_get_imm>;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@@ -20,31 +20,38 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ppc-loop-preinc-prep" #define DEBUG_TYPE "ppc-loop-preinc-prep"
#include "PPC.h" #include "PPC.h"
#include "PPCSubtarget.h"
#include "PPCTargetMachine.h" #include "PPCTargetMachine.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h" #include "llvm/IR/CFG.h"
#include "llvm/IR/Dominators.h" #include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/ValueMapper.h" #include <cassert>
#include <iterator>
#include <utility>
using namespace llvm; using namespace llvm;
// By default, we limit this to creating 16 PHIs (which is a little over half // By default, we limit this to creating 16 PHIs (which is a little over half
@@ -54,14 +61,17 @@ static cl::opt<unsigned> MaxVars("ppc-preinc-prep-max-vars",
cl::desc("Potential PHI threshold for PPC preinc loop prep")); cl::desc("Potential PHI threshold for PPC preinc loop prep"));
namespace llvm { namespace llvm {
void initializePPCLoopPreIncPrepPass(PassRegistry&); void initializePPCLoopPreIncPrepPass(PassRegistry&);
}
} // end namespace llvm
namespace { namespace {
class PPCLoopPreIncPrep : public FunctionPass { class PPCLoopPreIncPrep : public FunctionPass {
public: public:
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
PPCLoopPreIncPrep() : FunctionPass(ID), TM(nullptr) { PPCLoopPreIncPrep() : FunctionPass(ID), TM(nullptr) {
initializePPCLoopPreIncPrepPass(*PassRegistry::getPassRegistry()); initializePPCLoopPreIncPrepPass(*PassRegistry::getPassRegistry());
} }
@@ -89,7 +99,8 @@ namespace {
ScalarEvolution *SE; ScalarEvolution *SE;
bool PreserveLCSSA; bool PreserveLCSSA;
}; };
}
} // end anonymous namespace
char PPCLoopPreIncPrep::ID = 0; char PPCLoopPreIncPrep::ID = 0;
static const char *name = "Prepare loop for pre-inc. addressing modes"; static const char *name = "Prepare loop for pre-inc. addressing modes";
@@ -103,6 +114,7 @@ FunctionPass *llvm::createPPCLoopPreIncPrepPass(PPCTargetMachine &TM) {
} }
namespace { namespace {
struct BucketElement { struct BucketElement {
BucketElement(const SCEVConstant *O, Instruction *I) : Offset(O), Instr(I) {} BucketElement(const SCEVConstant *O, Instruction *I) : Offset(O), Instr(I) {}
BucketElement(Instruction *I) : Offset(nullptr), Instr(I) {} BucketElement(Instruction *I) : Offset(nullptr), Instr(I) {}
@@ -118,7 +130,8 @@ namespace {
const SCEV *BaseSCEV; const SCEV *BaseSCEV;
SmallVector<BucketElement, 16> Elements; SmallVector<BucketElement, 16> Elements;
}; };
}
} // end anonymous namespace
static bool IsPtrInBounds(Value *BasePtr) { static bool IsPtrInBounds(Value *BasePtr) {
Value *StrippedBasePtr = BasePtr; Value *StrippedBasePtr = BasePtr;
@@ -140,7 +153,7 @@ static Value *GetPointerOperand(Value *MemI) {
return IMemI->getArgOperand(0); return IMemI->getArgOperand(0);
} }
return 0; return nullptr;
} }
bool PPCLoopPreIncPrep::runOnFunction(Function &F) { bool PPCLoopPreIncPrep::runOnFunction(Function &F) {
@@ -394,7 +407,7 @@ bool PPCLoopPreIncPrep::runOnLoop(Loop *L) {
Instruction *PtrIP = dyn_cast<Instruction>(Ptr); Instruction *PtrIP = dyn_cast<Instruction>(Ptr);
if (PtrIP && isa<Instruction>(NewBasePtr) && if (PtrIP && isa<Instruction>(NewBasePtr) &&
cast<Instruction>(NewBasePtr)->getParent() == PtrIP->getParent()) cast<Instruction>(NewBasePtr)->getParent() == PtrIP->getParent())
PtrIP = 0; PtrIP = nullptr;
else if (isa<PHINode>(PtrIP)) else if (isa<PHINode>(PtrIP))
PtrIP = &*PtrIP->getParent()->getFirstInsertionPt(); PtrIP = &*PtrIP->getParent()->getFirstInsertionPt();
else if (!PtrIP) else if (!PtrIP)
@@ -437,4 +450,3 @@ bool PPCLoopPreIncPrep::runOnLoop(Loop *L) {
return MadeChange; return MadeChange;
} }

View File

@@ -14,7 +14,9 @@
#include "CodeGenTarget.h" #include "CodeGenTarget.h"
#include "CodeGenSchedule.h" #include "CodeGenSchedule.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCInstrItineraries.h" #include "llvm/MC/MCInstrItineraries.h"
#include "llvm/MC/MCSchedule.h" #include "llvm/MC/MCSchedule.h"
#include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/SubtargetFeature.h"
@@ -27,6 +29,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cstdint> #include <cstdint>
#include <iterator>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -42,7 +45,7 @@ class SubtargetEmitter {
// The SchedClassDesc table indexes into a global write resource table, write // The SchedClassDesc table indexes into a global write resource table, write
// latency table, and read advance table. // latency table, and read advance table.
struct SchedClassTables { struct SchedClassTables {
std::vector<std::vector<MCSchedClassDesc> > ProcSchedClasses; std::vector<std::vector<MCSchedClassDesc>> ProcSchedClasses;
std::vector<MCWriteProcResEntry> WriteProcResources; std::vector<MCWriteProcResEntry> WriteProcResources;
std::vector<MCWriteLatencyEntry> WriteLatencies; std::vector<MCWriteLatencyEntry> WriteLatencies;
std::vector<std::string> WriterNames; std::vector<std::string> WriterNames;
@@ -81,10 +84,10 @@ class SubtargetEmitter {
Record *ItinData, Record *ItinData,
std::string &ItinString, unsigned NOperandCycles); std::string &ItinString, unsigned NOperandCycles);
void EmitStageAndOperandCycleData(raw_ostream &OS, void EmitStageAndOperandCycleData(raw_ostream &OS,
std::vector<std::vector<InstrItinerary> > std::vector<std::vector<InstrItinerary>>
&ProcItinLists); &ProcItinLists);
void EmitItineraries(raw_ostream &OS, void EmitItineraries(raw_ostream &OS,
std::vector<std::vector<InstrItinerary> > std::vector<std::vector<InstrItinerary>>
&ProcItinLists); &ProcItinLists);
void EmitProcessorProp(raw_ostream &OS, const Record *R, StringRef Name, void EmitProcessorProp(raw_ostream &OS, const Record *R, StringRef Name,
char Separator); char Separator);
@@ -357,9 +360,8 @@ void SubtargetEmitter::FormItineraryBypassString(const std::string &Name,
// //
void SubtargetEmitter:: void SubtargetEmitter::
EmitStageAndOperandCycleData(raw_ostream &OS, EmitStageAndOperandCycleData(raw_ostream &OS,
std::vector<std::vector<InstrItinerary> > std::vector<std::vector<InstrItinerary>>
&ProcItinLists) { &ProcItinLists) {
// Multiple processor models may share an itinerary record. Emit it once. // Multiple processor models may share an itinerary record. Emit it once.
SmallPtrSet<Record*, 8> ItinsDefSet; SmallPtrSet<Record*, 8> ItinsDefSet;
@@ -498,7 +500,7 @@ EmitStageAndOperandCycleData(raw_ostream &OS,
int NumUOps = ItinData ? ItinData->getValueAsInt("NumMicroOps") : 0; int NumUOps = ItinData ? ItinData->getValueAsInt("NumMicroOps") : 0;
InstrItinerary Intinerary = { NumUOps, FindStage, FindStage + NStages, InstrItinerary Intinerary = { NumUOps, FindStage, FindStage + NStages,
FindOperandCycle, FindOperandCycle,
FindOperandCycle + NOperandCycles}; FindOperandCycle + NOperandCycles };
// Inject - empty slots will be 0, 0 // Inject - empty slots will be 0, 0
ItinList[SchedClassIdx] = Intinerary; ItinList[SchedClassIdx] = Intinerary;
@@ -530,13 +532,12 @@ EmitStageAndOperandCycleData(raw_ostream &OS,
// //
void SubtargetEmitter:: void SubtargetEmitter::
EmitItineraries(raw_ostream &OS, EmitItineraries(raw_ostream &OS,
std::vector<std::vector<InstrItinerary> > &ProcItinLists) { std::vector<std::vector<InstrItinerary>> &ProcItinLists) {
// Multiple processor models may share an itinerary record. Emit it once. // Multiple processor models may share an itinerary record. Emit it once.
SmallPtrSet<Record*, 8> ItinsDefSet; SmallPtrSet<Record*, 8> ItinsDefSet;
// For each processor's machine model // For each processor's machine model
std::vector<std::vector<InstrItinerary> >::iterator std::vector<std::vector<InstrItinerary>>::iterator
ProcItinListsIter = ProcItinLists.begin(); ProcItinListsIter = ProcItinLists.begin();
for (CodeGenSchedModels::ProcIter PI = SchedModels.procModelBegin(), for (CodeGenSchedModels::ProcIter PI = SchedModels.procModelBegin(),
PE = SchedModels.procModelEnd(); PI != PE; ++PI, ++ProcItinListsIter) { PE = SchedModels.procModelEnd(); PI != PE; ++PI, ++ProcItinListsIter) {
@@ -1240,7 +1241,7 @@ void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) {
<< "#endif\n"; << "#endif\n";
if (SchedModels.hasItineraries()) { if (SchedModels.hasItineraries()) {
std::vector<std::vector<InstrItinerary> > ProcItinLists; std::vector<std::vector<InstrItinerary>> ProcItinLists;
// Emit the stage data // Emit the stage data
EmitStageAndOperandCycleData(OS, ProcItinLists); EmitStageAndOperandCycleData(OS, ProcItinLists);
EmitItineraries(OS, ProcItinLists); EmitItineraries(OS, ProcItinLists);
@@ -1424,13 +1425,13 @@ void SubtargetEmitter::run(raw_ostream &OS) {
<< Target << "WriteProcResTable, " << Target << "WriteProcResTable, "
<< Target << "WriteLatencyTable, " << Target << "WriteLatencyTable, "
<< Target << "ReadAdvanceTable, "; << Target << "ReadAdvanceTable, ";
OS << '\n'; OS.indent(22);
if (SchedModels.hasItineraries()) { if (SchedModels.hasItineraries()) {
OS << '\n'; OS.indent(22);
OS << Target << "Stages, " OS << Target << "Stages, "
<< Target << "OperandCycles, " << Target << "OperandCycles, "
<< Target << "ForwardingPaths"; << Target << "ForwardingPaths";
} else } else
OS << "0, 0, 0"; OS << "nullptr, nullptr, nullptr";
OS << ");\n}\n\n"; OS << ");\n}\n\n";
OS << "} // end namespace llvm\n\n"; OS << "} // end namespace llvm\n\n";
@@ -1510,7 +1511,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
<< Target << "OperandCycles, " << Target << "OperandCycles, "
<< Target << "ForwardingPaths"; << Target << "ForwardingPaths";
} else } else
OS << "0, 0, 0"; OS << "nullptr, nullptr, nullptr";
OS << ") {}\n\n"; OS << ") {}\n\n";
EmitSchedModelHelpers(ClassName, OS); EmitSchedModelHelpers(ClassName, OS);