CIRCT  20.0.0git
APInt.h
Go to the documentation of this file.
1 //===- APInt.h - CIRCT Lowering Options -------------------------*- 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 //===----------------------------------------------------------------------===//
8 //
9 // Utilities for working around limitations of upstream LLVM APInts.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_SUPPORT_APINT_H
14 #define CIRCT_SUPPORT_APINT_H
15 
16 #include "circt/Support/LLVM.h"
17 
18 namespace circt {
19 
20 /// A safe version of APInt::sext that will NOT assert on zero-width
21 /// signed APSInts. Instead of asserting, this will zero extend.
22 APInt sextZeroWidth(APInt value, unsigned width);
23 
24 /// A safe version of APSInt::extOrTrunc that will NOT assert on zero-width
25 /// signed APSInts. Instead of asserting, this will zero extend.
26 APSInt extOrTruncZeroWidth(APSInt value, unsigned width);
27 
28 } // namespace circt
29 
30 #endif // CIRCT_SUPPORT_APINT_H
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
APSInt extOrTruncZeroWidth(APSInt value, unsigned width)
A safe version of APSInt::extOrTrunc that will NOT assert on zero-width signed APSInts.
Definition: APInt.cpp:22
APInt sextZeroWidth(APInt value, unsigned width)
A safe version of APInt::sext that will NOT assert on zero-width signed APSInts.
Definition: APInt.cpp:18