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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eugene Zelenko 2017-01-24 23:02:48 +00:00
parent e8e3365d52
commit adb0ce8f9c
5 changed files with 53 additions and 42 deletions

View File

@ -11,15 +11,19 @@
//
//===----------------------------------------------------------------------===//
#include "XCoreMCTargetDesc.h"
#include "InstPrinter/XCoreInstPrinter.h"
#include "XCoreMCAsmInfo.h"
#include "MCTargetDesc/XCoreMCAsmInfo.h"
#include "MCTargetDesc/XCoreMCTargetDesc.h"
#include "XCoreTargetStreamer.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
@ -79,20 +83,25 @@ static MCInstPrinter *createXCoreMCInstPrinter(const Triple &T,
}
XCoreTargetStreamer::XCoreTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
XCoreTargetStreamer::~XCoreTargetStreamer() {}
XCoreTargetStreamer::~XCoreTargetStreamer() = default;
namespace {
class XCoreTargetAsmStreamer : public XCoreTargetStreamer {
formatted_raw_ostream &OS;
public:
XCoreTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
void emitCCTopData(StringRef Name) override;
void emitCCTopFunction(StringRef Name) override;
void emitCCBottomData(StringRef Name) override;
void emitCCBottomFunction(StringRef Name) override;
};
} // end anonymous namespace
XCoreTargetAsmStreamer::XCoreTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS)
: XCoreTargetStreamer(S), OS(OS) {}
@ -112,7 +121,6 @@ void XCoreTargetAsmStreamer::emitCCBottomData(StringRef Name) {
void XCoreTargetAsmStreamer::emitCCBottomFunction(StringRef Name) {
OS << "\t.cc_bottom " << Name << ".function\n";
}
}
static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS,

View File

@ -14,13 +14,13 @@
#ifndef LLVM_LIB_TARGET_XCORE_MCTARGETDESC_XCOREMCTARGETDESC_H
#define LLVM_LIB_TARGET_XCORE_MCTARGETDESC_XCOREMCTARGETDESC_H
#include "llvm/Support/DataTypes.h"
namespace llvm {
class Target;
Target &getTheXCoreTarget();
} // End llvm namespace
} // end namespace llvm
// Defines symbolic names for XCore registers. This defines a mapping from
// register name to register number.
@ -36,4 +36,4 @@ Target &getTheXCoreTarget();
#define GET_SUBTARGETINFO_ENUM
#include "XCoreGenSubtargetInfo.inc"
#endif
#endif // LLVM_LIB_TARGET_XCORE_MCTARGETDESC_XCOREMCTARGETDESC_H

View File

@ -14,50 +14,39 @@
#ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
#define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include <cassert>
#include <utility>
#include <vector>
namespace llvm {
// Forward declarations
class Function;
/// XCoreFunctionInfo - This class is derived from MachineFunction private
/// XCore target-specific information for each MachineFunction.
class XCoreFunctionInfo : public MachineFunctionInfo {
virtual void anchor();
bool LRSpillSlotSet;
bool LRSpillSlotSet = false;
int LRSpillSlot;
bool FPSpillSlotSet;
bool FPSpillSlotSet = false;
int FPSpillSlot;
bool EHSpillSlotSet;
bool EHSpillSlotSet = false;
int EHSpillSlot[2];
unsigned ReturnStackOffset;
bool ReturnStackOffsetSet;
int VarArgsFrameIndex;
mutable int CachedEStackSize;
bool ReturnStackOffsetSet = false;
int VarArgsFrameIndex = 0;
mutable int CachedEStackSize = -1;
std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>>
SpillLabels;
virtual void anchor();
public:
XCoreFunctionInfo() :
LRSpillSlotSet(false),
FPSpillSlotSet(false),
EHSpillSlotSet(false),
ReturnStackOffsetSet(false),
VarArgsFrameIndex(0),
CachedEStackSize(-1) {}
XCoreFunctionInfo() = default;
explicit XCoreFunctionInfo(MachineFunction &MF) :
LRSpillSlotSet(false),
FPSpillSlotSet(false),
EHSpillSlotSet(false),
ReturnStackOffsetSet(false),
VarArgsFrameIndex(0),
CachedEStackSize(-1) {}
explicit XCoreFunctionInfo(MachineFunction &MF) {}
~XCoreFunctionInfo() {}
~XCoreFunctionInfo() override = default;
void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
@ -101,6 +90,7 @@ public:
return SpillLabels;
}
};
} // End llvm namespace
#endif
} // end namespace llvm
#endif // LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H

View File

@ -10,15 +10,19 @@
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/XCoreMCTargetDesc.h"
#include "XCore.h"
#include "XCoreTargetMachine.h"
#include "XCoreTargetObjectFile.h"
#include "XCoreTargetTransformInfo.h"
#include "XCore.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
@ -38,14 +42,15 @@ XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Triple &TT,
: LLVMTargetMachine(
T, "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32-f64:32-a:0:32-n32",
TT, CPU, FS, Options, getEffectiveRelocModel(RM), CM, OL),
TLOF(make_unique<XCoreTargetObjectFile>()),
TLOF(llvm::make_unique<XCoreTargetObjectFile>()),
Subtarget(TT, CPU, FS, *this) {
initAsmInfo();
}
XCoreTargetMachine::~XCoreTargetMachine() {}
XCoreTargetMachine::~XCoreTargetMachine() = default;
namespace {
/// XCore Code Generator Pass Configuration Options.
class XCorePassConfig : public TargetPassConfig {
public:
@ -61,7 +66,8 @@ public:
bool addInstSelector() override;
void addPreEmitPass() override;
};
} // namespace
} // end anonymous namespace
TargetPassConfig *XCoreTargetMachine::createPassConfig(PassManagerBase &PM) {
return new XCorePassConfig(this, PM);

View File

@ -15,13 +15,19 @@
#define LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H
#include "XCoreSubtarget.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Target/TargetMachine.h"
#include <memory>
namespace llvm {
class XCoreTargetMachine : public LLVMTargetMachine {
std::unique_ptr<TargetLoweringObjectFile> TLOF;
XCoreSubtarget Subtarget;
public:
XCoreTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
StringRef FS, const TargetOptions &Options,
@ -38,6 +44,7 @@ public:
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
@ -45,4 +52,4 @@ public:
} // end namespace llvm
#endif
#endif // LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H