[llvm-commits] [llvm-gcc] Changes In Boolean (please commit)
Jeff Cohen
jeffc at jolt-lang.org
Thu Jan 11 12:38:16 PST 2007
OK, so I figured I need to update LLVM. Now that doesn't build:
llvm[2]: Compiling Lexer.cpp for Debug build
Lexer.cpp: In function 'int llvmAsmlex()':
Lexer.cpp:1244: error: label 'find_rule' used but not defined
gmake[2]: *** [/usr/home/jeffc/llvm/obj/lib/AsmParser/Debug/Lexer.o] Error 1
I think I'll just go away for a few weeks and wait for the dust to
settle....
Jeff Cohen wrote:
> The patch doesn't work:
>
> g++40 -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -pedantic
> -Wno-long-long -Wno-variadic-macros -fno-common -DHAVE_CONFIG_H
> -Wno-unused -DTARGET_NAME=\"amd64-unknown-freebsd6.1\" -DENABLE_LLVM
> -D__STDC_LIMIT_MACROS -I. -I. -I../../gcc -I../../gcc/.
> -I../../gcc/../include -I../../gcc/../libcpp/include
> -I/usr/home/jeffc/llvm/include -I/home/jeffc/llvm/obj/include
> ../../gcc/llvm-debug.cpp -o llvm-debug.o
> ../../gcc/llvm-types.cpp: In member function 'const llvm::Type*
> TypeConverter::ConvertType(tree_node*)':
> ../../gcc/llvm-types.cpp:291: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> ../../gcc/llvm-types.cpp: In member function
> 'void<unnamed>::FunctionTypeConversion::HandleScalarArgument(const
> llvm::Type*, tree_node*)':
> ../../gcc/llvm-types.cpp:520: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> gmake[1]: *** [llvm-types.o] Error 1
> gmake[1]: *** Waiting for unfinished jobs....
> ../../gcc/llvm-convert.cpp: In member function 'llvm::Value*
> TreeToLLVM::CastToType(unsigned int, llvm::Value*, const llvm::Type*)':
> ../../gcc/llvm-convert.cpp:716: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> ../../gcc/llvm-convert.cpp:716: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> ../../gcc/llvm-convert.cpp: In member function 'llvm::Value*
> TreeToLLVM::EmitCOND_EXPR(tree_node*)':
> ../../gcc/llvm-convert.cpp:1390: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> ../../gcc/llvm-convert.cpp: In member function 'llvm::Value*
> TreeToLLVM::EmitTRUTH_NOT_EXPR(tree_node*)':
> ../../gcc/llvm-convert.cpp:2379: error: 'Int1Ty' is not a member of
> 'llvm::Type'
> ../../gcc/llvm-convert.cpp: In member function 'LValue
> TreeToLLVM::EmitLV_COMPONENT_REF(tree_node*)':
> ../../gcc/llvm-convert.cpp:4041: error: 'Int1Ty' is not a member of
> 'llvm::Type'
>
>
> Reid Spencer wrote:
>> 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 at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
> ------------------------------------------------------------------------
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list