1 //===- llvm/Support/KnownBits.h - Stores known zeros/ones -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a class for representing known zeros and ones used by
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SUPPORT_KNOWNBITS_H
16 #define LLVM_SUPPORT_KNOWNBITS_H
18 #include "llvm/ADT/APInt.h"
22 // For now this is a simple wrapper around two APInts.
27 // Default construct Zero and One.
30 /// Create a known bits object of BitWidth bits initialized to unknown.
31 KnownBits(unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {}
33 /// Get the bit width of this value.
34 unsigned getBitWidth() const {
35 assert(Zero.getBitWidth() == One.getBitWidth() &&
36 "Zero and One should have the same width!");
37 return Zero.getBitWidth();
41 } // end namespace llvm