[llvm] r313782 - [TableGen] Add a DenseMapInfo for MachineValueType.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 11:14:52 PDT 2017


Do we still need this after Krzysztof's changes? There's no longer a
DenseSet/Map of MVTs

~Craig

On Wed, Sep 20, 2017 at 11:01 AM, Zachary Turner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: zturner
> Date: Wed Sep 20 11:01:20 2017
> New Revision: 313782
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313782&view=rev
> Log:
> [TableGen] Add a DenseMapInfo for MachineValueType.
>
> No functional change, just adding a DenseMapInfo and tombstone
> value so that MVT's can be put into a DenseMap / DenseSet.
>
> Modified:
>     llvm/trunk/include/llvm/CodeGen/MachineValueType.h
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineValueType.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/CodeGen/MachineValueType.h?rev=313782&r1=313781&r2=313782&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/CodeGen/MachineValueType.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineValueType.h Wed Sep 20
> 11:01:20 2017
> @@ -16,6 +16,7 @@
>  #define LLVM_CODEGEN_MACHINEVALUETYPE_H
>
>  #include "llvm/ADT/iterator_range.h"
> +#include "llvm/ADT/DenseMapInfo.h"
>  #include "llvm/Support/ErrorHandling.h"
>  #include "llvm/Support/MathExtras.h"
>  #include <cassert>
> @@ -30,6 +31,8 @@ namespace llvm {
>    class MVT {
>    public:
>      enum SimpleValueType : uint8_t {
> +      // clang-format off
> +
>        // Simple value types that aren't explicitly part of this
> enumeration
>        // are considered extended value types.
>        INVALID_SIMPLE_VALUE_TYPE = 0,
> @@ -198,6 +201,10 @@ namespace llvm {
>        // This value must be a multiple of 32.
>        MAX_ALLOWED_VALUETYPE = 128,
>
> +      // tombstone value used for DenseMap / DenseSet.
> +      // This is only for internal use!
> +      tombstone      = 247,
> +
>        // A value of type llvm::TokenTy
>        token          = 248,
>
> @@ -231,6 +238,8 @@ namespace llvm {
>        // Any type. This is used for intrinsics that have overloadings.
>        // This is only for tblgen's consumption!
>        Any            = 255
> +
> +      // clang-format on
>      };
>
>      SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE;
> @@ -1044,6 +1053,18 @@ namespace llvm {
>      /// @}
>    };
>
> +  template <> struct DenseMapInfo<MVT> {
> +    static inline MVT getEmptyKey() {
> +      return MVT(MVT::INVALID_SIMPLE_VALUE_TYPE);
> +    }
> +
> +    static inline MVT getTombstoneKey() { return MVT(MVT::tombstone); }
> +    static unsigned getHashValue(const MVT &Val) {
> +      return unsigned(Val.SimpleTy);
> +    }
> +    static bool isEqual(const MVT &LHS, const MVT &RHS) { return LHS ==
> RHS; }
> +  };
> +
>  } // end namespace llvm
>
>  #endif // LLVM_CODEGEN_MACHINEVALUETYPE_H
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/95cddb2d/attachment.html>


More information about the llvm-commits mailing list