From 2bc24928d36531aeea52c6563a125adb22c203bf Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Tue, 29 Oct 2013 05:12:14 +0000 Subject: [PassManager] add ReaderWriter{Native,YAML} to the Driver. Enable this for the following flavors a) core b) gnu c) darwin Its disabled for the flavor PECOFF. Convenient markers are added with FIXME comments in the Driver that would be removed and code removed from each flavor. llvm-svn: 193585 --- lld/lib/ReaderWriter/CoreLinkingContext.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lld/lib/ReaderWriter/CoreLinkingContext.cpp') diff --git a/lld/lib/ReaderWriter/CoreLinkingContext.cpp b/lld/lib/ReaderWriter/CoreLinkingContext.cpp index ec8962bbce2..3b83d297e48 100644 --- a/lld/lib/ReaderWriter/CoreLinkingContext.cpp +++ b/lld/lib/ReaderWriter/CoreLinkingContext.cpp @@ -12,6 +12,9 @@ #include "lld/Core/Pass.h" #include "lld/Core/PassManager.h" #include "lld/Passes/LayoutPass.h" +#include "lld/Passes/RoundTripNativePass.h" +#include "lld/Passes/RoundTripYAMLPass.h" +#include "lld/ReaderWriter/Simple.h" #include "llvm/ADT/ArrayRef.h" @@ -149,10 +152,10 @@ private: uint32_t _ordinal; }; -class TestingPassFile : public MutableFile { +class TestingPassFile : public SimpleFile { public: TestingPassFile(const LinkingContext &ctx) - : MutableFile(ctx, "Testing pass") {} + : SimpleFile(ctx, "Testing pass") {} virtual void addAtom(const Atom &atom) { if (const DefinedAtom *defAtom = dyn_cast(&atom)) @@ -277,7 +280,7 @@ bool CoreLinkingContext::validateImpl(raw_ostream &) { return true; } -void CoreLinkingContext::addPasses(PassManager &pm) const { +void CoreLinkingContext::addPasses(PassManager &pm) { for (StringRef name : _passNames) { if (name.equals("layout")) pm.add(std::unique_ptr((new LayoutPass()))); @@ -288,6 +291,10 @@ void CoreLinkingContext::addPasses(PassManager &pm) const { else llvm_unreachable("bad pass name"); } +#ifndef NDEBUG + pm.add(std::unique_ptr(new RoundTripYAMLPass(*this))); + pm.add(std::unique_ptr(new RoundTripNativePass(*this))); +#endif } Writer &CoreLinkingContext::writer() const { return *_writer; } -- cgit v1.2.3