OSDN Git Service

[AVR] Update to current LLVM API
authorDylan McKay <me@dylanmckay.io>
Wed, 18 Oct 2017 12:35:15 +0000 (12:35 +0000)
committerDylan McKay <me@dylanmckay.io>
Wed, 18 Oct 2017 12:35:15 +0000 (12:35 +0000)
r315410 broke a number of things in the AVR backend, which are now
fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316076 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp
lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.h

index d182983..01a0961 100644 (file)
@@ -340,7 +340,8 @@ void AVRAsmBackend::adjustFixupValue(const MCFixup &Fixup,
   }
 }
 
-MCObjectWriter *AVRAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
+std::unique_ptr<MCObjectWriter>
+AVRAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
   return createAVRELFObjectWriter(OS,
                                   MCELFObjectTargetWriter::getOSABI(OSType));
 }
index 4a75e3b..af615df 100644 (file)
@@ -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<MCObjectWriter> createObjectWriter(raw_pwrite_stream &OS) const override;
 
   void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
                   const MCValue &Target, MutableArrayRef<char> Data,
index 8bdbfb4..25da75e 100644 (file)
@@ -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<MCObjectWriter>
+createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) {
+  std::unique_ptr<MCELFObjectTargetWriter> MOTW(new AVRELFObjectWriter(OSABI));
+  return createELFObjectWriter(std::move(MOTW), OS, true);
 }
 
 } // end of namespace llvm
index 826430e..bccce5d 100644 (file)
@@ -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<MCAsmBackend> &&MAB,
+                                    raw_pwrite_stream &OS,
+                                    std::unique_ptr<MCCodeEmitter> &&Emitter,
+                                    bool RelaxAll) {
+  return createELFStreamer(Context, std::move(MAB), OS,
+      std::move(Emitter), RelaxAll);
 }
 
 static MCTargetStreamer *
index 41a5747..8053b8d 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "llvm/Support/DataTypes.h"
 
+#include <memory>
+
 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<MCObjectWriter>
+createAVRELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI);
 
 } // end namespace llvm