diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/IR/DiagnosticInfo.h | 19 | ||||
| -rw-r--r-- | llvm/include/llvm/IR/IRBuilder.h | 30 | ||||
| -rw-r--r-- | llvm/include/llvm/Transforms/Utils/MemorySSA.h | 41 | ||||
| -rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 22 | ||||
| -rw-r--r-- | llvm/unittests/ProfileData/SampleProfTest.cpp | 22 |
5 files changed, 104 insertions, 30 deletions
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h index 66f8c086287..ba8f8ae7696 100644 --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -15,11 +15,13 @@ #ifndef LLVM_IR_DIAGNOSTICINFO_H #define LLVM_IR_DIAGNOSTICINFO_H +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/DebugLoc.h" -#include "llvm/IR/Module.h" -#include "llvm/Support/Casting.h" +#include "llvm/Support/CBindingWrapping.h" +#include "llvm-c/Types.h" #include <functional> +#include <string> namespace llvm { @@ -27,9 +29,8 @@ namespace llvm { class DiagnosticPrinter; class Function; class Instruction; -class LLVMContextImpl; -class Value; -class DebugLoc; +class LLVMContext; +class Module; class SMDiagnostic; /// \brief Defines the different supported severity of a diagnostic. @@ -91,7 +92,7 @@ public: DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity) : Kind(Kind), Severity(Severity) {} - virtual ~DiagnosticInfo() {} + virtual ~DiagnosticInfo() = default; /* DiagnosticKind */ int getKind() const { return Kind; } DiagnosticSeverity getSeverity() const { return Severity; } @@ -617,7 +618,7 @@ public: const Twine &getMessage() const { return Msg; } - void print(DiagnosticPrinter &DP) const; + void print(DiagnosticPrinter &DP) const override; }; /// Emit a warning when loop vectorization is specified but fails. \p Fn is the @@ -632,6 +633,6 @@ void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn, void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg); -} // End namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_IR_DIAGNOSTICINFO_H diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 14e4048a4dd..1e26593c188 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -16,22 +16,42 @@ #define LLVM_IR_IRBUILDER_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/None.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Constant.h" #include "llvm/IR/ConstantFolder.h" +#include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" +#include "llvm/IR/DebugLoc.h" +#include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Operator.h" +#include "llvm/IR/Type.h" +#include "llvm/IR/Value.h" #include "llvm/IR/ValueHandle.h" +#include "llvm/Support/AtomicOrdering.h" #include "llvm/Support/CBindingWrapping.h" +#include "llvm/Support/Casting.h" +#include "llvm-c/Types.h" +#include <cassert> +#include <cstddef> +#include <cstdint> namespace llvm { -class StringRef; + +class APInt; class MDNode; +class Module; +class Use; /// \brief This provides the default implementation of the IRBuilder /// 'InsertHelper' method that is called whenever an instruction is created by @@ -435,12 +455,14 @@ public: Value *Mask); /// \brief Create a call to Masked Gather intrinsic - CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, Value *Mask = 0, - Value *PassThru = 0, const Twine& Name = ""); + CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, + Value *Mask = nullptr, + Value *PassThru = nullptr, + const Twine& Name = ""); /// \brief Create a call to Masked Scatter intrinsic CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Align, - Value *Mask = 0); + Value *Mask = nullptr); /// \brief Create an assume intrinsic call that allows the optimizer to /// assume that the provided condition will be true. diff --git a/llvm/include/llvm/Transforms/Utils/MemorySSA.h b/llvm/include/llvm/Transforms/Utils/MemorySSA.h index b5e3ffce5d1..aa38deea1da 100644 --- a/llvm/include/llvm/Transforms/Utils/MemorySSA.h +++ b/llvm/include/llvm/Transforms/Utils/MemorySSA.h @@ -68,6 +68,7 @@ // definitions, which would require multiple phis, and multiple memoryaccesses // per instruction. //===----------------------------------------------------------------------===// + #ifndef LLVM_TRANSFORMS_UTILS_MEMORYSSA_H #define LLVM_TRANSFORMS_UTILS_MEMORYSSA_H @@ -75,24 +76,41 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/iterator.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MemoryLocation.h" #include "llvm/Analysis/PHITransAddr.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Module.h" #include "llvm/IR/OperandTraits.h" #include "llvm/IR/Type.h" +#include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Pass.h" +#include "llvm/PassAnalysisSupport.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" +#include <algorithm> +#include <cassert> +#include <cstddef> +#include <iterator> +#include <memory> +#include <utility> namespace llvm { -class BasicBlock; + class DominatorTree; class Function; +class Instruction; class MemoryAccess; +class LLVMContext; +class raw_ostream; + template <class T> class memoryaccess_def_iterator_base; using memoryaccess_def_iterator = memoryaccess_def_iterator_base<MemoryAccess>; using const_memoryaccess_def_iterator = @@ -113,7 +131,8 @@ public: return ID == MemoryUseVal || ID == MemoryPhiVal || ID == MemoryDefVal; } - virtual ~MemoryAccess(); + ~MemoryAccess() override; + BasicBlock *getBlock() const { return Block; } virtual void print(raw_ostream &OS) const = 0; @@ -214,6 +233,7 @@ protected: private: Instruction *MemoryInst; }; + template <> struct OperandTraits<MemoryUseOrDef> : public FixedNumOperandTraits<MemoryUseOrDef, 1> {}; @@ -250,6 +270,7 @@ protected: llvm_unreachable("MemoryUses do not have IDs"); } }; + template <> struct OperandTraits<MemoryUse> : public FixedNumOperandTraits<MemoryUse, 1> {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryUse, MemoryAccess) @@ -293,6 +314,7 @@ protected: private: const unsigned ID; }; + template <> struct OperandTraits<MemoryDef> : public FixedNumOperandTraits<MemoryDef, 1> {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryDef, MemoryAccess) @@ -447,7 +469,7 @@ protected: /// For debugging only. This gets used to give memory accesses pretty numbers /// when printing them out - virtual unsigned getID() const final { return ID; } + unsigned getID() const final { return ID; } private: // For debugging only @@ -463,8 +485,8 @@ private: growHungoffUses(ReservedSpace, /* IsPhi */ true); } }; -template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits<2> {}; +template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits<2> {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryPhi, MemoryAccess) class MemorySSAWalker; @@ -674,6 +696,7 @@ public: /// starting from the use side of the memory def. virtual MemoryAccess *getClobberingMemoryAccess(MemoryAccess *, MemoryLocation &) = 0; + /// \brief Given a memory access, invalidate anything this walker knows about /// that access. /// This API is used by walkers that store information to perform basic cache @@ -733,7 +756,8 @@ using ConstMemoryAccessPair = std::pair<const MemoryAccess *, MemoryLocation>; class CachingMemorySSAWalker final : public MemorySSAWalker { public: CachingMemorySSAWalker(MemorySSA *, AliasAnalysis *, DominatorTree *); - virtual ~CachingMemorySSAWalker(); + ~CachingMemorySSAWalker() override; + MemoryAccess *getClobberingMemoryAccess(const Instruction *) override; MemoryAccess *getClobberingMemoryAccess(MemoryAccess *, MemoryLocation &) override; @@ -821,6 +845,7 @@ private: inline memoryaccess_def_iterator MemoryAccess::defs_begin() { return memoryaccess_def_iterator(this); } + inline const_memoryaccess_def_iterator MemoryAccess::defs_begin() const { return const_memoryaccess_def_iterator(this); } @@ -940,7 +965,9 @@ private: inline upward_defs_iterator upward_defs_begin(const MemoryAccessPair &Pair) { return upward_defs_iterator(Pair); } + inline upward_defs_iterator upward_defs_end() { return upward_defs_iterator(); } -} -#endif +} // end namespace llvm + +#endif // LLVM_TRANSFORMS_UTILS_MEMORYSSA_H diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index ee95c4f80e4..9369cbd6a08 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -13,16 +13,23 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/LLVMContext.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" #include "LLVMContextImpl.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/DebugLoc.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/IR/Instruction.h" #include "llvm/IR/Metadata.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/SourceMgr.h" -#include <cctype> +#include "llvm/IR/Module.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include <cassert> +#include <cstdlib> +#include <string> +#include <utility> + using namespace llvm; LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { @@ -142,6 +149,7 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { "gc-transition operand bundle id drifted!"); (void)GCTransitionEntry; } + LLVMContext::~LLVMContext() { delete pImpl; } void LLVMContext::addModule(Module *M) { @@ -300,9 +308,11 @@ void LLVMContext::setGC(const Function &Fn, std::string GCName) { } It->second = std::move(GCName); } + const std::string &LLVMContext::getGC(const Function &Fn) { return pImpl->GCNames[&Fn]; } + void LLVMContext::deleteGC(const Function &Fn) { pImpl->GCNames.erase(&Fn); } diff --git a/llvm/unittests/ProfileData/SampleProfTest.cpp b/llvm/unittests/ProfileData/SampleProfTest.cpp index 24ffee72d3c..8de090d2293 100644 --- a/llvm/unittests/ProfileData/SampleProfTest.cpp +++ b/llvm/unittests/ProfileData/SampleProfTest.cpp @@ -1,5 +1,4 @@ -//===- unittest/ProfileData/SampleProfTest.cpp -------------------*- C++ -//-*-===// +//===- unittest/ProfileData/SampleProfTest.cpp ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,12 +7,27 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" +#include "llvm/IR/Module.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/ProfileData/SampleProf.h" #include "llvm/ProfileData/SampleProfReader.h" #include "llvm/ProfileData/SampleProfWriter.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" - -#include <cstdarg> +#include <algorithm> +#include <cstdint> +#include <limits> +#include <memory> +#include <string> +#include <system_error> +#include <vector> using namespace llvm; using namespace sampleprof; |

