summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-02 00:08:37 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-02 00:08:37 +0000
commit4e76019e349d1daab85cc42b265fbea1f9ff760c (patch)
tree2a7ceca6a3aae9eb25f86382cf0f200a97d9b1a2 /llvm/include
parent028eb5a3f823c25e6c3040d300910e23ed69e788 (diff)
downloadbcm5719-llvm-4e76019e349d1daab85cc42b265fbea1f9ff760c.tar.gz
bcm5719-llvm-4e76019e349d1daab85cc42b265fbea1f9ff760c.zip
Support: Remove MemoryObject and DataStreamer interfaces.
These interfaces are no longer used. Differential Revision: https://reviews.llvm.org/D26222 llvm-svn: 285774
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Support/DataStream.h38
-rw-r--r--llvm/include/llvm/Support/MemoryObject.h68
-rw-r--r--llvm/include/llvm/Support/StreamingMemoryObject.h87
3 files changed, 0 insertions, 193 deletions
diff --git a/llvm/include/llvm/Support/DataStream.h b/llvm/include/llvm/Support/DataStream.h
deleted file mode 100644
index a544316f430..00000000000
--- a/llvm/include/llvm/Support/DataStream.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//===---- llvm/Support/DataStream.h - Lazy bitcode streaming ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This header defines DataStreamer, which fetches bytes of data from
-// a stream source. It provides support for streaming (lazy reading) of
-// data, e.g. bitcode
-//
-//===----------------------------------------------------------------------===//
-
-
-#ifndef LLVM_SUPPORT_DATASTREAM_H
-#define LLVM_SUPPORT_DATASTREAM_H
-
-#include <memory>
-#include <string>
-
-namespace llvm {
-
-class DataStreamer {
-public:
- /// Fetch bytes [start-end) from the stream, and write them to the
- /// buffer pointed to by buf. Returns the number of bytes actually written.
- virtual size_t GetBytes(unsigned char *buf, size_t len) = 0;
-
- virtual ~DataStreamer();
-};
-
-std::unique_ptr<DataStreamer> getDataFileStreamer(const std::string &Filename,
- std::string *Err);
-}
-
-#endif // LLVM_SUPPORT_DATASTREAM_H_
diff --git a/llvm/include/llvm/Support/MemoryObject.h b/llvm/include/llvm/Support/MemoryObject.h
deleted file mode 100644
index e0c8749da34..00000000000
--- a/llvm/include/llvm/Support/MemoryObject.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===- MemoryObject.h - Abstract memory interface ---------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_MEMORYOBJECT_H
-#define LLVM_SUPPORT_MEMORYOBJECT_H
-
-#include "llvm/Support/DataTypes.h"
-
-namespace llvm {
-
-/// Interface to data which might be streamed. Streamability has 2 important
-/// implications/restrictions. First, the data might not yet exist in memory
-/// when the request is made. This just means that readByte/readBytes might have
-/// to block or do some work to get it. More significantly, the exact size of
-/// the object might not be known until it has all been fetched. This means that
-/// to return the right result, getExtent must also wait for all the data to
-/// arrive; therefore it should not be called on objects which are actually
-/// streamed (this would defeat the purpose of streaming). Instead,
-/// isValidAddress can be used to test addresses without knowing the exact size
-/// of the stream. Finally, getPointer can be used instead of readBytes to avoid
-/// extra copying.
-class MemoryObject {
-public:
- virtual ~MemoryObject();
-
- /// Returns the size of the region in bytes. (The region is contiguous, so
- /// the highest valid address of the region is getExtent() - 1).
- ///
- /// @result - The size of the region.
- virtual uint64_t getExtent() const = 0;
-
- /// Tries to read a contiguous range of bytes from the region, up to the end
- /// of the region.
- ///
- /// @param Buf - A pointer to a buffer to be filled in. Must be non-NULL
- /// and large enough to hold size bytes.
- /// @param Size - The number of bytes to copy.
- /// @param Address - The address of the first byte, in the same space as
- /// getBase().
- /// @result - The number of bytes read.
- virtual uint64_t readBytes(uint8_t *Buf, uint64_t Size,
- uint64_t Address) const = 0;
-
- /// Ensures that the requested data is in memory, and returns a pointer to it.
- /// More efficient than using readBytes if the data is already in memory. May
- /// block until (address - base + size) bytes have been read
- /// @param address - address of the byte, in the same space as getBase()
- /// @param size - amount of data that must be available on return
- /// @result - valid pointer to the requested data
- virtual const uint8_t *getPointer(uint64_t address, uint64_t size) const = 0;
-
- /// Returns true if the address is within the object (i.e. between base and
- /// base + extent - 1 inclusive). May block until (address - base) bytes have
- /// been read
- /// @param address - address of the byte, in the same space as getBase()
- /// @result - true if the address may be read with readByte()
- virtual bool isValidAddress(uint64_t address) const = 0;
-};
-
-}
-
-#endif
diff --git a/llvm/include/llvm/Support/StreamingMemoryObject.h b/llvm/include/llvm/Support/StreamingMemoryObject.h
deleted file mode 100644
index 1ab85372cd2..00000000000
--- a/llvm/include/llvm/Support/StreamingMemoryObject.h
+++ /dev/null
@@ -1,87 +0,0 @@
-//===- StreamingMemoryObject.h - Streamable data interface -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_STREAMINGMEMORYOBJECT_H
-#define LLVM_SUPPORT_STREAMINGMEMORYOBJECT_H
-
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataStream.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MemoryObject.h"
-#include <memory>
-#include <vector>
-
-namespace llvm {
-
-/// Interface to data which is actually streamed from a DataStreamer. In
-/// addition to inherited members, it has the dropLeadingBytes and
-/// setKnownObjectSize methods which are not applicable to non-streamed objects.
-class StreamingMemoryObject : public MemoryObject {
-public:
- StreamingMemoryObject(std::unique_ptr<DataStreamer> Streamer);
- uint64_t getExtent() const override;
- uint64_t readBytes(uint8_t *Buf, uint64_t Size,
- uint64_t Address) const override;
- const uint8_t *getPointer(uint64_t Address, uint64_t Size) const override;
- bool isValidAddress(uint64_t address) const override;
-
- /// Drop s bytes from the front of the stream, pushing the positions of the
- /// remaining bytes down by s. This is used to skip past the bitcode header,
- /// since we don't know a priori if it's present, and we can't put bytes
- /// back into the stream once we've read them.
- bool dropLeadingBytes(size_t s);
-
- /// If the data object size is known in advance, many of the operations can
- /// be made more efficient, so this method should be called before reading
- /// starts (although it can be called anytime).
- void setKnownObjectSize(size_t size);
-
- /// The number of bytes read at a time from the data streamer.
- static const uint32_t kChunkSize = 4096 * 4;
-
-private:
- mutable std::vector<unsigned char> Bytes;
- std::unique_ptr<DataStreamer> Streamer;
- mutable size_t BytesRead; // Bytes read from stream
- size_t BytesSkipped;// Bytes skipped at start of stream (e.g. wrapper/header)
- mutable size_t ObjectSize; // 0 if unknown, set if wrapper seen or EOF reached
- mutable bool EOFReached;
-
- // Fetch enough bytes such that Pos can be read (i.e. BytesRead >
- // Pos). Returns true if Pos can be read. Unlike most of the
- // functions in BitcodeReader, returns true on success. Most of the
- // requests will be small, but we fetch at kChunkSize bytes at a
- // time to avoid making too many potentially expensive GetBytes
- // calls.
- bool fetchToPos(size_t Pos) const {
- while (Pos >= BytesRead) {
- if (EOFReached)
- return false;
- Bytes.resize(BytesRead + BytesSkipped + kChunkSize);
- size_t bytes = Streamer->GetBytes(&Bytes[BytesRead + BytesSkipped],
- kChunkSize);
- BytesRead += bytes;
- if (bytes == 0) { // reached EOF/ran out of bytes
- if (ObjectSize == 0)
- ObjectSize = BytesRead;
- EOFReached = true;
- }
- }
- return !ObjectSize || Pos < ObjectSize;
- }
-
- StreamingMemoryObject(const StreamingMemoryObject&) = delete;
- void operator=(const StreamingMemoryObject&) = delete;
-};
-
-MemoryObject *getNonStreamedMemoryObject(
- const unsigned char *Start, const unsigned char *End);
-
-}
-#endif // STREAMINGMEMORYOBJECT_H_
OpenPOWER on IntegriCloud