[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp ConstantFolding.cpp Constants.cpp Instructions.cpp Type.cpp ValueTypes.cpp Verifier.cpp
Reid Spencer
reid at x10sys.com
Thu Jan 11 10:22:16 PST 2007
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.247 -> 1.248
ConstantFolding.cpp updated: 1.127 -> 1.128
Constants.cpp updated: 1.195 -> 1.196
Instructions.cpp updated: 1.59 -> 1.60
Type.cpp updated: 1.156 -> 1.157
ValueTypes.cpp updated: 1.9 -> 1.10
Verifier.cpp updated: 1.182 -> 1.183
---
Log message:
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
---
Diffs of the changes: (+26 -26)
AsmWriter.cpp | 2 +-
ConstantFolding.cpp | 8 ++++----
Constants.cpp | 24 ++++++++++++------------
Instructions.cpp | 6 +++---
Type.cpp | 8 ++++----
ValueTypes.cpp | 2 +-
Verifier.cpp | 2 +-
7 files changed, 26 insertions(+), 26 deletions(-)
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.247 llvm/lib/VMCore/AsmWriter.cpp:1.248
--- llvm/lib/VMCore/AsmWriter.cpp:1.247 Thu Jan 11 06:24:14 2007
+++ llvm/lib/VMCore/AsmWriter.cpp Thu Jan 11 12:21:29 2007
@@ -439,7 +439,7 @@
const int IndentSize = 4;
static std::string Indent = "\n";
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
- if (CI->getType() == Type::BoolTy)
+ if (CI->getType() == Type::Int1Ty)
Out << (CI->getBoolValue() ? "true" : "false");
else Out << CI->getSExtValue();
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.127 llvm/lib/VMCore/ConstantFolding.cpp:1.128
--- llvm/lib/VMCore/ConstantFolding.cpp:1.127 Thu Jan 11 06:24:14 2007
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Jan 11 12:21:29 2007
@@ -317,7 +317,7 @@
const Constant *V1,
const Constant *V2) {
if (const ConstantInt *CB = dyn_cast<ConstantInt>(Cond))
- if (CB->getType() == Type::BoolTy)
+ if (CB->getType() == Type::Int1Ty)
return const_cast<Constant*>(CB->getBoolValue() ? V1 : V2);
if (isa<UndefValue>(V1)) return const_cast<Constant*>(V2);
@@ -555,7 +555,7 @@
// so look at directly computing the value.
if (const ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {
if (const ConstantInt *CI2 = dyn_cast<ConstantInt>(C2)) {
- if (CI1->getType() == Type::BoolTy && CI2->getType() == Type::BoolTy) {
+ if (CI1->getType() == Type::Int1Ty && CI2->getType() == Type::Int1Ty) {
switch (Opcode) {
default:
break;
@@ -1037,7 +1037,7 @@
// Handle some degenerate cases first
if (isa<UndefValue>(C1) || isa<UndefValue>(C2))
- return UndefValue::get(Type::BoolTy);
+ return UndefValue::get(Type::Int1Ty);
// icmp eq/ne(null,GV) -> false/true
if (C1->isNullValue()) {
@@ -1058,7 +1058,7 @@
}
if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2) &&
- C1->getType() == Type::BoolTy && C2->getType() == Type::BoolTy) {
+ C1->getType() == Type::Int1Ty && C2->getType() == Type::Int1Ty) {
bool C1Val = cast<ConstantInt>(C1)->getBoolValue();
bool C2Val = cast<ConstantInt>(C2)->getBoolValue();
switch (pred) {
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.195 llvm/lib/VMCore/Constants.cpp:1.196
--- llvm/lib/VMCore/Constants.cpp:1.195 Thu Jan 11 06:24:14 2007
+++ llvm/lib/VMCore/Constants.cpp Thu Jan 11 12:21:29 2007
@@ -92,7 +92,7 @@
// Static constructor to create a '0' constant of arbitrary type...
Constant *Constant::getNullValue(const Type *Ty) {
switch (Ty->getTypeID()) {
- case Type::BoolTyID: {
+ case Type::Int1TyID: {
static Constant *NullBool = ConstantInt::get(false);
return NullBool;
}
@@ -137,7 +137,7 @@
// Static constructor to create an integral constant with all bits set
ConstantInt *ConstantInt::getAllOnesValue(const Type *Ty) {
switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantInt::getTrue();
+ case Type::Int1TyID: return ConstantInt::getTrue();
case Type::Int8TyID:
case Type::Int16TyID:
case Type::Int32TyID:
@@ -166,11 +166,11 @@
// Normal Constructors
ConstantInt::ConstantInt(bool V)
- : Constant(Type::BoolTy, ConstantIntVal, 0, 0), Val(uint64_t(V)) {
+ : Constant(Type::Int1Ty, ConstantIntVal, 0, 0), Val(uint64_t(V)) {
}
ConstantInt::ConstantInt(const Type *Ty, uint64_t V)
- : Constant(Ty, ConstantIntVal, 0, 0), Val(Ty == Type::BoolTy ? bool(V) : V) {
+ : Constant(Ty, ConstantIntVal, 0, 0), Val(Ty == Type::Int1Ty ? bool(V) : V) {
}
ConstantFP::ConstantFP(const Type *Ty, double V)
@@ -349,7 +349,7 @@
Use Ops[2];
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
Constant* LHS, Constant* RHS)
- : ConstantExpr(Type::BoolTy, opc, Ops, 2), predicate(pred) {
+ : ConstantExpr(Type::Int1Ty, opc, Ops, 2), predicate(pred) {
OperandList[0].init(LHS, this);
OperandList[1].init(RHS, this);
}
@@ -551,7 +551,7 @@
bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) {
switch (Ty->getTypeID()) {
default: return false; // These can't be represented as integers!
- case Type::BoolTyID: return Val == 0 || Val == 1;
+ case Type::Int1TyID: return Val == 0 || Val == 1;
case Type::Int8TyID: return Val <= UINT8_MAX;
case Type::Int16TyID: return Val <= UINT16_MAX;
case Type::Int32TyID: return Val <= UINT32_MAX;
@@ -562,7 +562,7 @@
bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) {
switch (Ty->getTypeID()) {
default: return false; // These can't be represented as integers!
- case Type::BoolTyID: return (Val == 0 || Val == 1);
+ case Type::Int1TyID: return (Val == 0 || Val == 1);
case Type::Int8TyID: return (Val >= INT8_MIN && Val <= INT8_MAX);
case Type::Int16TyID: return (Val >= INT16_MIN && Val <= UINT16_MAX);
case Type::Int32TyID: return (Val >= INT32_MIN && Val <= UINT32_MAX);
@@ -838,7 +838,7 @@
// just return the stored value while getSExtValue has to convert back to sign
// extended. getZExtValue is more common in LLVM than getSExtValue().
ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) {
- if (Ty == Type::BoolTy) return ConstantInt::get(V&1);
+ if (Ty == Type::Int1Ty) return ConstantInt::get(V&1);
return IntConstants->getOrCreate(Ty, V & Ty->getIntegralTypeMask());
}
@@ -1589,7 +1589,7 @@
assert(C1->getType() == C2->getType() &&
"Operand types in binary constant expression should match");
- if (ReqTy == C1->getType() || ReqTy == Type::BoolTy)
+ if (ReqTy == C1->getType() || ReqTy == Type::Int1Ty)
if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))
return FC; // Fold a few common cases...
@@ -1684,7 +1684,7 @@
Constant *ConstantExpr::getSelectTy(const Type *ReqTy, Constant *C,
Constant *V1, Constant *V2) {
- assert(C->getType() == Type::BoolTy && "Select condition must be bool!");
+ assert(C->getType() == Type::Int1Ty && "Select condition must be bool!");
assert(V1->getType() == V2->getType() && "Select value types must match!");
assert(V1->getType()->isFirstClassType() && "Cannot select aggregate type!");
@@ -1774,7 +1774,7 @@
ArgVec.push_back(RHS);
// Get the key type with both the opcode and predicate
const ExprMapKeyType Key(Instruction::ICmp, ArgVec, pred);
- return ExprConstants->getOrCreate(Type::BoolTy, Key);
+ return ExprConstants->getOrCreate(Type::Int1Ty, Key);
}
Constant *
@@ -1791,7 +1791,7 @@
ArgVec.push_back(RHS);
// Get the key type with both the opcode and predicate
const ExprMapKeyType Key(Instruction::FCmp, ArgVec, pred);
- return ExprConstants->getOrCreate(Type::BoolTy, Key);
+ return ExprConstants->getOrCreate(Type::Int1Ty, Key);
}
Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.59 llvm/lib/VMCore/Instructions.cpp:1.60
--- llvm/lib/VMCore/Instructions.cpp:1.59 Thu Jan 11 06:24:14 2007
+++ llvm/lib/VMCore/Instructions.cpp Thu Jan 11 12:21:29 2007
@@ -482,7 +482,7 @@
void BranchInst::AssertOK() {
if (isConditional())
- assert(getCondition()->getType() == Type::BoolTy &&
+ assert(getCondition()->getType() == Type::Int1Ty &&
"May only branch on boolean predicates!");
}
@@ -1900,7 +1900,7 @@
CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
const std::string &Name, Instruction *InsertBefore)
- : Instruction(Type::BoolTy, op, Ops, 2, Name, InsertBefore) {
+ : Instruction(Type::Int1Ty, op, Ops, 2, Name, InsertBefore) {
Ops[0].init(LHS, this);
Ops[1].init(RHS, this);
SubclassData = predicate;
@@ -1934,7 +1934,7 @@
CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
const std::string &Name, BasicBlock *InsertAtEnd)
- : Instruction(Type::BoolTy, op, Ops, 2, Name, InsertAtEnd) {
+ : Instruction(Type::Int1Ty, op, Ops, 2, Name, InsertAtEnd) {
Ops[0].init(LHS, this);
Ops[1].init(RHS, this);
SubclassData = predicate;
Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.156 llvm/lib/VMCore/Type.cpp:1.157
--- llvm/lib/VMCore/Type.cpp:1.156 Mon Jan 8 13:41:01 2007
+++ llvm/lib/VMCore/Type.cpp Thu Jan 11 12:21:29 2007
@@ -73,7 +73,7 @@
const Type *Type::getPrimitiveType(TypeID IDNumber) {
switch (IDNumber) {
case VoidTyID : return VoidTy;
- case BoolTyID : return BoolTy;
+ case Int1TyID : return Int1Ty;
case Int8TyID : return Int8Ty;
case Int16TyID : return Int16Ty;
case Int32TyID : return Int32Ty;
@@ -127,7 +127,7 @@
//
unsigned Type::getPrimitiveSize() const {
switch (getTypeID()) {
- case Type::BoolTyID:
+ case Type::Int1TyID:
case Type::Int8TyID: return 1;
case Type::Int16TyID: return 2;
case Type::FloatTyID:
@@ -140,7 +140,7 @@
unsigned Type::getPrimitiveSizeInBits() const {
switch (getTypeID()) {
- case Type::BoolTyID: return 1;
+ case Type::Int1TyID: return 1;
case Type::Int8TyID: return 8;
case Type::Int16TyID: return 16;
case Type::FloatTyID:
@@ -368,7 +368,7 @@
Type *Type::TY##Ty = &*The##TY##Ty
DeclarePrimType(Void, "void");
-DeclarePrimType(Bool, "bool");
+DeclarePrimType(Int1, "bool");
DeclarePrimType(Int8, "i8");
DeclarePrimType(Int16, "i16");
DeclarePrimType(Int32, "i32");
Index: llvm/lib/VMCore/ValueTypes.cpp
diff -u llvm/lib/VMCore/ValueTypes.cpp:1.9 llvm/lib/VMCore/ValueTypes.cpp:1.10
--- llvm/lib/VMCore/ValueTypes.cpp:1.9 Sat Dec 30 23:26:44 2006
+++ llvm/lib/VMCore/ValueTypes.cpp Thu Jan 11 12:21:29 2007
@@ -87,7 +87,7 @@
switch (VT) {
default: assert(0 && "ValueType does not correspond to LLVM type!");
case MVT::isVoid:return Type::VoidTy;
- case MVT::i1: return Type::BoolTy;
+ case MVT::i1: return Type::Int1Ty;
case MVT::i8: return Type::Int8Ty;
case MVT::i16: return Type::Int16Ty;
case MVT::i32: return Type::Int32Ty;
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.182 llvm/lib/VMCore/Verifier.cpp:1.183
--- llvm/lib/VMCore/Verifier.cpp:1.182 Sat Jan 6 01:24:44 2007
+++ llvm/lib/VMCore/Verifier.cpp Thu Jan 11 12:21:29 2007
@@ -474,7 +474,7 @@
}
void Verifier::visitSelectInst(SelectInst &SI) {
- Assert1(SI.getCondition()->getType() == Type::BoolTy,
+ Assert1(SI.getCondition()->getType() == Type::Int1Ty,
"Select condition type must be bool!", &SI);
Assert1(SI.getTrueValue()->getType() == SI.getFalseValue()->getType(),
"Select values must have identical types!", &SI);
More information about the llvm-commits
mailing list