From: Dylan McKay Date: Wed, 18 Oct 2017 12:35:15 +0000 (+0000) Subject: [AVR] Update to current LLVM API X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bebde41ec5b6321c84415ae5a8d1f1e770f61516;p=platform%2Fupstream%2Fllvm.git [AVR] Update to current LLVM API r315410 broke a number of things in the AVR backend, which are now fixed. llvm-svn: 316076 --- diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp index d182983..01a0961 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp @@ -340,7 +340,8 @@ void AVRAsmBackend::adjustFixupValue(const MCFixup &Fixup, } } -MCObjectWriter *AVRAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const { +std::unique_ptr +AVRAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const { return createAVRELFObjectWriter(OS, MCELFObjectTargetWriter::getOSABI(OSType)); } diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h index 4a75e3b..af615df 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h @@ -38,7 +38,7 @@ public: void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx = nullptr) const; - MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override; + std::unique_ptr createObjectWriter(raw_pwrite_stream &OS) const override; void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef Data, diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp index 8bdbfb4..25da75e 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp @@ -13,6 +13,7 @@ #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" @@ -118,9 +119,10 @@ unsigned AVRELFObjectWriter::getRelocType(MCContext &Ctx, } } -MCObjectWriter *createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) { - MCELFObjectTargetWriter *MOTW = new AVRELFObjectWriter(OSABI); - return createELFObjectWriter(MOTW, OS, true); +std::unique_ptr +createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) { + std::unique_ptr MOTW(new AVRELFObjectWriter(OSABI)); + return createELFObjectWriter(std::move(MOTW), OS, true); } } // end of namespace llvm diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp index 826430e..bccce5d 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp @@ -18,6 +18,7 @@ #include "InstPrinter/AVRInstPrinter.h" #include "llvm/MC/MCELFStreamer.h" +#include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" @@ -66,9 +67,12 @@ static MCInstPrinter *createAVRMCInstPrinter(const Triple &T, } static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context, - MCAsmBackend &MAB, raw_pwrite_stream &OS, - MCCodeEmitter *Emitter, bool RelaxAll) { - return createELFStreamer(Context, MAB, OS, Emitter, RelaxAll); + std::unique_ptr &&MAB, + raw_pwrite_stream &OS, + std::unique_ptr &&Emitter, + bool RelaxAll) { + return createELFStreamer(Context, std::move(MAB), OS, + std::move(Emitter), RelaxAll); } static MCTargetStreamer * diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.h index 41a5747..8053b8d 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.h +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.h @@ -16,6 +16,8 @@ #include "llvm/Support/DataTypes.h" +#include + namespace llvm { class MCAsmBackend; @@ -43,7 +45,8 @@ MCAsmBackend *createAVRAsmBackend(const Target &T, const MCRegisterInfo &MRI, const llvm::MCTargetOptions &TO); /// Creates an ELF object writer for AVR. -MCObjectWriter *createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI); +std::unique_ptr +createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI); } // end namespace llvm