diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:25:46 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:25:46 +0000 |
commit | 7a7e6055035bfd93ab507051819373a6f171258b (patch) | |
tree | dc9ac22b4fea4f445748feaf7232a146623f0dfa /contrib/llvm/lib/Target/XCore | |
parent | b96a714f453e7f5aeeb3c2df2c3e1e8ad749f96f (diff) | |
parent | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (diff) | |
download | src-7a7e6055035bfd93ab507051819373a6f171258b.tar.gz src-7a7e6055035bfd93ab507051819373a6f171258b.zip |
Merge llvm trunk r300422 and resolve conflicts.
Notes
Notes:
svn path=/projects/clang500-import/; revision=317029
Diffstat (limited to 'contrib/llvm/lib/Target/XCore')
11 files changed, 71 insertions, 52 deletions
diff --git a/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.cpp b/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.cpp index 500c84d2a418..b03c1852281d 100644 --- a/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.cpp +++ b/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.cpp @@ -12,13 +12,15 @@ //===----------------------------------------------------------------------===// #include "XCoreInstPrinter.h" -#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" -#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +#include <cassert> + using namespace llvm; #define DEBUG_TYPE "asm-printer" diff --git a/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.h b/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.h index dc513f7b225b..8a7efe2e39c6 100644 --- a/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.h +++ b/contrib/llvm/lib/Target/XCore/InstPrinter/XCoreInstPrinter.h @@ -15,6 +15,8 @@ #ifndef LLVM_LIB_TARGET_XCORE_INSTPRINTER_XCOREINSTPRINTER_H #define LLVM_LIB_TARGET_XCORE_INSTPRINTER_XCOREINSTPRINTER_H + +#include "llvm/ADT/StringRef.h" #include "llvm/MC/MCInstPrinter.h" namespace llvm { @@ -32,12 +34,14 @@ public: void printRegName(raw_ostream &OS, unsigned RegNo) const override; void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override; + private: void printInlineJT(const MCInst *MI, int opNum, raw_ostream &O); void printInlineJT32(const MCInst *MI, int opNum, raw_ostream &O); void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printMemOperand(const MCInst *MI, int opNum, raw_ostream &O); }; + } // end namespace llvm -#endif +#endif // LLVM_LIB_TARGET_XCORE_INSTPRINTER_XCOREINSTPRINTER_H diff --git a/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp b/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp index c5859b7786f7..5fc58d831319 100644 --- a/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp +++ b/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp @@ -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, diff --git a/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h b/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h index ac0f3fefbae7..1dc384fadf69 100644 --- a/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h +++ b/contrib/llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h @@ -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 diff --git a/contrib/llvm/lib/Target/XCore/XCoreFrameLowering.cpp b/contrib/llvm/lib/Target/XCore/XCoreFrameLowering.cpp index e0e2e0319964..a752357400b3 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreFrameLowering.cpp +++ b/contrib/llvm/lib/Target/XCore/XCoreFrameLowering.cpp @@ -238,7 +238,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF, report_fatal_error("emitPrologue unsupported alignment: " + Twine(MFI.getMaxAlignment())); - const AttributeSet &PAL = MF.getFunction()->getAttributes(); + const AttributeList &PAL = MF.getFunction()->getAttributes(); if (PAL.hasAttrSomewhere(Attribute::Nest)) BuildMI(MBB, MBBI, dl, TII.get(XCore::LDWSP_ru6), XCore::R11).addImm(0); // FIX: Needs addMemOperand() but can't use getFixedStack() or getStack(). diff --git a/contrib/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/contrib/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 9244d594460f..45437815fa37 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/contrib/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -483,7 +483,7 @@ LowerLOAD(SDValue Op, SelectionDAG &DAG) const { Args.push_back(Entry); TargetLowering::CallLoweringInfo CLI(DAG); - CLI.setDebugLoc(DL).setChain(Chain).setCallee( + CLI.setDebugLoc(DL).setChain(Chain).setLibCallee( CallingConv::C, IntPtrTy, DAG.getExternalSymbol("__misaligned_load", getPointerTy(DAG.getDataLayout())), @@ -1824,6 +1824,7 @@ SDValue XCoreTargetLowering::PerformDAGCombine(SDNode *N, void XCoreTargetLowering::computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero, APInt &KnownOne, + const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const { KnownZero = KnownOne = APInt(KnownZero.getBitWidth(), 0); diff --git a/contrib/llvm/lib/Target/XCore/XCoreISelLowering.h b/contrib/llvm/lib/Target/XCore/XCoreISelLowering.h index 41813bbb8156..188f4f1fa06b 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreISelLowering.h +++ b/contrib/llvm/lib/Target/XCore/XCoreISelLowering.h @@ -202,6 +202,7 @@ namespace llvm { void computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero, APInt &KnownOne, + const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth = 0) const override; diff --git a/contrib/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.h b/contrib/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.h index cdcc52fdc32d..cf469ec3cf1a 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.h +++ b/contrib/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.h @@ -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 diff --git a/contrib/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp b/contrib/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp index c03b0afceba3..646309e02de8 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp +++ b/contrib/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp @@ -35,11 +35,11 @@ SDValue XCoreSelectionDAGInfo::EmitTargetCodeForMemcpy( TargetLowering::CallLoweringInfo CLI(DAG); CLI.setDebugLoc(dl) .setChain(Chain) - .setCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY), - Type::getVoidTy(*DAG.getContext()), - DAG.getExternalSymbol("__memcpy_4", - TLI.getPointerTy(DAG.getDataLayout())), - std::move(Args)) + .setLibCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY), + Type::getVoidTy(*DAG.getContext()), + DAG.getExternalSymbol( + "__memcpy_4", TLI.getPointerTy(DAG.getDataLayout())), + std::move(Args)) .setDiscardResult(); std::pair<SDValue,SDValue> CallResult = TLI.LowerCallTo(CLI); diff --git a/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.cpp b/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.cpp index bf3138f2164a..e28e05c7f6a8 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.cpp @@ -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); diff --git a/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.h b/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.h index 4bd25bc8776c..2b53f01a996d 100644 --- a/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.h +++ b/contrib/llvm/lib/Target/XCore/XCoreTargetMachine.h @@ -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 |