[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.305 -> 1.306 --- Log message: For PR1090: http://llvm.org/PR1090 : Clean up the definitions of the helper functions per Chris' review suggestions so they are easier to read. For PR1091: http://llvm.org/PR1091 : Print minimum signed integer values as unsigned so that we get no warnings from the C compiler about constant ranges and value comparisons. --- Diffs of the changes: (+31 -28) Writer.cpp | 59 +++ 1 files changed, 31 insertions(+), 28 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.305 llvm/lib/Target/CBackend/Writer.cpp:1.306 --- llvm/lib/Target/CBackend/Writer.cpp:1.305 Mon Jan 8 00:58:32 2007 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Jan 8 02:00:00 2007 @@ -826,23 +826,26 @@ return; } - switch (CPV->getType()->getTypeID()) { - case Type::BoolTyID: -Out << (cast(CPV)->getValue() ? '1' : '0'); -break; - case Type::Int8TyID: -Out << "((char)" << cast(CPV)->getSExtValue() << ")"; -break; - case Type::Int16TyID: -Out << "((short)" << cast(CPV)->getSExtValue() << ")"; -break; - case Type::Int32TyID: -Out << "((int)" << cast(CPV)->getSExtValue() << ")"; -break; - case Type::Int64TyID: -Out << "((long long)" << cast(CPV)->getSExtValue() << "ll)"; -break; + if (ConstantBool *CB = dyn_cast(CPV)) { +Out << (CB->getValue() ? '1' : '0') ; +return; + } + if (ConstantInt *CI = dyn_cast(CPV)) { +const Type* Ty = CI->getType(); +Out << "(("; +printPrimitiveType(Out, Ty, true) << ')'; +if (CI->isMinValue(true)) + Out << CI->getZExtValue() << 'u'; +else + Out << CI->getSExtValue(); +if (Ty->getPrimitiveSizeInBits() > 32) + Out << "ll"; +Out << ')'; +return; + } + + switch (CPV->getType()->getTypeID()) { case Type::FloatTyID: case Type::DoubleTyID: { ConstantFP *FPC = cast(CPV); @@ -1586,29 +1589,29 @@ Out << "static inline int llvm_fcmp_uno(double X, double Y) { "; Out << "return X != X || Y != Y; }\n"; Out << "static inline int llvm_fcmp_ueq(double X, double Y) { "; - Out << "return X == Y || X != X || Y != Y; }\n"; + Out << "return X == Y || llvm_fcmp_uno(X, Y); }\n"; Out << "static inline int llvm_fcmp_une(double X, double Y) { "; - Out << "return X != Y || X != X || Y != Y; }\n"; + Out << "return X != Y; }\n"; Out << "static inline int llvm_fcmp_ult(double X, double Y) { "; - Out << "return X < Y || X != X || Y != Y; }\n"; + Out << "return X < Y || llvm_fcmp_uno(X, Y); }\n"; Out << "static inline int llvm_fcmp_ugt(double X, double Y) { "; - Out << "return X > Y || X != X || Y != Y; }\n"; + Out << "return X > Y || llvm_fcmp_uno(X, Y); }\n"; Out << "static inline int llvm_fcmp_ule(double X, double Y) { "; - Out << "return X <= Y || X != X || Y != Y; }\n"; + Out << "return X <= Y || llvm_fcmp_uno(X, Y); }\n"; Out << "static inline int llvm_fcmp_uge(double X, double Y) { "; - Out << "return X >= Y || X != X || Y != Y; }\n"; + Out << "return X >= Y || llvm_fcmp_uno(X, Y); }\n"; Out << "static inline int llvm_fcmp_oeq(double X, double Y) { "; - Out << "return X == Y && X == X && Y == Y; }\n"; + Out << "return X == Y ; }\n"; Out << "static inline int llvm_fcmp_one(double X, double Y) { "; - Out << "return X != Y && X == X && Y == Y; }\n"; + Out << "return X != Y && llvm_fcmp_ord(X, Y); }\n"; Out << "static inline int llvm_fcmp_olt(double X, double Y) { "; - Out << "return X < Y && X == X && Y == Y; }\n"; + Out << "return X < Y ; }\n"; Out << "static inline int llvm_fcmp_ogt(double X, double Y) { "; - Out << "return X > Y && X == X && Y == Y; }\n"; + Out << "return X > Y ; }\n"; Out << "static inline int llvm_fcmp_ole(double X, double Y) { "; - Out << "return X <= Y && X == X && Y == Y; }\n"; + Out << "return X <= Y ; }\n"; Out << "static inline int llvm_fcmp_oge(double X, double Y) { "; - Out << "return X >= Y && X == X && Y == Y; }\n"; + Out << "return X >= Y ; }\n"; return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.104 -> 1.105 --- Log message: For PR1097: http://llvm.org/PR1097 : Enable complex addressing modes on 64-bit platforms involving two induction variables by keeping a size and scale in 64-bits not 32. Patch by Dan Gohman. --- Diffs of the changes: (+1 -1) LoopStrengthReduce.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.104 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.105 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.104 Fri Jan 5 19:37:35 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jan 8 10:17:51 2007 @@ -893,7 +893,7 @@ if (unsigned(abs(SInt)) < Scale || (SInt % Scale) != 0) continue; std::map::iterator SI = -IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt/Scale, Type::Int32Ty)); +IVsByStride.find(SCEVUnknown::getIntegerSCEV(SInt/Scale, UIntPtrTy)); if (SI == IVsByStride.end()) continue; for (std::vector::iterator II = SI->second.IVs.begin(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp InstructionCombining.cpp ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: IndVarSimplify.cpp updated: 1.101 -> 1.102 InstructionCombining.cpp updated: 1.586 -> 1.587 ScalarReplAggregates.cpp updated: 1.62 -> 1.63 --- Log message: Comparison of primitive type sizes should now be done in bits, not bytes. This patch converts getPrimitiveSize to getPrimitiveSizeInBits where it is appropriate to do so (comparison of integer primitive types). --- Diffs of the changes: (+14 -12) IndVarSimplify.cpp |5 +++-- InstructionCombining.cpp | 17 + ScalarReplAggregates.cpp |4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.101 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.102 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.101 Sat Jan 6 19:14:12 2007 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Jan 8 10:32:00 2007 @@ -498,8 +498,9 @@ bool DifferingSizes = false; for (unsigned i = 1, e = IndVars.size(); i != e; ++i) { const Type *Ty = IndVars[i].first->getType(); -DifferingSizes |= Ty->getPrimitiveSize() != LargestType->getPrimitiveSize(); -if (Ty->getPrimitiveSize() > LargestType->getPrimitiveSize()) +DifferingSizes |= + Ty->getPrimitiveSizeInBits() != LargestType->getPrimitiveSizeInBits(); +if (Ty->getPrimitiveSizeInBits() > LargestType->getPrimitiveSizeInBits()) LargestType = Ty; } Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.586 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.587 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.586 Sun Jan 7 00:58:05 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 8 10:32:00 2007 @@ -1926,8 +1926,8 @@ Other = LHS; } if (CI && CI->getType()->isSized() && -(CI->getType()->getPrimitiveSize() == - TD->getIntPtrType()->getPrimitiveSize()) +(CI->getType()->getPrimitiveSizeInBits() == + TD->getIntPtrType()->getPrimitiveSizeInBits()) && isa(CI->getOperand(0)->getType())) { Value *I2 = InsertCastBefore(Instruction::BitCast, CI->getOperand(0), PointerType::get(Type::Int8Ty), I); @@ -7239,9 +7239,9 @@ bool isConvertible = ActTy == ParamTy || (isa(ParamTy) && isa(ActTy)) || (ParamTy->isIntegral() && ActTy->isIntegral() && - ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) || - (c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() && - c->getSExtValue() > 0); + ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()) || + (c && ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits() + && c->getSExtValue() > 0); if (Callee->isExternal() && !isConvertible) return false; } @@ -7594,8 +7594,8 @@ static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, Instruction *InsertPoint, InstCombiner *IC) { - unsigned PtrSize = DTy->getPrimitiveSize(); - unsigned VTySize = V->getType()->getPrimitiveSize(); + unsigned PtrSize = DTy->getPrimitiveSizeInBits(); + unsigned VTySize = V->getType()->getPrimitiveSizeInBits(); // We must cast correctly to the pointer type. Ensure that we // sign extend the integer value if it is smaller as this is // used for address computation. @@ -7642,7 +7642,8 @@ MadeChange = true; GEP.setOperand(i, Src); } - } else if (SrcTy->getPrimitiveSize() < DestTy->getPrimitiveSize() && + } else if (SrcTy->getPrimitiveSizeInBits() < + DestTy->getPrimitiveSizeInBits() && SrcTy->getPrimitiveSize() == 4) { // We can eliminate a cast from [u]int to [u]long iff the target // is a 32-bit pointer target. Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.62 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.63 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.62Sat Dec 30 23:48:39 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Jan 8 10:32:00 2007 @@ -665,8 +665,8 @@ LI->getName(), LI); } else if (LI->getType()->isFloatingPoint()) { // If needed, truncate the integer to the appropriate size. -if (NV->getType()->getPrimitiveSize() > -LI->getType()->getPrimitiveSize()) { +if (NV->getType()->getPrimitiveSizeInBits() > +LI->getType()->getPrimitiveSizeInBits()) { switch (LI->getType()->getTypeID()) { default: assert(0 && "Unknown FP type!"); case Type::FloatTyID: ___
[llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/2007-01-08-X86-64-Pointer.ll
Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: 2007-01-08-X86-64-Pointer.ll added (r1.1) --- Log message: testcase for PR1097: http://llvm.org/PR1097 --- Diffs of the changes: (+19 -0) 2007-01-08-X86-64-Pointer.ll | 19 +++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/Transforms/IndVarsSimplify/2007-01-08-X86-64-Pointer.ll diff -c /dev/null llvm/test/Regression/Transforms/IndVarsSimplify/2007-01-08-X86-64-Pointer.ll:1.1 *** /dev/null Mon Jan 8 11:52:39 2007 --- llvm/test/Regression/Transforms/IndVarsSimplify/2007-01-08-X86-64-Pointer.ll Mon Jan 8 11:52:29 2007 *** *** 0 --- 1,19 + ; RUN: llvm-as < %s | llc -march=x86-64 | grep '(%rdi,%rax,8)' && + ; RUN: llvm-as < %s | llc -march=x86-64 | not grep 'addq.*8' + + define void %foo(double* %y) { + entry: + br label %bb + + bb: + %i = phi i64 [ 0, %entry ], [ %k, %bb ] + %j = getelementptr double* %y, i64 %i + store double 0.00e+00, double* %j + %k = add i64 %i, 1 + %n = icmp eq i64 %k, 0 + br bool %n, label %return, label %bb + + return: + ret void + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Feature/packed_struct.ll
Changes in directory llvm/test/Feature: packed_struct.ll updated: 1.3 -> 1.4 --- Log message: Packed structs use packed struct initializers --- Diffs of the changes: (+17 -17) packed_struct.ll | 34 +- 1 files changed, 17 insertions(+), 17 deletions(-) Index: llvm/test/Feature/packed_struct.ll diff -u llvm/test/Feature/packed_struct.ll:1.3 llvm/test/Feature/packed_struct.ll:1.4 --- llvm/test/Feature/packed_struct.ll:1.3 Fri Dec 29 14:21:51 2006 +++ llvm/test/Feature/packed_struct.ll Mon Jan 8 12:15:35 2007 @@ -1,33 +1,33 @@ -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll +; RUN: llvm-as < %s | llvm-dis > %t1.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: diff %t1.ll %t2.ll && ; RUN: not grep cast %t2.ll && ; RUN: grep "<{" %t2.ll -%struct.anon = type <{ sbyte, int, int, int }> +%struct.anon = type <{ i8, i32, i32, i32 }> %foos = external global %struct.anon -%bara = external global [2 x <{ int, sbyte }>] +%bara = external global [2 x <{ i32, i8 }>] ;initializers should work for packed and non-packed the same way -%E1 = global <{sbyte, int, int}> {sbyte 1, int 2, int 3} -%E2 = global {sbyte, int, int} {sbyte 4, int 5, int 6} +%E1 = global <{i8, i32, i32}> <{i8 1, i32 2, i32 3}> +%E2 = global {i8, i32, i32} {i8 4, i32 5, i32 6} implementation ; Functions: -int %main() +define i32 %main() { -%tmp = load int* getelementptr (%struct.anon* %foos, int 0, uint 1) ; [#uses=1] -%tmp3 = load int* getelementptr (%struct.anon* %foos, int 0, uint 2) ; [#uses=1] -%tmp6 = load int* getelementptr (%struct.anon* %foos, int 0, uint 3) ; [#uses=1] -%tmp4 = add int %tmp3, %tmp ; [#uses=1] -%tmp7 = add int %tmp4, %tmp6; [#uses=1] -ret int %tmp7 +%tmp = load i32* getelementptr (%struct.anon* %foos, i32 0, i32 1) ; [#uses=1] +%tmp3 = load i32* getelementptr (%struct.anon* %foos, i32 0, i32 2) ; [#uses=1] +%tmp6 = load i32* getelementptr (%struct.anon* %foos, i32 0, i32 3) ; [#uses=1] +%tmp4 = add i32 %tmp3, %tmp ; [#uses=1] +%tmp7 = add i32 %tmp4, %tmp6; [#uses=1] +ret i32 %tmp7 } -int %bar() { +define i32 %bar() { entry: -%tmp = load int* getelementptr([2 x <{ int, sbyte }>]* %bara, int 0, int 0, uint 0 ); [#uses=1] -%tmp4 = load int* getelementptr ([2 x <{ int, sbyte }>]* %bara, int 0, int 1, uint 0) ; [#uses=1] -%tmp5 = add int %tmp4, %tmp ; [#uses=1] -ret int %tmp5 +%tmp = load i32* getelementptr([2 x <{ i32, i8 }>]* %bara, i32 0, i32 0, i32 0 ); [#uses=1] +%tmp4 = load i32* getelementptr ([2 x <{ i32, i8 }>]* %bara, i32 0, i32 1, i32 0) ; [#uses=1] +%tmp5 = add i32 %tmp4, %tmp ; [#uses=1] +ret i32 %tmp5 } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.301 -> 1.302 --- Log message: Make packed structs use packed initialiers for consistency --- Diffs of the changes: (+52 -0) llvmAsmParser.y | 52 1 files changed, 52 insertions(+) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.301 llvm/lib/AsmParser/llvmAsmParser.y:1.302 --- llvm/lib/AsmParser/llvmAsmParser.y:1.301Sat Jan 6 01:24:43 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Jan 8 12:16:47 2007 @@ -1484,6 +1484,10 @@ "' for element #" + utostr(i) + " of structure initializer!"); +// Check to ensure that Type is not packed +if (STy->isPacked()) + GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); + $$ = ConstantStruct::get(STy, *$3); delete $1; delete $3; CHECK_FOR_ERROR @@ -1499,6 +1503,54 @@ if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); +// Check to ensure that Type is not packed +if (STy->isPacked()) + GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); + +$$ = ConstantStruct::get(STy, std::vector()); +delete $1; +CHECK_FOR_ERROR + } + | Types '<' '{' ConstVector '}' '>' { +const StructType *STy = dyn_cast($1->get()); +if (STy == 0) + GEN_ERROR("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + +if ($4->size() != STy->getNumContainedTypes()) + GEN_ERROR("Illegal number of initializers for structure type!"); + +// Check to ensure that constants are compatible with the type initializer! +for (unsigned i = 0, e = $4->size(); i != e; ++i) + if ((*$4)[i]->getType() != STy->getElementType(i)) +GEN_ERROR("Expected type '" + + STy->getElementType(i)->getDescription() + + "' for element #" + utostr(i) + + " of structure initializer!"); + +// Check to ensure that Type is packed +if (!STy->isPacked()) + GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); + +$$ = ConstantStruct::get(STy, *$4); +delete $1; delete $4; +CHECK_FOR_ERROR + } + | Types '<' '{' '}' '>' { +if (!UpRefs.empty()) + GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); +const StructType *STy = dyn_cast($1->get()); +if (STy == 0) + GEN_ERROR("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + +if (STy->getNumContainedTypes() != 0) + GEN_ERROR("Illegal number of initializers for structure type!"); + +// Check to ensure that Type is packed +if (!STy->isPacked()) + GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); + $$ = ConstantStruct::get(STy, std::vector()); delete $1; CHECK_FOR_ERROR ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.235 -> 1.236 --- Log message: And asm writing for packed struct initializers --- Diffs of the changes: (+4 -0) AsmWriter.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.235 llvm/lib/VMCore/AsmWriter.cpp:1.236 --- llvm/lib/VMCore/AsmWriter.cpp:1.235 Sat Jan 6 01:24:44 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Jan 8 12:21:30 2007 @@ -501,6 +501,8 @@ Out << " ]"; } } else if (const ConstantStruct *CS = dyn_cast(CV)) { +if (CS->getType()->isPacked()) + Out << '<'; Out << '{'; unsigned N = CS->getNumOperands(); if (N) { @@ -525,6 +527,8 @@ } Out << " }"; +if (CS->getType()->isPacked()) + Out << '>'; } else if (const ConstantPacked *CP = dyn_cast(CV)) { const Type *ETy = CP->getType()->getElementType(); assert(CP->getNumOperands() > 0 && ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
On Jan 7, 2007, at 6:24 PM, Reid Spencer wrote: > I wish I could retract email. > > The patch I just sent didn't have differences for sub-directories in > it. > Please don't apply it. Instead use this one which should bring you > up to > date with Apple's changes. Again, this applies to r240 of the llvm-gcc > SVN mirror. > > Some things to note. If your target is not x86, x86-64, or ppc and > your > operating system is not darwin or linux, this probably won't work. > You'll get a link error like this: > > ../../src-1/gcc/llvm-convert.cpp:3118: undefined reference to > `TreeToLLVM::TargetIntrinsicLower(unsigned int, llvm::Value*, > llvm::Value*&, llvm::Type const*, std::vector std::allocator >&, llvm::SmallVector&, > llvm::BasicBlock*, bool, bool)' > > That's because the makefiles aren't quite ready to compile a target > specific C++ file yet. After quick look, I think makefiles are ready. However, if any target relies on llvm-i386.cpp to provide these undefined symbols then config.gcc needs to be updated to inform this to makefiles for such targets. Each target can use their own target specific C++ source file, no need to put everything in llvm-i386.c pp or llvm-ppc.cpp. > Fortunately there is a work around: So this is not a work around, but right way to fix it. Thanks! - Devang > > 1. Edit gcc/config.gcc > 2. Find the case statement at line 558 > 3. Find the pattern that matches your target in the cases that follow. > 4. Add the following right after the "tmake_file" line for your > target. > # APPLE LOCAL begin LLVM > out_cxx_file=i386/llvm-i386.cpp > # APPLE LOCAL end LLVM > > For example, find the line that matches this pattern: ^i.*linux > around line 964. That has an example of the correct patch. It looks > like > this: > > i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*- > knetbsd*-gnu) > # Intel 80386's running GNU/* > # with ELF format using glibc 2 > tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h > svr4.h linux.h i386/linux.h" > # APPLE LOCAL begin LLVM > out_cxx_file=i386/llvm-i386.cpp > # APPLE LOCAL end LLVM > case ${target} in > > The APPLE section is what you add. > > Reid. > > > > Reid. > > On Sun, 2007-01-07 at 17:14 -0800, Reid Spencer wrote: >> All, >> >> Attached is a cumulative patch with all changes in the Apple >> repository >> since the mirror's r240 revision. If you haven't applied the various >> patches sent in the last few days, this one will be much easier. >> >> The attached patch also contains one thing that the Apple repository >> doesn't have: fixes to i386.h for changes in the result type of >> Module::getOrInsertFunction. >> >> This patch compiles/works fine for me on Linux/x86 >> >> Reid. >> ___ >> llvm-commits mailing list >> llvm-commits@cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits> GCC-2007-01-07.patch> > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/lto/lto.cpp
Changes in directory llvm/tools/lto: lto.cpp updated: 1.29 -> 1.30 --- Log message: Modules are consumed when they are merged together by Linker. Clear modules vector so that destructure does not try to delete these modules again. Patch by Chandler Carruth. --- Diffs of the changes: (+2 -0) lto.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.29 llvm/tools/lto/lto.cpp:1.30 --- llvm/tools/lto/lto.cpp:1.29 Mon Jan 8 00:25:29 2007 +++ llvm/tools/lto/lto.cpp Mon Jan 8 12:42:27 2007 @@ -353,6 +353,8 @@ for (unsigned i = 1, e = modules.size(); i != e; ++i) if (theLinker.LinkModules(bigOne, modules[i], errMsg)) return LTO_MODULE_MERGE_FAILURE; + // all modules have been handed off to the linker. + modules.clear(); sys::Path FinalOutputPath(FinalOutputFilename); FinalOutputPath.eraseSuffix(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
> After quick look, I think makefiles are ready. However, if any target > relies on llvm-i386.cpp to provide these undefined symbols then > config.gcc needs to be updated to inform this to makefiles for such > targets. Each target can use their own target specific C++ source > file, no need to put everything in llvm-i386.c pp or llvm-ppc.cpp. Ok. This will be every target that uses i386.h >> Fortunately there is a work around: > > So this is not a work around, but right way to fix it. Thanks! Devang, can you commit a patch to add llvm-i386.cpp for every target that uses i386.c ? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
On Jan 8, 2007, at 10:45 AM, Chris Lattner wrote: >> After quick look, I think makefiles are ready. However, if any target >> relies on llvm-i386.cpp to provide these undefined symbols then >> config.gcc needs to be updated to inform this to makefiles for such >> targets. Each target can use their own target specific C++ source >> file, no need to put everything in llvm-i386.c pp or llvm-ppc.cpp. > > Ok. This will be every target that uses i386.h > >>> Fortunately there is a work around: >> >> So this is not a work around, but right way to fix it. Thanks! > > Devang, can you commit a patch to add llvm-i386.cpp for every target > that uses i386.c ? OK. I suspect this may not be straight forward. Let's see. - Devang ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
The attached patch worked for me on x86-linux and for Chandler on x86-64-linux. This is a delta from r240 of the mirror .. YMMV. Reid. On Mon, 2007-01-08 at 10:51 -0800, Devang Patel wrote: > On Jan 8, 2007, at 10:45 AM, Chris Lattner wrote: > > >> After quick look, I think makefiles are ready. However, if any target > >> relies on llvm-i386.cpp to provide these undefined symbols then > >> config.gcc needs to be updated to inform this to makefiles for such > >> targets. Each target can use their own target specific C++ source > >> file, no need to put everything in llvm-i386.c pp or llvm-ppc.cpp. > > > > Ok. This will be every target that uses i386.h > > > >>> Fortunately there is a work around: > >> > >> So this is not a work around, but right way to fix it. Thanks! > > > > Devang, can you commit a patch to add llvm-i386.cpp for every target > > that uses i386.c ? > > OK. I suspect this may not be straight forward. Let's see. > > - > Devang > Index: gcc/config.gcc === --- gcc/config.gcc (revision 240) +++ gcc/config.gcc (working copy) @@ -1036,6 +1036,9 @@ # Intel 80386's running GNU/* # with ELF format using glibc 2 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h" +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM case ${target} in i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h i386/knetbsd-gnu.h" ;; i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;; @@ -1045,6 +1048,9 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h \ i386/x86-64.h i386/linux64.h" +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM case ${target} in x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;; x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
On Jan 8, 2007, at 11:05 AM, Reid Spencer wrote: OK. I suspect this may not be straight forward. Let's see. - Devang config.gcc selects target specific C source file name based on cpu_type (by default). So, I thought it may not be super easy to trace all uses of i386.c. Your patch should work. However, I am testing following to cover everything under i386* and x86* umbrella in one shot. - Devang Index: config.gcc === --- config.gcc (revision 122065) +++ config.gcc (working copy) @@ -269,11 +269,17 @@ xscale-*-*) # APPLE LOCAL begin mni 4424835 i[34567]86-*-*) cpu_type=i386 +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h" ;; x86_64-*-*) cpu_type=i386 +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h" need_64bit_hwint=yes @@ -966,9 +972,6 @@ i[34567]86-*-darwin*) # APPLE LOCAL end mainline 2005-10-02 4218570 # APPLE LOCAL 4099000 tmake_file="${tmake_file} i386/t-darwin" -# APPLE LOCAL begin LLVM - out_cxx_file=i386/llvm-i386.cpp -# APPLE LOCAL end LLVM # APPLE LOCAL 4126124 need_64bit_hwint=yes ;; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] Corrected K&R prototype patch
Basically the same as before, but I have this: - FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv); + FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/ *not K&R*/); instead of this: - FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv); + FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, true/ *not K&R*/); Whoops. I've verified that the CFE builds from scratch with this patch and that Shootout-C++ now passes. -Chris Index: llvm-convert.cpp === --- llvm-convert.cpp(revision 122094) +++ llvm-convert.cpp(working copy) @@ -213,15 +213,17 @@ namespace { // If this is GCC being sloppy about pointer types, insert a bitcast. // See PR1083 for an example. ArgVal = new BitCastInst(ArgVal, LLVMTy, "tmp", CurBB); +} else if (ArgVal->getType() == Type::DoubleTy) { + // If this is a K&R float parameter, it got promoted to double. Insert + // the truncation to float now. + ArgVal = new FPTruncInst(ArgVal, LLVMTy, NameStack.back(), CurBB); } else { - // If this is just a mismatch between integer types, this could be due + // If this is just a mismatch between integer types, this is due // to K&R prototypes, where the forward proto defines the arg as int // and the actual impls is a short or char. - assert(ArgVal->getType()->isIntegral() && LLVMTy->isIntegral() && + assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isIntegral() && "Lowerings don't match?"); - bool isSigned = type == 0 ? true : !TYPE_UNSIGNED(type); - ArgVal = CastInst::createIntegerCast(ArgVal, LLVMTy, isSigned, - NameStack.back(), CurBB); + ArgVal = new TruncInst(ArgVal, LLVMTy, NameStack.back(), CurBB); } } assert(!LocStack.empty()); Index: llvm-types.cpp === --- llvm-types.cpp (revision 122094) +++ llvm-types.cpp (working copy) @@ -474,10 +474,11 @@ namespace { const Type *&RetTy; std::vector &ArgTypes; unsigned &CallingConv; +bool KNRPromotion; public: FunctionTypeConversion(const Type *&retty, std::vector &AT, - unsigned &CC) - : RetTy(retty), ArgTypes(AT), CallingConv(CC) { + unsigned &CC, bool KNR) + : RetTy(retty), ArgTypes(AT), CallingConv(CC), KNRPromotion(KNR) { CallingConv = CallingConv::C; } @@ -512,6 +513,13 @@ namespace { } void HandleScalarArgument(const llvm::Type *LLVMTy, tree type) { + if (KNRPromotion) { +if (LLVMTy == Type::FloatTy) + LLVMTy = Type::DoubleTy; +else if (LLVMTy == Type::Int16Ty || LLVMTy == Type::Int8Ty || + LLVMTy == Type::BoolTy) + LLVMTy = Type::Int32Ty; + } ArgTypes.push_back(LLVMTy); } }; @@ -528,7 +536,7 @@ ConvertArgListToFnType(tree ReturnType, std::vector ArgTys; const Type *RetTy; - FunctionTypeConversion Client(RetTy, ArgTys, CallingConv); + FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/); TheLLVMABI ABIConverter(Client); ABIConverter.HandleReturnType(ReturnType); @@ -542,7 +550,7 @@ const FunctionType *TypeConverter::Conve const Type *RetTy = 0; std::vector ArgTypes; bool isVarArg = false; - FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv); + FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/); TheLLVMABI ABIConverter(Client); ABIConverter.HandleReturnType(TREE_TYPE(type)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Pass.h
Changes in directory llvm/include/llvm: Pass.h updated: 1.70 -> 1.71 --- Log message: Add PMStack, a Pass Manager stack. Eventually, Top level pass managers will use this to keep track of active pass managers. Eass pass will also learn how to find appropriate manager from these managers stack. --- Diffs of the changes: (+32 -2) Pass.h | 34 -- 1 files changed, 32 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.70 llvm/include/llvm/Pass.h:1.71 --- llvm/include/llvm/Pass.h:1.70 Fri Jan 5 16:47:07 2007 +++ llvm/include/llvm/Pass.hMon Jan 8 13:29:38 2007 @@ -31,6 +31,7 @@ #include "llvm/Support/Streams.h" #include +#include #include #include #include @@ -49,6 +50,7 @@ class BasicBlockPassManager; class FunctionPassManagerT; class ModulePassManager; +class PMStack; class AnalysisResolver; // AnalysisID - Use the PassInfo to identify a pass... @@ -133,8 +135,6 @@ // dumpPassStructure - Implement the -debug-passes=PassStructure option virtual void dumpPassStructure(unsigned Offset = 0); - - // getPassInfo - Static method to get the pass information from a class name. template static const PassInfo *getClassPassInfo() { return lookupPassInfo(typeid(AnalysisClass)); @@ -198,6 +198,7 @@ virtual bool runPass(Module &M) { return runOnModule(M); } virtual bool runPass(BasicBlock&) { return false; } + virtual void assignPassManager(PMStack &PMS); // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -263,6 +264,7 @@ /// bool run(Function &F); + virtual void assignPassManager(PMStack &PMS); }; @@ -316,8 +318,36 @@ virtual bool runPass(Module &M) { return false; } virtual bool runPass(BasicBlock &BB); + virtual void assignPassManager(PMStack &PMS); +}; + +/// PMStack +/// Top level pass manager (see PasManager.cpp) maintains active Pass Managers +/// using PMStack. Each Pass implements assignPassManager() to connect itself +/// with appropriate manager. assignPassManager() walks PMStack to find +/// suitable manager. +/// +/// PMStack is just a wrapper around standard deque that overrides pop() and +/// push() methods. +class PMDataManager; +class PMStack { +public: + typedef std::deque::reverse_iterator iterator; + iterator begin() { return S.rbegin(); } + iterator end() { return S.rend(); } + + void handleLastUserOverflow(); + + void pop(); + inline PMDataManager *top() { return S.back(); } + void push(PMDataManager *PM); + inline bool empty() { return S.empty(); } + +private: + std::deque S; }; + /// If the user specifies the -time-passes argument on an LLVM tool command line /// then the value of this boolean will be true, otherwise false. /// @brief This is the storage for the -time-passes option. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.112 -> 1.113 --- Log message: Add PMStack, a Pass Manager stack. Eventually, Top level pass managers will use this to keep track of active pass managers. Eass pass will also learn how to find appropriate manager from these managers stack. --- Diffs of the changes: (+138 -0) PassManager.cpp | 138 1 files changed, 138 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.112 llvm/lib/VMCore/PassManager.cpp:1.113 --- llvm/lib/VMCore/PassManager.cpp:1.112 Fri Jan 5 16:47:07 2007 +++ llvm/lib/VMCore/PassManager.cpp Mon Jan 8 13:29:38 2007 @@ -1514,7 +1514,9 @@ bool PassManagerImpl::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { + activeManager = new MPPassManager(getDepth() + 1); + // Inherit top level manager activeManager->setTopLevelManager(this->getTopLevelManager()); @@ -1601,4 +1603,140 @@ TheTimeInfo = &*TTI; } +//===--===// +// PMStack implementation +// +// Pop Pass Manager from the stack and clear its analysis info. +void PMStack::pop() { + + PMDataManager *Top = this->top(); + Top->initializeAnalysisInfo(); + + S.pop_back(); +} + +// Push PM on the stack and set its top level manager. +void PMStack::push(PMDataManager *PM) { + + PMDataManager *Top = this->top(); + + // Inherit top level manager + PMTopLevelManager *TPM = Top->getTopLevelManager(); + PM->setTopLevelManager(TPM); + TPM->addIndirectPassManager(PM); +} + +// Walk Pass Manager stack and set LastUse markers if any +// manager is transfering this priviledge to its parent manager +void PMStack::handleLastUserOverflow() { + + for(PMStack::iterator I = this->begin(), E = this->end(); I != E;) { + +PMDataManager *Child = *I++; +if (I != E) { + PMDataManager *Parent = *I++; + PMTopLevelManager *TPM = Parent->getTopLevelManager(); + std::vector &TLU = Child->getTransferredLastUses(); + if (!TLU.empty()) { +Pass *P = dynamic_cast(Parent); +TPM->setLastUser(TLU, P); + } +} + } +} + +/// Find appropriate Module Pass Manager in the PM Stack and +/// add self into that manager. +void ModulePass::assignPassManager(PMStack &PMS) { + + MPPassManager *MPP = NULL; + + // Find Module Pass Manager + while(!PMS.empty()) { + +MPP = dynamic_cast(PMS.top()); +if (MPP) + break;// Found it +else + PMS.pop();// Pop children pass managers + } + + assert(MPP && "Unable to find Module Pass Manager"); + + MPP->addPassToManager(this); +} + +/// Find appropriate Function Pass Manager or Call Graph Pass Manager +/// in the PM Stack and add self into that manager. +void FunctionPass::assignPassManager(PMStack &PMS) { + + FPPassManager *FPP = NULL; + + // Find Module Pass Manager + while(!PMS.empty()) { + +FPP = dynamic_cast(PMS.top()); +if (FPP || dynamic_cast(PMS.top())) + break;// Found it or it is not here +else + PMS.pop();// Pop children pass managers + } + + if (!FPP) { +/// Create new Function Pass Manager + +/// Function Pass Manager does not live by itself +assert(!PMS.empty() && "Unable to create Function Pass Manager"); + +PMDataManager *PMD = PMS.top(); + +/// PMD should be either Module Pass Manager or Call Graph Pass Manager +assert(dynamic_cast(PMD) && + "Unable to create Function Pass Manager"); + +FPP = new FPPassManager(PMD->getDepth() + 1); +PMD->addPassToManager(FPP, false); +PMS.push(FPP); + } + + + FPP->addPassToManager(this); +} + +/// Find appropriate Basic Pass Manager or Call Graph Pass Manager +/// in the PM Stack and add self into that manager. +void BasicBlockPass::assignPassManager(PMStack &PMS) { + + BBPassManager *BBP = NULL; + + // Find Module Pass Manager + while(!PMS.empty()) { + +BBP = dynamic_cast(PMS.top()); +if (BBP || dynamic_cast(PMS.top())) + break;// Found it or it is not here +else + PMS.pop();// Pop children pass managers + } + + if (!BBP) { +/// Create new BasicBlock Pass Manager + +/// BasicBlock Pass Manager does not live by itself +assert(!PMS.empty() && "Unable to create BasicBlock Pass Manager"); + +PMDataManager *PMD = PMS.top(); + +/// PMD should be Function Pass Manager +assert(dynamic_cast(PMD) && + "Unable to create BasicBlock Pass Manager"); + +BBP = new BBPassManager(PMD->getDepth() + 1); +PMD->addPassToManager(BBP, false); +PMS.push(BBP); + } + + BBP->addPassToManager(this); +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07 (Take 2)
On Jan 8, 2007, at 11:08 AM, Devang Patel wrote: On Jan 8, 2007, at 11:05 AM, Reid Spencer wrote: OK. I suspect this may not be straight forward. Let's see. - Devang config.gcc selects target specific C source file name based on cpu_type (by default). So, I thought it may not be super easy to trace all uses of i386.c. Your patch should work. However, I am testing following to cover everything under i386* and x86* umbrella in one shot. Following works for darwin-x86. I applied this. Let me know if this does not work for your target. - Devang - Devang Index: config.gcc === --- config.gcc (revision 122065) +++ config.gcc (working copy) @@ -269,11 +269,17 @@ xscale-*-*) # APPLE LOCAL begin mni 4424835 i[34567]86-*-*) cpu_type=i386 +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h" ;; x86_64-*-*) cpu_type=i386 +# APPLE LOCAL begin LLVM + out_cxx_file=i386/llvm-i386.cpp +# APPLE LOCAL end LLVM extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h" need_64bit_hwint=yes @@ -966,9 +972,6 @@ i[34567]86-*-darwin*) # APPLE LOCAL end mainline 2005-10-02 4218570 # APPLE LOCAL 4099000 tmake_file="${tmake_file} i386/t-darwin" -# APPLE LOCAL begin LLVM - out_cxx_file=i386/llvm-i386.cpp -# APPLE LOCAL end LLVM # APPLE LOCAL 4126124 need_64bit_hwint=yes ;; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp
Changes in directory llvm/test/Regression/C++Frontend: 2007-01-06-ELF-Thunk-Sections.cpp updated: 1.1 -> 1.2 --- Log message: XFAIL this test until PR1085: http://llvm.org/PR1085 mystery is resolved. --- Diffs of the changes: (+1 -0) 2007-01-06-ELF-Thunk-Sections.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp diff -u llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.1 llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.2 --- llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.1 Sat Jan 6 18:32:15 2007 +++ llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp Mon Jan 8 13:38:58 2007 @@ -1,6 +1,7 @@ // RUN: %llvmgxx %s -emit-llvm -S -o - && // RUN: %llvmgxx %s -emit-llvm -S -o - | not grep 'gnu.linkonce.' // PR1085 +// XFAIL: i.86-pc-linux-* class __attribute__((visibility("default"))) QGenericArgument ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.155 -> 1.156 --- Log message: Parameter attributes are part of a FunctionType and deserve to be factored into comparisons of two FunctionTypes. Make it so. --- Diffs of the changes: (+6 -1) Type.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.155 llvm/lib/VMCore/Type.cpp:1.156 --- llvm/lib/VMCore/Type.cpp:1.155 Fri Jan 5 11:06:19 2007 +++ llvm/lib/VMCore/Type.cppMon Jan 8 13:41:01 2007 @@ -607,11 +607,16 @@ const FunctionType *FTy2 = cast(Ty2); if (FTy->isVarArg() != FTy2->isVarArg() || FTy->getNumParams() != FTy2->getNumParams() || +FTy->getNumAttrs() != FTy2->getNumAttrs() || +FTy->getParamAttrs(0) != FTy2->getParamAttrs(0) || !TypesEqual(FTy->getReturnType(), FTy2->getReturnType(), EqTypes)) return false; -for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i) +for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i) { + if (FTy->getParamAttrs(i+1) != FTy->getParamAttrs(i+1)) +return false; if (!TypesEqual(FTy->getParamType(i), FTy2->getParamType(i), EqTypes)) return false; +} return true; } else { assert(0 && "Unknown derived type!"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/VMCore/VMCore.vcproj
Changes in directory llvm/win32/VMCore: VMCore.vcproj updated: 1.24 -> 1.25 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+0 -3) VMCore.vcproj |3 --- 1 files changed, 3 deletions(-) Index: llvm/win32/VMCore/VMCore.vcproj diff -u llvm/win32/VMCore/VMCore.vcproj:1.24 llvm/win32/VMCore/VMCore.vcproj:1.25 --- llvm/win32/VMCore/VMCore.vcproj:1.24Fri Dec 15 15:47:01 2006 +++ llvm/win32/VMCore/VMCore.vcproj Mon Jan 8 14:17:17 2007 @@ -291,9 +291,6 @@ RelativePath="..\..\include\llvm\PassManager.h"> - - http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] fixed patch for PR1085
Index: method.c === --- method.c(revision 122094) +++ method.c(working copy) @@ -392,7 +392,7 @@ use_thunk (tree thunk_fndecl, bool emit_ if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function) /* APPLE LOCAL begin LLVM */ /* PR1085 */ -#ifndef ENABLE_LLVM +#ifdef ENABLE_LLVM && 0 #endif /* APPLE LOCAL end LLVM */ -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/Transforms/Transforms.vcproj
Changes in directory llvm/win32/Transforms: Transforms.vcproj updated: 1.23 -> 1.24 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+0 -3) Transforms.vcproj |3 --- 1 files changed, 3 deletions(-) Index: llvm/win32/Transforms/Transforms.vcproj diff -u llvm/win32/Transforms/Transforms.vcproj:1.23 llvm/win32/Transforms/Transforms.vcproj:1.24 --- llvm/win32/Transforms/Transforms.vcproj:1.23Sun Nov 5 13:31:28 2006 +++ llvm/win32/Transforms/Transforms.vcproj Mon Jan 8 14:17:17 2007 @@ -147,9 +147,6 @@ - - http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.587 -> 1.588 --- Log message: Unbreak VC++ build. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.587 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.588 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.587 Mon Jan 8 10:32:00 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 8 14:17:17 2007 @@ -1091,7 +1091,7 @@ // If the top bit of the output is demanded, demand everything from the // input. Otherwise, we demand all the input bits except NLZ top bits. - uint64_t InDemandedBits = ~0ULL >> 64-BitWidth+NLZ; + uint64_t InDemandedBits = ~0ULL >> (64-BitWidth+NLZ); // Find information about known zero/one bits in the input. if (SimplifyDemandedBits(I->getOperand(0), InDemandedBits, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.110 -> 1.111 --- Log message: Need to handle static declarations properly. --- Diffs of the changes: (+9 -6) DwarfWriter.cpp | 15 +-- 1 files changed, 9 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.110 llvm/lib/CodeGen/DwarfWriter.cpp:1.111 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.110 Wed Jan 3 07:36:40 2007 +++ llvm/lib/CodeGen/DwarfWriter.cppMon Jan 8 16:15:18 2007 @@ -1614,7 +1614,8 @@ AddType(Static, StaticTy, Unit); // Add flags. -AddUInt(Static, DW_AT_external, DW_FORM_flag, 1); +if (!StaticDesc->isStatic()) + AddUInt(Static, DW_AT_external, DW_FORM_flag, 1); AddUInt(Static, DW_AT_declaration, DW_FORM_flag, 1); Buffer.AddChild(Static); @@ -1662,7 +1663,8 @@ } // Add flags. -AddUInt(Method, DW_AT_external, DW_FORM_flag, 1); +if (!MethodDesc->isStatic()) + AddUInt(Method, DW_AT_external, DW_FORM_flag, 1); AddUInt(Method, DW_AT_declaration, DW_FORM_flag, 1); Buffer.AddChild(Method); @@ -1773,8 +1775,9 @@ AddString(VariableDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); } -AddType(VariableDie, GVD->getType(), Unit); -AddUInt(VariableDie, DW_AT_external, DW_FORM_flag, 1); +AddType(VariableDie, GVD->getType(), Unit); +if (!GVD->isStatic()) + AddUInt(VariableDie, DW_AT_external, DW_FORM_flag, 1); // Add source line info if available. AddSourceLine(VariableDie, UnitDesc, GVD->getLine()); @@ -1814,7 +1817,6 @@ const std::string &Name = SPD->getName(); const std::string &FullName = SPD->getFullName(); const std::string &LinkageName = SPD->getLinkageName(); -unsigned IsExternal = SPD->isStatic() ? 0 : 1; DIE *SubprogramDie = new DIE(DW_TAG_subprogram); AddString(SubprogramDie, DW_AT_name, DW_FORM_string, Name); @@ -1823,7 +1825,8 @@ LinkageName); } if (SPD->getType()) AddType(SubprogramDie, SPD->getType(), Unit); -AddUInt(SubprogramDie, DW_AT_external, DW_FORM_flag, IsExternal); +if (!SPD->isStatic()) + AddUInt(SubprogramDie, DW_AT_external, DW_FORM_flag, 1); AddUInt(SubprogramDie, DW_AT_prototyped, DW_FORM_flag, 1); // Add source line info if available. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-commit][llvm-gcc]Proper way to check for statics.
This fixes a problem where debug info was missing static declarations on class members. Cheers, -- Jim static.patch Description: Binary data smime.p7s Description: S/MIME cryptographic signature ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/unsafe-math.ll
Changes in directory llvm/test/Regression/CodeGen/PowerPC: unsafe-math.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+9 -0) unsafe-math.ll |9 + 1 files changed, 9 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/unsafe-math.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/unsafe-math.ll:1.1 *** /dev/null Mon Jan 8 17:03:29 2007 --- llvm/test/Regression/CodeGen/PowerPC/unsafe-math.ll Mon Jan 8 17:03:19 2007 *** *** 0 --- 1,9 + ; RUN: llvm-as < %s | llc -march=ppc32 | grep fmul | wc -l | grep 2 && + ; RUN: llvm-as < %s | llc -march=ppc32 -enable-unsafe-fp-math | grep fmul | wc -l | grep 1 + + define double %foo(double %X) { + %tmp1 = mul double %X, 1.23 + %tmp2 = mul double %tmp1, 4.124 + ret double %tmp2 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.264 -> 1.265 --- Log message: Implement some trivial FP foldings when -enable-unsafe-fp-math is specified. This implements CodeGen/PowerPC/unsafe-math.ll --- Diffs of the changes: (+15 -0) DAGCombiner.cpp | 15 +++ 1 files changed, 15 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.264 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.265 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.264 Tue Dec 19 16:41:21 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jan 8 17:04:05 2007 @@ -35,6 +35,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include @@ -2401,6 +2402,13 @@ // fold ((-A) + B) -> B-A if (N0.getOpcode() == ISD::FNEG) return DAG.getNode(ISD::FSUB, VT, N1, N0.getOperand(0)); + + // If allowed, fold (fadd (fadd x, c1), c2) -> (fadd x, (fadd c1, c2)) + if (UnsafeFPMath && N1CFP && N0.getOpcode() == ISD::FADD && + N0.Val->hasOneUse() && isa(N0.getOperand(1))) +return DAG.getNode(ISD::FADD, VT, N0.getOperand(0), + DAG.getNode(ISD::FADD, VT, N0.getOperand(1), N1)); + return SDOperand(); } @@ -2436,6 +2444,13 @@ // fold (fmul X, 2.0) -> (fadd X, X) if (N1CFP && N1CFP->isExactlyValue(+2.0)) return DAG.getNode(ISD::FADD, VT, N0, N0); + + // If allowed, fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2)) + if (UnsafeFPMath && N1CFP && N0.getOpcode() == ISD::FMUL && + N0.Val->hasOneUse() && isa(N0.getOperand(1))) +return DAG.getNode(ISD::FMUL, VT, N0.getOperand(0), + DAG.getNode(ISD::FMUL, VT, N0.getOperand(1), N1)); + return SDOperand(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGRRList.cpp updated: 1.23 -> 1.24 --- Log message: Fix for PR1075: http://llvm.org/PR1075 : bottom-up register-reduction scheduling actually increases register pressure. - Fixed bugs in sethi-ullman number computation and priority queue comparison functions. - Separate code that handles priority computation special cases from SU number computation. --- Diffs of the changes: (+72 -120) ScheduleDAGRRList.cpp | 192 ++ 1 files changed, 72 insertions(+), 120 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.23 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.24 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.23Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Jan 8 17:50:38 2007 @@ -414,6 +414,12 @@ }; } // end anonymous namespace +static inline bool isCopyFromLiveIn(const SUnit *SU) { + SDNode *N = SU->Node; + return N->getOpcode() == ISD::CopyFromReg && +N->getOperand(N->getNumOperands()-1).getValueType() != MVT::Flag; +} + namespace { template class VISIBILITY_HIDDEN RegReductionPriorityQueue @@ -428,7 +434,7 @@ std::vector &sunits) {} virtual void releaseState() {} -virtual int getSethiUllmanNumber(unsigned NodeNum) const { +virtual unsigned getSethiUllmanNumber(const SUnit *SU) const { return 0; } @@ -464,7 +470,7 @@ const std::vector *SUnits; // SethiUllmanNumbers - The SethiUllman number for each node. -std::vector SethiUllmanNumbers; +std::vector SethiUllmanNumbers; const TargetInstrInfo *TII; public: @@ -486,9 +492,30 @@ SethiUllmanNumbers.clear(); } -int getSethiUllmanNumber(unsigned NodeNum) const { - assert(NodeNum < SethiUllmanNumbers.size()); - return SethiUllmanNumbers[NodeNum]; +unsigned getSethiUllmanNumber(const SUnit *SU) const { + assert(SU->NodeNum < SethiUllmanNumbers.size()); + unsigned Opc = SU->Node->getOpcode(); + if (Opc == ISD::CopyFromReg && !isCopyFromLiveIn(SU)) +// CopyFromReg should be close to its def because it restricts +// allocation choices. But if it is a livein then perhaps we want it +// closer to its uses so it can be coalesced. +return 0x; + else if (Opc == ISD::TokenFactor || Opc == ISD::CopyToReg) +// CopyToReg should be close to its uses to facilitate coalescing and +// avoid spilling. +return 0; + else if (SU->NumSuccs == 0) +// If SU does not have a use, i.e. it doesn't produce a value that would +// be consumed (e.g. store), then it terminates a chain of computation. +// Give it a large SethiUllman number so it will be scheduled right +// before its predecessors that it doesn't lengthen their live ranges. +return 0x; + else if (SU->NumPreds == 0) +// If SU does not have a def, schedule it close to its uses because it +// does not lengthen any live ranges. +return 0; + else +return SethiUllmanNumbers[SU->NodeNum]; } bool isDUOperand(const SUnit *SU1, const SUnit *SU2) { @@ -507,7 +534,7 @@ bool canClobber(SUnit *SU, SUnit *Op); void AddPseudoTwoAddrDeps(); void CalculatePriorities(); -int CalcNodePriority(const SUnit *SU); +unsigned CalcNodePriority(const SUnit *SU); }; @@ -520,7 +547,7 @@ const std::vector *SUnits; // SethiUllmanNumbers - The SethiUllman number for each node. -std::vector SethiUllmanNumbers; +std::vector SethiUllmanNumbers; public: TDRegReductionPriorityQueue() {} @@ -538,86 +565,38 @@ SethiUllmanNumbers.clear(); } -int getSethiUllmanNumber(unsigned NodeNum) const { - assert(NodeNum < SethiUllmanNumbers.size()); - return SethiUllmanNumbers[NodeNum]; +unsigned getSethiUllmanNumber(const SUnit *SU) const { + assert(SU->NodeNum < SethiUllmanNumbers.size()); + return SethiUllmanNumbers[SU->NodeNum]; } private: void CalculatePriorities(); -int CalcNodePriority(const SUnit *SU); +unsigned CalcNodePriority(const SUnit *SU); }; } -static bool isFloater(const SUnit *SU) { - if (SU->Node->isTargetOpcode()) { -if (SU->NumPreds == 0) - return true; -if (SU->NumPreds == 1) { - for (SUnit::const_pred_iterator I = SU->Preds.begin(),E = SU->Preds.end(); - I != E; ++I) { -if (I->second) continue; - -SUnit *PredSU = I->first; -unsigned Opc = PredSU->Node->getOpcode(); -if (Opc != ISD::EntryToken && Opc != ISD::TokenFactor && -Opc != ISD::CopyToReg) - return false; - } - return true; -} - } - return false; -} - -static bool isSimpleFloaterUse(cons
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2006-05-02-InstrSched2.ll updated: 1.3 -> 1.4 --- Log message: Undo xfail now scheduler deficiency has been fixed. --- Diffs of the changes: (+1 -2) 2006-05-02-InstrSched2.ll |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll diff -u llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll:1.3 llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll:1.4 --- llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll:1.3 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/X86/2006-05-02-InstrSched2.ll Mon Jan 8 17:57:40 2007 @@ -1,5 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | grep "asm-printer" | grep 19 -; XFAIL: * +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | grep "asm-printer" | grep 18 void %_ZN9__gnu_cxx9hashtableISt4pairIKPKciES3_NS_4hashIS3_EESt10_Select1stIS5_E5eqstrSaIiEE14find_or_insertERKS5__cond_true456.i(sbyte* %tmp435.i, uint* %tmp449.i.out) { newFuncRoot: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGRRList.cpp updated: 1.24 -> 1.25 --- Log message: Naming consistency. --- Diffs of the changes: (+27 -25) ScheduleDAGRRList.cpp | 52 +- 1 files changed, 27 insertions(+), 25 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.24 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.25 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.24Mon Jan 8 17:50:38 2007 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Jan 8 17:55:53 2007 @@ -434,7 +434,7 @@ std::vector &sunits) {} virtual void releaseState() {} -virtual unsigned getSethiUllmanNumber(const SUnit *SU) const { +virtual unsigned getNodePriority(const SUnit *SU) const { return 0; } @@ -484,7 +484,7 @@ // Add pseudo dependency edges for two-address nodes. AddPseudoTwoAddrDeps(); // Calculate node priorities. - CalculatePriorities(); + CalculateSethiUllmanNumbers(); } void releaseState() { @@ -492,7 +492,7 @@ SethiUllmanNumbers.clear(); } -unsigned getSethiUllmanNumber(const SUnit *SU) const { +unsigned getNodePriority(const SUnit *SU) const { assert(SU->NodeNum < SethiUllmanNumbers.size()); unsigned Opc = SU->Node->getOpcode(); if (Opc == ISD::CopyFromReg && !isCopyFromLiveIn(SU)) @@ -533,8 +533,8 @@ private: bool canClobber(SUnit *SU, SUnit *Op); void AddPseudoTwoAddrDeps(); -void CalculatePriorities(); -unsigned CalcNodePriority(const SUnit *SU); +void CalculateSethiUllmanNumbers(); +unsigned CalcNodeSethiUllmanNumber(const SUnit *SU); }; @@ -557,7 +557,7 @@ SUnitMap = &sumap; SUnits = &sunits; // Calculate node priorities. - CalculatePriorities(); + CalculateSethiUllmanNumbers(); } void releaseState() { @@ -565,14 +565,14 @@ SethiUllmanNumbers.clear(); } -unsigned getSethiUllmanNumber(const SUnit *SU) const { +unsigned getNodePriority(const SUnit *SU) const { assert(SU->NodeNum < SethiUllmanNumbers.size()); return SethiUllmanNumbers[SU->NodeNum]; } private: -void CalculatePriorities(); -unsigned CalcNodePriority(const SUnit *SU); +void CalculateSethiUllmanNumbers(); +unsigned CalcNodeSethiUllmanNumber(const SUnit *SU); }; } @@ -580,8 +580,6 @@ bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const { bool LIsTarget = left->Node->isTargetOpcode(); bool RIsTarget = right->Node->isTargetOpcode(); - unsigned LPriority = SPQ->getSethiUllmanNumber(left); - unsigned RPriority = SPQ->getSethiUllmanNumber(right); // Special tie breaker: if two nodes share a operand, the one that use it // as a def&use operand is preferred. @@ -594,6 +592,8 @@ return true; } + unsigned LPriority = SPQ->getNodePriority(left); + unsigned RPriority = SPQ->getNodePriority(right); if (LPriority > RPriority) return true; else if (LPriority == RPriority) @@ -693,10 +693,10 @@ } } -/// CalcNodePriority - Priority is the Sethi Ullman number. +/// CalcNodeSethiUllmanNumber - Priority is the Sethi Ullman number. /// Smaller number is the higher priority. template -unsigned BURegReductionPriorityQueue::CalcNodePriority(const SUnit *SU) { +unsigned BURegReductionPriorityQueue::CalcNodeSethiUllmanNumber(const SUnit *SU) { unsigned &SethiUllmanNumber = SethiUllmanNumbers[SU->NodeNum]; if (SethiUllmanNumber != 0) return SethiUllmanNumber; @@ -706,7 +706,7 @@ I != E; ++I) { if (I->second) continue; // ignore chain preds SUnit *PredSU = I->first; -unsigned PredSethiUllman = CalcNodePriority(PredSU); +unsigned PredSethiUllman = CalcNodeSethiUllmanNumber(PredSU); if (PredSethiUllman > SethiUllmanNumber) { SethiUllmanNumber = PredSethiUllman; Extra = 0; @@ -722,13 +722,14 @@ return SethiUllmanNumber; } -/// CalculatePriorities - Calculate priorities of all scheduling units. +/// CalculateSethiUllmanNumbers - Calculate Sethi-Ullman numbers of all +/// scheduling units. template -void BURegReductionPriorityQueue::CalculatePriorities() { +void BURegReductionPriorityQueue::CalculateSethiUllmanNumbers() { SethiUllmanNumbers.assign(SUnits->size(), 0); for (unsigned i = 0, e = SUnits->size(); i != e; ++i) -CalcNodePriority(&(*SUnits)[i]); +CalcNodeSethiUllmanNumber(&(*SUnits)[i]); } static unsigned SumOfUnscheduledPredsOfSuccs(const SUnit *SU) { @@ -750,8 +751,8 @@ // Top down bool td_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const { - unsigned LPriority = SPQ->getSethiUllmanNumber(left); - unsigned RPriority = SPQ->getSethiUllmanNumber(right); + unsigned LPriority = SPQ->getNodePriority(left); + unsi
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2007-01-08-InstrSched.ll added (r1.1) --- Log message: Added a test case from PR1075: http://llvm.org/PR1075 . --- Diffs of the changes: (+13 -0) 2007-01-08-InstrSched.ll | 13 + 1 files changed, 13 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.1 *** /dev/null Mon Jan 8 17:58:37 2007 --- llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll Mon Jan 8 17:58:27 2007 *** *** 0 --- 1,13 + ; RUN: llvm-as < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | \ + ; RUN: %prcontext 'mulss LCPI1_3' 1 | grep mulss | wc -l | grep 1 + + define float %foo(float %x) { + %tmp1 = mul float %x, 3.00e+00 + %tmp3 = mul float %x, 5.00e+00 + %tmp5 = mul float %x, 7.00e+00 + %tmp7 = mul float %x, 1.10e+01 + %tmp10 = add float %tmp1, %tmp3 + %tmp12 = add float %tmp10, %tmp5 + %tmp14 = add float %tmp12, %tmp7 + ret float %tmp14 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp
Changes in directory llvm/test/Regression/C++Frontend: 2007-01-06-ELF-Thunk-Sections.cpp updated: 1.2 -> 1.3 --- Log message: PR1085: http://llvm.org/PR1085 is fixed now. --- Diffs of the changes: (+0 -1) 2007-01-06-ELF-Thunk-Sections.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp diff -u llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.2 llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.3 --- llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp:1.2 Mon Jan 8 13:38:58 2007 +++ llvm/test/Regression/C++Frontend/2007-01-06-ELF-Thunk-Sections.cpp Mon Jan 8 18:05:55 2007 @@ -1,7 +1,6 @@ // RUN: %llvmgxx %s -emit-llvm -S -o - && // RUN: %llvmgxx %s -emit-llvm -S -o - | not grep 'gnu.linkonce.' // PR1085 -// XFAIL: i.86-pc-linux-* class __attribute__((visibility("default"))) QGenericArgument ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2007-01-08-InstrSched.ll updated: 1.1 -> 1.2 --- Log message: Fix test case. --- Diffs of the changes: (+1 -1) 2007-01-08-InstrSched.ll |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll diff -u llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.1 llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.2 --- llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.1 Mon Jan 8 17:58:27 2007 +++ llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll Mon Jan 8 18:09:34 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | \ +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ ; RUN: %prcontext 'mulss LCPI1_3' 1 | grep mulss | wc -l | grep 1 define float %foo(float %x) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2007-01-08-InstrSched.ll updated: 1.2 -> 1.3 --- Log message: Add PR number for future reference --- Diffs of the changes: (+1 -0) 2007-01-08-InstrSched.ll |1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll diff -u llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.2 llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.3 --- llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll:1.2 Mon Jan 8 18:09:34 2007 +++ llvm/test/Regression/CodeGen/X86/2007-01-08-InstrSched.ll Mon Jan 8 18:31:52 2007 @@ -1,5 +1,6 @@ ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ ; RUN: %prcontext 'mulss LCPI1_3' 1 | grep mulss | wc -l | grep 1 +; PR1075 define float %foo(float %x) { %tmp1 = mul float %x, 3.00e+00 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-config/Makefile
Changes in directory llvm/tools/llvm-config: Makefile updated: 1.20 -> 1.21 --- Log message: Fixing a ">" redirect to be a ">>" redirect, so a sed command doesn't get clobbered. --- Diffs of the changes: (+1 -1) Makefile |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-config/Makefile diff -u llvm/tools/llvm-config/Makefile:1.20 llvm/tools/llvm-config/Makefile:1.21 --- llvm/tools/llvm-config/Makefile:1.20Fri Jan 5 20:48:03 2007 +++ llvm/tools/llvm-config/Makefile Mon Jan 8 20:38:29 2007 @@ -57,7 +57,7 @@ $(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps) $(Echo) "Building llvm-config script." $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' > temp.sed - $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed + $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed $(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed $(Verb) $(SED) -f temp.sed < $< > $@ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/MiBench/
Changes in directory llvm-test/MultiSource/Benchmarks/MiBench: --- Log message: Directory /var/cvs/llvm/llvm-test/MultiSource/Benchmarks/MiBench added to the repository --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MutiSource/Benchmarks/MiBench/
Changes in directory llvm-test/MutiSource/Benchmarks/MiBench: --- Log message: Add selected tests from MiBench 1.0 to LLVM test suite. Status: Vendor Tag: UofM Release Tags: V1_0 N llvm-test/MutiSource/Benchmarks/MiBench/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/automotive/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/basicmath.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/round.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/pi.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/isqrt.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/cubic.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/sniptype.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/snipmath.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/automotive/basicmath/rad2deg.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitcnt_3.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitcnt_2.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitcnts.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/conio.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/extkword.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitarray.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitops.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitfiles.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/sniptype.h N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitstrng.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitcnt_4.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bstr_i.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/bitcnt_1.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/bitcount/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/automotive/susan/input_large.pgm N llvm-test/MutiSource/Benchmarks/MiBench/automotive/susan/susan.c N llvm-test/MutiSource/Benchmarks/MiBench/automotive/susan/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/automotive/susan/input_small.pgm N llvm-test/MutiSource/Benchmarks/MiBench/automotive/susan/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/network/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/small.udp N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/patricia.h N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/patricia_test.c N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/patricia.c N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/large.udp N llvm-test/MutiSource/Benchmarks/MiBench/network/patricia/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/network/dijkstra/dijkstra.c N llvm-test/MutiSource/Benchmarks/MiBench/network/dijkstra/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/network/dijkstra/input.dat N llvm-test/MutiSource/Benchmarks/MiBench/network/dijkstra/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/sha.h N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/input_large.asc N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/sha.c N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/input_small.asc N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/security/sha/sha_driver.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_ecb.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_skey.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_cfb64.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_cbc.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/COPYRIGHT N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_ofb64.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/blowfish.h N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/input_large.asc N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bftest.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/Makefile N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_enc.c N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_locl.h N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/bf_pi.h N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/input_small.asc N llvm-test/MutiSource/Benchmarks/MiBench/security/blowfish/LICENSE N llvm-test/MutiSource/Benchmarks/MiBench/security/rijndael/output_large.enc N llvm-test/MutiSource/Benchmarks/MiBench/security/rijndael/aesxam.c N llvm-test/MutiSource/Benchmarks/MiBench/
[llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll
Changes in directory llvm/test/Regression/CodeGen/CBackend: 2007-01-08-ParamAttr-ICmp.ll added (r1.1) --- Log message: Test case for PR1099: http://llvm.org/PR1099 . --- Diffs of the changes: (+31 -0) 2007-01-08-ParamAttr-ICmp.ll | 31 +++ 1 files changed, 31 insertions(+) Index: llvm/test/Regression/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll diff -c /dev/null llvm/test/Regression/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll:1.1 *** /dev/null Tue Jan 9 00:25:25 2007 --- llvm/test/Regression/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll Tue Jan 9 00:25:15 2007 *** *** 0 --- 1,31 + ; RUN: llvm-as < %s | llc -march=c | \ + ; RUN: grep 'return ltmp_2_2 == (signed int)ltmp_1_2)) ? (1) : (0)))' + ; For PR1099 + ; XFAIL: * + + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-apple-darwin8" + %struct.Connector = type { i16, i16, i8, i8, %struct.Connector*, i8* } + + implementation ; Functions: + + define bool %prune_match_entry_2E_ce(%struct.Connector* %a, i16 %b.0.0.val) { + newFuncRoot: + br label %entry.ce + + cond_next.exitStub: ; preds = %entry.ce + ret bool true + + entry.return_crit_edge.exitStub:; preds = %entry.ce + ret bool false + + entry.ce: ; preds = %newFuncRoot + %tmp = getelementptr %struct.Connector* %a, i32 0, i32 0 ; [#uses=1] + %tmp = load i16* %tmp ; [#uses=1] + %tmp = icmp eq i16 %tmp, %b.0.0.val ; [#uses=1] + br bool %tmp, label %cond_next.exitStub, label %entry.return_crit_edge.exitStub + } + + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.306 -> 1.307 --- Log message: For PR1099: http://llvm.org/PR1099 : Partial fix for this PR. Default function parameters to signed integer, just like everything else in CBE. The bug was caused by incorrectly introducing parameter attributes feature by choosing "signed" parameter if the SExtAttribute was specified. Howeer, if no attribute is specified, this causes it to become unsigned which is incorrect. Reversing the logic so that signedness is detected by "not ZExtAttribute" set fixes the issue. This fixes 197.parser but there is more to do. Any comparison and possibly other operators involving arguments may need to correctly cast the parameter before its use, depending on the sign of the operator. --- Diffs of the changes: (+9 -8) Writer.cpp | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.306 llvm/lib/Target/CBackend/Writer.cpp:1.307 --- llvm/lib/Target/CBackend/Writer.cpp:1.306 Mon Jan 8 02:00:00 2007 +++ llvm/lib/Target/CBackend/Writer.cpp Tue Jan 9 00:38:06 2007 @@ -348,7 +348,7 @@ if (PrintedType) FunctionInnards << ", "; printType(FunctionInnards, *I, -/*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), ""); +/*isSigned=*/!FTy->paramHasAttr(Idx, FunctionType::ZExtAttribute), ""); PrintedType = true; } if (FTy->isVarArg()) { @@ -360,7 +360,7 @@ FunctionInnards << ')'; std::string tstr = FunctionInnards.str(); printType(Out, RetTy, - /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr); + /*isSigned=*/!FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr); } std::ostream & @@ -417,7 +417,7 @@ if (I != FTy->param_begin()) FunctionInnards << ", "; printType(FunctionInnards, *I, - /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), ""); + /*isSigned=*/!FTy->paramHasAttr(Idx, FunctionType::ZExtAttribute), ""); ++Idx; } if (FTy->isVarArg()) { @@ -429,7 +429,7 @@ FunctionInnards << ')'; std::string tstr = FunctionInnards.str(); printType(Out, FTy->getReturnType(), -/*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr); +/*isSigned=*/!FTy->paramHasAttr(0, FunctionType::ZExtAttribute), tstr); return Out; } case Type::StructTyID: { @@ -1775,7 +1775,7 @@ else ArgName = ""; printType(FunctionInnards, I->getType(), -/*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute), +/*isSigned=*/!FT->paramHasAttr(Idx, FunctionType::ZExtAttribute), ArgName); PrintedArg = true; ++Idx; @@ -1796,7 +1796,7 @@ for (; I != E; ++I) { if (PrintedArg) FunctionInnards << ", "; printType(FunctionInnards, *I, - /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute)); + /*isSigned=*/!FT->paramHasAttr(Idx, FunctionType::ZExtAttribute)); PrintedArg = true; ++Idx; } @@ -1823,7 +1823,8 @@ } // Print out the return type and the signature built above. - printType(Out, RetTy, FT->paramHasAttr(0, FunctionType::SExtAttribute), + printType(Out, RetTy, +/*isSigned=*/!FT->paramHasAttr(0, FunctionType::ZExtAttribute), FunctionInnards.str()); } @@ -2516,7 +2517,7 @@ (*AI)->getType() != FTy->getParamType(ArgNo)) { Out << '('; printType(Out, FTy->getParamType(ArgNo), - /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute)); +/*isSigned=*/!FTy->paramHasAttr(Idx, FunctionType::ZExtAttribute)); Out << ')'; } writeOperand(*AI); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.236 -> 1.237 --- Log message: Remove extraneous return value from insertValue and getOrCreateSlot. Since getOrCreateSlot no longer gets the slot, rename it to CreateSlot. --- Diffs of the changes: (+35 -54) AsmWriter.cpp | 89 ++ 1 files changed, 35 insertions(+), 54 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.236 llvm/lib/VMCore/AsmWriter.cpp:1.237 --- llvm/lib/VMCore/AsmWriter.cpp:1.236 Mon Jan 8 12:21:30 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Jan 9 01:46:21 2007 @@ -102,15 +102,12 @@ /// This function does the actual initialization. inline void initialize(); - /// Values can be crammed into here at will. If they haven't - /// been inserted already, they get inserted, otherwise they are ignored. - /// Either way, the slot number for the Value* is returned. - unsigned getOrCreateSlot(const Value *V); - - /// Insert a value into the value table. Return the slot number - /// that it now occupies. BadThings(TM) will happen if you insert a - /// Value that's already been inserted. - unsigned insertValue(const Value *V); + /// CreateSlot - If the specified Value* doesn't have a name, assign it a slot + /// number. + void CreateSlot(const Value *V); + + /// Insert a value into the value table. + void insertValue(const Value *V); /// Add all of the module level global variables (and their initializers) /// and function declarations, but not the contents of those functions. @@ -1427,13 +1424,13 @@ for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end(); I != E; ++I) if (!I->hasName()) - getOrCreateSlot(I); + CreateSlot(I); // Add all the unnamed functions to the table. for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); I != E; ++I) if (!I->hasName()) - getOrCreateSlot(I); + CreateSlot(I); SC_DEBUG("end processModule!\n"); } @@ -1447,7 +1444,7 @@ for(Function::const_arg_iterator AI = TheFunction->arg_begin(), AE = TheFunction->arg_end(); AI != AE; ++AI) if (!AI->hasName()) - getOrCreateSlot(AI); + CreateSlot(AI); SC_DEBUG("Inserting Instructions:\n"); @@ -1455,10 +1452,10 @@ for (Function::const_iterator BB = TheFunction->begin(), E = TheFunction->end(); BB != E; ++BB) { if (!BB->hasName()) - getOrCreateSlot(BB); + CreateSlot(BB); for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (I->getType() != Type::VoidTy && !I->hasName()) -getOrCreateSlot(I); +CreateSlot(I); } FunctionProcessed = true; @@ -1467,9 +1464,8 @@ } /// Clean up after incorporating a function. This is the only way to get out of -/// the function incorporation state that affects the -/// getSlot/getOrCreateSlot lock. Function incorporation state is indicated -/// by TheFunction != 0. +/// the function incorporation state that affects getSlot/CreateSlot. Function +/// incorporation state is indicated by TheFunction != 0. void SlotMachine::purgeFunction() { SC_DEBUG("begin purgeFunction!\n"); fMap.clear(); // Simply discard the function level map @@ -1479,8 +1475,7 @@ } /// Get the slot number for a value. This function will assert if you -/// ask for a Value that hasn't previously been inserted with getOrCreateSlot. -/// Types are forbidden because Type does not inherit from Value (any more). +/// ask for a Value that hasn't previously been inserted with CreateSlot. int SlotMachine::getSlot(const Value *V) { assert(V && "Can't get slot for null Value"); assert(!isa(V) || isa(V) && @@ -1540,10 +1535,8 @@ } -// Create a new slot, or return the existing slot if it is already -// inserted. Note that the logic here parallels getSlot but instead -// of asserting when the Value* isn't found, it inserts the value. -unsigned SlotMachine::getOrCreateSlot(const Value *V) { +/// CreateSlot - Create a new slot for the specified value if it has no name. +void SlotMachine::CreateSlot(const Value *V) { const Type* VTy = V->getType(); assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a slot!"); assert(!isa(V) || isa(V) && @@ -1557,32 +1550,21 @@ TypedPlanes::const_iterator FI = fMap.find(VTy); // If there is a corresponding type plane in the function map if (FI != fMap.end()) { - // Lookup the Value in the function map + // Lookup the Value in the function map. ValueMap::const_iterator FVI = FI->second.map.find(V); - // If the value doesn't exist in the function map - if (FVI == FI->second.map.end()) { -// If there is no corresponding type plane in the module map -if (MI == mMap.end()) - return insertValue(V); -// Look up the value in the module map -ValueMap::const_iterator MV
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.237 -> 1.238 --- Log message: Split CreateSlot into two versions, one for globals and one for function-local values --- Diffs of the changes: (+68 -61) AsmWriter.cpp | 129 ++ 1 files changed, 68 insertions(+), 61 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.237 llvm/lib/VMCore/AsmWriter.cpp:1.238 --- llvm/lib/VMCore/AsmWriter.cpp:1.237 Tue Jan 9 01:46:21 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Jan 9 01:55:49 2007 @@ -102,9 +102,11 @@ /// This function does the actual initialization. inline void initialize(); - /// CreateSlot - If the specified Value* doesn't have a name, assign it a slot - /// number. - void CreateSlot(const Value *V); + /// CreateModuleSlot - Insert the specified GlobalValue* into the slot table. + void CreateModuleSlot(const GlobalValue *V); + + /// CreateFunctionSlot - Insert the specified Value* into the slot table. + void CreateFunctionSlot(const Value *V); /// Insert a value into the value table. void insertValue(const Value *V); @@ -1424,13 +1426,13 @@ for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end(); I != E; ++I) if (!I->hasName()) - CreateSlot(I); + CreateModuleSlot(I); // Add all the unnamed functions to the table. for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); I != E; ++I) if (!I->hasName()) - CreateSlot(I); + CreateModuleSlot(I); SC_DEBUG("end processModule!\n"); } @@ -1444,7 +1446,7 @@ for(Function::const_arg_iterator AI = TheFunction->arg_begin(), AE = TheFunction->arg_end(); AI != AE; ++AI) if (!AI->hasName()) - CreateSlot(AI); + CreateFunctionSlot(AI); SC_DEBUG("Inserting Instructions:\n"); @@ -1452,10 +1454,10 @@ for (Function::const_iterator BB = TheFunction->begin(), E = TheFunction->end(); BB != E; ++BB) { if (!BB->hasName()) - CreateSlot(BB); + CreateFunctionSlot(BB); for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (I->getType() != Type::VoidTy && !I->hasName()) -CreateSlot(I); +CreateFunctionSlot(I); } FunctionProcessed = true; @@ -1464,7 +1466,7 @@ } /// Clean up after incorporating a function. This is the only way to get out of -/// the function incorporation state that affects getSlot/CreateSlot. Function +/// the function incorporation state that affects getSlot/Create*Slot. Function /// incorporation state is indicated by TheFunction != 0. void SlotMachine::purgeFunction() { SC_DEBUG("begin purgeFunction!\n"); @@ -1475,7 +1477,7 @@ } /// Get the slot number for a value. This function will assert if you -/// ask for a Value that hasn't previously been inserted with CreateSlot. +/// ask for a Value that hasn't previously been inserted with Create*Slot. int SlotMachine::getSlot(const Value *V) { assert(V && "Can't get slot for null Value"); assert(!isa(V) || isa(V) && @@ -1535,68 +1537,73 @@ } +/// CreateModuleSlot - Insert the specified GlobalValue* into the slot table. +void SlotMachine::CreateModuleSlot(const GlobalValue *V) { + assert(!V->hasName() && "Doesn't need a slot!"); + const Type *VTy = V->getType(); + + // Look up the type plane for the Value's type from the module map + TypedPlanes::const_iterator MI = mMap.find(VTy); + + // If the module map's type plane is not for the Value's type + if (MI != mMap.end()) { +// Lookup the value in the module's map +ValueMap::const_iterator MVI = MI->second.map.find(V); +if (MVI != MI->second.map.end()) + return; + } + + return insertValue(V); +} + + /// CreateSlot - Create a new slot for the specified value if it has no name. -void SlotMachine::CreateSlot(const Value *V) { - const Type* VTy = V->getType(); +void SlotMachine::CreateFunctionSlot(const Value *V) { + const Type *VTy = V->getType(); assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a slot!"); - assert(!isa(V) || isa(V) && -"Can't insert a non-GlobalValue Constant into SlotMachine"); + assert(!isa(V) && "Can't insert a Constants into SlotMachine"); // Look up the type plane for the Value's type from the module map TypedPlanes::const_iterator MI = mMap.find(VTy); - if (TheFunction) { -// Get the type plane for the Value's type from the function map -TypedPlanes::const_iterator FI = fMap.find(VTy); -// If there is a corresponding type plane in the function map -if (FI != fMap.end()) { - // Lookup the Value in the function map. - ValueMap::const_iterator FVI = FI->second.map.find(V); - // If the value exists in the function map, we're done. - if (FVI != FI->second.map.end()) -return; - - // If there is no corresponding type plane in the module map -
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.238 -> 1.239 --- Log message: Remove a bunch of complex logic that is completely dead: duplicates can never be inserted! --- Diffs of the changes: (+1 -57) AsmWriter.cpp | 58 +- 1 files changed, 1 insertion(+), 57 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.238 llvm/lib/VMCore/AsmWriter.cpp:1.239 --- llvm/lib/VMCore/AsmWriter.cpp:1.238 Tue Jan 9 01:55:49 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Jan 9 01:58:11 2007 @@ -1539,20 +1539,6 @@ /// CreateModuleSlot - Insert the specified GlobalValue* into the slot table. void SlotMachine::CreateModuleSlot(const GlobalValue *V) { - assert(!V->hasName() && "Doesn't need a slot!"); - const Type *VTy = V->getType(); - - // Look up the type plane for the Value's type from the module map - TypedPlanes::const_iterator MI = mMap.find(VTy); - - // If the module map's type plane is not for the Value's type - if (MI != mMap.end()) { -// Lookup the value in the module's map -ValueMap::const_iterator MVI = MI->second.map.find(V); -if (MVI != MI->second.map.end()) - return; - } - return insertValue(V); } @@ -1561,49 +1547,7 @@ void SlotMachine::CreateFunctionSlot(const Value *V) { const Type *VTy = V->getType(); assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a slot!"); - assert(!isa(V) && "Can't insert a Constants into SlotMachine"); - - // Look up the type plane for the Value's type from the module map - TypedPlanes::const_iterator MI = mMap.find(VTy); - - // Get the type plane for the Value's type from the function map - TypedPlanes::const_iterator FI = fMap.find(VTy); - // If there is a corresponding type plane in the function map - if (FI != fMap.end()) { -// Lookup the Value in the function map. -ValueMap::const_iterator FVI = FI->second.map.find(V); -// If the value exists in the function map, we're done. -if (FVI != FI->second.map.end()) - return; - -// If there is no corresponding type plane in the module map -if (MI == mMap.end()) - return insertValue(V); -// Look up the value in the module map -ValueMap::const_iterator MVI = MI->second.map.find(V); -// If we found it, it was already inserted -if (MVI != MI->second.map.end()) - return; -return insertValue(V); - } - - // Otherwise, there is no corresponding type plane in the function map yet. - - // If the type plane doesn't exists at the module level - if (MI == mMap.end()) { -return insertValue(V); - // else type plane exists at the module level, examine it - } else { -// Look up the value in the module's map -ValueMap::const_iterator MVI = MI->second.map.find(V); -// If we didn't find it there either -if (MVI == MI->second.map.end()) - // Return the slot number as the module's contribution to - // the type plane plus the index of the function map insertion. - return insertValue(V); -else - return; - } + return insertValue(V); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits