[llvm] r330107 - Rename ObjectMemoryBuffer to SmallVectorMemoryBuffer; NFCI
Weiming Zhao via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 15 20:44:03 PDT 2018
Author: weimingz
Date: Sun Apr 15 20:44:03 2018
New Revision: 330107
URL: http://llvm.org/viewvc/llvm-project?rev=330107&view=rev
Log:
Rename ObjectMemoryBuffer to SmallVectorMemoryBuffer; NFCI
Summary: As discussed in https://reviews.llvm.org/D45606, it makes more sense to name the class as SmallVectorMemoryBuffer
Reviewers: bkramer, dblaikie
Reviewed By: dblaikie
Subscribers: mehdi_amini, eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D45661
Added:
llvm/trunk/include/llvm/Support/SmallVectorMemoryBuffer.h
- copied, changed from r330106, llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h
Removed:
llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h
Modified:
llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/trunk/lib/Support/MemoryBuffer.cpp
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h?rev=330107&r1=330106&r2=330107&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h Sun Apr 15 20:44:03 2018
@@ -22,7 +22,7 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/ObjectMemoryBuffer.h"
+#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
Removed: llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h?rev=330106&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h (removed)
@@ -1,64 +0,0 @@
-//===- ObjectMemoryBuffer.h - SmallVector-backed MemoryBuffrer -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares a wrapper class to hold the memory into which an
-// object will be generated.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_OBJECTMEMORYBUFFER_H
-#define LLVM_EXECUTIONENGINE_OBJECTMEMORYBUFFER_H
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/raw_ostream.h"
-
-namespace llvm {
-
-/// \brief SmallVector-backed MemoryBuffer instance.
-///
-/// This class enables efficient construction of MemoryBuffers from SmallVector
-/// instances. This is useful for MCJIT and Orc, where object files are streamed
-/// into SmallVectors, then inspected using ObjectFile (which takes a
-/// MemoryBuffer).
-class ObjectMemoryBuffer : public MemoryBuffer {
-public:
-
- /// \brief Construct an ObjectMemoryBuffer from the given SmallVector r-value.
- ///
- /// FIXME: It'd be nice for this to be a non-templated constructor taking a
- /// SmallVectorImpl here instead of a templated one taking a SmallVector<N>,
- /// but SmallVector's move-construction/assignment currently only take
- /// SmallVectors. If/when that is fixed we can simplify this constructor and
- /// the following one.
- ObjectMemoryBuffer(SmallVectorImpl<char> &&SV)
- : SV(std::move(SV)), BufferName("<in-memory object>") {
- init(this->SV.begin(), this->SV.end(), false);
- }
-
- /// \brief Construct a named ObjectMemoryBuffer from the given SmallVector
- /// r-value and StringRef.
- ObjectMemoryBuffer(SmallVectorImpl<char> &&SV, StringRef Name)
- : SV(std::move(SV)), BufferName(Name) {
- init(this->SV.begin(), this->SV.end(), false);
- }
-
- StringRef getBufferIdentifier() const override { return BufferName; }
-
- BufferKind getBufferKind() const override { return MemoryBuffer_Malloc; }
-
-private:
- SmallVector<char, 0> SV;
- std::string BufferName;
- void anchor() override;
-};
-
-} // namespace llvm
-
-#endif
Copied: llvm/trunk/include/llvm/Support/SmallVectorMemoryBuffer.h (from r330106, llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SmallVectorMemoryBuffer.h?p2=llvm/trunk/include/llvm/Support/SmallVectorMemoryBuffer.h&p1=llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h&r1=330106&r2=330107&rev=330107&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ObjectMemoryBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/SmallVectorMemoryBuffer.h Sun Apr 15 20:44:03 2018
@@ -1,4 +1,5 @@
-//===- ObjectMemoryBuffer.h - SmallVector-backed MemoryBuffrer -*- C++ -*-===//
+//===- SmallVectorMemoryBuffer.h - SmallVector-backed MemoryBuffrer -*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -27,25 +28,26 @@ namespace llvm {
/// instances. This is useful for MCJIT and Orc, where object files are streamed
/// into SmallVectors, then inspected using ObjectFile (which takes a
/// MemoryBuffer).
-class ObjectMemoryBuffer : public MemoryBuffer {
+class SmallVectorMemoryBuffer : public MemoryBuffer {
public:
-
- /// \brief Construct an ObjectMemoryBuffer from the given SmallVector r-value.
+ /// \brief Construct an SmallVectorMemoryBuffer from the given SmallVector
+ /// r-value.
///
/// FIXME: It'd be nice for this to be a non-templated constructor taking a
/// SmallVectorImpl here instead of a templated one taking a SmallVector<N>,
/// but SmallVector's move-construction/assignment currently only take
/// SmallVectors. If/when that is fixed we can simplify this constructor and
/// the following one.
- ObjectMemoryBuffer(SmallVectorImpl<char> &&SV)
- : SV(std::move(SV)), BufferName("<in-memory object>") {
+ SmallVectorMemoryBuffer(SmallVectorImpl<char> &&SV)
+ : SV(std::move(SV)), BufferName("<in-memory object>") {
init(this->SV.begin(), this->SV.end(), false);
}
- /// \brief Construct a named ObjectMemoryBuffer from the given SmallVector
+ /// \brief Construct a named SmallVectorMemoryBuffer from the given
+ /// SmallVector
/// r-value and StringRef.
- ObjectMemoryBuffer(SmallVectorImpl<char> &&SV, StringRef Name)
- : SV(std::move(SV)), BufferName(Name) {
+ SmallVectorMemoryBuffer(SmallVectorImpl<char> &&SV, StringRef Name)
+ : SV(std::move(SV)), BufferName(Name) {
init(this->SV.begin(), this->SV.end(), false);
}
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=330107&r1=330106&r2=330107&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Sun Apr 15 20:44:03 2018
@@ -164,7 +164,7 @@ std::unique_ptr<MemoryBuffer> MCJIT::emi
// Flush the output buffer to get the generated code into memory
std::unique_ptr<MemoryBuffer> CompiledObjBuffer(
- new ObjectMemoryBuffer(std::move(ObjBufferSV)));
+ new SmallVectorMemoryBuffer(std::move(ObjBufferSV)));
// If we have an object cache, tell it about the new object.
// Note that we're using the compiled image, not the loaded image (as below).
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=330107&r1=330106&r2=330107&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Sun Apr 15 20:44:03 2018
@@ -17,7 +17,7 @@
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/IR/Module.h"
-#include "llvm/Support/ObjectMemoryBuffer.h"
+#include "llvm/Support/SmallVectorMemoryBuffer.h"
namespace llvm {
class MCJIT;
Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=330107&r1=330106&r2=330107&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Sun Apr 15 20:44:03 2018
@@ -36,9 +36,9 @@
#include "llvm/Support/CachePruning.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/ObjectMemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SHA1.h"
+#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/Threading.h"
@@ -274,7 +274,7 @@ std::unique_ptr<MemoryBuffer> codegenMod
// Run codegen now. resulting binary is in OutputBuffer.
PM.run(TheModule);
}
- return make_unique<ObjectMemoryBuffer>(std::move(OutputBuffer));
+ return make_unique<SmallVectorMemoryBuffer>(std::move(OutputBuffer));
}
/// Manage caching for a single Module.
@@ -475,7 +475,7 @@ ProcessThinLTOModule(Module &TheModule,
auto Index = buildModuleSummaryIndex(TheModule, nullptr, &PSI);
WriteBitcodeToFile(TheModule, OS, true, &Index);
}
- return make_unique<ObjectMemoryBuffer>(std::move(OutputBuffer));
+ return make_unique<SmallVectorMemoryBuffer>(std::move(OutputBuffer));
}
return codegenModule(TheModule, TM);
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=330107&r1=330106&r2=330107&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Sun Apr 15 20:44:03 2018
@@ -18,10 +18,10 @@
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/ObjectMemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
+#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include <cassert>
#include <cerrno>
#include <cstring>
@@ -534,4 +534,4 @@ MemoryBufferRef MemoryBuffer::getMemBuff
}
void MemoryBuffer::anchor() {}
-void ObjectMemoryBuffer::anchor() {}
+void SmallVectorMemoryBuffer::anchor() {}
More information about the llvm-commits
mailing list