LLVM 20.0.0git
DynamicAPInt.cpp
Go to the documentation of this file.
1//===- DynamicAPInt.cpp - DynamicAPInt Implementation -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
9#include "llvm/ADT/Hashing.h"
10#include "llvm/Support/Debug.h"
12
13using namespace llvm;
14
16 if (X.isSmall())
17 return llvm::hash_value(X.getSmall());
18 return detail::hash_value(X.getLarge());
19}
20
22 constexpr size_t ValLargeOffset =
23 offsetof(DynamicAPInt, ValLarge.Val.BitWidth);
24 constexpr size_t ValSmallOffset = offsetof(DynamicAPInt, ValSmall);
25 constexpr size_t ValSmallSize = sizeof(ValSmall);
26 static_assert(ValLargeOffset >= ValSmallOffset + ValSmallSize);
27}
28
30 if (isSmall())
31 return OS << ValSmall;
32 return OS << ValLarge;
33}
34
35void DynamicAPInt::dump() const { print(dbgs()); }
#define offsetof(TYPE, MEMBER)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
raw_pwrite_stream & OS
This class provides support for dynamic arbitrary-precision arithmetic.
Definition: DynamicAPInt.h:46
raw_ostream & print(raw_ostream &OS) const
detail::SlowDynamicAPInt ValLarge
Definition: DynamicAPInt.h:49
LLVM_DUMP_METHOD void dump() const
An opaque object representing a hash code.
Definition: Hashing.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
hash_code hash_value(const FixedPointSemantics &Val)
Definition: APFixedPoint.h:127
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163