mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
|
//===- llvm/Support/KnownBits.h - Stores known zeros/ones -------*- C++ -*-===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
//
|
||
|
// This file contains a class for representing known zeros and ones used by
|
||
|
// computeKnownBits.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#ifndef LLVM_SUPPORT_KNOWNBITS_H
|
||
|
#define LLVM_SUPPORT_KNOWNBITS_H
|
||
|
|
||
|
#include "llvm/ADT/APInt.h"
|
||
|
|
||
|
namespace llvm {
|
||
|
|
||
|
// For now this is a simple wrapper around two APInts.
|
||
|
struct KnownBits {
|
||
|
APInt Zero;
|
||
|
APInt One;
|
||
|
|
||
|
// Default construct Zero and One.
|
||
|
KnownBits() {}
|
||
|
|
||
|
/// Create a known bits object of BitWidth bits initialized to unknown.
|
||
|
KnownBits(unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {}
|
||
|
|
||
|
/// Get the bit width of this value.
|
||
|
unsigned getBitWidth() const {
|
||
|
assert(Zero.getBitWidth() == One.getBitWidth() &&
|
||
|
"Zero and One should have the same width!");
|
||
|
return Zero.getBitWidth();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} // end namespace llvm
|
||
|
|
||
|
#endif
|