
Change: remove guards on debug-printing, to allow Release builds without LLVM_ENABLE_DUMP to pass. MPInt is an arbitrary-precision integer library that builds on top of APInt, and has a fast-path when the number fits within 64 bits. It was originally written for the Presburger library in MLIR, but seems useful to the LLVM project in general, independently of the Presburger library or MLIR. Hence, move it into LLVM/ADT under the name DynamicAPInt. This patch is part of a project to move the Presburger library into LLVM.
28 lines
869 B
C++
28 lines
869 B
C++
//===- DynamicAPInt.cpp - DynamicAPInt Implementation -----------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#include "llvm/ADT/DynamicAPInt.h"
|
|
#include "llvm/ADT/Hashing.h"
|
|
#include "llvm/Support/Debug.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using namespace llvm;
|
|
|
|
hash_code llvm::hash_value(const DynamicAPInt &X) {
|
|
if (X.isSmall())
|
|
return llvm::hash_value(X.getSmall());
|
|
return detail::hash_value(X.getLarge());
|
|
}
|
|
|
|
raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
|
|
if (isSmall())
|
|
return OS << ValSmall;
|
|
return OS << ValLarge;
|
|
}
|
|
|
|
void DynamicAPInt::dump() const { print(dbgs()); }
|