[llvm-commits] [llvm-gcc] Changes In Boolean (please commit)

Reid Spencer rspencer at reidspencer.com
Thu Jan 11 13:13:17 PST 2007


Jeff,

That just can't be .. see below

On Thu, 2007-01-11 at 12:57 -0800, Jeff Cohen wrote:
> See my previous message.  I updated, and LLVM no longer builds.
> 
> Reid Spencer wrote:
> > You need to update your LLVM tree. I just committed the BoolTy->Int1Ty
> > change and the patch handles that change as well.
> >
> > Reid.
> >
> > On Thu, 2007-01-11 at 12:24 -0800, 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'

Int1Ty is now a member of the Type class. I double checked to make sure
I committed everything. If you're getting this error then you've still
got a Type.h file that is defining BoolTy instead of Int1Ty. For
whatever reason, you're not at TOT for LLVM!

> >> ../../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'

Same.

> >> 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'

Same.

> >> ../../gcc/llvm-convert.cpp:716: error: 'Int1Ty' is not a member of
> >> 'llvm::Type'

Same.

> >> ../../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'

Same.

> >> ../../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'

Same.

> >> ../../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'

Same.

If these are all the errors you're getting, then its very clear you are
not at HEAD revision for LLVM.  Check your revision number for
include/llvm/Type.h.  It should be revision 1.98:

cvs status include/llvm/Type.h
===================================================================
File: Type.h            Status: Up-to-date

   Working revision:    1.98
   Repository revision: 1.98    /var/cvs/llvm/llvm/include/llvm/Type.h,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)


I know you can retrieve this from CVS because I just did it 2 hours ago
to merge the BoolTy->Int1Ty changes into another working tree.

Reid.

> >>
> >>
> >> 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
> >>>   
> >>>       
> >
> >
> >
> >
> >   
> 




More information about the llvm-commits mailing list