diff options
author | Derek Schuff <dschuff@chromium.org> | 2012-09-19 16:10:54 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2012-09-19 16:10:54 -0700 |
commit | 0e15ffd8cb1ec642eddb96380660914ff2b007e1 (patch) | |
tree | bc5ccf8c89bfe799bb276625e8e0bd6d84e3a75c /lib/Support | |
parent | 5e79ec1d7ada2e14283e2b69b6f4375eb4dd1890 (diff) | |
parent | 020aba0c3b6092e353e133446cb6453f95f0d61b (diff) |
Merge commit '020aba0c3b6092e353e133446cb6453f95f0d61b'
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/FoldingSet.cpp | 18 | ||||
-rw-r--r-- | lib/Support/Memory.cpp | 4 | ||||
-rw-r--r-- | lib/Support/Unix/Memory.inc | 8 |
3 files changed, 26 insertions, 4 deletions
diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp index c6282c6ab2..4d489a88e5 100644 --- a/lib/Support/FoldingSet.cpp +++ b/lib/Support/FoldingSet.cpp @@ -38,6 +38,14 @@ bool FoldingSetNodeIDRef::operator==(FoldingSetNodeIDRef RHS) const { return memcmp(Data, RHS.Data, Size*sizeof(*Data)) == 0; } +/// Used to compare the "ordering" of two nodes as defined by the +/// profiled bits and their ordering defined by memcmp(). +bool FoldingSetNodeIDRef::operator<(FoldingSetNodeIDRef RHS) const { + if (Size != RHS.Size) + return Size < RHS.Size; + return memcmp(Data, RHS.Data, Size*sizeof(*Data)) < 0; +} + //===----------------------------------------------------------------------===// // FoldingSetNodeID Implementation @@ -152,6 +160,16 @@ bool FoldingSetNodeID::operator==(FoldingSetNodeIDRef RHS) const { return FoldingSetNodeIDRef(Bits.data(), Bits.size()) == RHS; } +/// Used to compare the "ordering" of two nodes as defined by the +/// profiled bits and their ordering defined by memcmp(). +bool FoldingSetNodeID::operator<(const FoldingSetNodeID &RHS)const{ + return *this < FoldingSetNodeIDRef(RHS.Bits.data(), RHS.Bits.size()); +} + +bool FoldingSetNodeID::operator<(FoldingSetNodeIDRef RHS) const { + return FoldingSetNodeIDRef(Bits.data(), Bits.size()) < RHS; +} + /// Intern - Copy this node's data to a memory region allocated from the /// given allocator and return a FoldingSetNodeIDRef describing the /// interned data. diff --git a/lib/Support/Memory.cpp b/lib/Support/Memory.cpp index 22f7494486..3cc8f5ee7b 100644 --- a/lib/Support/Memory.cpp +++ b/lib/Support/Memory.cpp @@ -16,10 +16,6 @@ #include "llvm/Support/Valgrind.h" #include "llvm/Config/config.h" -#if defined(__mips__) -#include <sys/cachectl.h> -#endif - namespace llvm { using namespace sys; } diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc index 13c35e8aa8..7136acf6cf 100644 --- a/lib/Support/Unix/Memory.inc +++ b/lib/Support/Unix/Memory.inc @@ -25,6 +25,14 @@ #include <mach/mach.h> #endif +#if defined(__mips__) +# if defined(__OpenBSD__) +# include <mips64/sysarch.h> +# else +# include <sys/cachectl.h> +# endif +#endif + /// AllocateRWX - Allocate a slab of memory with read/write/execute /// permissions. This is typically used for JIT applications where we want /// to emit code to the memory then jump to it. Getting this type of memory |