TypeInfos are passed around as pointers (i8*), yet when a null value is needed it is passed as an i32 value of 0, rather than an i8* null. The attached patches change to using an i8* null in LLVM and llvm-gcc. At the same time I eliminated some uses of std::vector<Value*> as a way of holding a single Value* in the llvm-gcc EH stuff.
Ciao, Duncan.
Index: llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== --- llvm.master.orig/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2007-05-30 19:03:53.000000000 +0200 +++ llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2007-05-30 19:09:38.000000000 +0200 @@ -2620,8 +2620,7 @@ for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) { Constant *C = cast<Constant>(I.getOperand(i)); GlobalVariable *GV = ExtractGlobalVariable(C); - assert (GV || (isa<ConstantInt>(C) && - cast<ConstantInt>(C)->isNullValue()) && + assert (GV || isa<ConstantPointerNull>(C) && "TypeInfo must be a global variable or NULL"); TyInfo.push_back(GV); } @@ -2653,8 +2652,7 @@ // Find the type id for the given typeinfo. Constant *C = cast<Constant>(I.getOperand(1)); GlobalVariable *GV = ExtractGlobalVariable(C); - assert (GV || (isa<ConstantInt>(C) && - cast<ConstantInt>(C)->isNullValue()) && + assert (GV || isa<ConstantPointerNull>(C) && "TypeInfo must be a global variable or NULL"); unsigned TypeID = MMI->getTypeIDFor(GV);
Index: gcc.llvm/gcc/llvm-convert.cpp =================================================================== --- gcc.llvm.orig/gcc/llvm-convert.cpp 2007-05-30 22:54:23.000000000 +0200 +++ gcc.llvm/gcc/llvm-convert.cpp 2007-05-30 22:55:37.000000000 +0200 @@ -703,9 +703,8 @@ #ifdef ITANIUM_STYLE_EXCEPTIONS if (ExceptionValue) { // Fetch and store exception handler. - std::vector<Value*> Args; - Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); - Builder.CreateCall(FuncUnwindResume, &Args[0], Args.size()); + Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr"); + Builder.CreateCall(FuncUnwindResume, &Arg, 1); Builder.CreateUnreachable(); } else { new UnwindInst(UnwindBB); @@ -1899,7 +1898,9 @@ if (!Types) { // Catch all. - TypeInfos.push_back(Constant::getNullValue(Type::Int32Ty)); + TypeInfos.push_back( + Constant::getNullValue(PointerType::get(Type::Int8Ty)) + ); } else if (TREE_CODE(Types) != TREE_LIST) { // Construct typeinfo object. Each call will produce a new expression // even if duplicate. @@ -2206,9 +2207,7 @@ Value *TypeInfo = Emit(TypeInfoNopExpr, 0); // Call get eh type id. - std::vector<Value*> Args; - Args.push_back(TypeInfo); - Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &Args[0], Args.size(), + Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1, "eh_typeid"); Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp"); @@ -2233,9 +2232,7 @@ TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty)); // Call get eh type id. - std::vector<Value*> Args; - Args.push_back(TypeInfo); - Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &Args[0], Args.size(), + Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1, "eh_typeid"); Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp");
_______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits