All,
Please apply this patch to llvm-gcc r247. It adjusts llvm-gcc for recent
changes in LLVM related to the BoolTy.
BoolTy->Int1Ty
ConstantBool->ConstantInt
ConstantIntegral->ConstantInt
Reid
------------------------------------------------------------------------
Index: gcc/llvm-backend.cpp
===================================================================
--- gcc/llvm-backend.cpp (revision 247)
+++ gcc/llvm-backend.cpp (working copy)
@@ -569,7 +569,7 @@
// If this has already been processed, don't emit duplicate error messages.
if (DECL_LLVM_SET_P(decl)) {
// Error state encoded into DECL_LLVM.
- return cast<ConstantBool>(DECL_LLVM(decl))->getValue();
+ return cast<ConstantInt>(DECL_LLVM(decl))->getBoolValue();
}
/* Detect errors in declaring global registers. */
@@ -593,10 +593,10 @@
if (TREE_THIS_VOLATILE(decl))
warning("volatile register variables don%'t work as you might wish");
- SET_DECL_LLVM(decl, ConstantBool::getFalse());
+ SET_DECL_LLVM(decl, ConstantInt::getFalse());
return false; // Everything ok.
}
- SET_DECL_LLVM(decl, ConstantBool::getTrue());
+ SET_DECL_LLVM(decl, ConstantInt::getTrue());
return true;
}
Index: gcc/llvm-convert.cpp
===================================================================
--- gcc/llvm-convert.cpp (revision 247)
+++ gcc/llvm-convert.cpp (working copy)
@@ -713,7 +713,7 @@
// Handle cast (cast bool X to T2) to bool as X, because this occurs all over
// the place.
if (CastInst *CI = dyn_cast<CastInst>(V))
- if (Ty == Type::BoolTy && CI->getOperand(0)->getType() == Type::BoolTy)
+ if (Ty == Type::Int1Ty && CI->getOperand(0)->getType() == Type::Int1Ty)
return CI->getOperand(0);
return CastInst::create(Instruction::CastOps(opcode), V, Ty, V->getName(),
CurBB);
@@ -1384,10 +1384,10 @@
}
Value *TreeToLLVM::EmitCOND_EXPR(tree exp) {
- // Emit the conditional expression and trunc/bitcast to BoolTy
+ // Emit the conditional expression and trunc/bitcast to Int1Ty
Value *Cond = Emit(COND_EXPR_COND(exp), 0);
// If its not already a bool, insert a comparison against zero to make it so.
- if (Cond->getType() != Type::BoolTy)
+ if (Cond->getType() != Type::Int1Ty)
Cond = new ICmpInst(ICmpInst::ICMP_NE, Cond,
Constant::getNullValue(Cond->getType()), "toBool",
CurBB);
@@ -2376,7 +2376,7 @@
Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree exp) {
Value *V = Emit(TREE_OPERAND(exp, 0), 0);
- if (V->getType() != Type::BoolTy)
+ if (V->getType() != Type::Int1Ty)
V = new ICmpInst(ICmpInst::ICMP_NE, V,
Constant::getNullValue(V->getType()), "toBool", CurBB);
V = BinaryOperator::createNot(V, V->getName()+"not", CurBB);
@@ -4038,7 +4038,7 @@
// If the field result is a bool, cast to a ubyte instead. It is not
// possible to access all bits of a memory object with a bool (only the low
// bit) but it is possible to access them with a byte.
- if (FieldTy == Type::BoolTy)
+ if (FieldTy == Type::Int1Ty)
FieldTy = Type::Int8Ty;
assert(FieldTy->isInteger() && "Invalid bitfield");
Index: gcc/llvm-types.cpp
===================================================================
--- gcc/llvm-types.cpp (revision 247)
+++ gcc/llvm-types.cpp (working copy)
@@ -288,7 +288,7 @@
case UNION_TYPE: return ConvertUNION(type, orig_type);
case BOOLEAN_TYPE:
if (TREE_INT_CST_LOW(TYPE_SIZE(type)) <= 8)
- return SET_TYPE_LLVM(type, Type::BoolTy);
+ return SET_TYPE_LLVM(type, Type::Int1Ty);
else { // Bools on some platforms take more space than LLVM bool (e.g.
PPC).
if (const Type *Ty = GET_TYPE_LLVM(type))
return Ty;
@@ -517,7 +517,7 @@
if (LLVMTy == Type::FloatTy)
LLVMTy = Type::DoubleTy;
else if (LLVMTy == Type::Int16Ty || LLVMTy == Type::Int8Ty ||
- LLVMTy == Type::BoolTy)
+ LLVMTy == Type::Int1Ty)
LLVMTy = Type::Int32Ty;
}
ArgTypes.push_back(LLVMTy);
------------------------------------------------------------------------
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits