forked from OSchip/llvm-project
Implement a convenience method to construct a ConstantInt directly from an
APInt. The implied type is the integer type that corresponds to the bit width of the APInt. llvm-svn: 34757
This commit is contained in:
parent
56f784d12d
commit
8774fe816a
|
@ -97,6 +97,10 @@ public:
|
|||
static ConstantInt *get(const Type *Ty, int64_t V);
|
||||
static ConstantInt *get(const Type *Ty, const APInt& V);
|
||||
|
||||
/// Return a ConstantInt with the specified value and an implied Type. The
|
||||
/// type is the integer type that corresponds to the bit width of the value.
|
||||
static ConstantInt *get(const APInt &V);
|
||||
|
||||
/// getType - Specialize the getType() method to always return an IntegerType,
|
||||
/// which reduces the amount of casting needed in parts of the compiler.
|
||||
///
|
||||
|
|
|
@ -216,6 +216,10 @@ ConstantInt *ConstantInt::get(const Type *Ty, const APInt& V) {
|
|||
return Slot = new ConstantInt(ITy, V);
|
||||
}
|
||||
|
||||
ConstantInt *ConstantInt::get(const APInt &V) {
|
||||
return ConstantInt::get(IntegerType::get(V.getBitWidth()), V);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConstantFP
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue