summaryrefslogtreecommitdiff
path: root/gnu/llvm
diff options
context:
space:
mode:
authorPascal Stumpf <pascal@cvs.openbsd.org>2016-09-03 22:47:03 +0000
committerPascal Stumpf <pascal@cvs.openbsd.org>2016-09-03 22:47:03 +0000
commitd022654048587369e156f8c7b8d47ac812b4ae32 (patch)
treed6251d644a2b2f009743a49b16a59fc44ba767ef /gnu/llvm
parente1a2d8fa9673d9167b20e4a38cf22e7e325581ce (diff)
Use the space freed up by sparc and zaurus to import LLVM.
ok hackroom@
Diffstat (limited to 'gnu/llvm')
-rw-r--r--gnu/llvm/include/llvm/Bitcode/ReaderWriter.h81
-rw-r--r--gnu/llvm/include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h37
-rw-r--r--gnu/llvm/include/llvm/DebugInfo/CodeView/ListRecordBuilder.h22
-rw-r--r--gnu/llvm/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h48
-rw-r--r--gnu/llvm/include/llvm/ExecutionEngine/JITSymbolFlags.h10
-rw-r--r--gnu/llvm/include/llvm/ExecutionEngine/Orc/JITSymbol.h10
-rw-r--r--gnu/llvm/include/llvm/ExecutionEngine/Orc/RPCChannel.h188
-rw-r--r--gnu/llvm/include/llvm/Support/StreamingMemoryObject.h10
-rw-r--r--gnu/llvm/include/llvm/Target/TargetRecip.h9
-rw-r--r--gnu/llvm/include/llvm/Transforms/IPO/InlinerPass.h32
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp141
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp87
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp27
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp2
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp36
-rw-r--r--gnu/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp224
-rw-r--r--gnu/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp96
-rw-r--r--gnu/llvm/lib/Fuzzer/test/dfsan/CMakeLists.txt21
-rw-r--r--gnu/llvm/lib/Fuzzer/test/fuzzer-dfsan.test5
-rw-r--r--gnu/llvm/lib/Fuzzer/test/fuzzer-traces.test19
-rw-r--r--gnu/llvm/lib/Fuzzer/test/trace-bb/CMakeLists.txt15
-rw-r--r--gnu/llvm/lib/Support/StreamingMemoryObject.cpp6
-rw-r--r--gnu/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp30
-rw-r--r--gnu/llvm/lib/Target/Hexagon/HexagonRDF.h4
-rw-r--r--gnu/llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp7
-rw-r--r--gnu/llvm/lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp2
-rw-r--r--gnu/llvm/lib/Target/TargetRecip.cpp10
-rw-r--r--gnu/llvm/lib/Target/TargetSubtargetInfo.cpp2
-rw-r--r--gnu/llvm/lib/Transforms/IPO/InlineAlways.cpp11
-rw-r--r--gnu/llvm/tools/clang/lib/Headers/cuda_builtin_vars.h44
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp27
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.h3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.h3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/CompilandDumper.cpp68
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/CompilandDumper.h7
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/EnumDumper.cpp3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/EnumDumper.h3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.cpp1
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.h2
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/FunctionDumper.cpp15
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/FunctionDumper.h3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/TypeDumper.cpp5
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/TypeDumper.h4
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/TypedefDumper.cpp1
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/TypedefDumper.h2
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/VariableDumper.cpp3
-rw-r--r--gnu/llvm/tools/llvm-pdbdump/VariableDumper.h7
-rw-r--r--gnu/llvm/unittests/Analysis/MixedTBAATest.cpp1
-rw-r--r--gnu/llvm/unittests/Support/IteratorTest.cpp87
50 files changed, 553 insertions, 931 deletions
diff --git a/gnu/llvm/include/llvm/Bitcode/ReaderWriter.h b/gnu/llvm/include/llvm/Bitcode/ReaderWriter.h
index 76a60a0b8d2..60d865fd235 100644
--- a/gnu/llvm/include/llvm/Bitcode/ReaderWriter.h
+++ b/gnu/llvm/include/llvm/Bitcode/ReaderWriter.h
@@ -15,7 +15,7 @@
#define LLVM_BITCODE_READERWRITER_H
#include "llvm/IR/DiagnosticInfo.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/IR/FunctionInfo.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -30,14 +30,6 @@ namespace llvm {
class ModulePass;
class raw_ostream;
- /// Offsets of the 32-bit fields of bitcode wrapper header.
- static const unsigned BWH_MagicField = 0*4;
- static const unsigned BWH_VersionField = 1*4;
- static const unsigned BWH_OffsetField = 2*4;
- static const unsigned BWH_SizeField = 3*4;
- static const unsigned BWH_CPUTypeField = 4*4;
- static const unsigned BWH_HeaderSize = 5*4;
-
/// Read the header of the specified bitcode buffer and prepare for lazy
/// deserialization of function bodies. If ShouldLazyLoadMetadata is true,
/// lazily load metadata as well. If successful, this moves Buffer. On
@@ -60,11 +52,6 @@ namespace llvm {
std::string getBitcodeTargetTriple(MemoryBufferRef Buffer,
LLVMContext &Context);
- /// Return true if \p Buffer contains a bitcode file with ObjC code (category
- /// or class) in it.
- bool isBitcodeContainingObjCCategory(MemoryBufferRef Buffer,
- LLVMContext &Context);
-
/// Read the header of the specified bitcode buffer and extract just the
/// producer string information. If successful, this returns a string. On
/// error, this returns "".
@@ -75,15 +62,29 @@ namespace llvm {
ErrorOr<std::unique_ptr<Module>> parseBitcodeFile(MemoryBufferRef Buffer,
LLVMContext &Context);
- /// Check if the given bitcode buffer contains a summary block.
- bool
- hasGlobalValueSummary(MemoryBufferRef Buffer,
- const DiagnosticHandlerFunction &DiagnosticHandler);
-
- /// Parse the specified bitcode buffer, returning the module summary index.
- ErrorOr<std::unique_ptr<ModuleSummaryIndex>>
- getModuleSummaryIndex(MemoryBufferRef Buffer,
- const DiagnosticHandlerFunction &DiagnosticHandler);
+ /// Check if the given bitcode buffer contains a function summary block.
+ bool hasFunctionSummary(MemoryBufferRef Buffer,
+ DiagnosticHandlerFunction DiagnosticHandler);
+
+ /// Parse the specified bitcode buffer, returning the function info index.
+ /// If IsLazy is true, parse the entire function summary into
+ /// the index. Otherwise skip the function summary section, and only create
+ /// an index object with a map from function name to function summary offset.
+ /// The index is used to perform lazy function summary reading later.
+ ErrorOr<std::unique_ptr<FunctionInfoIndex>>
+ getFunctionInfoIndex(MemoryBufferRef Buffer,
+ DiagnosticHandlerFunction DiagnosticHandler,
+ bool IsLazy = false);
+
+ /// This method supports lazy reading of function summary data from the
+ /// combined index during function importing. When reading the combined index
+ /// file, getFunctionInfoIndex is first invoked with IsLazy=true.
+ /// Then this method is called for each function considered for importing,
+ /// to parse the summary information for the given function name into
+ /// the index.
+ std::error_code readFunctionSummary(
+ MemoryBufferRef Buffer, DiagnosticHandlerFunction DiagnosticHandler,
+ StringRef FunctionName, std::unique_ptr<FunctionInfoIndex> Index);
/// \brief Write the specified module to the specified raw output stream.
///
@@ -94,21 +95,17 @@ namespace llvm {
/// Value in \c M. These will be reconstructed exactly when \a M is
/// deserialized.
///
- /// If \c EmitSummaryIndex, emit the module's summary index (currently
+ /// If \c EmitFunctionSummary, emit the function summary index (currently
/// for use in ThinLTO optimization).
void WriteBitcodeToFile(const Module *M, raw_ostream &Out,
bool ShouldPreserveUseListOrder = false,
- const ModuleSummaryIndex *Index = nullptr,
- bool GenerateHash = false);
+ bool EmitFunctionSummary = false);
- /// Write the specified module summary index to the given raw output stream,
+ /// Write the specified function summary index to the given raw output stream,
/// where it will be written in a new bitcode block. This is used when
- /// writing the combined index file for ThinLTO. When writing a subset of the
- /// index for a distributed backend, provide the \p ModuleToSummariesForIndex
- /// map.
- void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
- std::map<std::string, GVSummaryMapTy>
- *ModuleToSummariesForIndex = nullptr);
+ /// writing the combined index file for ThinLTO.
+ void WriteFunctionSummaryToFile(const FunctionInfoIndex &Index,
+ raw_ostream &Out);
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
/// for an LLVM IR bitcode wrapper.
@@ -166,16 +163,20 @@ namespace llvm {
inline bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr,
const unsigned char *&BufEnd,
bool VerifyBufferSize) {
- // Must contain the offset and size field!
- if (unsigned(BufEnd - BufPtr) < BWH_SizeField + 4)
- return true;
+ enum {
+ KnownHeaderSize = 4*4, // Size of header we read.
+ OffsetField = 2*4, // Offset in bytes to Offset field.
+ SizeField = 3*4 // Offset in bytes to Size field.
+ };
+
+ // Must contain the header!
+ if (BufEnd-BufPtr < KnownHeaderSize) return true;
- unsigned Offset = support::endian::read32le(&BufPtr[BWH_OffsetField]);
- unsigned Size = support::endian::read32le(&BufPtr[BWH_SizeField]);
- uint64_t BitcodeOffsetEnd = (uint64_t)Offset + (uint64_t)Size;
+ unsigned Offset = support::endian::read32le(&BufPtr[OffsetField]);
+ unsigned Size = support::endian::read32le(&BufPtr[SizeField]);
// Verify that Offset+Size fits in the file.
- if (VerifyBufferSize && BitcodeOffsetEnd > uint64_t(BufEnd-BufPtr))
+ if (VerifyBufferSize && Offset+Size > unsigned(BufEnd-BufPtr))
return true;
BufPtr += Offset;
BufEnd = BufPtr+Size;
diff --git a/gnu/llvm/include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h b/gnu/llvm/include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h
index 75a075157d2..1ed62487aec 100644
--- a/gnu/llvm/include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h
+++ b/gnu/llvm/include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h
@@ -11,7 +11,6 @@
#define LLVM_DEBUGINFO_CODEVIEW_FIELDLISTRECORDBUILDER_H
#include "llvm/DebugInfo/CodeView/ListRecordBuilder.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
namespace llvm {
namespace codeview {
@@ -47,17 +46,31 @@ private:
public:
FieldListRecordBuilder();
- void reset() { ListRecordBuilder::reset(); }
-
- void writeBaseClass(const BaseClassRecord &Record);
- void writeEnumerator(const EnumeratorRecord &Record);
- void writeDataMember(const DataMemberRecord &Record);
- void writeOneMethod(const OneMethodRecord &Record);
- void writeOverloadedMethod(const OverloadedMethodRecord &Record);
- void writeNestedType(const NestedTypeRecord &Record);
- void writeStaticDataMember(const StaticDataMemberRecord &Record);
- void writeVirtualBaseClass(const VirtualBaseClassRecord &Record);
- void writeVFPtr(const VFPtrRecord &Type);
+ void writeBaseClass(MemberAccess Access, TypeIndex Type, uint64_t Offset);
+ void writeEnumerate(MemberAccess Access, uint64_t Value, StringRef Name);
+ void writeIndirectVirtualBaseClass(MemberAccess Access, TypeIndex Type,
+ TypeIndex VirtualBasePointerType,
+ int64_t VirtualBasePointerOffset,
+ uint64_t SlotIndex);
+ void writeMember(MemberAccess Access, TypeIndex Type, uint64_t Offset,
+ StringRef Name);
+ void writeOneMethod(MemberAccess Access, MethodKind Kind,
+ MethodOptions Options, TypeIndex Type,
+ int32_t VTableSlotOffset, StringRef Name);
+ void writeOneMethod(const MethodInfo &Method, StringRef Name);
+ void writeMethod(uint16_t OverloadCount, TypeIndex MethodList,
+ StringRef Name);
+ void writeNestedType(TypeIndex Type, StringRef Name);
+ void writeStaticMember(MemberAccess Access, TypeIndex Type, StringRef Name);
+ void writeVirtualBaseClass(MemberAccess Access, TypeIndex Type,
+ TypeIndex VirtualBasePointerType,
+ int64_t VirtualBasePointerOffset,
+ uint64_t SlotIndex);
+ void writeVirtualBaseClass(TypeRecordKind Kind, MemberAccess Access,
+ TypeIndex Type, TypeIndex VirtualBasePointerType,
+ int64_t VirtualBasePointerOffset,
+ uint64_t SlotIndex);
+ void writeVirtualFunctionTablePointer(TypeIndex Type);
};
}
}
diff --git a/gnu/llvm/include/llvm/DebugInfo/CodeView/ListRecordBuilder.h b/gnu/llvm/include/llvm/DebugInfo/CodeView/ListRecordBuilder.h
index 00bf03d417a..df0a2e08a41 100644
--- a/gnu/llvm/include/llvm/DebugInfo/CodeView/ListRecordBuilder.h
+++ b/gnu/llvm/include/llvm/DebugInfo/CodeView/ListRecordBuilder.h
@@ -14,7 +14,6 @@
namespace llvm {
namespace codeview {
-class TypeTableBuilder;
class ListRecordBuilder {
private:
@@ -29,35 +28,14 @@ protected:
public:
llvm::StringRef str() { return Builder.str(); }
- void reset() {
- Builder.reset(Kind);
- ContinuationOffsets.clear();
- SubrecordStart = 0;
- }
-
- void writeListContinuation(const ListContinuationRecord &R);
-
- /// Writes this list record as a possible sequence of records.
- TypeIndex writeListRecord(TypeTableBuilder &Table);
-
protected:
void finishSubRecord();
TypeRecordBuilder &getBuilder() { return Builder; }
private:
- size_t getLastContinuationStart() const {
- return ContinuationOffsets.empty() ? 0 : ContinuationOffsets.back();
- }
- size_t getLastContinuationEnd() const { return Builder.size(); }
- size_t getLastContinuationSize() const {
- return getLastContinuationEnd() - getLastContinuationStart();
- }
-
- TypeRecordKind Kind;
TypeRecordBuilder Builder;
SmallVector<size_t, 4> ContinuationOffsets;
- size_t SubrecordStart = 0;
};
}
}
diff --git a/gnu/llvm/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h b/gnu/llvm/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h
index 002f885c7c5..5bfe2a06867 100644
--- a/gnu/llvm/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h
+++ b/gnu/llvm/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h
@@ -10,9 +10,12 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H
#define LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
+#include <functional>
+#include <memory>
+#include <unordered_map>
#include <vector>
namespace llvm {
@@ -20,29 +23,46 @@ namespace codeview {
class MemoryTypeTableBuilder : public TypeTableBuilder {
public:
- MemoryTypeTableBuilder() {}
+ class Record {
+ public:
+ explicit Record(llvm::StringRef RData);
+
+ const char *data() const { return Data.get(); }
+ uint16_t size() const { return Size; }
+
+ private:
+ uint16_t Size;
+ std::unique_ptr<char[]> Data;
+ };
+
+private:
+ class RecordHash : std::unary_function<llvm::StringRef, size_t> {
+ public:
+ size_t operator()(llvm::StringRef Val) const {
+ return static_cast<size_t>(llvm::hash_value(Val));
+ }
+ };
- bool empty() const { return Records.empty(); }
+public:
+ MemoryTypeTableBuilder() {}
template <typename TFunc> void ForEachRecord(TFunc Func) {
uint32_t Index = TypeIndex::FirstNonSimpleIndex;
- for (StringRef R : Records) {
- Func(TypeIndex(Index), R);
+ for (const std::unique_ptr<Record> &R : Records) {
+ Func(TypeIndex(Index), R.get());
++Index;
}
}
-protected:
- TypeIndex writeRecord(llvm::StringRef Data) override;
+private:
+ virtual TypeIndex writeRecord(llvm::StringRef Data) override;
private:
- std::vector<StringRef> Records;
- BumpPtrAllocator RecordStorage;
- DenseMap<StringRef, TypeIndex> HashedRecords;
+ std::vector<std::unique_ptr<Record>> Records;
+ std::unordered_map<llvm::StringRef, TypeIndex, RecordHash> HashedRecords;
};
+}
+}
-} // end namespace codeview
-} // end namespace llvm
-
-#endif // LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H
+#endif
diff --git a/gnu/llvm/include/llvm/ExecutionEngine/JITSymbolFlags.h b/gnu/llvm/include/llvm/ExecutionEngine/JITSymbolFlags.h
index 7e1d57dabc8..450e9481fa0 100644
--- a/gnu/llvm/include/llvm/ExecutionEngine/JITSymbolFlags.h
+++ b/gnu/llvm/include/llvm/ExecutionEngine/JITSymbolFlags.h
@@ -15,7 +15,6 @@
#define LLVM_EXECUTIONENGINE_JITSYMBOLFLAGS_H
#include "llvm/IR/GlobalValue.h"
-#include "llvm/Object/SymbolicFile.h"
namespace llvm {
@@ -70,16 +69,7 @@ public:
if (!GV.hasLocalLinkage() && !GV.hasHiddenVisibility())
Flags |= JITSymbolFlags::Exported;
return Flags;
- }
- static JITSymbolFlags
- flagsFromObjectSymbol(const object::BasicSymbolRef &Symbol) {
- JITSymbolFlags Flags = JITSymbolFlags::None;
- if (Symbol.getFlags() & object::BasicSymbolRef::SF_Weak)
- Flags |= JITSymbolFlags::Weak;
- if (Symbol.getFlags() & object::BasicSymbolRef::SF_Exported)
- Flags |= JITSymbolFlags::Exported;
- return Flags;
}
private:
diff --git a/gnu/llvm/include/llvm/ExecutionEngine/Orc/JITSymbol.h b/gnu/llvm/include/llvm/ExecutionEngine/Orc/JITSymbol.h
index 464417e4e6d..422a3761837 100644
--- a/gnu/llvm/include/llvm/ExecutionEngine/Orc/JITSymbol.h
+++ b/gnu/llvm/include/llvm/ExecutionEngine/Orc/JITSymbol.h
@@ -15,7 +15,6 @@
#define LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H
#include "llvm/ExecutionEngine/JITSymbolFlags.h"
-#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <functional>
@@ -53,10 +52,6 @@ public:
JITSymbol(GetAddressFtor GetAddress, JITSymbolFlags Flags)
: JITSymbolBase(Flags), GetAddress(std::move(GetAddress)), CachedAddr(0) {}
- /// @brief Create a JITSymbol from a RuntimeDyld::SymbolInfo.
- JITSymbol(const RuntimeDyld::SymbolInfo &Sym)
- : JITSymbolBase(Sym.getFlags()), CachedAddr(Sym.getAddress()) {}
-
/// @brief Returns true if the symbol exists, false otherwise.
explicit operator bool() const { return CachedAddr || GetAddress; }
@@ -71,11 +66,6 @@ public:
return CachedAddr;
}
- /// @brief Convert this JITSymbol to a RuntimeDyld::SymbolInfo.
- RuntimeDyld::SymbolInfo toRuntimeDyldSymbol() {
- return RuntimeDyld::SymbolInfo(getAddress(), getFlags());
- }
-
private:
GetAddressFtor GetAddress;
TargetAddress CachedAddr;
diff --git a/gnu/llvm/include/llvm/ExecutionEngine/Orc/RPCChannel.h b/gnu/llvm/include/llvm/ExecutionEngine/Orc/RPCChannel.h
index c569e3cf05b..b97b6daf586 100644
--- a/gnu/llvm/include/llvm/ExecutionEngine/Orc/RPCChannel.h
+++ b/gnu/llvm/include/llvm/ExecutionEngine/Orc/RPCChannel.h
@@ -1,27 +1,13 @@
-//===- llvm/ExecutionEngine/Orc/RPCChannel.h --------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
+// -*- c++ -*-
#ifndef LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H
#define LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H
#include "OrcError.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Endian.h"
-#include "llvm/Support/Error.h"
-#include <cstddef>
-#include <cstdint>
-#include <mutex>
-#include <string>
-#include <tuple>
-#include <vector>
+
+#include <system_error>
namespace llvm {
namespace orc {
@@ -33,73 +19,40 @@ public:
virtual ~RPCChannel() {}
/// Read Size bytes from the stream into *Dst.
- virtual Error readBytes(char *Dst, unsigned Size) = 0;
+ virtual std::error_code readBytes(char *Dst, unsigned Size) = 0;
/// Read size bytes from *Src and append them to the stream.
- virtual Error appendBytes(const char *Src, unsigned Size) = 0;
+ virtual std::error_code appendBytes(const char *Src, unsigned Size) = 0;
/// Flush the stream if possible.
- virtual Error send() = 0;
-
- /// Get the lock for stream reading.
- std::mutex &getReadLock() { return readLock; }
-
- /// Get the lock for stream writing.
- std::mutex &getWriteLock() { return writeLock; }
-
-private:
- std::mutex readLock, writeLock;
+ virtual std::error_code send() = 0;
};
-/// Notify the channel that we're starting a message send.
-/// Locks the channel for writing.
-inline Error startSendMessage(RPCChannel &C) {
- C.getWriteLock().lock();
- return Error::success();
-}
-
-/// Notify the channel that we're ending a message send.
-/// Unlocks the channel for writing.
-inline Error endSendMessage(RPCChannel &C) {
- C.getWriteLock().unlock();
- return Error::success();
-}
-
-/// Notify the channel that we're starting a message receive.
-/// Locks the channel for reading.
-inline Error startReceiveMessage(RPCChannel &C) {
- C.getReadLock().lock();
- return Error::success();
-}
-
-/// Notify the channel that we're ending a message receive.
-/// Unlocks the channel for reading.
-inline Error endReceiveMessage(RPCChannel &C) {
- C.getReadLock().unlock();
- return Error::success();
-}
-
/// RPC channel serialization for a variadic list of arguments.
template <typename T, typename... Ts>
-Error serializeSeq(RPCChannel &C, const T &Arg, const Ts &... Args) {
- if (auto Err = serialize(C, Arg))
- return Err;
- return serializeSeq(C, Args...);
+std::error_code serialize_seq(RPCChannel &C, const T &Arg, const Ts &... Args) {
+ if (auto EC = serialize(C, Arg))
+ return EC;
+ return serialize_seq(C, Args...);
}
/// RPC channel serialization for an (empty) variadic list of arguments.
-inline Error serializeSeq(RPCChannel &C) { return Error::success(); }
+inline std::error_code serialize_seq(RPCChannel &C) {
+ return std::error_code();
+}
/// RPC channel deserialization for a variadic list of arguments.
template <typename T, typename... Ts>
-Error deserializeSeq(RPCChannel &C, T &Arg, Ts &... Args) {
- if (auto Err = deserialize(C, Arg))
- return Err;
- return deserializeSeq(C, Args...);
+std::error_code deserialize_seq(RPCChannel &C, T &Arg, Ts &... Args) {
+ if (auto EC = deserialize(C, Arg))
+ return EC;
+ return deserialize_seq(C, Args...);
}
/// RPC channel serialization for an (empty) variadic list of arguments.
-inline Error deserializeSeq(RPCChannel &C) { return Error::success(); }
+inline std::error_code deserialize_seq(RPCChannel &C) {
+ return std::error_code();
+}
/// RPC channel serialization for integer primitives.
template <typename T>
@@ -108,7 +61,7 @@ typename std::enable_if<
std::is_same<T, uint32_t>::value || std::is_same<T, int32_t>::value ||
std::is_same<T, uint16_t>::value || std::is_same<T, int16_t>::value ||
std::is_same<T, uint8_t>::value || std::is_same<T, int8_t>::value,
- Error>::type
+ std::error_code>::type
serialize(RPCChannel &C, T V) {
support::endian::byte_swap<T, support::big>(V);
return C.appendBytes(reinterpret_cast<const char *>(&V), sizeof(T));
@@ -121,129 +74,106 @@ typename std::enable_if<
std::is_same<T, uint32_t>::value || std::is_same<T, int32_t>::value ||
std::is_same<T, uint16_t>::value || std::is_same<T, int16_t>::value ||
std::is_same<T, uint8_t>::value || std::is_same<T, int8_t>::value,
- Error>::type
+ std::error_code>::type
deserialize(RPCChannel &C, T &V) {
- if (auto Err = C.readBytes(reinterpret_cast<char *>(&V), sizeof(T)))
- return Err;
+ if (auto EC = C.readBytes(reinterpret_cast<char *>(&V), sizeof(T)))
+ return EC;
support::endian::byte_swap<T, support::big>(V);
- return Error::success();
+ return std::error_code();
}
/// RPC channel serialization for enums.
template <typename T>
-typename std::enable_if<std::is_enum<T>::value, Error>::type
+typename std::enable_if<std::is_enum<T>::value, std::error_code>::type
serialize(RPCChannel &C, T V) {
return serialize(C, static_cast<typename std::underlying_type<T>::type>(V));
}
/// RPC channel deserialization for enums.
template <typename T>
-typename std::enable_if<std::is_enum<T>::value, Error>::type
+typename std::enable_if<std::is_enum<T>::value, std::error_code>::type
deserialize(RPCChannel &C, T &V) {
typename std::underlying_type<T>::type Tmp;
- Error Err = deserialize(C, Tmp);
+ std::error_code EC = deserialize(C, Tmp);
V = static_cast<T>(Tmp);
- return Err;
+ return EC;
}
/// RPC channel serialization for bools.
-inline Error serialize(RPCChannel &C, bool V) {
+inline std::error_code serialize(RPCChannel &C, bool V) {
uint8_t VN = V ? 1 : 0;
return C.appendBytes(reinterpret_cast<const char *>(&VN), 1);
}
/// RPC channel deserialization for bools.
-inline Error deserialize(RPCChannel &C, bool &V) {
+inline std::error_code deserialize(RPCChannel &C, bool &V) {
uint8_t VN = 0;
- if (auto Err = C.readBytes(reinterpret_cast<char *>(&VN), 1))
- return Err;
+ if (auto EC = C.readBytes(reinterpret_cast<char *>(&VN), 1))
+ return EC;
- V = (VN != 0);
- return Error::success();
+ V = (VN != 0) ? true : false;
+ return std::error_code();
}
/// RPC channel serialization for StringRefs.
/// Note: There is no corresponding deseralization for this, as StringRef
/// doesn't own its memory and so can't hold the deserialized data.
-inline Error serialize(RPCChannel &C, StringRef S) {
- if (auto Err = serialize(C, static_cast<uint64_t>(S.size())))
- return Err;
+inline std::error_code serialize(RPCChannel &C, StringRef S) {
+ if (auto EC = serialize(C, static_cast<uint64_t>(S.size())))
+ return EC;
return C.appendBytes((const char *)S.bytes_begin(), S.size());
}
/// RPC channel serialization for std::strings.
-inline Error serialize(RPCChannel &C, const std::string &S) {
+inline std::error_code serialize(RPCChannel &C, const std::string &S) {
return serialize(C, StringRef(S));
}
/// RPC channel deserialization for std::strings.
-inline Error deserialize(RPCChannel &C, std::string &S) {
+inline std::error_code deserialize(RPCChannel &C, std::string &S) {
uint64_t Count;
- if (auto Err = deserialize(C, Count))
- return Err;
+ if (auto EC = deserialize(C, Count))
+ return EC;
S.resize(Count);
return C.readBytes(&S[0], Count);
}
-// Serialization helper for std::tuple.
-template <typename TupleT, size_t... Is>
-inline Error serializeTupleHelper(RPCChannel &C, const TupleT &V,
- llvm::index_sequence<Is...> _) {
- return serializeSeq(C, std::get<Is>(V)...);
-}
-
-/// RPC channel serialization for std::tuple.
-template <typename... ArgTs>
-inline Error serialize(RPCChannel &C, const std::tuple<ArgTs...> &V) {
- return serializeTupleHelper(C, V, llvm::index_sequence_for<ArgTs...>());
-}
-
-// Serialization helper for std::tuple.
-template <typename TupleT, size_t... Is>
-inline Error deserializeTupleHelper(RPCChannel &C, TupleT &V,
- llvm::index_sequence<Is...> _) {
- return deserializeSeq(C, std::get<Is>(V)...);
-}
-
-/// RPC channel deserialization for std::tuple.
-template <typename... ArgTs>
-inline Error deserialize(RPCChannel &C, std::tuple<ArgTs...> &V) {
- return deserializeTupleHelper(C, V, llvm::index_sequence_for<ArgTs...>());
-}
-
/// RPC channel serialization for ArrayRef<T>.
-template <typename T> Error serialize(RPCChannel &C, const ArrayRef<T> &A) {
- if (auto Err = serialize(C, static_cast<uint64_t>(A.size())))
- return Err;
+template <typename T>
+std::error_code serialize(RPCChannel &C, const ArrayRef<T> &A) {
+ if (auto EC = serialize(C, static_cast<uint64_t>(A.size())))
+ return EC;
for (const auto &E : A)
- if (auto Err = serialize(C, E))
- return Err;
+ if (auto EC = serialize(C, E))
+ return EC;
- return Error::success();
+ return std::error_code();
}
/// RPC channel serialization for std::array<T>.
-template <typename T> Error serialize(RPCChannel &C, const std::vector<T> &V) {
+template <typename T>
+std::error_code serialize(RPCChannel &C, const std::vector<T> &V) {
return serialize(C, ArrayRef<T>(V));
}
/// RPC channel deserialization for std::array<T>.
-template <typename T> Error deserialize(RPCChannel &C, std::vector<T> &V) {
+template <typename T>
+std::error_code deserialize(RPCChannel &C, std::vector<T> &V) {
uint64_t Count = 0;
- if (auto Err = deserialize(C, Count))
- return Err;
+ if (auto EC = deserialize(C, Count))
+ return EC;
V.resize(Count);
for (auto &E : V)
- if (auto Err = deserialize(C, E))
- return Err;
+ if (auto EC = deserialize(C, E))
+ return EC;
- return Error::success();
+ return std::error_code();
}
} // end namespace remote
} // end namespace orc
} // end namespace llvm
-#endif // LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H
+#endif
diff --git a/gnu/llvm/include/llvm/Support/StreamingMemoryObject.h b/gnu/llvm/include/llvm/Support/StreamingMemoryObject.h
index 1ab85372cd2..a5980c23594 100644
--- a/gnu/llvm/include/llvm/Support/StreamingMemoryObject.h
+++ b/gnu/llvm/include/llvm/Support/StreamingMemoryObject.h
@@ -28,7 +28,15 @@ public:
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;
+ const uint8_t *getPointer(uint64_t address, uint64_t size) const override {
+ // FIXME: This could be fixed by ensuring the bytes are fetched and
+ // making a copy, requiring that the bitcode size be known, or
+ // otherwise ensuring that the memory doesn't go away/get reallocated,
+ // but it's not currently necessary. Users that need the pointer (any
+ // that need Blobs) don't stream.
+ report_fatal_error("getPointer in streaming memory objects not allowed");
+ return nullptr;
+ }
bool isValidAddress(uint64_t address) const override;
/// Drop s bytes from the front of the stream, pushing the positions of the
diff --git a/gnu/llvm/include/llvm/Target/TargetRecip.h b/gnu/llvm/include/llvm/Target/TargetRecip.h
index 309b9607913..210d4932484 100644
--- a/gnu/llvm/include/llvm/Target/TargetRecip.h
+++ b/gnu/llvm/include/llvm/Target/TargetRecip.h
@@ -18,10 +18,9 @@
#define LLVM_TARGET_TARGETRECIP_H
#include "llvm/ADT/StringRef.h"
-#include <cstdint>
-#include <map>
-#include <string>
#include <vector>
+#include <string>
+#include <map>
namespace llvm {
@@ -69,6 +68,6 @@ private:
void parseIndividualParams(const std::vector<std::string> &Args);
};
-} // end namespace llvm
+} // End llvm namespace
-#endif // LLVM_TARGET_TARGETRECIP_H
+#endif
diff --git a/gnu/llvm/include/llvm/Transforms/IPO/InlinerPass.h b/gnu/llvm/include/llvm/Transforms/IPO/InlinerPass.h
index 59e10608a9b..58ef0cbbfb5 100644
--- a/gnu/llvm/include/llvm/Transforms/IPO/InlinerPass.h
+++ b/gnu/llvm/include/llvm/Transforms/IPO/InlinerPass.h
@@ -24,7 +24,6 @@ class AssumptionCacheTracker;
class CallSite;
class DataLayout;
class InlineCost;
-class ProfileSummaryInfo;
template <class PtrType, unsigned SmallSize> class SmallPtrSet;
/// Inliner - This class contains all of the helper code which is used to
@@ -32,7 +31,7 @@ template <class PtrType, unsigned SmallSize> class SmallPtrSet;
///
struct Inliner : public CallGraphSCCPass {
explicit Inliner(char &ID);
- explicit Inliner(char &ID, bool InsertLifetime);
+ explicit Inliner(char &ID, int Threshold, bool InsertLifetime);
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
@@ -48,6 +47,18 @@ struct Inliner : public CallGraphSCCPass {
// processing to avoid breaking the SCC traversal.
bool doFinalization(CallGraph &CG) override;
+ /// This method returns the value specified by the -inline-threshold value,
+ /// specified on the command line. This is typically not directly needed.
+ ///
+ unsigned getInlineThreshold() const { return InlineThreshold; }
+
+ /// Calculate the inline threshold for given Caller. This threshold is lower
+ /// if the caller is marked with OptimizeForSize and -inline-threshold is not
+ /// given on the comand line. It is higher if the callee is marked with the
+ /// inlinehint attribute.
+ ///
+ unsigned getInlineThreshold(CallSite CS) const;
+
/// getInlineCost - This method must be implemented by the subclass to
/// determine the cost of inlining the specified call site. If the cost
/// returned is greater than the current inline threshold, the call site is
@@ -63,30 +74,19 @@ struct Inliner : public CallGraphSCCPass {
/// deal with that subset of the functions.
bool removeDeadFunctions(CallGraph &CG, bool AlwaysInlineOnly = false);
- /// This function performs the main work of the pass. The default
- /// of Inlinter::runOnSCC() calls skipSCC() before calling this method, but
- /// derived classes which cannot be skipped can override that method and
- /// call this function unconditionally.
- bool inlineCalls(CallGraphSCC &SCC);
-
private:
+ // InlineThreshold - Cache the value here for easy access.
+ unsigned InlineThreshold;
+
// InsertLifetime - Insert @llvm.lifetime intrinsics.
bool InsertLifetime;
/// shouldInline - Return true if the inliner should attempt to
/// inline at the given CallSite.
bool shouldInline(CallSite CS);
- /// Return true if inlining of CS can block the caller from being
- /// inlined which is proved to be more beneficial. \p IC is the
- /// estimated inline cost associated with callsite \p CS.
- /// \p TotalAltCost will be set to the estimated cost of inlining the caller
- /// if \p CS is suppressed for inlining.
- bool shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,
- int &TotalAltCost);
protected:
AssumptionCacheTracker *ACT;
- ProfileSummaryInfo *PSI;
};
} // End llvm namespace
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp
index 5f229e3d9f9..91b71cc4b11 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp
@@ -15,118 +15,151 @@ using namespace codeview;
FieldListRecordBuilder::FieldListRecordBuilder()
: ListRecordBuilder(TypeRecordKind::FieldList) {}
-void FieldListRecordBuilder::writeBaseClass(const BaseClassRecord &Record) {
+void FieldListRecordBuilder::writeBaseClass(MemberAccess Access, TypeIndex Type,
+ uint64_t Offset) {
TypeRecordBuilder &Builder = getBuilder();
Builder.writeTypeRecordKind(TypeRecordKind::BaseClass);
- Builder.writeUInt16(static_cast<uint16_t>(Record.getAccess()));
- Builder.writeTypeIndex(Record.getBaseType());
- Builder.writeEncodedUnsignedInteger(Record.getBaseOffset());
+ Builder.writeUInt16(static_cast<uint16_t>(Access));
+ Builder.writeTypeIndex(Type);
+ Builder.writeEncodedUnsignedInteger(Offset);
finishSubRecord();
}
-void FieldListRecordBuilder::writeEnumerator(const EnumeratorRecord &Record) {
+void FieldListRecordBuilder::writeEnumerate(MemberAccess Access, uint64_t Value,
+ StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(TypeRecordKind::Enumerator);
- Builder.writeUInt16(static_cast<uint16_t>(Record.getAccess()));
- // FIXME: Handle full APInt such as __int128.
- Builder.writeEncodedUnsignedInteger(Record.getValue().getZExtValue());
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeTypeRecordKind(TypeRecordKind::Enumerate);
+ Builder.writeUInt16(static_cast<uint16_t>(Access));
+ Builder.writeEncodedUnsignedInteger(Value);
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
-void FieldListRecordBuilder::writeDataMember(const DataMemberRecord &Record) {
+void FieldListRecordBuilder::writeMember(MemberAccess Access, TypeIndex Type,
+ uint64_t Offset, StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(Record.getKind());
- Builder.writeUInt16(static_cast<uint16_t>(Record.getAccess()));
- Builder.writeTypeIndex(Record.getType());
- Builder.writeEncodedUnsignedInteger(Record.getFieldOffset());
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeTypeRecordKind(TypeRecordKind::Member);
+ Builder.writeUInt16(static_cast<uint16_t>(Access));
+ Builder.writeTypeIndex(Type);
+ Builder.writeEncodedUnsignedInteger(Offset);
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
-void FieldListRecordBuilder::writeOverloadedMethod(
- const OverloadedMethodRecord &Record) {
+void FieldListRecordBuilder::writeMethod(uint16_t OverloadCount,
+ TypeIndex MethodList, StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(TypeRecordKind::OverloadedMethod);
- Builder.writeUInt16(Record.getNumOverloads());
- Builder.writeTypeIndex(Record.getMethodList());
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeTypeRecordKind(TypeRecordKind::Method);
+ Builder.writeUInt16(OverloadCount);
+ Builder.writeTypeIndex(MethodList);
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
-void FieldListRecordBuilder::writeOneMethod(const OneMethodRecord &Record) {
+void FieldListRecordBuilder::writeOneMethod(
+ MemberAccess Access, MethodKind Kind, MethodOptions Options, TypeIndex Type,
+ int32_t VTableSlotOffset, StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- uint16_t Flags = static_cast<uint16_t>(Record.getAccess());
- Flags |= static_cast<uint16_t>(Record.getKind()) << MethodKindShift;
- Flags |= static_cast<uint16_t>(Record.getOptions());
+ uint16_t Flags = static_cast<uint16_t>(Access);
+ Flags |= static_cast<uint16_t>(Kind) << MethodKindShift;
+ Flags |= static_cast<uint16_t>(Options);
Builder.writeTypeRecordKind(TypeRecordKind::OneMethod);
Builder.writeUInt16(Flags);
- Builder.writeTypeIndex(Record.getType());
- if (Record.isIntroducingVirtual()) {
- assert(Record.getVFTableOffset() >= 0);
- Builder.writeInt32(Record.getVFTableOffset());
- } else {
- assert(Record.getVFTableOffset() == -1);
+ Builder.writeTypeIndex(Type);
+ switch (Kind) {
+ case MethodKind::IntroducingVirtual:
+ case MethodKind::PureIntroducingVirtual:
+ assert(VTableSlotOffset >= 0);
+ Builder.writeInt32(VTableSlotOffset);
+ break;
+
+ default:
+ assert(VTableSlotOffset == -1);
+ break;
}
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
-void FieldListRecordBuilder::writeNestedType(const NestedTypeRecord &Record) {
+void FieldListRecordBuilder::writeOneMethod(const MethodInfo &Method,
+ StringRef Name) {
+ writeOneMethod(Method.getAccess(), Method.getKind(), Method.getOptions(),
+ Method.getType(), Method.getVTableSlotOffset(), Name);
+}
+
+void FieldListRecordBuilder::writeNestedType(TypeIndex Type, StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(Record.getKind());
+ Builder.writeTypeRecordKind(TypeRecordKind::NestedType);
Builder.writeUInt16(0);
- Builder.writeTypeIndex(Record.getNestedType());
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeTypeIndex(Type);
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
-void FieldListRecordBuilder::writeStaticDataMember(
- const StaticDataMemberRecord &Record) {
+void FieldListRecordBuilder::writeStaticMember(MemberAccess Access,
+ TypeIndex Type, StringRef Name) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(Record.getKind());
- Builder.writeUInt16(static_cast<uint16_t>(Record.getAccess()));
- Builder.writeTypeIndex(Record.getType());
- Builder.writeNullTerminatedString(Record.getName());
+ Builder.writeTypeRecordKind(TypeRecordKind::StaticMember);
+ Builder.writeUInt16(static_cast<uint16_t>(Access));
+ Builder.writeTypeIndex(Type);
+ Builder.writeNullTerminatedString(Name);
finishSubRecord();
}
+void FieldListRecordBuilder::writeIndirectVirtualBaseClass(
+ MemberAccess Access, TypeIndex Type, TypeIndex VirtualBasePointerType,
+ int64_t VirtualBasePointerOffset, uint64_t SlotIndex) {
+ writeVirtualBaseClass(TypeRecordKind::IndirectVirtualBaseClass, Access, Type,
+ VirtualBasePointerType, VirtualBasePointerOffset,
+ SlotIndex);
+}
+
void FieldListRecordBuilder::writeVirtualBaseClass(
- const VirtualBaseClassRecord &Record) {
+ MemberAccess Access, TypeIndex Type, TypeIndex VirtualBasePointerType,
+ int64_t VirtualBasePointerOffset, uint64_t SlotIndex) {
+ writeVirtualBaseClass(TypeRecordKind::VirtualBaseClass, Access, Type,
+ VirtualBasePointerType, VirtualBasePointerOffset,
+ SlotIndex);
+}
+
+void FieldListRecordBuilder::writeVirtualBaseClass(
+ TypeRecordKind Kind, MemberAccess Access, TypeIndex Type,
+ TypeIndex VirtualBasePointerType, int64_t VirtualBasePointerOffset,
+ uint64_t SlotIndex) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(Record.getKind());
- Builder.writeUInt16(static_cast<uint16_t>(Record.getAccess()));
- Builder.writeTypeIndex(Record.getBaseType());
- Builder.writeTypeIndex(Record.getVBPtrType());
- Builder.writeEncodedInteger(Record.getVBPtrOffset());
- Builder.writeEncodedUnsignedInteger(Record.getVTableIndex());
+ Builder.writeTypeRecordKind(Kind);
+ Builder.writeUInt16(static_cast<uint16_t>(Access));
+ Builder.writeTypeIndex(Type);
+ Builder.writeTypeIndex(VirtualBasePointerType);
+ Builder.writeEncodedInteger(VirtualBasePointerOffset);
+ Builder.writeEncodedUnsignedInteger(SlotIndex);
finishSubRecord();
}
-void FieldListRecordBuilder::writeVFPtr(const VFPtrRecord &Record) {
+void FieldListRecordBuilder::writeVirtualFunctionTablePointer(TypeIndex Type) {
TypeRecordBuilder &Builder = getBuilder();
- Builder.writeTypeRecordKind(TypeRecordKind::VFPtr);
+ Builder.writeTypeRecordKind(TypeRecordKind::VirtualFunctionTablePointer);
Builder.writeUInt16(0);
- Builder.writeTypeIndex(Record.getType());
+ Builder.writeTypeIndex(Type);
finishSubRecord();
-}
+} \ No newline at end of file
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
index eb79e8ac9a3..69c7e87330e 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
@@ -7,96 +7,25 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/SmallString.h"
#include "llvm/DebugInfo/CodeView/ListRecordBuilder.h"
-#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
using namespace llvm;
using namespace codeview;
-ListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind)
- : Kind(Kind), Builder(Kind) {}
-
-void ListRecordBuilder::writeListContinuation(const ListContinuationRecord &R) {
- TypeRecordBuilder &Builder = getBuilder();
-
- assert(getLastContinuationSize() < 65535 - 8 && "continuation won't fit");
-
- Builder.writeTypeRecordKind(TypeRecordKind::ListContinuation);
- Builder.writeUInt16(0);
- Builder.writeTypeIndex(R.getContinuationIndex());
-
- // End the current segment manually so that nothing comes after the
- // continuation.
- ContinuationOffsets.push_back(Builder.size());
- SubrecordStart = Builder.size();
-}
+ListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind) : Builder(Kind) {}
void ListRecordBuilder::finishSubRecord() {
- // The type table inserts a 16 bit size field before each list, so factor that
- // into our alignment padding.
- uint32_t Remainder =
- (Builder.size() + 2 * (ContinuationOffsets.size() + 1)) % 4;
+ // The builder starts at offset 2 in the actual CodeView buffer, so add an
+ // additional offset of 2 before computing the alignment.
+ uint32_t Remainder = (Builder.size() + 2) % 4;
if (Remainder != 0) {
for (int32_t PaddingBytesLeft = 4 - Remainder; PaddingBytesLeft > 0;
--PaddingBytesLeft) {
- Builder.writeUInt8(LF_PAD0 + PaddingBytesLeft);
+ Builder.writeUInt8(0xf0 + PaddingBytesLeft);
}
}
- // Check if this subrecord makes the current segment not fit in 64K minus the
- // space for a continuation record (8 bytes). If the segment does not fit,
- // back up and insert a continuation record, sliding the current subrecord
- // down.
- if (getLastContinuationSize() > 65535 - 8) {
- assert(SubrecordStart != 0 && "can't slide from the start!");
- SmallString<128> SubrecordCopy(
- Builder.str().slice(SubrecordStart, Builder.size()));
- assert(SubrecordCopy.size() < 65530 && "subrecord is too large to slide!");
- Builder.truncate(SubrecordStart);
-
- // Write a placeholder continuation record.
- Builder.writeTypeRecordKind(TypeRecordKind::ListContinuation);
- Builder.writeUInt16(0);
- Builder.writeUInt32(0);
- ContinuationOffsets.push_back(Builder.size());
- assert(Builder.size() == SubrecordStart + 8 && "wrong continuation size");
- assert(getLastContinuationSize() < 65535 && "segment too big");
-
- // Start a new list record of the appropriate kind, and copy the previous
- // subrecord into place.
- Builder.writeTypeRecordKind(Kind);
- Builder.writeBytes(SubrecordCopy);
- }
-
- SubrecordStart = Builder.size();
-}
-
-TypeIndex ListRecordBuilder::writeListRecord(TypeTableBuilder &Table) {
- // Get the continuation segments as a reversed vector of StringRefs for
- // convenience.
- SmallVector<StringRef, 1> Segments;
- StringRef Data = str();
- size_t LastEnd = 0;
- for (size_t SegEnd : ContinuationOffsets) {
- Segments.push_back(Data.slice(LastEnd, SegEnd));
- LastEnd = SegEnd;
- }
- Segments.push_back(Data.slice(LastEnd, Builder.size()));
-
- // Pop the last record off and emit it directly.
- StringRef LastRec = Segments.pop_back_val();
- TypeIndex ContinuationIndex = Table.writeRecord(LastRec);
-
- // Emit each record with a continuation in reverse order, so that each one
- // references the previous record.
- for (StringRef Rec : reverse(Segments)) {
- assert(*reinterpret_cast<const ulittle16_t *>(Rec.data()) ==
- unsigned(Kind));
- ulittle32_t *ContinuationPtr =
- reinterpret_cast<ulittle32_t *>(const_cast<char *>(Rec.end())) - 1;
- *ContinuationPtr = ContinuationIndex.getIndex();
- ContinuationIndex = Table.writeRecord(Rec);
- }
- return ContinuationIndex;
+ // TODO: Split the list into multiple records if it's longer than 64KB, using
+ // a subrecord of TypeRecordKind::Index to chain the records together.
+ assert(Builder.size() < 65536);
}
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp
index 8b9e73b94ff..9afce92eeb1 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp
@@ -13,34 +13,23 @@
using namespace llvm;
using namespace codeview;
+MemoryTypeTableBuilder::Record::Record(StringRef RData)
+ : Size(RData.size()), Data(new char[RData.size()]) {
+ memcpy(Data.get(), RData.data(), RData.size());
+}
+
TypeIndex MemoryTypeTableBuilder::writeRecord(StringRef Data) {
- assert(Data.size() <= UINT16_MAX);
auto I = HashedRecords.find(Data);
if (I != HashedRecords.end()) {
return I->second;
}
- // The record provided by the user lacks the 2 byte size field prefix and is
- // not padded to 4 bytes. Ultimately, that is what gets emitted in the object
- // file, so pad it out now.
- const int SizeOfRecLen = 2;
- const int Align = 4;
- int TotalSize = alignTo(Data.size() + SizeOfRecLen, Align);
- assert(TotalSize - SizeOfRecLen <= UINT16_MAX);
- char *Mem =
- reinterpret_cast<char *>(RecordStorage.Allocate(TotalSize, Align));
- *reinterpret_cast<ulittle16_t *>(Mem) = uint16_t(TotalSize - SizeOfRecLen);
- memcpy(Mem + SizeOfRecLen, Data.data(), Data.size());
- for (int I = Data.size() + SizeOfRecLen; I < TotalSize; ++I)
- Mem[I] = LF_PAD0 + (TotalSize - I);
+ std::unique_ptr<Record> R(new Record(Data));
TypeIndex TI(static_cast<uint32_t>(Records.size()) +
TypeIndex::FirstNonSimpleIndex);
-
- // Use only the data supplied by the user as a key to the hash table, so that
- // future lookups will succeed.
- HashedRecords.insert(std::make_pair(StringRef(Mem + SizeOfRecLen, Data.size()), TI));
- Records.push_back(StringRef(Mem, TotalSize));
+ HashedRecords.insert(std::make_pair(StringRef(R->data(), R->size()), TI));
+ Records.push_back(std::move(R));
return TI;
}
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp
index ae089a35208..889302556b2 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp
@@ -14,7 +14,7 @@ using namespace llvm;
using namespace codeview;
MethodListRecordBuilder::MethodListRecordBuilder()
- : ListRecordBuilder(TypeRecordKind::MethodOverloadList) {}
+ : ListRecordBuilder(TypeRecordKind::MethodList) {}
void MethodListRecordBuilder::writeMethod(MemberAccess Access, MethodKind Kind,
MethodOptions Options, TypeIndex Type,
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp
index 112612cc85e..cbf464fd766 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp
@@ -12,8 +12,8 @@
using namespace llvm;
using namespace codeview;
-TypeRecordBuilder::TypeRecordBuilder(TypeRecordKind Kind)
- : Stream(Buffer), Writer(Stream) {
+TypeRecordBuilder::TypeRecordBuilder(TypeRecordKind Kind) : Stream(Buffer),
+ Writer(Stream) {
writeTypeRecordKind(Kind);
}
@@ -60,48 +60,48 @@ void TypeRecordBuilder::writeEncodedInteger(int64_t Value) {
void TypeRecordBuilder::writeEncodedSignedInteger(int64_t Value) {
if (Value >= std::numeric_limits<int8_t>::min() &&
Value <= std::numeric_limits<int8_t>::max()) {
- writeUInt16(LF_CHAR);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::SByte));
writeInt16(static_cast<int8_t>(Value));
} else if (Value >= std::numeric_limits<int16_t>::min() &&
Value <= std::numeric_limits<int16_t>::max()) {
- writeUInt16(LF_SHORT);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::Int16));
writeInt16(static_cast<int16_t>(Value));
} else if (Value >= std::numeric_limits<int32_t>::min() &&
Value <= std::numeric_limits<int32_t>::max()) {
- writeUInt16(LF_LONG);
+ writeUInt16(static_cast<uint32_t>(TypeRecordKind::Int32));
writeInt32(static_cast<int32_t>(Value));
} else {
- writeUInt16(LF_QUADWORD);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::Int64));
writeInt64(Value);
}
}
void TypeRecordBuilder::writeEncodedUnsignedInteger(uint64_t Value) {
- if (Value < LF_CHAR) {
+ if (Value < static_cast<uint16_t>(TypeRecordKind::SByte)) {
writeUInt16(static_cast<uint16_t>(Value));
} else if (Value <= std::numeric_limits<uint16_t>::max()) {
- writeUInt16(LF_USHORT);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::UInt16));
writeUInt16(static_cast<uint16_t>(Value));
} else if (Value <= std::numeric_limits<uint32_t>::max()) {
- writeUInt16(LF_ULONG);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::UInt32));
writeUInt32(static_cast<uint32_t>(Value));
} else {
- writeUInt16(LF_UQUADWORD);
+ writeUInt16(static_cast<uint16_t>(TypeRecordKind::UInt64));
writeUInt64(Value);
}
}
-void TypeRecordBuilder::writeNullTerminatedString(StringRef Value) {
- // Microsoft's linker seems to have trouble with symbol names longer than
- // 0xffd8 bytes.
- Value = Value.substr(0, 0xffd8);
- Stream.write(Value.data(), Value.size());
+void TypeRecordBuilder::writeNullTerminatedString(const char *Value) {
+ assert(Value != nullptr);
+
+ size_t Length = strlen(Value);
+ Stream.write(Value, Length);
writeUInt8(0);
}
-void TypeRecordBuilder::writeGuid(StringRef Guid) {
- assert(Guid.size() == 16);
- Stream.write(Guid.data(), 16);
+void TypeRecordBuilder::writeNullTerminatedString(StringRef Value) {
+ Stream.write(Value.data(), Value.size());
+ writeUInt8(0);
}
void TypeRecordBuilder::writeTypeIndex(TypeIndex TypeInd) {
diff --git a/gnu/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp b/gnu/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
index 647538ee8ce..4af5dcaf722 100644
--- a/gnu/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
+++ b/gnu/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/MethodListRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
@@ -17,21 +18,42 @@
using namespace llvm;
using namespace codeview;
+namespace {
+
+const int PointerKindShift = 0;
+const int PointerModeShift = 5;
+const int PointerSizeShift = 13;
+
+const int ClassHfaKindShift = 11;
+const int ClassWindowsRTClassKindShift = 14;
+
+void writePointerBase(TypeRecordBuilder &Builder,
+ const PointerRecordBase &Record) {
+ Builder.writeTypeIndex(Record.getReferentType());
+ uint32_t flags =
+ static_cast<uint32_t>(Record.getOptions()) |
+ (Record.getSize() << PointerSizeShift) |
+ (static_cast<uint32_t>(Record.getMode()) << PointerModeShift) |
+ (static_cast<uint32_t>(Record.getPointerKind()) << PointerKindShift);
+ Builder.writeUInt32(flags);
+}
+}
+
TypeTableBuilder::TypeTableBuilder() {}
TypeTableBuilder::~TypeTableBuilder() {}
TypeIndex TypeTableBuilder::writeModifier(const ModifierRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::Modifier);
Builder.writeTypeIndex(Record.getModifiedType());
- Builder.writeUInt16(static_cast<uint16_t>(Record.getModifiers()));
+ Builder.writeUInt16(static_cast<uint16_t>(Record.getOptions()));
return writeRecord(Builder);
}
TypeIndex TypeTableBuilder::writeProcedure(const ProcedureRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::Procedure);
Builder.writeTypeIndex(Record.getReturnType());
Builder.writeUInt8(static_cast<uint8_t>(Record.getCallConv()));
@@ -44,7 +66,7 @@ TypeIndex TypeTableBuilder::writeProcedure(const ProcedureRecord &Record) {
TypeIndex
TypeTableBuilder::writeMemberFunction(const MemberFunctionRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::MemberFunction);
Builder.writeTypeIndex(Record.getReturnType());
Builder.writeTypeIndex(Record.getClassType());
@@ -58,11 +80,12 @@ TypeTableBuilder::writeMemberFunction(const MemberFunctionRecord &Record) {
return writeRecord(Builder);
}
-TypeIndex TypeTableBuilder::writeArgList(const ArgListRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+TypeIndex
+TypeTableBuilder::writeArgumentList(const ArgumentListRecord &Record) {
+ TypeRecordBuilder Builder(TypeRecordKind::ArgumentList);
- Builder.writeUInt32(Record.getIndices().size());
- for (TypeIndex TI : Record.getIndices()) {
+ Builder.writeUInt32(Record.getArgumentTypes().size());
+ for (TypeIndex TI : Record.getArgumentTypes()) {
Builder.writeTypeIndex(TI);
}
@@ -70,28 +93,27 @@ TypeIndex TypeTableBuilder::writeArgList(const ArgListRecord &Record) {
}
TypeIndex TypeTableBuilder::writePointer(const PointerRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::Pointer);
- Builder.writeTypeIndex(Record.getReferentType());
- uint32_t flags = static_cast<uint32_t>(Record.getOptions()) |
- (Record.getSize() << PointerRecord::PointerSizeShift) |
- (static_cast<uint32_t>(Record.getMode())
- << PointerRecord::PointerModeShift) |
- (static_cast<uint32_t>(Record.getPointerKind())
- << PointerRecord::PointerKindShift);
- Builder.writeUInt32(flags);
+ writePointerBase(Builder, Record);
- if (Record.isPointerToMember()) {
- const MemberPointerInfo &M = Record.getMemberInfo();
- Builder.writeTypeIndex(M.getContainingType());
- Builder.writeUInt16(static_cast<uint16_t>(M.getRepresentation()));
- }
+ return writeRecord(Builder);
+}
+
+TypeIndex
+TypeTableBuilder::writePointerToMember(const PointerToMemberRecord &Record) {
+ TypeRecordBuilder Builder(TypeRecordKind::Pointer);
+
+ writePointerBase(Builder, Record);
+
+ Builder.writeTypeIndex(Record.getContainingType());
+ Builder.writeUInt16(static_cast<uint16_t>(Record.getRepresentation()));
return writeRecord(Builder);
}
TypeIndex TypeTableBuilder::writeArray(const ArrayRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::Array);
Builder.writeTypeIndex(Record.getElementType());
Builder.writeTypeIndex(Record.getIndexType());
@@ -101,52 +123,40 @@ TypeIndex TypeTableBuilder::writeArray(const ArrayRecord &Record) {
return writeRecord(Builder);
}
-TypeIndex TypeTableBuilder::writeClass(const ClassRecord &Record) {
- assert((Record.getKind() == TypeRecordKind::Struct) ||
+TypeIndex TypeTableBuilder::writeAggregate(const AggregateRecord &Record) {
+ assert((Record.getKind() == TypeRecordKind::Structure) ||
(Record.getKind() == TypeRecordKind::Class) ||
- (Record.getKind() == TypeRecordKind::Interface));
+ (Record.getKind() == TypeRecordKind::Union));
TypeRecordBuilder Builder(Record.getKind());
Builder.writeUInt16(Record.getMemberCount());
uint16_t Flags =
static_cast<uint16_t>(Record.getOptions()) |
- (static_cast<uint16_t>(Record.getHfa()) << ClassRecord::HfaKindShift) |
+ (static_cast<uint16_t>(Record.getHfa()) << ClassHfaKindShift) |
(static_cast<uint16_t>(Record.getWinRTKind())
- << ClassRecord::WinRTKindShift);
+ << ClassWindowsRTClassKindShift);
Builder.writeUInt16(Flags);
Builder.writeTypeIndex(Record.getFieldList());
- Builder.writeTypeIndex(Record.getDerivationList());
- Builder.writeTypeIndex(Record.getVTableShape());
- Builder.writeEncodedUnsignedInteger(Record.getSize());
- Builder.writeNullTerminatedString(Record.getName());
- if ((Record.getOptions() & ClassOptions::HasUniqueName) !=
- ClassOptions::None) {
- Builder.writeNullTerminatedString(Record.getUniqueName());
+ if (Record.getKind() != TypeRecordKind::Union) {
+ Builder.writeTypeIndex(Record.getDerivationList());
+ Builder.writeTypeIndex(Record.getVTableShape());
+ } else {
+ assert(Record.getDerivationList() == TypeIndex());
+ assert(Record.getVTableShape() == TypeIndex());
}
-
- return writeRecord(Builder);
-}
-
-TypeIndex TypeTableBuilder::writeUnion(const UnionRecord &Record) {
- TypeRecordBuilder Builder(TypeRecordKind::Union);
- Builder.writeUInt16(Record.getMemberCount());
- uint16_t Flags =
- static_cast<uint16_t>(Record.getOptions()) |
- (static_cast<uint16_t>(Record.getHfa()) << ClassRecord::HfaKindShift);
- Builder.writeUInt16(Flags);
- Builder.writeTypeIndex(Record.getFieldList());
Builder.writeEncodedUnsignedInteger(Record.getSize());
Builder.writeNullTerminatedString(Record.getName());
if ((Record.getOptions() & ClassOptions::HasUniqueName) !=
ClassOptions::None) {
Builder.writeNullTerminatedString(Record.getUniqueName());
}
+
return writeRecord(Builder);
}
TypeIndex TypeTableBuilder::writeEnum(const EnumRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::Enum);
Builder.writeUInt16(Record.getMemberCount());
Builder.writeUInt16(static_cast<uint16_t>(Record.getOptions()));
@@ -162,7 +172,7 @@ TypeIndex TypeTableBuilder::writeEnum(const EnumRecord &Record) {
}
TypeIndex TypeTableBuilder::writeBitField(const BitFieldRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+ TypeRecordBuilder Builder(TypeRecordKind::BitField);
Builder.writeTypeIndex(Record.getType());
Builder.writeUInt8(Record.getBitSize());
@@ -171,11 +181,11 @@ TypeIndex TypeTableBuilder::writeBitField(const BitFieldRecord &Record) {
return writeRecord(Builder);
}
-TypeIndex
-TypeTableBuilder::writeVFTableShape(const VFTableShapeRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
+TypeIndex TypeTableBuilder::writeVirtualTableShape(
+ const VirtualTableShapeRecord &Record) {
+ TypeRecordBuilder Builder(TypeRecordKind::VirtualTableShape);
- ArrayRef<VFTableSlotKind> Slots = Record.getSlots();
+ ArrayRef<VirtualTableSlotKind> Slots = Record.getSlots();
Builder.writeUInt16(Slots.size());
for (size_t SlotIndex = 0; SlotIndex < Slots.size(); SlotIndex += 2) {
@@ -189,115 +199,19 @@ TypeTableBuilder::writeVFTableShape(const VFTableShapeRecord &Record) {
return writeRecord(Builder);
}
-TypeIndex
-TypeTableBuilder::writeVFTable(const VFTableRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeTypeIndex(Record.getCompleteClass());
- Builder.writeTypeIndex(Record.getOverriddenVTable());
- Builder.writeUInt32(Record.getVFPtrOffset());
-
- // Sum up the lengths of the null-terminated names.
- size_t NamesLen = Record.getName().size() + 1;
- for (StringRef MethodName : Record.getMethodNames())
- NamesLen += MethodName.size() + 1;
-
- Builder.writeUInt32(NamesLen);
- Builder.writeNullTerminatedString(Record.getName());
- for (StringRef MethodName : Record.getMethodNames())
- Builder.writeNullTerminatedString(MethodName);
-
- return writeRecord(Builder);
-}
-
-TypeIndex TypeTableBuilder::writeStringId(const StringIdRecord &Record) {
- TypeRecordBuilder Builder(TypeRecordKind::StringId);
- Builder.writeTypeIndex(Record.getId());
- Builder.writeNullTerminatedString(Record.getString());
- return writeRecord(Builder);
-}
-
-TypeIndex
-TypeTableBuilder::writeUdtSourceLine(const UdtSourceLineRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeTypeIndex(Record.getUDT());
- Builder.writeTypeIndex(Record.getSourceFile());
- Builder.writeUInt32(Record.getLineNumber());
- return writeRecord(Builder);
-}
-
-TypeIndex
-TypeTableBuilder::writeUdtModSourceLine(const UdtModSourceLineRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeTypeIndex(Record.getUDT());
- Builder.writeTypeIndex(Record.getSourceFile());
- Builder.writeUInt32(Record.getLineNumber());
- Builder.writeUInt16(Record.getModule());
- return writeRecord(Builder);
-}
-
-TypeIndex TypeTableBuilder::writeFuncId(const FuncIdRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeTypeIndex(Record.getParentScope());
- Builder.writeTypeIndex(Record.getFunctionType());
- Builder.writeNullTerminatedString(Record.getName());
- return writeRecord(Builder);
-}
-
-TypeIndex
-TypeTableBuilder::writeMemberFuncId(const MemberFuncIdRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeTypeIndex(Record.getClassType());
- Builder.writeTypeIndex(Record.getFunctionType());
- Builder.writeNullTerminatedString(Record.getName());
- return writeRecord(Builder);
-}
-
-TypeIndex
-TypeTableBuilder::writeBuildInfo(const BuildInfoRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- assert(Record.getArgs().size() <= UINT16_MAX);
- Builder.writeUInt16(Record.getArgs().size());
- for (TypeIndex Arg : Record.getArgs())
- Builder.writeTypeIndex(Arg);
- return writeRecord(Builder);
-}
-
TypeIndex TypeTableBuilder::writeRecord(TypeRecordBuilder &Builder) {
return writeRecord(Builder.str());
}
TypeIndex TypeTableBuilder::writeFieldList(FieldListRecordBuilder &FieldList) {
- return FieldList.writeListRecord(*this);
-}
-
-TypeIndex TypeTableBuilder::writeMethodOverloadList(
- const MethodOverloadListRecord &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- for (const OneMethodRecord &Method : Record.getMethods()) {
- uint16_t Flags = static_cast<uint16_t>(Method.getAccess());
- Flags |= static_cast<uint16_t>(Method.getKind())
- << MemberAttributes::MethodKindShift;
- Flags |= static_cast<uint16_t>(Method.getOptions());
- Builder.writeUInt16(Flags);
- Builder.writeUInt16(0); // padding
- Builder.writeTypeIndex(Method.getType());
- if (Method.isIntroducingVirtual()) {
- assert(Method.getVFTableOffset() >= 0);
- Builder.writeInt32(Method.getVFTableOffset());
- } else {
- assert(Method.getVFTableOffset() == -1);
- }
- }
-
// TODO: Split the list into multiple records if it's longer than 64KB, using
// a subrecord of TypeRecordKind::Index to chain the records together.
- return writeRecord(Builder);
+ return writeRecord(FieldList.str());
}
-TypeIndex TypeTableBuilder::writeTypeServer2(const TypeServer2Record &Record) {
- TypeRecordBuilder Builder(Record.getKind());
- Builder.writeGuid(Record.getGuid());
- Builder.writeUInt32(Record.getAge());
- Builder.writeNullTerminatedString(Record.getName());
- return writeRecord(Builder);
+TypeIndex
+TypeTableBuilder::writeMethodList(MethodListRecordBuilder &MethodList) {
+ // TODO: Split the list into multiple records if it's longer than 64KB, using
+ // a subrecord of TypeRecordKind::Index to chain the records together.
+ return writeRecord(MethodList.str());
}
diff --git a/gnu/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp b/gnu/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
index d1a021aee3a..064633b4e49 100644
--- a/gnu/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
+++ b/gnu/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
@@ -13,41 +13,71 @@ namespace llvm {
namespace orc {
namespace remote {
-#define FUNCNAME(X) \
- case X ## Id: \
- return #X
-
-const char *OrcRemoteTargetRPCAPI::getJITFuncIdName(JITFuncId Id) {
+const char *OrcRemoteTargetRPCAPI::getJITProcIdName(JITProcId Id) {
switch (Id) {
case InvalidId:
- return "*** Invalid JITFuncId ***";
- FUNCNAME(CallIntVoid);
- FUNCNAME(CallMain);
- FUNCNAME(CallVoidVoid);
- FUNCNAME(CreateRemoteAllocator);
- FUNCNAME(CreateIndirectStubsOwner);
- FUNCNAME(DeregisterEHFrames);
- FUNCNAME(DestroyRemoteAllocator);
- FUNCNAME(DestroyIndirectStubsOwner);
- FUNCNAME(EmitIndirectStubs);
- FUNCNAME(EmitResolverBlock);
- FUNCNAME(EmitTrampolineBlock);
- FUNCNAME(GetSymbolAddress);
- FUNCNAME(GetRemoteInfo);
- FUNCNAME(ReadMem);
- FUNCNAME(RegisterEHFrames);
- FUNCNAME(ReserveMem);
- FUNCNAME(RequestCompile);
- FUNCNAME(SetProtections);
- FUNCNAME(TerminateSession);
- FUNCNAME(WriteMem);
- FUNCNAME(WritePtr);
+ return "*** Invalid JITProcId ***";
+ case CallIntVoidId:
+ return "CallIntVoid";
+ case CallIntVoidResponseId:
+ return "CallIntVoidResponse";
+ case CallMainId:
+ return "CallMain";
+ case CallMainResponseId:
+ return "CallMainResponse";
+ case CallVoidVoidId:
+ return "CallVoidVoid";
+ case CallVoidVoidResponseId:
+ return "CallVoidVoidResponse";
+ case CreateRemoteAllocatorId:
+ return "CreateRemoteAllocator";
+ case CreateIndirectStubsOwnerId:
+ return "CreateIndirectStubsOwner";
+ case DestroyRemoteAllocatorId:
+ return "DestroyRemoteAllocator";
+ case DestroyIndirectStubsOwnerId:
+ return "DestroyIndirectStubsOwner";
+ case EmitIndirectStubsId:
+ return "EmitIndirectStubs";
+ case EmitIndirectStubsResponseId:
+ return "EmitIndirectStubsResponse";
+ case EmitResolverBlockId:
+ return "EmitResolverBlock";
+ case EmitTrampolineBlockId:
+ return "EmitTrampolineBlock";
+ case EmitTrampolineBlockResponseId:
+ return "EmitTrampolineBlockResponse";
+ case GetSymbolAddressId:
+ return "GetSymbolAddress";
+ case GetSymbolAddressResponseId:
+ return "GetSymbolAddressResponse";
+ case GetRemoteInfoId:
+ return "GetRemoteInfo";
+ case GetRemoteInfoResponseId:
+ return "GetRemoteInfoResponse";
+ case ReadMemId:
+ return "ReadMem";
+ case ReadMemResponseId:
+ return "ReadMemResponse";
+ case ReserveMemId:
+ return "ReserveMem";
+ case ReserveMemResponseId:
+ return "ReserveMemResponse";
+ case RequestCompileId:
+ return "RequestCompile";
+ case RequestCompileResponseId:
+ return "RequestCompileResponse";
+ case SetProtectionsId:
+ return "SetProtections";
+ case TerminateSessionId:
+ return "TerminateSession";
+ case WriteMemId:
+ return "WriteMem";
+ case WritePtrId:
+ return "WritePtr";
};
return nullptr;
}
-
-#undef FUNCNAME
-
-} // end namespace remote
-} // end namespace orc
-} // end namespace llvm
+}
+}
+}
diff --git a/gnu/llvm/lib/Fuzzer/test/dfsan/CMakeLists.txt b/gnu/llvm/lib/Fuzzer/test/dfsan/CMakeLists.txt
index 2a4dc18bfee..2b49831fcdb 100644
--- a/gnu/llvm/lib/Fuzzer/test/dfsan/CMakeLists.txt
+++ b/gnu/llvm/lib/Fuzzer/test/dfsan/CMakeLists.txt
@@ -1,19 +1,14 @@
# These tests depend on both coverage and dfsan instrumentation.
-set(CMAKE_CXX_FLAGS
- "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fsanitize=dataflow")
-
-set(DFSanTests
- MemcmpTest
- SimpleCmpTest
- StrcmpTest
- StrncmpTest
- SwitchTest
- )
+set(CMAKE_CXX_FLAGS_RELEASE
+ "${LIBFUZZER_FLAGS_BASE} -O0 -fno-sanitize=all -fsanitize=dataflow")
foreach(Test ${DFSanTests})
- add_libfuzzer_test(${Test}-DFSan SOURCES ../${Test}.cpp)
+ add_executable(LLVMFuzzer-${Test}-DFSan
+ ../${Test}.cpp
+ )
+ target_link_libraries(LLVMFuzzer-${Test}-DFSan
+ LLVMFuzzer
+ )
endforeach()
-# Propagate value into parent directory
-set(TestBinaries ${TestBinaries} PARENT_SCOPE)
diff --git a/gnu/llvm/lib/Fuzzer/test/fuzzer-dfsan.test b/gnu/llvm/lib/Fuzzer/test/fuzzer-dfsan.test
index 5bd5c0f18d2..567086ed65a 100644
--- a/gnu/llvm/lib/Fuzzer/test/fuzzer-dfsan.test
+++ b/gnu/llvm/lib/Fuzzer/test/fuzzer-dfsan.test
@@ -1,4 +1,3 @@
-REQUIRES: dfsan
CHECK1: BINGO
CHECK2: BINGO
CHECK3: BINGO
@@ -8,10 +7,10 @@ CHECK_DFSanCmpCallback: DFSanCmpCallback: PC
CHECK_DFSanSwitchCallback: DFSanSwitchCallback: PC
CHECK_DFSanMemcmpCallback: DFSanMemcmpCallback: Pos
-RUN: not LLVMFuzzer-SimpleCmpTest-DFSan -use_traces=1 -seed=1 -runs=10000000 -timeout=5 2>&1 | FileCheck %s --check-prefix=CHECK1
+RUN: not LLVMFuzzer-SimpleCmpTest-DFSan -use_traces=1 -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s --check-prefix=CHECK1
RUN: LLVMFuzzer-SimpleCmpTest-DFSan -use_traces=1 -seed=1 -runs=100 -timeout=5 -verbosity=3 2>&1 | FileCheck %s -check-prefix=CHECK_DFSanCmpCallback
-RUN: not LLVMFuzzer-MemcmpTest-DFSan -use_traces=1 -seed=1 -runs=100000 -timeout=5 2>&1 | FileCheck %s --check-prefix=CHECK2
+RUN: not LLVMFuzzer-MemcmpTest-DFSan -use_traces=1 -seed=1 -runs=10000 -timeout=5 2>&1 | FileCheck %s --check-prefix=CHECK2
RUN: LLVMFuzzer-MemcmpTest-DFSan -use_traces=1 -seed=1 -runs=2 -timeout=5 -verbosity=3 2>&1 | FileCheck %s -check-prefix=CHECK_DFSanMemcmpCallback
RUN: not LLVMFuzzer-StrncmpTest-DFSan -use_traces=1 -seed=1 -runs=10000 -timeout=5 2>&1 | FileCheck %s --check-prefix=CHECK3
diff --git a/gnu/llvm/lib/Fuzzer/test/fuzzer-traces.test b/gnu/llvm/lib/Fuzzer/test/fuzzer-traces.test
index 2d772953664..3b8639b8e94 100644
--- a/gnu/llvm/lib/Fuzzer/test/fuzzer-traces.test
+++ b/gnu/llvm/lib/Fuzzer/test/fuzzer-traces.test
@@ -1,9 +1,20 @@
CHECK: BINGO
Done1000000: Done 1000000 runs in
+Done10000000: Done 10000000 runs in
+
RUN: not LLVMFuzzer-SimpleCmpTest -use_traces=1 -seed=1 -runs=10000001 2>&1 | FileCheck %s
-RUN: not LLVMFuzzer-SwitchTest -use_traces=1 -seed=6 -runs=1000002 2>&1 | FileCheck %s
-RUN: LLVMFuzzer-SwitchTest -seed=7 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
+RUN: not LLVMFuzzer-MemcmpTest -use_traces=1 -seed=4294967295 -runs=100000 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-MemcmpTest -seed=4294967295 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
+
+RUN: not LLVMFuzzer-StrncmpTest -use_traces=1 -seed=1 -runs=100000 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-StrncmpTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
+
+RUN: not LLVMFuzzer-StrcmpTest -use_traces=1 -seed=1 -runs=200000 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-StrcmpTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
+
+RUN: not LLVMFuzzer-SwitchTest -use_traces=1 -seed=1 -runs=1000002 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-SwitchTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000
-RUN: not LLVMFuzzer-SimpleHashTest -use_traces=1 -seed=8 -runs=1000000 -max_len=16 2>&1 | FileCheck %s
-RUN: LLVMFuzzer-SimpleHashTest -seed=9 -runs=1000000 -max_len=16 2>&1 | FileCheck %s --check-prefix=Done1000000
+RUN: not LLVMFuzzer-SimpleHashTest -use_traces=1 -seed=1 -runs=10000000 2>&1 | FileCheck %s
+RUN: LLVMFuzzer-SimpleHashTest -seed=1 -runs=10000000 2>&1 | FileCheck %s --check-prefix=Done10000000
diff --git a/gnu/llvm/lib/Fuzzer/test/trace-bb/CMakeLists.txt b/gnu/llvm/lib/Fuzzer/test/trace-bb/CMakeLists.txt
index fd168c4515b..99af019565b 100644
--- a/gnu/llvm/lib/Fuzzer/test/trace-bb/CMakeLists.txt
+++ b/gnu/llvm/lib/Fuzzer/test/trace-bb/CMakeLists.txt
@@ -1,15 +1,14 @@
# These tests are not instrumented with coverage.
-set(CMAKE_CXX_FLAGS
+set(CMAKE_CXX_FLAGS_RELEASE
"${LIBFUZZER_FLAGS_BASE} -fsanitize-coverage=edge,trace-bb")
-set(TraceBBTests
- SimpleTest
- )
-
foreach(Test ${TraceBBTests})
- add_libfuzzer_test(${Test}-TraceBB SOURCES ../${Test}.cpp)
+ add_executable(LLVMFuzzer-${Test}-TraceBB
+ ../${Test}.cpp
+ )
+ target_link_libraries(LLVMFuzzer-${Test}-TraceBB
+ LLVMFuzzer
+ )
endforeach()
-# Propagate value into parent directory
-set(TestBinaries ${TestBinaries} PARENT_SCOPE)
diff --git a/gnu/llvm/lib/Support/StreamingMemoryObject.cpp b/gnu/llvm/lib/Support/StreamingMemoryObject.cpp
index fb566179486..5a44e624eb8 100644
--- a/gnu/llvm/lib/Support/StreamingMemoryObject.cpp
+++ b/gnu/llvm/lib/Support/StreamingMemoryObject.cpp
@@ -104,12 +104,6 @@ uint64_t StreamingMemoryObject::readBytes(uint8_t *Buf, uint64_t Size,
return Size;
}
-const uint8_t *StreamingMemoryObject::getPointer(uint64_t Address,
- uint64_t Size) const {
- fetchToPos(Address + Size - 1);
- return &Bytes[Address + BytesSkipped];
-}
-
bool StreamingMemoryObject::dropLeadingBytes(size_t s) {
if (BytesRead < s) return true;
BytesSkipped = s;
diff --git a/gnu/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp b/gnu/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp
index 9ec6ae4118a..a614f555a4e 100644
--- a/gnu/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp
+++ b/gnu/llvm/lib/Target/AArch64/AArch64BranchRelaxation.cpp
@@ -177,7 +177,7 @@ void AArch64BranchRelaxation::scanFunction() {
void AArch64BranchRelaxation::computeBlockSize(const MachineBasicBlock &MBB) {
unsigned Size = 0;
for (const MachineInstr &MI : MBB)
- Size += TII->GetInstSizeInBytes(MI);
+ Size += TII->GetInstSizeInBytes(&MI);
BlockInfo[MBB.getNumber()].Size = Size;
}
@@ -195,7 +195,7 @@ unsigned AArch64BranchRelaxation::getInstrOffset(MachineInstr *MI) const {
// Sum instructions before MI in MBB.
for (MachineBasicBlock::iterator I = MBB->begin(); &*I != MI; ++I) {
assert(I != MBB->end() && "Didn't find MI in its own basic block?");
- Offset += TII->GetInstSizeInBytes(*I);
+ Offset += TII->GetInstSizeInBytes(I);
}
return Offset;
}
@@ -415,12 +415,12 @@ bool AArch64BranchRelaxation::fixupConditionalBranch(MachineInstr *MI) {
// Analyze the branch so we know how to update the successor lists.
MachineBasicBlock *TBB, *FBB;
SmallVector<MachineOperand, 2> Cond;
- TII->analyzeBranch(*MBB, TBB, FBB, Cond, false);
+ TII->AnalyzeBranch(*MBB, TBB, FBB, Cond, false);
MachineBasicBlock *NewBB = splitBlockBeforeInstr(MI);
// No need for the branch to the next block. We're adding an unconditional
// branch to the destination.
- int delta = TII->GetInstSizeInBytes(MBB->back());
+ int delta = TII->GetInstSizeInBytes(&MBB->back());
BlockInfo[MBB->getNumber()].Size -= delta;
MBB->back().eraseFromParent();
// BlockInfo[SplitBB].Offset is wrong temporarily, fixed below
@@ -446,12 +446,12 @@ bool AArch64BranchRelaxation::fixupConditionalBranch(MachineInstr *MI) {
if (MI->getOpcode() == AArch64::Bcc)
invertBccCondition(MIB);
MIB.addMBB(NextBB);
- BlockInfo[MBB->getNumber()].Size += TII->GetInstSizeInBytes(MBB->back());
+ BlockInfo[MBB->getNumber()].Size += TII->GetInstSizeInBytes(&MBB->back());
BuildMI(MBB, DebugLoc(), TII->get(AArch64::B)).addMBB(DestBB);
- BlockInfo[MBB->getNumber()].Size += TII->GetInstSizeInBytes(MBB->back());
+ BlockInfo[MBB->getNumber()].Size += TII->GetInstSizeInBytes(&MBB->back());
// Remove the old conditional branch. It may or may not still be in MBB.
- BlockInfo[MI->getParent()->getNumber()].Size -= TII->GetInstSizeInBytes(*MI);
+ BlockInfo[MI->getParent()->getNumber()].Size -= TII->GetInstSizeInBytes(MI);
MI->eraseFromParent();
// Finally, keep the block offsets up to date.
@@ -463,13 +463,12 @@ bool AArch64BranchRelaxation::relaxBranchInstructions() {
bool Changed = false;
// Relaxing branches involves creating new basic blocks, so re-eval
// end() for termination.
- for (MachineFunction::iterator I = MF->begin(); I != MF->end(); ++I) {
- MachineBasicBlock &MBB = *I;
- MachineInstr &MI = *MBB.getFirstTerminator();
- if (isConditionalBranch(MI.getOpcode()) &&
- !isBlockInRange(&MI, getDestBlock(&MI),
- getBranchDisplacementBits(MI.getOpcode()))) {
- fixupConditionalBranch(&MI);
+ for (auto &MBB : *MF) {
+ MachineInstr *MI = MBB.getFirstTerminator();
+ if (isConditionalBranch(MI->getOpcode()) &&
+ !isBlockInRange(MI, getDestBlock(MI),
+ getBranchDisplacementBits(MI->getOpcode()))) {
+ fixupConditionalBranch(MI);
++NumRelaxed;
Changed = true;
}
@@ -514,7 +513,8 @@ bool AArch64BranchRelaxation::runOnMachineFunction(MachineFunction &mf) {
return MadeChange;
}
-/// Returns an instance of the AArch64 Branch Relaxation pass.
+/// createAArch64BranchRelaxation - returns an instance of the constpool
+/// island pass.
FunctionPass *llvm::createAArch64BranchRelaxation() {
return new AArch64BranchRelaxation();
}
diff --git a/gnu/llvm/lib/Target/Hexagon/HexagonRDF.h b/gnu/llvm/lib/Target/Hexagon/HexagonRDF.h
index 9a63150c377..00c1889e8eb 100644
--- a/gnu/llvm/lib/Target/Hexagon/HexagonRDF.h
+++ b/gnu/llvm/lib/Target/Hexagon/HexagonRDF.h
@@ -13,6 +13,7 @@
namespace llvm {
class TargetRegisterInfo;
+}
namespace rdf {
struct HexagonRegisterAliasInfo : public RegisterAliasInfo {
@@ -21,8 +22,7 @@ namespace rdf {
bool covers(RegisterRef RA, RegisterRef RR) const override;
bool covers(const RegisterSet &RRs, RegisterRef RR) const override;
};
-} // namespace rdf
-} // namespace llvm
+}
#endif
diff --git a/gnu/llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp b/gnu/llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
index 7c5a54162d7..95813c8430d 100644
--- a/gnu/llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
+++ b/gnu/llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// FIXME: This pass is deprecated in favor of NVPTXInferAddressSpaces, which
-// uses a new algorithm that handles pointer induction variables.
-//
// When a load/store accesses the generic address space, checks whether the
// address is casted from a non-generic address space. If so, remove this
// addrspacecast because accessing non-generic address spaces is typically
@@ -167,8 +164,8 @@ Value *NVPTXFavorNonGenericAddrSpaces::hoistAddrSpaceCastFromGEP(
GEP->getSourceElementType(), Cast->getOperand(0), Indices,
"", GEPI);
NewGEP->setIsInBounds(GEP->isInBounds());
- NewGEP->takeName(GEP);
NewASC = new AddrSpaceCastInst(NewGEP, GEP->getType(), "", GEPI);
+ NewASC->takeName(GEP);
// Without RAUWing GEP, the compiler would visit GEP again and emit
// redundant instructions. This is exercised in test @rauw in
// access-non-generic.ll.
@@ -266,7 +263,7 @@ bool NVPTXFavorNonGenericAddrSpaces::optimizeMemoryInstruction(Instruction *MI,
}
bool NVPTXFavorNonGenericAddrSpaces::runOnFunction(Function &F) {
- if (DisableFavorNonGeneric || skipFunction(F))
+ if (DisableFavorNonGeneric)
return false;
bool Changed = false;
diff --git a/gnu/llvm/lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp b/gnu/llvm/lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
index d162a283f74..6656077348a 100644
--- a/gnu/llvm/lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
+++ b/gnu/llvm/lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
@@ -128,7 +128,7 @@ INITIALIZE_PASS(NVPTXLowerKernelArgs, "nvptx-lower-kernel-args",
"Lower kernel arguments (NVPTX)", false, false)
// =============================================================================
-// If the function had a byval struct ptr arg, say foo(%struct.x* byval %d),
+// If the function had a byval struct ptr arg, say foo(%struct.x *byval %d),
// then add the following instructions to the first basic block:
//
// %temp = alloca %struct.x, align 8
diff --git a/gnu/llvm/lib/Target/TargetRecip.cpp b/gnu/llvm/lib/Target/TargetRecip.cpp
index 183fa5062ea..d41b6436928 100644
--- a/gnu/llvm/lib/Target/TargetRecip.cpp
+++ b/gnu/llvm/lib/Target/TargetRecip.cpp
@@ -14,10 +14,11 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Target/TargetRecip.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Target/TargetRecip.h"
+#include <map>
using namespace llvm;
@@ -156,10 +157,9 @@ void TargetRecip::parseIndividualParams(const std::vector<std::string> &Args) {
// If the precision was not specified, the double entry is also initialized.
if (Val.back() != 'f' && Val.back() != 'd') {
- RecipParams &Params = RecipMap[Val.str() + 'd'];
- Params.Enabled = !IsDisabled;
+ RecipMap[Val.str() + 'd'].Enabled = !IsDisabled;
if (!RefStepString.empty())
- Params.RefinementSteps = RefSteps;
+ RecipMap[Val.str() + 'd'].RefinementSteps = RefSteps;
}
}
}
diff --git a/gnu/llvm/lib/Target/TargetSubtargetInfo.cpp b/gnu/llvm/lib/Target/TargetSubtargetInfo.cpp
index c3f94a99b4c..6a61fcdf0f8 100644
--- a/gnu/llvm/lib/Target/TargetSubtargetInfo.cpp
+++ b/gnu/llvm/lib/Target/TargetSubtargetInfo.cpp
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/CommandLine.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Target/TargetSubtargetInfo.h"
using namespace llvm;
diff --git a/gnu/llvm/lib/Transforms/IPO/InlineAlways.cpp b/gnu/llvm/lib/Transforms/IPO/InlineAlways.cpp
index cb1ab95ec2a..1704bfea0b8 100644
--- a/gnu/llvm/lib/Transforms/IPO/InlineAlways.cpp
+++ b/gnu/llvm/lib/Transforms/IPO/InlineAlways.cpp
@@ -17,7 +17,6 @@
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/InlineCost.h"
-#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/CallingConv.h"
@@ -38,17 +37,16 @@ namespace {
class AlwaysInliner : public Inliner {
public:
- AlwaysInliner() : Inliner(ID, /*InsertLifetime*/ true) {
+ // Use extremely low threshold.
+ AlwaysInliner() : Inliner(ID, -2000000000, /*InsertLifetime*/ true) {
initializeAlwaysInlinerPass(*PassRegistry::getPassRegistry());
}
- AlwaysInliner(bool InsertLifetime) : Inliner(ID, InsertLifetime) {
+ AlwaysInliner(bool InsertLifetime)
+ : Inliner(ID, -2000000000, InsertLifetime) {
initializeAlwaysInlinerPass(*PassRegistry::getPassRegistry());
}
- /// Main run interface method. We override here to avoid calling skipSCC().
- bool runOnSCC(CallGraphSCC &SCC) override { return inlineCalls(SCC); }
-
static char ID; // Pass identification, replacement for typeid
InlineCost getInlineCost(CallSite CS) override;
@@ -66,7 +64,6 @@ INITIALIZE_PASS_BEGIN(AlwaysInliner, "always-inline",
"Inliner for always_inline functions", false, false)
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_END(AlwaysInliner, "always-inline",
"Inliner for always_inline functions", false, false)
diff --git a/gnu/llvm/tools/clang/lib/Headers/cuda_builtin_vars.h b/gnu/llvm/tools/clang/lib/Headers/cuda_builtin_vars.h
index 6f5eb9c78d8..901356b3d5c 100644
--- a/gnu/llvm/tools/clang/lib/Headers/cuda_builtin_vars.h
+++ b/gnu/llvm/tools/clang/lib/Headers/cuda_builtin_vars.h
@@ -24,20 +24,16 @@
#ifndef __CUDA_BUILTIN_VARS_H
#define __CUDA_BUILTIN_VARS_H
-// Forward declares from vector_types.h.
-struct uint3;
-struct dim3;
-
// The file implements built-in CUDA variables using __declspec(property).
// https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
// All read accesses of built-in variable fields get converted into calls to a
-// getter function which in turn calls the appropriate builtin to fetch the
+// getter function which in turn would call appropriate builtin to fetch the
// value.
//
// Example:
// int x = threadIdx.x;
// IR output:
-// %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #3
+// %0 = call i32 @llvm.ptx.read.tid.x() #3
// PTX output:
// mov.u32 %r2, %tid.x;
@@ -64,45 +60,33 @@ struct dim3;
__attribute__((device)) TypeName *operator&() const __DELETE
struct __cuda_builtin_threadIdx_t {
- __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_tid_x());
- __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_tid_y());
- __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_tid_z());
- // threadIdx should be convertible to uint3 (in fact in nvcc, it *is* a
- // uint3). This function is defined after we pull in vector_types.h.
- __attribute__((device)) operator uint3() const;
+ __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_tid_x());
+ __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_tid_y());
+ __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_tid_z());
private:
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_threadIdx_t);
};
struct __cuda_builtin_blockIdx_t {
- __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ctaid_x());
- __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ctaid_y());
- __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ctaid_z());
- // blockIdx should be convertible to uint3 (in fact in nvcc, it *is* a
- // uint3). This function is defined after we pull in vector_types.h.
- __attribute__((device)) operator uint3() const;
+ __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_ctaid_x());
+ __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_ctaid_y());
+ __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_ctaid_z());
private:
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockIdx_t);
};
struct __cuda_builtin_blockDim_t {
- __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ntid_x());
- __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ntid_y());
- __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ntid_z());
- // blockDim should be convertible to dim3 (in fact in nvcc, it *is* a
- // dim3). This function is defined after we pull in vector_types.h.
- __attribute__((device)) operator dim3() const;
+ __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_ntid_x());
+ __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_ntid_y());
+ __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_ntid_z());
private:
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockDim_t);
};
struct __cuda_builtin_gridDim_t {
- __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_nctaid_x());
- __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_nctaid_y());
- __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_nctaid_z());
- // gridDim should be convertible to dim3 (in fact in nvcc, it *is* a
- // dim3). This function is defined after we pull in vector_types.h.
- __attribute__((device)) operator dim3() const;
+ __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_nctaid_x());
+ __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_nctaid_y());
+ __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_nctaid_z());
private:
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_gridDim_t);
};
diff --git a/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp
index 2ce1a783911..43270540f45 100644
--- a/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp
@@ -14,7 +14,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
using namespace llvm;
-using namespace llvm::pdb;
BuiltinDumper::BuiltinDumper(LinePrinter &P)
: PDBSymDumper(false), Printer(P) {}
@@ -31,31 +30,13 @@ StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
return "float";
return "double";
case PDB_BuiltinType::UInt:
- switch (Symbol.getLength()) {
- case 8:
+ if (Symbol.getLength() == 8)
return "unsigned __int64";
- case 4:
- return "unsigned int";
- case 2:
- return "unsigned short";
- case 1:
- return "unsigned char";
- default:
- return "unsigned";
- }
+ return "unsigned";
case PDB_BuiltinType::Int:
- switch (Symbol.getLength()) {
- case 8:
- return "__int64";
- case 4:
- return "int";
- case 2:
- return "short";
- case 1:
- return "char";
- default:
+ if (Symbol.getLength() == 4)
return "int";
- }
+ return "__int64";
case PDB_BuiltinType::Char:
return "char";
case PDB_BuiltinType::WCharT:
diff --git a/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.h b/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.h
index 7a2f1438669..ac666dbd059 100644
--- a/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/BuiltinDumper.h
@@ -10,11 +10,9 @@
#ifndef LLVM_TOOLS_LLVMPDBDUMP_BUILTINDUMPER_H
#define LLVM_TOOLS_LLVMPDBDUMP_BUILTINDUMPER_H
-#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
class LinePrinter;
@@ -30,6 +28,5 @@ private:
LinePrinter &Printer;
};
}
-}
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
index 553bc0b267c..8abf3fa3912 100644
--- a/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
@@ -28,7 +28,6 @@
#include "llvm/Support/Format.h"
using namespace llvm;
-using namespace llvm::pdb;
ClassDefinitionDumper::ClassDefinitionDumper(LinePrinter &P)
: PDBSymDumper(true), Printer(P) {}
@@ -85,7 +84,7 @@ void ClassDefinitionDumper::start(const PDBSymbolTypeUDT &Class) {
auto &AccessGroup = Groups.find((int)Access)->second;
if (auto Func = dyn_cast<PDBSymbolFunc>(Child.get())) {
- if (Func->isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
+ if (Func->isCompilerGenerated() && opts::ExcludeCompilerGenerated)
continue;
if (Func->getLength() == 0 && !Func->isPureVirtual() &&
!Func->isIntroVirtualFunction())
diff --git a/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.h b/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.h
index 304e11dcb6c..5b48ba879cf 100644
--- a/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.h
@@ -19,7 +19,6 @@
#include <unordered_map>
namespace llvm {
-namespace pdb {
class LinePrinter;
@@ -59,5 +58,5 @@ private:
int dumpAccessGroup(PDB_MemberAccess Access, const SymbolGroup &Group);
};
}
-}
+
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.cpp
index 5ec37cbbb5a..68ceb620627 100644
--- a/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.cpp
@@ -12,9 +12,7 @@
#include "llvm-pdbdump.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
@@ -33,9 +31,9 @@
#include "FunctionDumper.h"
#include <utility>
+#include <vector>
using namespace llvm;
-using namespace llvm::pdb;
CompilandDumper::CompilandDumper(LinePrinter &P)
: PDBSymDumper(true), Printer(P) {}
@@ -44,65 +42,21 @@ void CompilandDumper::dump(const PDBSymbolCompilandDetails &Symbol) {}
void CompilandDumper::dump(const PDBSymbolCompilandEnv &Symbol) {}
-void CompilandDumper::start(const PDBSymbolCompiland &Symbol,
- CompilandDumpFlags opts) {
+void CompilandDumper::start(const PDBSymbolCompiland &Symbol, bool Children) {
std::string FullName = Symbol.getName();
if (Printer.IsCompilandExcluded(FullName))
return;
Printer.NewLine();
WithColor(Printer, PDB_ColorItem::Path).get() << FullName;
+ if (!Children)
+ return;
- if (opts & Flags::Lines) {
- const IPDBSession &Session = Symbol.getSession();
- auto Files = Session.getSourceFilesForCompiland(Symbol);
- Printer.Indent();
- while (auto File = Files->getNext()) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Path).get() << File->getFileName();
-
- auto Lines = Session.findLineNumbers(Symbol, *File);
- Printer.Indent();
- while (auto Line = Lines->getNext()) {
- Printer.NewLine();
- uint32_t LineStart = Line->getLineNumber();
- uint32_t LineEnd = Line->getLineNumberEnd();
-
- Printer << "Line ";
- PDB_ColorItem StatementColor = Line->isStatement()
- ? PDB_ColorItem::Keyword
- : PDB_ColorItem::LiteralValue;
- WithColor(Printer, StatementColor).get() << LineStart;
- if (LineStart != LineEnd)
- WithColor(Printer, StatementColor).get() << " - " << LineEnd;
-
- Printer << ", Address: ";
- if (Line->getLength() > 0) {
- uint64_t AddrStart = Line->getVirtualAddress();
- uint64_t AddrEnd = AddrStart + Line->getLength() - 1;
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(AddrStart, 10) << " - "
- << format_hex(AddrEnd, 10) << "]";
- Printer << " (" << Line->getLength() << " bytes)";
- } else {
- uint64_t AddrStart = Line->getVirtualAddress();
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(AddrStart, 10) << "] ";
- Printer << "(0 bytes)";
- }
- }
- Printer.Unindent();
- }
- Printer.Unindent();
- }
-
- if (opts & Flags::Children) {
- auto ChildrenEnum = Symbol.findAllChildren();
- Printer.Indent();
- while (auto Child = ChildrenEnum->getNext())
- Child->dump(*this);
- Printer.Unindent();
- }
+ auto ChildrenEnum = Symbol.findAllChildren();
+ Printer.Indent();
+ while (auto Child = ChildrenEnum->getNext())
+ Child->dump(*this);
+ Printer.Unindent();
}
void CompilandDumper::dump(const PDBSymbolData &Symbol) {
@@ -158,9 +112,9 @@ void CompilandDumper::dump(const PDBSymbolThunk &Symbol) {
Printer.NewLine();
Printer << "thunk ";
- codeview::ThunkOrdinal Ordinal = Symbol.getThunkOrdinal();
+ PDB_ThunkOrdinal Ordinal = Symbol.getThunkOrdinal();
uint64_t VA = Symbol.getVirtualAddress();
- if (Ordinal == codeview::ThunkOrdinal::TrampIncremental) {
+ if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
uint64_t Target = Symbol.getTargetVirtualAddress();
WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(VA, 10);
Printer << " -> ";
diff --git a/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.h b/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.h
index 462aaeb2611..0d1d27cd7a4 100644
--- a/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/CompilandDumper.h
@@ -13,18 +13,14 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
class LinePrinter;
-typedef int CompilandDumpFlags;
class CompilandDumper : public PDBSymDumper {
public:
- enum Flags { None = 0x0, Children = 0x1, Symbols = 0x2, Lines = 0x4 };
-
CompilandDumper(LinePrinter &P);
- void start(const PDBSymbolCompiland &Symbol, CompilandDumpFlags flags);
+ void start(const PDBSymbolCompiland &Symbol, bool Children);
void dump(const PDBSymbolCompilandDetails &Symbol) override;
void dump(const PDBSymbolCompilandEnv &Symbol) override;
@@ -39,6 +35,5 @@ private:
LinePrinter &Printer;
};
}
-}
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/EnumDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/EnumDumper.cpp
index 43b6018ffed..3514c39f6e0 100644
--- a/gnu/llvm/tools/llvm-pdbdump/EnumDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/EnumDumper.cpp
@@ -18,14 +18,13 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
using namespace llvm;
-using namespace llvm::pdb;
EnumDumper::EnumDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
void EnumDumper::start(const PDBSymbolTypeEnum &Symbol) {
WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
- if (!opts::pretty::NoEnumDefs) {
+ if (!opts::NoEnumDefs) {
auto BuiltinType = Symbol.getUnderlyingType();
if (BuiltinType->getBuiltinType() != PDB_BuiltinType::Int ||
BuiltinType->getLength() != 4) {
diff --git a/gnu/llvm/tools/llvm-pdbdump/EnumDumper.h b/gnu/llvm/tools/llvm-pdbdump/EnumDumper.h
index 0a34e1f89ad..23de0614247 100644
--- a/gnu/llvm/tools/llvm-pdbdump/EnumDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/EnumDumper.h
@@ -13,7 +13,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
class LinePrinter;
@@ -27,5 +26,5 @@ private:
LinePrinter &Printer;
};
}
-}
+
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
index 508a2405772..c4e9f474880 100644
--- a/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
@@ -15,7 +15,6 @@
#include "llvm/Support/Format.h"
using namespace llvm;
-using namespace llvm::pdb;
ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
: PDBSymDumper(true), Printer(P) {}
diff --git a/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.h b/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.h
index b44b8a6fe98..d77b09cdebf 100644
--- a/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/ExternalSymbolDumper.h
@@ -13,7 +13,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
class LinePrinter;
@@ -29,6 +28,5 @@ private:
LinePrinter &Printer;
};
}
-}
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
index 29ba15d521f..9584812e81a 100644
--- a/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
@@ -13,7 +13,6 @@
#include "llvm-pdbdump.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
@@ -28,13 +27,11 @@
#include "llvm/Support/Format.h"
using namespace llvm;
-using namespace llvm::codeview;
-using namespace llvm::pdb;
namespace {
template <class T>
void dumpClassParentWithScopeOperator(const T &Symbol, LinePrinter &Printer,
- FunctionDumper &Dumper) {
+ llvm::FunctionDumper &Dumper) {
uint32_t ClassParentId = Symbol.getClassParentId();
auto ClassParent =
Symbol.getSession().template getConcreteSymbolById<PDBSymbolTypeUDT>(
@@ -62,8 +59,8 @@ void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
PDB_CallingConv CC = Symbol.getCallingConvention();
bool ShouldDumpCallingConvention = true;
- if ((ClassParent && CC == CallingConvention::ThisCall) ||
- (!ClassParent && CC == CallingConvention::NearStdCall)) {
+ if ((ClassParent && CC == PDB_CallingConv::Thiscall) ||
+ (!ClassParent && CC == PDB_CallingConv::NearStdcall)) {
ShouldDumpCallingConvention = false;
}
@@ -155,12 +152,12 @@ void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer) {
Printer << " ";
auto ClassParent = Symbol.getClassParent();
- CallingConvention CC = Signature->getCallingConvention();
+ PDB_CallingConv CC = Signature->getCallingConvention();
if (Pointer != FunctionDumper::PointerType::None)
Printer << "(";
- if ((ClassParent && CC != CallingConvention::ThisCall) ||
- (!ClassParent && CC != CallingConvention::NearStdCall)) {
+ if ((ClassParent && CC != PDB_CallingConv::Thiscall) ||
+ (!ClassParent && CC != PDB_CallingConv::NearStdcall)) {
WithColor(Printer, PDB_ColorItem::Keyword).get()
<< Signature->getCallingConvention() << " ";
}
diff --git a/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.h b/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.h
index c71fafa18ed..19a00145a1f 100644
--- a/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/FunctionDumper.h
@@ -13,7 +13,7 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
+
class LinePrinter;
class FunctionDumper : public PDBSymDumper {
@@ -38,6 +38,5 @@ private:
LinePrinter &Printer;
};
}
-}
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/TypeDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/TypeDumper.cpp
index a49d6404555..88c0bd65697 100644
--- a/gnu/llvm/tools/llvm-pdbdump/TypeDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/TypeDumper.cpp
@@ -24,7 +24,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
using namespace llvm;
-using namespace llvm::pdb;
TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
@@ -63,7 +62,7 @@ void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
if (Printer.IsTypeExcluded(Symbol.getName()))
return;
// Dump member enums when dumping their class definition.
- if (nullptr != Symbol.getClassParent())
+ if (Symbol.isNested())
return;
Printer.NewLine();
@@ -88,7 +87,7 @@ void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
Printer.NewLine();
- if (opts::pretty::NoClassDefs) {
+ if (opts::NoClassDefs) {
WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
} else {
diff --git a/gnu/llvm/tools/llvm-pdbdump/TypeDumper.h b/gnu/llvm/tools/llvm-pdbdump/TypeDumper.h
index 76a477964f1..5c0832eccaf 100644
--- a/gnu/llvm/tools/llvm-pdbdump/TypeDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/TypeDumper.h
@@ -13,7 +13,7 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
+
class LinePrinter;
class TypeDumper : public PDBSymDumper {
@@ -30,5 +30,5 @@ private:
LinePrinter &Printer;
};
}
-}
+
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.cpp
index b1e017613ce..a6b5c53a6b3 100644
--- a/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.cpp
@@ -23,7 +23,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
using namespace llvm;
-using namespace llvm::pdb;
TypedefDumper::TypedefDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
diff --git a/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.h b/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.h
index c22b58a7e41..8cd578cc6d2 100644
--- a/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/TypedefDumper.h
@@ -13,7 +13,6 @@
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
namespace llvm {
-namespace pdb {
class LinePrinter;
@@ -34,6 +33,5 @@ private:
LinePrinter &Printer;
};
}
-}
#endif
diff --git a/gnu/llvm/tools/llvm-pdbdump/VariableDumper.cpp b/gnu/llvm/tools/llvm-pdbdump/VariableDumper.cpp
index 284d7e9b731..e5665b5fcaf 100644
--- a/gnu/llvm/tools/llvm-pdbdump/VariableDumper.cpp
+++ b/gnu/llvm/tools/llvm-pdbdump/VariableDumper.cpp
@@ -27,13 +27,12 @@
#include "llvm/Support/Format.h"
using namespace llvm;
-using namespace llvm::pdb;
VariableDumper::VariableDumper(LinePrinter &P)
: PDBSymDumper(true), Printer(P) {}
void VariableDumper::start(const PDBSymbolData &Var) {
- if (Var.isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
+ if (Var.isCompilerGenerated() && opts::ExcludeCompilerGenerated)
return;
if (Printer.IsSymbolExcluded(Var.getName()))
return;
diff --git a/gnu/llvm/tools/llvm-pdbdump/VariableDumper.h b/gnu/llvm/tools/llvm-pdbdump/VariableDumper.h
index 4f00358878c..db8d8ea0e43 100644
--- a/gnu/llvm/tools/llvm-pdbdump/VariableDumper.h
+++ b/gnu/llvm/tools/llvm-pdbdump/VariableDumper.h
@@ -11,13 +11,10 @@
#define LLVM_TOOLS_LLVMPDBDUMP_VARIABLEDUMPER_H
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
-class StringRef;
-
-namespace pdb {
-
class LinePrinter;
class VariableDumper : public PDBSymDumper {
@@ -40,5 +37,5 @@ private:
LinePrinter &Printer;
};
}
-}
+
#endif
diff --git a/gnu/llvm/unittests/Analysis/MixedTBAATest.cpp b/gnu/llvm/unittests/Analysis/MixedTBAATest.cpp
index d70324f2c6a..d0cfa59f645 100644
--- a/gnu/llvm/unittests/Analysis/MixedTBAATest.cpp
+++ b/gnu/llvm/unittests/Analysis/MixedTBAATest.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
-#include "llvm/Analysis/AliasAnalysisEvaluator.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
diff --git a/gnu/llvm/unittests/Support/IteratorTest.cpp b/gnu/llvm/unittests/Support/IteratorTest.cpp
index 63dfa2a9d01..83848328c0c 100644
--- a/gnu/llvm/unittests/Support/IteratorTest.cpp
+++ b/gnu/llvm/unittests/Support/IteratorTest.cpp
@@ -16,24 +16,6 @@ using namespace llvm;
namespace {
-template <int> struct Shadow;
-
-struct WeirdIter : std::iterator<std::input_iterator_tag, Shadow<0>, Shadow<1>,
- Shadow<2>, Shadow<3>> {};
-
-struct AdaptedIter : iterator_adaptor_base<AdaptedIter, WeirdIter> {};
-
-// Test that iterator_adaptor_base forwards typedefs, if value_type is
-// unchanged.
-static_assert(std::is_same<typename AdaptedIter::value_type, Shadow<0>>::value,
- "");
-static_assert(
- std::is_same<typename AdaptedIter::difference_type, Shadow<1>>::value, "");
-static_assert(std::is_same<typename AdaptedIter::pointer, Shadow<2>>::value,
- "");
-static_assert(std::is_same<typename AdaptedIter::reference, Shadow<3>>::value,
- "");
-
TEST(PointeeIteratorTest, Basic) {
int arr[4] = { 1, 2, 3, 4 };
SmallVector<int *, 4> V;
@@ -116,73 +98,4 @@ TEST(PointeeIteratorTest, SmartPointer) {
EXPECT_EQ(End, I);
}
-TEST(FilterIteratorTest, Lambda) {
- auto IsOdd = [](int N) { return N % 2 == 1; };
- int A[] = {0, 1, 2, 3, 4, 5, 6};
- auto Range = make_filter_range(A, IsOdd);
- SmallVector<int, 3> Actual(Range.begin(), Range.end());
- EXPECT_EQ((SmallVector<int, 3>{1, 3, 5}), Actual);
-}
-
-TEST(FilterIteratorTest, CallableObject) {
- int Counter = 0;
- struct Callable {
- int &Counter;
-
- Callable(int &Counter) : Counter(Counter) {}
-
- bool operator()(int N) {
- Counter++;
- return N % 2 == 1;
- }
- };
- Callable IsOdd(Counter);
- int A[] = {0, 1, 2, 3, 4, 5, 6};
- auto Range = make_filter_range(A, IsOdd);
- EXPECT_EQ(2, Counter);
- SmallVector<int, 3> Actual(Range.begin(), Range.end());
- EXPECT_GE(Counter, 7);
- EXPECT_EQ((SmallVector<int, 3>{1, 3, 5}), Actual);
-}
-
-TEST(FilterIteratorTest, FunctionPointer) {
- bool (*IsOdd)(int) = [](int N) { return N % 2 == 1; };
- int A[] = {0, 1, 2, 3, 4, 5, 6};
- auto Range = make_filter_range(A, IsOdd);
- SmallVector<int, 3> Actual(Range.begin(), Range.end());
- EXPECT_EQ((SmallVector<int, 3>{1, 3, 5}), Actual);
-}
-
-TEST(FilterIteratorTest, Composition) {
- auto IsOdd = [](int N) { return N % 2 == 1; };
- std::unique_ptr<int> A[] = {make_unique<int>(0), make_unique<int>(1),
- make_unique<int>(2), make_unique<int>(3),
- make_unique<int>(4), make_unique<int>(5),
- make_unique<int>(6)};
- using PointeeIterator = pointee_iterator<std::unique_ptr<int> *>;
- auto Range = make_filter_range(
- make_range(PointeeIterator(std::begin(A)), PointeeIterator(std::end(A))),
- IsOdd);
- SmallVector<int, 3> Actual(Range.begin(), Range.end());
- EXPECT_EQ((SmallVector<int, 3>{1, 3, 5}), Actual);
-}
-
-TEST(FilterIteratorTest, InputIterator) {
- struct InputIterator
- : iterator_adaptor_base<InputIterator, int *, std::input_iterator_tag> {
- using BaseT =
- iterator_adaptor_base<InputIterator, int *, std::input_iterator_tag>;
-
- InputIterator(int *It) : BaseT(It) {}
- };
-
- auto IsOdd = [](int N) { return N % 2 == 1; };
- int A[] = {0, 1, 2, 3, 4, 5, 6};
- auto Range = make_filter_range(
- make_range(InputIterator(std::begin(A)), InputIterator(std::end(A))),
- IsOdd);
- SmallVector<int, 3> Actual(Range.begin(), Range.end());
- EXPECT_EQ((SmallVector<int, 3>{1, 3, 5}), Actual);
-}
-
} // anonymous namespace