[llvm-commits] CVS: llvm/test/Integer/2007-01-19-TruncSext.ll
Changes in directory llvm/test/Integer: 2007-01-19-TruncSext.ll added (r1.1) --- Log message: Add a test case for sext bug that Leo found. --- Diffs of the changes: (+29 -0) 2007-01-19-TruncSext.ll | 29 + 1 files changed, 29 insertions(+) Index: llvm/test/Integer/2007-01-19-TruncSext.ll diff -c /dev/null llvm/test/Integer/2007-01-19-TruncSext.ll:1.1 *** /dev/null Sat Jan 20 02:31:55 2007 --- llvm/test/Integer/2007-01-19-TruncSext.ll Sat Jan 20 02:31:45 2007 *** *** 0 --- 1,29 + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + ; RUN: llvm-as < %s | lli --force-interpreter=true | grep -- '-255' + + %ARRAY = global [ 20 x i17 ] zeroinitializer + %FORMAT = constant [ 4 x i8 ] c"%d\0A\00" + + declare i32 %printf(i8* %format, ...) + + define void %multiply(i32 %index, i32 %X, i32 %Y) { + %Z = mul i32 %X, %Y + %P = getelementptr [20 x i17]* %ARRAY, i32 0, i32 %index + %Result = trunc i32 %Z to i17 + store i17 %Result, i17* %P + ret void + } + + define i32 %main(i32 %argc, i8** %argc) { + %i = bitcast i32 0 to i32 + call void %multiply(i32 %i, i32 -1, i32 255) + %P = getelementptr [20 x i17]* %ARRAY, i32 0, i32 0 + %X = load i17* %P + %result = sext i17 %X to i32 + %fmt = getelementptr [4 x i8]* %FORMAT, i32 0, i32 0 + call i32 (i8*,...)* %printf(i8* %fmt, i32 %result) + ret i32 %result + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.162 -> 1.163 --- Log message: Implement bit-accurate sext instruction. This patch fixes test/Integer/2007-01-17-TruncSext.ll --- Diffs of the changes: (+14 -10) Execution.cpp | 24 ++-- 1 files changed, 14 insertions(+), 10 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.162 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.163 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.162Wed Jan 17 20:12:51 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Sat Jan 20 02:32:52 2007 @@ -1347,21 +1347,25 @@ assert(SBitWidth <= 64 && DBitWidth <= 64 && "Integer types > 64 bits not supported"); assert(SBitWidth < DBitWidth && "Invalid sign extend"); - int64_t Extended = 0; - if (SBitWidth == 1) -// For sign extension from bool, we must extend the source bits. -Extended = 0 - (Src.Int1Val & 1); - else if (SBitWidth <= 8) -Extended = (int64_t) (int8_t)Src.Int8Val; + + // Normalize to a 64-bit value. + uint64_t Normalized = 0; + if (SBitWidth <= 8) +Normalized = Src.Int8Val; else if (SBitWidth <= 16) -Extended = (int64_t) (int16_t)Src.Int16Val; +Normalized = Src.Int16Val; else if (SBitWidth <= 32) -Extended = (int64_t) (int32_t)Src.Int32Val; +Normalized = Src.Int32Val; else -Extended = (int64_t) Src.Int64Val; +Normalized = Src.Int64Val; + + // Now do the bit-accurate sign extension manually. + bool isSigned = (Normalized & (1 << (SBitWidth-1))) != 0; + if (isSigned) +Normalized |= ~SITy->getBitMask(); // Now that we have a sign extended value, assign it to the destination - INTEGER_ASSIGN(Dest, DBitWidth, Extended); + INTEGER_ASSIGN(Dest, DBitWidth, Normalized); return Dest; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll
Changes in directory llvm/test/Assembler: 2002-04-04-PureVirtMethCall.ll updated: 1.3 -> 1.4 --- Log message: Fix incorrect run line. --- Diffs of the changes: (+1 -1) 2002-04-04-PureVirtMethCall.ll |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll diff -u llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll:1.3 llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll:1.4 --- llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll:1.3 Sat Dec 2 14:34:08 2006 +++ llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll Sat Jan 20 02:48:05 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade | llvm-as -o /dev/null -f +; RUN: llvm-upgrade < %s | llvm-as -o /dev/null -f type { { \2 *, \4 ** }, { \2 *, \4 ** } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.64 -> 1.65 --- Log message: Remove an unused variable. --- Diffs of the changes: (+0 -1) PrologEpilogInserter.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.64 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.65 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.64 Fri Jan 19 20:07:13 2007 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Sat Jan 20 03:21:54 2007 @@ -292,7 +292,6 @@ // Loop over all of the stack objects, assigning sequential addresses... MachineFrameInfo *FFI = Fn.getFrameInfo(); - unsigned StackAlignment = TFI.getStackAlignment(); unsigned MaxAlign = 0; // Start at the beginning of the local area. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp
Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.191 -> 1.192 --- Log message: One more try... --- Diffs of the changes: (+3 -2) X86RegisterInfo.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.191 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.192 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.191 Sat Jan 20 04:11:56 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Sat Jan 20 04:17:53 2007 @@ -998,12 +998,13 @@ // Get the number of bytes to allocate from the FrameInfo unsigned NumBytes = MFI->getStackSize(); - if (MFI->hasCalls() && !hasFP(MF)) + if (MFI->hasCalls() || MF.getFrameInfo()->hasVarSizedObjects()) { // When we have no frame pointer, we reserve argument space for call sites // in the function immediately on entry to the current function. This // eliminates the need for add/sub ESP brackets around call sites. // -NumBytes += MFI->getMaxCallFrameSize(); +if (!hasFP(MF)) + NumBytes += MFI->getMaxCallFrameSize(); // Round the size to a multiple of the alignment (don't forget the 4/8 byte // offset pushed by the caller though). No need to align the stack if this ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp
Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.190 -> 1.191 --- Log message: Last check-in was bogus. There is no need to align the stack if the function is a leaf function (and without alloca). --- Diffs of the changes: (+6 -3) X86RegisterInfo.cpp |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.190 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.191 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.190 Fri Jan 19 20:08:16 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Sat Jan 20 04:11:56 2007 @@ -991,6 +991,7 @@ MachineBasicBlock::iterator MBBI = MBB.begin(); MachineFrameInfo *MFI = MF.getFrameInfo(); unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); + unsigned AlignMask = Align - 1; const Function* Fn = MF.getFunction(); const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget(); MachineInstr *MI; @@ -1004,9 +1005,11 @@ // NumBytes += MFI->getMaxCallFrameSize(); - // Round the size to a multiple of the alignment (don't forget the 4/8 byte - // offset though). - NumBytes = ((NumBytes+SlotSize)+Align-1)/Align*Align - SlotSize; +// Round the size to a multiple of the alignment (don't forget the 4/8 byte +// offset pushed by the caller though). No need to align the stack if this +// is a leaf function. +NumBytes = (((NumBytes+SlotSize) + AlignMask) & ~AlignMask) - SlotSize; + } // Update frame info to pretend that this is part of the stack... MFI->setStackSize(NumBytes); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
Changes in directory llvm/lib/Target/ARM: ARMRegisterInfo.cpp updated: 1.37 -> 1.38 --- Log message: Round up stack to multiple of alignment only if it's a leaf function without alloca. --- Diffs of the changes: (+7 -4) ARMRegisterInfo.cpp | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.37 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.38 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.37Fri Jan 19 21:24:07 2007 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Sat Jan 20 04:22:33 2007 @@ -917,14 +917,17 @@ // If necessary, add one more SUBri to account for the call frame // and/or local storage, alloca area. - if (MFI->hasCalls() && !hasFP(MF)) + if (MFI->hasCalls() || MF.getFrameInfo()->hasVarSizedObjects()) { // We reserve argument space for call sites in the function immediately on // entry to the current function. This eliminates the need for add/sub // brackets around call sites. -NumBytes += MFI->getMaxCallFrameSize(); +if (!hasFP(MF)) + NumBytes += MFI->getMaxCallFrameSize(); + +// Round the size to a multiple of the alignment. +NumBytes = (NumBytes+Align-1)/Align*Align; + } - // Round the size to a multiple of the alignment. - NumBytes = (NumBytes+Align-1)/Align*Align; MFI->setStackSize(NumBytes); // Determine starting offsets of spill areas. ___ 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.268 -> 1.269 --- Log message: Fix for PR1108: http://llvm.org/PR1108 : type of insert_vector_elt index operand is PtrVT, not MVT::i32. --- Diffs of the changes: (+4 -3) DAGCombiner.cpp |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.268 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.269 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.268 Fri Jan 19 11:51:44 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Jan 20 04:10:26 2007 @@ -3251,7 +3251,7 @@ SmallVector BuildVecIndices; for (unsigned i = 0; i != NumInScalars; ++i) { if (N->getOperand(i).getOpcode() == ISD::UNDEF) { -BuildVecIndices.push_back(DAG.getNode(ISD::UNDEF, MVT::i32)); +BuildVecIndices.push_back(DAG.getNode(ISD::UNDEF, TLI.getPointerTy())); continue; } @@ -3265,12 +3265,13 @@ // Otherwise, use InIdx + VecSize unsigned Idx = cast(Extract.getOperand(1))->getValue(); - BuildVecIndices.push_back(DAG.getConstant(Idx+NumInScalars, MVT::i32)); + BuildVecIndices.push_back(DAG.getConstant(Idx+NumInScalars, +TLI.getPointerTy())); } // Add count and size info. BuildVecIndices.push_back(NumElts); -BuildVecIndices.push_back(DAG.getValueType(MVT::i32)); +BuildVecIndices.push_back(DAG.getValueType(TLI.getPointerTy())); // Return the new VVECTOR_SHUFFLE node. SDOperand Ops[5]; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.88 -> 1.89 --- Log message: Correct a comment. --- Diffs of the changes: (+1 -1) SimplifyLibCalls.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.88 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.89 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.88 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSat Jan 20 04:07:23 2007 @@ -274,7 +274,7 @@ return sqrt_func; } - /// @brief Return a Function* for the strlen libcall + /// @brief Return a Function* for the strcpy libcall Constant *get_strcpy() { if (!strcpy_func) strcpy_func = M->getOrInsertFunction("strcpy", ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] llvm-gcc4: use langhooks rather t han front-end calls in i386.c
Hi Devang, thanks for reviewing these patches. > Applied, after adding "APPLE LOCAL llvm" markers. This hasn't turned up in the llvm-gcc4 svn repository yet. Did you apply it there or to some other tree? (I'm waiting for it to turn up, so I can see how the APPLE markers should be done). Thanks again, Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/template3.cpp
Changes in directory llvm-test/SingleSource/UnitTests/Integer: template3.cpp updated: 1.2 -> 1.3 --- Log message: Don't use C++ iostreams, lli can't resolve cout or cerr. --- Diffs of the changes: (+6 -10) template3.cpp | 16 ++-- 1 files changed, 6 insertions(+), 10 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/template3.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.3 --- llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.2 Fri Jan 19 16:54:01 2007 +++ llvm-test/SingleSource/UnitTests/Integer/template3.cpp Sat Jan 20 13:35:27 2007 @@ -4,30 +4,26 @@ // //======// -#include +#include using namespace std; typedef int __attribute__ ((bitwidth(17))) int17; typedef int __attribute__ ((bitwidth(15))) int15; template struct X - { void f() { cout << "Primary template" << endl; } }; + { void f() { printf("Primary template\n"); } }; template struct X - { void f() { cout << "Partial specialization 1" << endl; - } }; + { void f() { printf("Partial specialization 1\n"); } }; template struct X - { void f() { cout << "Partial specialization 2" << endl; - } }; + { void f() { printf("Partial specialization 2\n"); } }; template struct X - { void f() { cout << "Partial specialization 3" << endl; - } }; + { void f() { printf("Partial specialization 3\n"); } }; template struct X - { void f() { cout << "Partial specialization 4" << endl; - } }; + { void f() { printf("Partial specialization 4\n"); } }; int main() { X a; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [PATCH] PR970: isFloatingPoint audit 1 of 5
http://llvm.org/PR970 is for an audit of calls to isFloatingPoint. In addition to http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-January/007822.html and http://llvm.org/PR1126, I've written 5 small patches which correct the various minor issues I observed.This first patch includes changes which should be uncontroversial, including several typo fixes and stripping some code which was found to be dead. There's one diff which doesn't read well; it's just removing an if block and correcting interior indentation.— Gordon pr970-1.patch Description: Binary data ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [PATCH] PR970: isFloatingPoint audit 2 of 5
This second patch in the series modifies several assertions to be correct. Comparison instructions do not apply to vectors, and SCEV will introduce canonical induction variables only of an integer type. — Gordon pr970-2.patch Description: Binary data ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [PATCH] PR970: isFloatingPoint audit 3 of 5
This patch includes two changes I'm not entirely certain of.First, in PatternMatch.h, the m_Neg matcher is incorrect for VP vectors. It matches sub <+0.0, +0.0, ...>, %x but the correct pattern is sub <-0.0, -0.0, ...>, %x. Since this matcher is dead, I simply commented it out with a note that it was broken. It would be simple to delete or fix it instead. (In fact, patch 4 includes just such a fix.)Second, in GlobalOpt.cpp, the ShrinkGlobalToBoolean transformation excludes FP, but allows vectors. It doesn't explain why. FP exclusion was added last November to fix a crash, it looks like. I made it exclude vectors, too, but there's no overwhelming reason why.In addition to these, in LowerSelect.cpp:bool LowerSelect::runOnFunction(Function &F) { bool Changed = false; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { if (SelectInst *SI = dyn_cast(I)) if (!OnlyFP || SI->getType()->isFloatingPoint()) { // Split this basic block in half right before the select instruction.This pass is dead except for opt -lowerselect, so there's no client to say which (isFloatingPoint or isFPOrFPVector) is the correct behavior for the OnlyFP option. The pass could be deleted, the OnlyFP option deleted, the test switched to !OnlyFP || SI->getType()->isFPOrFPVector(), or the pass extended to lower any combination of FP and integer scalars and vectors. Or, of course, it could be left alone!— Gordon pr970-3.patch Description: Binary data ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [PATCH] PR970: isFloatingPoint audit 5 of 5
This final patch simplifies the logic in SelectionDAGISel.cpp with no functional change. This construct was in use: if (I.getType()->isFloatingPoint()) visitFPBinary(I, ISD::FADD, ISD::VADD); else visitIntBinary(I, ISD::ADD, ISD::VADD); Which confusingly sent even floating-point vector operations through the visitIntBinary routine. However, this was not a bug because visitFPBinary and visitIntBinary were identical (as is the vector opcode parameter).This patch streamlines the logic and eliminates redundant methods.— Gordon pr970-5.patch Description: Binary data ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [PATCH] PR970: isFloatingPoint audit 4 of 5
This patch fixes several routines which deal with negation but failed to use the proper floating point negation formula, f(x) = -0.0 - x, for vectors. I simply factored out the logic to get the properly-signed "zero" value and extended it to get the correct floating-point vector.In most cases, these local logic errors were harmless because callers operated exclusively on scalar integers, but in four cases there look to be potential problems or missed optimizations.This patch fixes the dead m_Neg matcher that patch 3 commented out.at lib/Transforms/Scalar/InstructionCombining.cpp:6788: NegVal = InsertNewInstBefore( BinaryOperator::createNeg(SubOp->getOperand(1), "tmp"), SI);This can pass vectors to createNeg and looks like it would previous miscompile code by inserting a sub <+0.0, +0.0, etc.>, %x as it simplifies an _expression_. This patch should fix this case.at lib/Target/CBackend/CBackend.cpp:2129This is now http://llvm.org/PR1126.at lib/Transforms/Scalar/InstructionCombining.cpp:325:Please review this call site in getComplexity. It is clearly reachable with FP vector operands, and isNeg will now return true for vector negation, which is not a single machine instruction as fneg or integer negation are. Therefore, existing behavior might be preferable? If so, exclude vectors: - if (BinaryOperator::isNeg(V) || BinaryOperator::isNot(V)) + if ((!isa(V->getType()) && BinaryOperator::isNeg(V)) || + BinaryOperator::isNot(V))at lib/Transforms/Scalar/InstructionCombining.cpp:473:static inline Value *dyn_castNegVal(Value *V) { if (BinaryOperator::isNeg(V)) return BinaryOperator::getNegArgument(V);This could clearly be invoked with FP vector operands. With this patch, the following transformations would be extended to FP vectors: -A + B --> B - A A + -B --> A - B A - (-B) --> A + B -X * -Y --> X * YThese would already have applied to scalar FP operations, so I have to assume that they're IEEE-approved.Just one more!— Gordon pr970-4.patch Description: Binary data ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/RandomBoxes/015-AppleOpenGL.html
Changes in directory llvm-www/RandomBoxes: 015-AppleOpenGL.html added (r1.1) --- Log message: add a box --- Diffs of the changes: (+1 -0) 015-AppleOpenGL.html |1 + 1 files changed, 1 insertion(+) Index: llvm-www/RandomBoxes/015-AppleOpenGL.html diff -c /dev/null llvm-www/RandomBoxes/015-AppleOpenGL.html:1.1 *** /dev/null Sat Jan 20 14:05:32 2007 --- llvm-www/RandomBoxes/015-AppleOpenGL.html Sat Jan 20 14:05:22 2007 *** *** 0 --- 1 + Did you know that http://lists.cs.uiuc.edu/pipermail/llvmdev/2006-August/006492.html";>Apple is using LLVM as a critical component of the Mac OS 10.5 OpenGL stack? They use the LLVM optimizers and JITs for 4 architectures (x86-32/x86-64/ppc/ppc64) to accelerate software paths in the OpenGL stack. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.163 -> 1.164 --- Log message: Implement the signed icmp instructions properly. To do this we introduce a small inline function to sign extend a uint64_t value based on its type's bitwidth. This function is then used in both executeSExtInst and the various executeICMP_S** functions. --- Diffs of the changes: (+27 -17) Execution.cpp | 44 +++- 1 files changed, 27 insertions(+), 17 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.163 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.164 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.163Sat Jan 20 02:32:52 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Sat Jan 20 14:12:29 2007 @@ -67,6 +67,15 @@ static GenericValue executeSelectInst(GenericValue Src1, GenericValue Src2, GenericValue Src3); +inline uint64_t doSignExtension(uint64_t Val, const IntegerType* ITy) { + // Determine if the value is signed or not + bool isSigned = (Val & (1 << (ITy->getBitWidth()-1))) != 0; + // If its signed, extend the sign bits + if (isSigned) +Val |= ~ITy->getBitMask(); + return Val; +} + GenericValue Interpreter::getConstantExprValue (ConstantExpr *CE, ExecutionContext &SF) { switch (CE->getOpcode()) { @@ -385,22 +394,26 @@ #define IMPLEMENT_SIGNED_ICMP(OP, TY) \ case Type::IntegerTyID: { \ - unsigned BitWidth = cast(TY)->getBitWidth(); \ - if (BitWidth == 1) \ - Dest.Int1Val = ((int8_t)Src1.Int1Val) OP ((int8_t)Src2.Int1Val); \ - else if (BitWidth <= 8) \ - Dest.Int1Val = ((int8_t)Src1.Int8Val) OP ((int8_t)Src2.Int8Val); \ - else if (BitWidth <= 16) \ - Dest.Int1Val = ((int16_t)Src1.Int16Val) OP ((int16_t)Src2.Int16Val); \ - else if (BitWidth <= 32) \ - Dest.Int1Val = ((int32_t)Src1.Int32Val) OP ((int32_t)Src2.Int32Val); \ - else if (BitWidth <= 64) \ - Dest.Int1Val = ((int64_t)Src1.Int64Val) OP ((int64_t)Src2.Int64Val); \ - else { \ + const IntegerType* ITy = cast(TY); \ + unsigned BitWidth = ITy->getBitWidth(); \ + int64_t LHS = 0, RHS = 0; \ + if (BitWidth <= 8) { \ + LHS = int64_t(doSignExtension(uint64_t(Src1.Int8Val), ITy)); \ + RHS = int64_t(doSignExtension(uint64_t(Src2.Int8Val), ITy)); \ + } else if (BitWidth <= 16) { \ + LHS = int64_t(doSignExtension(uint64_t(Src1.Int16Val), ITy)); \ + RHS = int64_t(doSignExtension(uint64_t(Src2.Int16Val), ITy)); \ +} else if (BitWidth <= 32) { \ + LHS = int64_t(doSignExtension(uint64_t(Src1.Int32Val), ITy)); \ + RHS = int64_t(doSignExtension(uint64_t(Src2.Int32Val), ITy)); \ +} else if (BitWidth <= 64) { \ + LHS = int64_t(doSignExtension(uint64_t(Src1.Int64Val), ITy)); \ + RHS = int64_t(doSignExtension(uint64_t(Src2.Int64Val), ITy)); \ +} else { \ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); \ } \ - maskToBitWidth(Dest, BitWidth); \ + Dest.Int1Val = LHS OP RHS; \ break; \ } @@ -1359,10 +1372,7 @@ else Normalized = Src.Int64Val; - // Now do the bit-accurate sign extension manually. - bool isSigned = (Normalized & (1 << (SBitWidth-1))) != 0; - if (isSigned) -Normalized |= ~SITy->getBitMask(); + Normalized = doSignExtension(Normalized, SITy); // Now that we have a sign extended value, assign it to the destination INTEGER_ASSIGN(Dest, DBitWidth, Normalized); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Integer/a7.ll a7.ll.out
Changes in directory llvm/test/Integer: a7.ll updated: 1.2 -> 1.3 a7.ll.out updated: 1.2 -> 1.3 --- Log message: Try a negative number with ashr. --- Diffs of the changes: (+2 -0) a7.ll |1 + a7.ll.out |1 + 2 files changed, 2 insertions(+) Index: llvm/test/Integer/a7.ll diff -u llvm/test/Integer/a7.ll:1.2 llvm/test/Integer/a7.ll:1.3 --- llvm/test/Integer/a7.ll:1.2 Fri Jan 19 08:23:46 2007 +++ llvm/test/Integer/a7.ll Sat Jan 20 14:30:13 2007 @@ -19,6 +19,7 @@ %k = constant i7 lshr(i7 127 , i8 7) %l = constant i7 ashr(i7 127 , i8 6) %m = constant i7 ashr(i7 127 , i8 7) +%m2= constant i7 ashr(i7 -1 , i8 3) %n = constant i7 mul(i7 127, i7 2) %t = constant i7 mul(i7 -63, i7 -2) Index: llvm/test/Integer/a7.ll.out diff -u llvm/test/Integer/a7.ll.out:1.2 llvm/test/Integer/a7.ll.out:1.3 --- llvm/test/Integer/a7.ll.out:1.2 Fri Jan 19 08:23:46 2007 +++ llvm/test/Integer/a7.ll.out Sat Jan 20 14:30:13 2007 @@ -14,6 +14,7 @@ %k = constant i7 0 ; [#uses=0] %l = constant i7 -1; [#uses=0] %m = constant i7 -1; [#uses=0] +%m2 = constant i7 -1 ; [#uses=0] %n = constant i7 -2; [#uses=0] %t = constant i7 -2; [#uses=0] %u = constant i7 -64 ; [#uses=0] ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/autoconf/configure.ac
Changes in directory llvm/autoconf: configure.ac updated: 1.261 -> 1.262 --- Log message: For PR808: http://llvm.org/PR808 : Add support for NetBSD. --- Diffs of the changes: (+5 -0) configure.ac |5 + 1 files changed, 5 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.261 llvm/autoconf/configure.ac:1.262 --- llvm/autoconf/configure.ac:1.261Sat Jan 20 01:40:26 2007 +++ llvm/autoconf/configure.ac Sat Jan 20 14:43:35 2007 @@ -131,6 +131,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="OpenBSD" llvm_cv_platform_type="Unix" ;; + *-*-netbsd*) +llvm_cv_link_all_option="-Wl,--whole-archive" +llvm_cv_no_link_all_option="-Wl,--no-whole-archive" +llvm_cv_os_type="NetBSD" +llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/System/Mutex.cpp
Changes in directory llvm/lib/System: Mutex.cpp updated: 1.10 -> 1.11 --- Log message: For PR808: http://llvm.org/PR808 : NetBSD also doesn't have pthread_mutexattr_setpshared --- Diffs of the changes: (+1 -1) Mutex.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/System/Mutex.cpp diff -u llvm/lib/System/Mutex.cpp:1.10 llvm/lib/System/Mutex.cpp:1.11 --- llvm/lib/System/Mutex.cpp:1.10 Thu Nov 2 01:59:59 2006 +++ llvm/lib/System/Mutex.cpp Sat Jan 20 14:44:38 2007 @@ -76,7 +76,7 @@ errorcode = pthread_mutexattr_settype(&attr, kind); assert(errorcode == 0); -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/configure
Changes in directory llvm: configure updated: 1.266 -> 1.267 --- Log message: For PR808: http://llvm.org/PR808 : Regenerate to include NetBSD. --- Diffs of the changes: (+29 -24) configure | 53 + 1 files changed, 29 insertions(+), 24 deletions(-) Index: llvm/configure diff -u llvm/configure:1.266 llvm/configure:1.267 --- llvm/configure:1.266Sat Jan 20 01:48:49 2007 +++ llvm/configure Sat Jan 20 14:45:39 2007 @@ -2255,6 +2255,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="OpenBSD" llvm_cv_platform_type="Unix" ;; + *-*-netbsd*) +llvm_cv_link_all_option="-Wl,--whole-archive" +llvm_cv_no_link_all_option="-Wl,--no-whole-archive" +llvm_cv_os_type="NetBSD" +llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" @@ -10329,7 +10334,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12481 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14191,11 +14196,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14194: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14199: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14198: \$? = $ac_status" >&5 + echo "$as_me:14203: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14459,11 +14464,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14462: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14467: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14466: \$? = $ac_status" >&5 + echo "$as_me:14471: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14563,11 +14568,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14566: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14571: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14570: \$? = $ac_status" >&5 + echo "$as_me:14575: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17015,7 +17020,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19491: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19490: \$? = $ac_status" >&5 + echo "$as_me:19495: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19587,11 +19592,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19590: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19595: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19594: \$? = $ac_status" >&5 + echo "$as_me:19599: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21157,11 +21162,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21160: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21165: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21164: \$? = $ac_status" >&5 + echo "$as_me:21169: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21261,1
[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.126 -> 1.127 --- Log message: DOUT still evaluates side effects, even though it doesn't print. This means that disassembleBuffer will be called even if NDEBUG, but the result will be ignored. --- Diffs of the changes: (+2 -0) JITEmitter.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.126 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.127 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.126 Fri Jan 19 14:17:59 2007 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Sat Jan 20 14:51:43 2007 @@ -866,6 +866,7 @@ << Relocations.size() << " relocations\n"; Relocations.clear(); +#ifndef NDEBUG DOUT << "Disassembled code:\n" #if defined(__i386__) << disassembleBuffer(FnStart, FnEnd-FnStart, @@ -876,6 +877,7 @@ #else << "N/A\n"; #endif +#endif return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
>>// Update the GOT entry for F to point to the new code. >> - if(MemMgr.isManagingGOT()) { >> + if (MemMgr.isManagingGOT()) { >> unsigned idx = getJITResolver(this).getGOTIndexForAddr((void*) >> BufferBegin); >> if (((void**)MemMgr.getGOTBase())[idx] != (void*)BufferBegin) { >>DOUT << "GOT was out of date for " << (void*)BufferBegin >> @@ -864,6 +865,18 @@ >> << ": " << (FnEnd-FnStart) << " bytes of text, " >> << Relocations.size() << " relocations\n"; >>Relocations.clear(); >> + >> + DOUT << "Disassembled code:\n" >> +#if defined(__i386__) >> + << disassembleBuffer(FnStart, FnEnd-FnStart, >> +Disassembler::X86_32, (uint32_t) >> FnStart); > > I'm not thrilled about having this system specific > #if/#elif/#else/#endif in the JITEmitter. I would prefer to see the > disassemblBuffer function become part of lib/System instead of > lib/Support and DTRT for any combination of supported platforms. The > list of disassembled architectures will grow over time (PPC/ARM/Sparc) > and I'd rather not have this sprinkled across the users of > disassembleBuffer but in one location in lib/System. FWIW, I agree with Reid. I think disassembleBuffer can just assume that we want to disassemble for the current ISA. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> For this transform: store V, (cast P) -> store (cast V), P > don't allow the transform if V and the pointer's element type are > different > width integer types. To fix this, I'd vastly prefer that you add TargetData::getTypeSizeInBits, rather than adding special cases for variable width integers (the current special case for bool is already bad). Change this code (line 8189): if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) || isa(SrcPTy)) && IC.getTargetData().getTypeSize(SrcPTy) == IC.getTargetData().getTypeSize(DestPTy)) { In any case, with either change, you can take out the "&& SrcPTy != Type::Int1Ty" check. The same xform happens for load, FWIW. It should be fixed also. -Chris > > > --- > Diffs of the changes: (+4 -3) > > InstructionCombining.cpp |7 --- > 1 files changed, 4 insertions(+), 3 deletions(-) > > > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.604 > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.605 > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.604 Fri > Jan 19 15:13:56 2007 > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jan 19 > 15:20:31 2007 > @@ -8162,7 +8162,7 @@ >return 0; > } > > -/// InstCombineStoreToCast - Fold 'store V, (cast P)' -> store > (cast V), P' > +/// InstCombineStoreToCast - Fold store V, (cast P) -> store (cast > V), P > /// when possible. > static Instruction *InstCombineStoreToCast(InstCombiner &IC, > StoreInst &SI) { >User *CI = cast(SI.getOperand(1)); > @@ -8206,8 +8206,9 @@ >if (isa(SIOp0->getType())) > opcode = Instruction::PtrToInt; >else if (const IntegerType* SITy = dyn_cast > (CastSrcTy)) > -assert(DITy->getBitWidth() == SITy->getBitWidth() && > - "Illegal store instruction"); > +if (SITy->getBitWidth() != DITy->getBitWidth()) > + return 0; // Don't do this transform on unequal bit > widths. > +// else, BitCast is fine > } > if (Constant *C = dyn_cast(SIOp0)) >NewCast = ConstantExpr::getCast(opcode, C, CastDstTy); > > > > ___ > 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
Re: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp
> For PR808: http://llvm.org/PR808 : > NetBSD also doesn't have pthread_mutexattr_setpshared > > -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) > +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined > (__NetBSD__) > // Make it a process local mutex > errorcode = pthread_mutexattr_setpshared(&attr, > PTHREAD_PROCESS_PRIVATE); > #endif Can't we just change this to: #ifdef PTHREAD_PROCESS_PRIVATE ? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp
I think it would be more appropriate to add a test for pthread_mutexattr_setpshared in the configure script. On Linux, PTHREAD_PROCESS_PRIVATE is both an enumerator and a #define. If its only an enumerator on some system, that check would be bad. Furthermore, a pthread.h could define the macro while not defining the function (which would be a bug, but it could happen). The check for the function is the safest. Reid. Perhaps, but what if PTHREAD_PROCESS_PRIVATE is defined in a header file and On Sat, 2007-01-20 at 14:13 -0800, Chris Lattner wrote: > > For PR808: http://llvm.org/PR808 : > > NetBSD also doesn't have pthread_mutexattr_setpshared > > > > > -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) > > +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined > > (__NetBSD__) > > // Make it a process local mutex > > errorcode = pthread_mutexattr_setpshared(&attr, > > PTHREAD_PROCESS_PRIVATE); > > #endif > > Can't we just change this to: > > #ifdef PTHREAD_PROCESS_PRIVATE > > ? > > -Chris > ___ > 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
Re: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp
On Jan 20, 2007, at 2:20 PM, Reid Spencer wrote: > I think it would be more appropriate to add a test for > pthread_mutexattr_setpshared in the configure script. On Linux, > PTHREAD_PROCESS_PRIVATE is both an enumerator and a #define. If its > only > an enumerator on some system, that check would be bad. Furthermore, a > pthread.h could define the macro while not defining the function > (which > would be a bug, but it could happen). The check for the function > is the > safest. It is also a macro on macos. I believe that it is standard for these things to be macros to allow #ifdef conditionals. Why don't we just do this for now, and switch to a full autoconf test if we find that to be insufficient? -Chris > Reid. > > Perhaps, but what if PTHREAD_PROCESS_PRIVATE is defined in a header > file > and > On Sat, 2007-01-20 at 14:13 -0800, Chris Lattner wrote: >>> For PR808: http://llvm.org/PR808 : >>> NetBSD also doesn't have pthread_mutexattr_setpshared >> >>> >>> -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) >>> +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined >>> (__NetBSD__) >>> // Make it a process local mutex >>> errorcode = pthread_mutexattr_setpshared(&attr, >>> PTHREAD_PROCESS_PRIVATE); >>> #endif >> >> Can't we just change this to: >> >> #ifdef PTHREAD_PROCESS_PRIVATE >> >> ? >> >> -Chris >> ___ >> 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/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.76 -> 1.77 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+186 -57) TargetData.cpp | 243 +++-- 1 files changed, 186 insertions(+), 57 deletions(-) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.76 llvm/lib/Target/TargetData.cpp:1.77 --- llvm/lib/Target/TargetData.cpp:1.76 Fri Jan 12 01:05:13 2007 +++ llvm/lib/Target/TargetData.cpp Sat Jan 20 16:35:55 2007 @@ -34,8 +34,11 @@ RegisterPass X("targetdata", "Target Data Layout"); } -static inline void getTypeInfo(const Type *Ty, const TargetData *TD, - uint64_t &Size, unsigned char &Alignment); +static inline void getTypeInfoABI(const Type *Ty, const TargetData *TD, + uint64_t &Size, unsigned char &Alignment); + +static inline void getTypeInfoPref(const Type *Ty, const TargetData *TD, + uint64_t &Size, unsigned char &Alignment); //===--===// // Support for StructLayout @@ -52,7 +55,7 @@ unsigned char A; unsigned TyAlign; uint64_t TySize; -getTypeInfo(Ty, &TD, TySize, A); +getTypeInfoABI(Ty, &TD, TySize, A); TyAlign = ST->isPacked() ? 1 : A; // Add padding if necessary to make the data element aligned properly... @@ -80,8 +83,7 @@ /// return the structure index that contains it. unsigned StructLayout::getElementContainingOffset(uint64_t Offset) const { std::vector::const_iterator SI = -std::upper_bound(MemberOffsets.begin(), MemberOffsets.end(), - Offset); +std::upper_bound(MemberOffsets.begin(), MemberOffsets.end(), Offset); assert(SI != MemberOffsets.begin() && "Offset not in structure type!"); --SI; assert(*SI <= Offset && "upper_bound didn't work"); @@ -99,15 +101,24 @@ std::string temp = TargetDescription; LittleEndian = false; - PointerSize = 8; - PointerAlignment = 8; - DoubleAlignment = 8; - FloatAlignment = 4; - LongAlignment = 8; - IntAlignment = 4; - ShortAlignment = 2; - ByteAlignment = 1; - BoolAlignment = 1; + PointerMemSize = 8; + PointerABIAlignment = 8; + DoubleABIAlignment = 8; + FloatABIAlignment = 4; + LongABIAlignment = 8; + IntABIAlignment = 4; + ShortABIAlignment = 2; + ByteABIAlignment = 1; + BoolABIAlignment = 1; + BoolPrefAlignment = BoolABIAlignment; + BytePrefAlignment = ByteABIAlignment; + ShortPrefAlignment = ShortABIAlignment; + IntPrefAlignment = IntABIAlignment; + LongPrefAlignment = LongABIAlignment; + FloatPrefAlignment = FloatABIAlignment; + DoublePrefAlignment = DoubleABIAlignment; + PointerPrefAlignment = PointerABIAlignment; + AggMinPrefAlignment = 0; while (!temp.empty()) { std::string token = getToken(temp, "-"); @@ -122,29 +133,58 @@ LittleEndian = true; break; case 'p': - PointerSize = atoi(getToken(token,":").c_str()) / 8; - PointerAlignment = atoi(getToken(token,":").c_str()) / 8; + PointerMemSize = atoi(getToken(token,":").c_str()) / 8; + PointerABIAlignment = atoi(getToken(token,":").c_str()) / 8; + PointerPrefAlignment = atoi(getToken(token,":").c_str()) / 8; + if (PointerPrefAlignment == 0) +PointerPrefAlignment = PointerABIAlignment; break; case 'd': - DoubleAlignment = atoi(getToken(token,":").c_str()) / 8; + DoubleABIAlignment = atoi(getToken(token,":").c_str()) / 8; + DoublePrefAlignment = atoi(getToken(token,":").c_str()) / 8; + if (DoublePrefAlignment == 0) +DoublePrefAlignment = DoubleABIAlignment; break; case 'f': - FloatAlignment = atoi(getToken(token, ":").c_str()) / 8; + FloatABIAlignment = atoi(getToken(token, ":").c_str()) / 8; + FloatPrefAlignment = atoi(getToken(token,":").c_str()) / 8; + if (FloatPrefAlignment == 0) +FloatPrefAlignment = FloatABIAlignment; break; case 'l': - LongAlignment = atoi(getToken(token, ":").c_str()) / 8; + LongABIAlignment = atoi(getToken(token, ":").c_str()) / 8; + LongPrefAlignment = atoi(getToken(token,":").c_str()) / 8; + if (LongPrefAlignment == 0) +LongPrefAlignment = LongABIAlignment; break; case 'i': - IntAlignment = atoi(getToken(token, ":").c_str()) / 8; + IntABIAlignment = atoi(getToken(token, ":").c_str()) / 8; + IntPrefAlignment = atoi(getToken(token,":").c_str()) / 8; + if (IntPrefAlignment == 0) +IntPrefAlignment = IntABIAlignment; break; case 's': - ShortAlignment = atoi(getToken(token, ":").c_str()) / 8; + ShortABIAlignment = atoi(getToken(token, ":").c_str()) / 8; + ShortPrefAlignment = at
[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp
Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.138 -> 1.139 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+2 -2) X86TargetMachine.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.138 llvm/lib/Target/X86/X86TargetMachine.cpp:1.139 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.138 Thu Jan 18 16:27:12 2007 +++ llvm/lib/Target/X86/X86TargetMachine.cppSat Jan 20 16:35:55 2007 @@ -109,8 +109,8 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS, bool is64Bit) : Subtarget(M, FS, is64Bit), DataLayout(Subtarget.is64Bit() ? - std::string("e-p:64:64-d:32-l:32") : - std::string("e-p:32:32-d:32-l:32")), + std::string("e-p:64:64-d:32:64-l:32") : + std::string("e-p:32:32-d:32:64-l:32")), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4), InstrInfo(*this), JITInfo(*this), TLInfo(*this) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ValueTypes.cpp
Changes in directory llvm/lib/VMCore: ValueTypes.cpp updated: 1.11 -> 1.12 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+11 -2) ValueTypes.cpp | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/ValueTypes.cpp diff -u llvm/lib/VMCore/ValueTypes.cpp:1.11 llvm/lib/VMCore/ValueTypes.cpp:1.12 --- llvm/lib/VMCore/ValueTypes.cpp:1.11 Fri Jan 19 15:13:56 2007 +++ llvm/lib/VMCore/ValueTypes.cpp Sat Jan 20 16:35:55 2007 @@ -82,8 +82,8 @@ } /// MVT::getTypeForValueType - This method returns an LLVM type corresponding -/// to the specified ValueType. For integer types, this returns an unsigned -/// type. Note that this will abort for types that cannot be represented. +/// to the specified ValueType. Note that this will abort for types that cannot +/// be represented. const Type *MVT::getTypeForValueType(MVT::ValueType VT) { switch (VT) { default: assert(0 && "ValueType does not correspond to LLVM type!"); @@ -95,5 +95,14 @@ case MVT::i64: return Type::Int64Ty; case MVT::f32: return Type::FloatTy; case MVT::f64: return Type::DoubleTy; + case MVT::v8i8: return PackedType::get(Type::Int8Ty, 8); + case MVT::v4i16: return PackedType::get(Type::Int16Ty, 4); + case MVT::v2i32: return PackedType::get(Type::Int32Ty, 2); + case MVT::v16i8: return PackedType::get(Type::Int8Ty, 16); + case MVT::v8i16: return PackedType::get(Type::Int16Ty, 8); + case MVT::v4i32: return PackedType::get(Type::Int32Ty, 4); + case MVT::v2i64: return PackedType::get(Type::Int64Ty, 2); + case MVT::v4f32: return PackedType::get(Type::FloatTy, 4); + case MVT::v2f64: return PackedType::get(Type::DoubleTy, 2); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp
Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.89 -> 1.90 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+1 -1) JIT.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.89 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.90 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.89 Fri Jan 12 01:05:13 2007 +++ llvm/lib/ExecutionEngine/JIT/JIT.cppSat Jan 20 16:35:55 2007 @@ -338,7 +338,7 @@ // compilation. const Type *GlobalType = GV->getType()->getElementType(); size_t S = getTargetData()->getTypeSize(GlobalType); -size_t A = getTargetData()->getTypeAlignment(GlobalType); +size_t A = getTargetData()->getTypeAlignmentPref(GlobalType); if (A <= 8) { Ptr = malloc(S); } else { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp MachineFunction.cpp
Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.34 -> 1.35 MachOWriter.cpp updated: 1.16 -> 1.17 MachineFunction.cpp updated: 1.107 -> 1.108 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+4 -3) ELFWriter.cpp |2 +- MachOWriter.cpp |2 +- MachineFunction.cpp |3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.34 llvm/lib/CodeGen/ELFWriter.cpp:1.35 --- llvm/lib/CodeGen/ELFWriter.cpp:1.34 Wed Jan 17 19:23:11 2007 +++ llvm/lib/CodeGen/ELFWriter.cpp Sat Jan 20 16:35:55 2007 @@ -241,7 +241,7 @@ } const Type *GVType = (const Type*)GV->getType(); - unsigned Align = TM.getTargetData()->getTypeAlignment(GVType); + unsigned Align = TM.getTargetData()->getTypeAlignmentPref(GVType); unsigned Size = TM.getTargetData()->getTypeSize(GVType); // If this global has a zero initializer, it is part of the .bss or common Index: llvm/lib/CodeGen/MachOWriter.cpp diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.16 llvm/lib/CodeGen/MachOWriter.cpp:1.17 --- llvm/lib/CodeGen/MachOWriter.cpp:1.16 Wed Jan 17 19:23:11 2007 +++ llvm/lib/CodeGen/MachOWriter.cppSat Jan 20 16:35:55 2007 @@ -309,7 +309,7 @@ unsigned Size = TM.getTargetData()->getTypeSize(Ty); unsigned Align = GV->getAlignment(); if (Align == 0) -Align = TM.getTargetData()->getTypeAlignment(Ty); +Align = TM.getTargetData()->getTypeAlignmentPref(Ty); MachOSym Sym(GV, Mang->getValueName(GV), Sec->Index, TM); Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.107 llvm/lib/CodeGen/MachineFunction.cpp:1.108 --- llvm/lib/CodeGen/MachineFunction.cpp:1.107 Thu Dec 21 20:04:05 2006 +++ llvm/lib/CodeGen/MachineFunction.cppSat Jan 20 16:35:55 2007 @@ -123,7 +123,8 @@ const TargetData &TD = *TM.getTargetData(); bool IsPic = TM.getRelocationModel() == Reloc::PIC_; unsigned EntrySize = IsPic ? 4 : TD.getPointerSize(); - unsigned Alignment = IsPic ? TD.getIntAlignment() : TD.getPointerAlignment(); + unsigned Alignment = IsPic ? TD.getIntABIAlignment() + : TD.getPointerABIAlignment(); JumpTableInfo = new MachineJumpTableInfo(EntrySize, Alignment); BasicBlocks.Parent = this; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
Changes in directory llvm/lib/Target/Sparc: SparcAsmPrinter.cpp updated: 1.75 -> 1.76 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+2 -2) SparcAsmPrinter.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.75 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.76 --- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.75 Tue Dec 19 16:59:26 2006 +++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Sat Jan 20 16:35:55 2007 @@ -229,7 +229,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); - unsigned Align = TD->getTypeAlignment(C->getType()); + unsigned Align = TD->getTypeAlignmentPref(C->getType()); if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || @@ -239,7 +239,7 @@ O << "\t.local " << name << "\n"; O << "\t.comm " << name << "," << TD->getTypeSize(C->getType()) - << "," << (unsigned)TD->getTypeAlignment(C->getType()); + << "," << Align; O << "\n"; } else { switch (I->getLinkage()) { ___ 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/LegalizeDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.456 -> 1.457 SelectionDAGISel.cpp updated: 1.342 -> 1.343 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+13 -15) LegalizeDAG.cpp | 13 + SelectionDAGISel.cpp | 15 --- 2 files changed, 13 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.456 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.457 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.456 Fri Jan 19 15:13:56 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Jan 20 16:35:55 2007 @@ -3029,7 +3029,7 @@ // new ones, as reuse may inhibit scheduling. const Type *Ty = MVT::getTypeForValueType(ExtraVT); unsigned TySize = (unsigned)TLI.getTargetData()->getTypeSize(Ty); -unsigned Align = TLI.getTargetData()->getTypeAlignment(Ty); +unsigned Align = TLI.getTargetData()->getTypeAlignmentPref(Ty); MachineFunction &MF = DAG.getMachineFunction(); int SSFI = MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align); @@ -3937,7 +3937,9 @@ SDOperand SelectionDAGLegalize::CreateStackTemporary(MVT::ValueType VT) { MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo(); unsigned ByteSize = MVT::getSizeInBits(VT)/8; - int FrameIdx = FrameInfo->CreateStackObject(ByteSize, ByteSize); + const Type *Ty = MVT::getTypeForValueType(VT); + unsigned StackAlign = (unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); return DAG.getFrameIndex(FrameIdx, TLI.getPointerTy()); } @@ -4242,9 +4244,12 @@ if (Op0.getValueType() == MVT::i32) { // simple 32-bit [signed|unsigned] integer to float/double expansion -// get the stack frame index of a 8 byte buffer +// get the stack frame index of a 8 byte buffer, pessimistically aligned MachineFunction &MF = DAG.getMachineFunction(); -int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); +const Type *F64Type = MVT::getTypeForValueType(MVT::f64); +unsigned StackAlign = + (unsigned)TLI.getTargetData()->getTypeAlignmentPref(F64Type); +int SSFI = MF.getFrameInfo()->CreateStackObject(8, StackAlign); // get address of 8 byte buffer SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy()); // word offset constant for Hi/Lo address computation Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.342 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.343 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.342Thu Jan 11 06:24:14 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 20 16:35:55 2007 @@ -244,17 +244,9 @@ const Type *Ty = AI->getAllocatedType(); uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); unsigned Align = - std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), + std::max((unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty), AI->getAlignment()); -// If the alignment of the value is smaller than the size of the -// value, and if the size of the value is particularly small -// (<= 8 bytes), round up to the size of the value for potentially -// better performance. -// -// FIXME: This could be made better with a preferred alignment hook in -// TargetData. It serves primarily to 8-byte align doubles for X86. -if (Align < TySize && TySize <= 8) Align = TySize; TySize *= CUI->getZExtValue(); // Get total allocated size. if (TySize == 0) TySize = 1; // Don't create zero-sized stack objects. StaticAllocaMap[AI] = @@ -1729,8 +1721,9 @@ const Type *Ty = I.getAllocatedType(); uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); - unsigned Align = std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), -I.getAlignment()); + unsigned Align = +std::max((unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty), + I.getAlignment()); SDOperand AllocSize = getValue(I.getArraySize()); MVT::ValueType IntPtr = TLI.getPointerTy(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.43 -> 1.44 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+131 -50) TargetData.h | 181 ++- 1 files changed, 131 insertions(+), 50 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.43 llvm/include/llvm/Target/TargetData.h:1.44 --- llvm/include/llvm/Target/TargetData.h:1.43 Wed Jan 17 01:28:48 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 16:35:55 2007 @@ -35,15 +35,28 @@ class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false - unsigned char BoolAlignment; // Defaults to 1 byte - unsigned char ByteAlignment; // Defaults to 1 byte - unsigned char ShortAlignment;// Defaults to 2 bytes - unsigned char IntAlignment; // Defaults to 4 bytes - unsigned char LongAlignment; // Defaults to 8 bytes - unsigned char FloatAlignment;// Defaults to 4 bytes - unsigned char DoubleAlignment; // Defaults to 8 bytes - unsigned char PointerSize; // Defaults to 8 bytes - unsigned char PointerAlignment; // Defaults to 8 bytes + + // ABI alignments + unsigned char BoolABIAlignment; // Defaults to 1 byte + unsigned char ByteABIAlignment; // Defaults to 1 byte + unsigned char ShortABIAlignment; // Defaults to 2 bytes + unsigned char IntABIAlignment;// Defaults to 4 bytes + unsigned char LongABIAlignment; // Defaults to 8 bytes + unsigned char FloatABIAlignment; // Defaults to 4 bytes + unsigned char DoubleABIAlignment; // Defaults to 8 bytes + unsigned char PointerMemSize;// Defaults to 8 bytes + unsigned char PointerABIAlignment;// Defaults to 8 bytes + + // Preferred stack/global type alignments + unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment + unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment + unsigned char ShortPrefAlignment; // Defaults to ShortABIAlignment + unsigned char IntPrefAlignment; // Defaults to IntABIAlignment + unsigned char LongPrefAlignment;// Defaults to LongABIAlignment + unsigned char FloatPrefAlignment; // Defaults to FloatABIAlignment + unsigned char DoublePrefAlignment; // Defaults to DoubleABIAlignment + unsigned char PointerPrefAlignment; // Defaults to PointerABIAlignment + unsigned char AggMinPrefAlignment; // Defaults to 0 bytes public: /// Default ctor - This has to exist, because this is a pass, but it should @@ -68,15 +81,24 @@ TargetData(const TargetData &TD) : ImmutablePass(), LittleEndian(TD.isLittleEndian()), -BoolAlignment(TD.getBoolAlignment()), -ByteAlignment(TD.getByteAlignment()), -ShortAlignment(TD.getShortAlignment()), -IntAlignment(TD.getIntAlignment()), -LongAlignment(TD.getLongAlignment()), -FloatAlignment(TD.getFloatAlignment()), -DoubleAlignment(TD.getDoubleAlignment()), -PointerSize(TD.getPointerSize()), -PointerAlignment(TD.getPointerAlignment()) { +BoolABIAlignment(TD.getBoolABIAlignment()), +ByteABIAlignment(TD.getByteABIAlignment()), +ShortABIAlignment(TD.getShortABIAlignment()), +IntABIAlignment(TD.getIntABIAlignment()), +LongABIAlignment(TD.getLongABIAlignment()), +FloatABIAlignment(TD.getFloatABIAlignment()), +DoubleABIAlignment(TD.getDoubleABIAlignment()), +PointerMemSize(TD.getPointerSize()), +PointerABIAlignment(TD.getPointerABIAlignment()), +BoolPrefAlignment(TD.getBoolPrefAlignment()), +BytePrefAlignment(TD.getBytePrefAlignment()), +ShortPrefAlignment(TD.getShortPrefAlignment()), +IntPrefAlignment(TD.getIntPrefAlignment()), +LongPrefAlignment(TD.getLongPrefAlignment()), +FloatPrefAlignment(TD.getFloatPrefAlignment()), +DoublePrefAlignment(TD.getDoublePrefAlignment()), +PointerPrefAlignment(TD.getPointerPrefAlignment()), +AggMinPrefAlignment(TD.getAggMinPrefAlignment()) { } ~TargetData(); // Not virtual, do not subclass this class @@ -86,10 +108,16 @@ /// Parse a target data layout string, initializing the various TargetData /// members along the way. A TargetData specification string looks like /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" and specifies the - /// target's endianess, the alignments of various data types and - /// the size of pointers. The "-" is used as a separator and ":" - /// separates a token from its argument. Alignment is indicated in bits - /// and internally converted to the appropriate number of bytes. + /// target's endianess, the ABI alignments of various data types and + /// the size of pointers. + /// + /// "-" is used as a separator and ":" separates a token from its argument. +
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.605 -> 1.606 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+15 -9) InstructionCombining.cpp | 24 +++- 1 files changed, 15 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.605 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.606 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.605 Fri Jan 19 15:20:31 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Jan 20 16:35:55 2007 @@ -5779,8 +5779,8 @@ const Type *CastElTy = PTy->getElementType(); if (!AllocElTy->isSized() || !CastElTy->isSized()) return 0; - unsigned AllocElTyAlign = TD->getTypeAlignment(AllocElTy); - unsigned CastElTyAlign = TD->getTypeAlignment(CastElTy); + unsigned AllocElTyAlign = TD->getTypeAlignmentABI(AllocElTy); + unsigned CastElTyAlign = TD->getTypeAlignmentABI(CastElTy); if (CastElTyAlign < AllocElTyAlign) return 0; // If the allocation has multiple uses, only promote it if we are strictly @@ -6878,18 +6878,22 @@ if (GlobalVariable *GV = dyn_cast(V)) { unsigned Align = GV->getAlignment(); if (Align == 0 && TD) - Align = TD->getTypeAlignment(GV->getType()->getElementType()); + Align = TD->getTypeAlignmentPref(GV->getType()->getElementType()); return Align; } else if (AllocationInst *AI = dyn_cast(V)) { unsigned Align = AI->getAlignment(); if (Align == 0 && TD) { if (isa(AI)) -Align = TD->getTypeAlignment(AI->getType()->getElementType()); +Align = TD->getTypeAlignmentPref(AI->getType()->getElementType()); else if (isa(AI)) { // Malloc returns maximally aligned memory. -Align = TD->getTypeAlignment(AI->getType()->getElementType()); -Align = std::max(Align, (unsigned)TD->getTypeAlignment(Type::DoubleTy)); -Align = std::max(Align, (unsigned)TD->getTypeAlignment(Type::Int64Ty)); +Align = TD->getTypeAlignmentABI(AI->getType()->getElementType()); +Align = + std::max(Align, + (unsigned)TD->getTypeAlignmentABI(Type::DoubleTy)); +Align = + std::max(Align, + (unsigned)TD->getTypeAlignmentABI(Type::Int64Ty)); } } return Align; @@ -6924,10 +6928,12 @@ if (!TD) return 0; const Type *BasePtrTy = GEPI->getOperand(0)->getType(); -if (TD->getTypeAlignment(cast(BasePtrTy)->getElementType()) +const PointerType *PtrTy = cast(BasePtrTy); +if (TD->getTypeAlignmentABI(PtrTy->getElementType()) <= BaseAlignment) { const Type *GEPTy = GEPI->getType(); - return TD->getTypeAlignment(cast(GEPTy)->getElementType()); + const PointerType *GEPPtrTy = cast(GEPTy); + return TD->getTypeAlignmentABI(GEPPtrTy->getElementType()); } return 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Round 2: ABI and preferred alignment enhancement
On Jan 17, 2007, at 7:11 PM, Scott Michel wrote: > Previously known as struct/array vs. stack vs. global alignments... Patch looks great, applied! Please take and close the corresponding bugzilla. Thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.77 -> 1.78 --- Log message: trivial cleanup --- Diffs of the changes: (+0 -2) TargetData.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.77 llvm/lib/Target/TargetData.cpp:1.78 --- llvm/lib/Target/TargetData.cpp:1.77 Sat Jan 20 16:35:55 2007 +++ llvm/lib/Target/TargetData.cpp Sat Jan 20 16:39:15 2007 @@ -183,8 +183,6 @@ break; case 'A': AggMinPrefAlignment = atoi(getToken(token,":").c_str()) / 8; - if (AggMinPrefAlignment == 0) -AggMinPrefAlignment = 0; break; default: break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc patch for TargetData changes
This patch matches Scott's recent TargetData changes that landed, and cleans up integer type handling in llvm-types.cpp. Index: llvm-backend.cpp === --- llvm-backend.cpp(revision 122494) +++ llvm-backend.cpp(working copy) @@ -550,7 +550,7 @@ // Set the alignment for the global. if (DECL_ALIGN_UNIT(decl) && -getTargetData().getTypeAlignment(GV->getType()->getElementType()) != +getTargetData().getTypeAlignmentABI(GV->getType()->getElementType()) != DECL_ALIGN_UNIT(decl)) GV->setAlignment(DECL_ALIGN_UNIT(decl)); Index: llvm-convert.cpp === --- llvm-convert.cpp(revision 122494) +++ llvm-convert.cpp(working copy) @@ -4089,7 +4089,7 @@ // In this case, we know that the alignment of the field is less than // the size of the field. To get the pointer close enough, add some // number of alignment units to the pointer. -unsigned ByteAlignment = TD.getTypeAlignment(FieldTy); +unsigned ByteAlignment = TD.getTypeAlignmentABI(FieldTy); assert(ByteAlignment*8 <= LLVMValueBitSize && "Unknown overlap case!"); unsigned NumAlignmentUnits = BitStart/(ByteAlignment*8); assert(NumAlignmentUnits && "Not adjusting pointer?"); @@ -4780,7 +4780,8 @@ } // Otherwise, we can get away with this initialization. - assert(TD.getTypeAlignment(FieldTy) >= TD.getTypeAlignment(Val->getType()) && + assert(TD.getTypeAlignmentABI(FieldTy) >= + TD.getTypeAlignmentABI(Val->getType()) && "Field initialize is over aligned for LLVM type!"); return Val; } Index: llvm-types.cpp === --- llvm-types.cpp (revision 122494) +++ llvm-types.cpp (working copy) @@ -62,26 +62,6 @@ // Type Conversion Utilities //===--===// -static inline const Type *getIntegerType(unsigned Bits, bool isUnsigned) { - switch (Bits*2+isUnsigned) { - default: assert(0 && "Unknown integral type size!"); - case 8*2+0: return Type::Int8Ty; - case 8*2+1: return Type::Int8Ty; - case 16*2+0: return Type::Int16Ty; - case 16*2+1: return Type::Int16Ty; - case 32*2+0: return Type::Int32Ty; - case 32*2+1: return Type::Int32Ty; - case 64*2+0: return Type::Int64Ty; - case 64*2+1: return Type::Int64Ty; - case 128*2+0: - case 128*2+1: -static bool Warned = false; -if (!Warned) fprintf(stderr, "WARNING: 128-bit integers not supported!\n"); -Warned = true; -return isUnsigned ? Type::Int64Ty : Type::Int64Ty; - } -} - // isPassedByInvisibleReference - Return true if an argument of the specified // type should be passed in by invisible reference. // @@ -286,15 +266,12 @@ case VOID_TYPE: return SET_TYPE_LLVM(type, Type::VoidTy); case RECORD_TYPE: return ConvertRECORD(type, orig_type); case UNION_TYPE: return ConvertUNION(type, orig_type); - case BOOLEAN_TYPE: -if (TREE_INT_CST_LOW(TYPE_SIZE(type)) <= 8) - return SET_TYPE_LLVM(type, Type::Int1Ty); -else { // Bools on some platforms take more space than LLVM bool (e.g. PPC). - if (const Type *Ty = GET_TYPE_LLVM(type)) -return Ty; - const Type *Ty = getIntegerType(TREE_INT_CST_LOW(TYPE_SIZE(type)), true); - return SET_TYPE_LLVM(type, Ty); -} + case BOOLEAN_TYPE: { +if (const Type *Ty = GET_TYPE_LLVM(type)) + return Ty; +return SET_TYPE_LLVM(type, + IntegerType::get(TREE_INT_CST_LOW(TYPE_SIZE(type; + } case ENUMERAL_TYPE: // Use of an enum that is implicitly declared? if (TYPE_SIZE(type) == 0) { @@ -309,8 +286,25 @@ // FALL THROUGH. case INTEGER_TYPE: if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; -return SET_TYPE_LLVM(type, getIntegerType(TREE_INT_CST_LOW(TYPE_SIZE(type)), - TYPE_UNSIGNED(type))); + +// FIXME: eliminate this when 128-bit integer types in LLVM work. +switch (TREE_INT_CST_LOW(TYPE_SIZE(type))) { +case 1: +case 8: +case 16: +case 32: +case 64: + break; +default: + static bool Warned = false; + if (!Warned) +fprintf(stderr, "WARNING: %d-bit integers not supported!\n", +(int)TREE_INT_CST_LOW(TYPE_SIZE(type))); + Warned = true; + return Type::Int64Ty; +} +return SET_TYPE_LLVM(type, + IntegerType::get(TREE_INT_CST_LOW(TYPE_SIZE(type; case REAL_TYPE: if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; switch (TYPE_PRECISION(type)) { @@ -647,7 +641,7 @@ /// getTypeAlignment - Return the alignment of the specified type in bytes. /// unsigned getTypeAlignment(const Type *Ty) const { -return TD.getTypeAlignment(Ty); +return T
[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.78 -> 1.79 --- Log message: TargetData assumes (and some regression tests depend on it) that the size of an unspecified datatype in the datalayout is capped by the size of a pointer. --- Diffs of the changes: (+11 -4) TargetData.cpp | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.78 llvm/lib/Target/TargetData.cpp:1.79 --- llvm/lib/Target/TargetData.cpp:1.78 Sat Jan 20 16:39:15 2007 +++ llvm/lib/Target/TargetData.cpp Sat Jan 20 17:07:13 2007 @@ -103,9 +103,9 @@ LittleEndian = false; PointerMemSize = 8; PointerABIAlignment = 8; - DoubleABIAlignment = 8; + DoubleABIAlignment = 0; FloatABIAlignment = 4; - LongABIAlignment = 8; + LongABIAlignment = 0; IntABIAlignment = 4; ShortABIAlignment = 2; ByteABIAlignment = 1; @@ -114,9 +114,9 @@ BytePrefAlignment = ByteABIAlignment; ShortPrefAlignment = ShortABIAlignment; IntPrefAlignment = IntABIAlignment; - LongPrefAlignment = LongABIAlignment; + LongPrefAlignment = 8; FloatPrefAlignment = FloatABIAlignment; - DoublePrefAlignment = DoubleABIAlignment; + DoublePrefAlignment = 8; PointerPrefAlignment = PointerABIAlignment; AggMinPrefAlignment = 0; @@ -188,6 +188,13 @@ break; } } + + // Unless explicitly specified, the alignments for longs and doubles is capped by + // pointer size. + if (LongABIAlignment == 0) + LongABIAlignment = LongPrefAlignment = PointerMemSize; + if (DoubleABIAlignment == 0) +DoubleABIAlignment = DoublePrefAlignment = PointerMemSize; } TargetData::TargetData(const Module *M) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.44 -> 1.45 --- Log message: TargetData assumes (and some regression tests depend on it) that the size of an unspecified datatype in the datalayout is capped by the size of a pointer. --- Diffs of the changes: (+2 -1) TargetData.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.44 llvm/include/llvm/Target/TargetData.h:1.45 --- llvm/include/llvm/Target/TargetData.h:1.44 Sat Jan 20 16:35:55 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 17:07:13 2007 @@ -70,7 +70,8 @@ /// Constructs a TargetData from a string of the following format: /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" /// The above string is considered the default, and any values not specified - /// in the string will be assumed to be as above. + /// in the string will be assumed to be as above, with the caveat that unspecified + /// values are always assumed to be smaller than the size of a pointer. TargetData(const std::string &TargetDescription) { init(TargetDescription); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/BitCodeFormat.html
Changes in directory llvm/docs: BitCodeFormat.html added (r1.1) --- Log message: Initial template for the 2.0 Bitcode format that will replace the 1.x Bytecode format. --- Diffs of the changes: (+61 -0) BitCodeFormat.html | 61 + 1 files changed, 61 insertions(+) Index: llvm/docs/BitCodeFormat.html diff -c /dev/null llvm/docs/BitCodeFormat.html:1.1 *** /dev/null Sat Jan 20 17:21:18 2007 --- llvm/docs/BitCodeFormat.htmlSat Jan 20 17:21:08 2007 *** *** 0 --- 1,61 + http://www.w3.org/TR/html4/strict.dtd";> + + + + LLVM Bitcode File Format + + + TR, TD { border: 2px solid gray; padding-left: 4pt; padding-right: 4pt; + padding-top: 2pt; padding-bottom: 2pt; } + TH { border: 2px solid gray; font-weight: bold; font-size: 105%; } + TABLE { text-align: center; border: 2px solid black; + border-collapse: collapse; margin-top: 1em; margin-left: 1em; + margin-right: 1em; margin-bottom: 1em; } + .td_left { border: 2px solid gray; text-align: left; } + + + + LLVM Bitcode File Format + + Abstract + Concepts + + + Written by mailto:[EMAIL PROTECTED]">Reid Spencer and + mailto:[EMAIL PROTECTED]">Chris Lattner. + + + + Abstract + + + This document describes the LLVM bitcode file format. It specifies + the binary encoding rules of the bitcode file format so that + equivalent systems can encode bitcode files correctly. The LLVM + bitcode representation is used to store the intermediate + representation on disk in a compacted form. + This document supercedes the LLVM bytecode file format for the 2.0 + release. + + + Concepts + + + This section describes the general concepts of the bitcode file + format without getting into specific layout details. It is recommended + that you read this section thoroughly before interpreting the detailed + descriptions. + + + + http://jigsaw.w3.org/css-validator/check/referer";>http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!"> + http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!"> + mailto:[EMAIL PROTECTED]">Reid Spencer and mailto:[EMAIL PROTECTED]">Chris Lattner + http://llvm.org";>The LLVM Compiler Infrastructure + Last modified: $Date: 2007/01/20 23:21:08 $ + + + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.79 -> 1.80 --- Log message: Implement a getTypeSizeInBits method. This helps in transforms that want to ensure the bit size of a type is identical before proceeding. --- Diffs of the changes: (+10 -0) TargetData.cpp | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.79 llvm/lib/Target/TargetData.cpp:1.80 --- llvm/lib/Target/TargetData.cpp:1.79 Sat Jan 20 17:07:13 2007 +++ llvm/lib/Target/TargetData.cpp Sat Jan 20 17:32:04 2007 @@ -426,6 +426,16 @@ return Size; } +uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { + if (Ty->isInteger()) +return cast(Ty)->getBitWidth(); + + uint64_t Size; + unsigned char Align; + getTypeInfoABI(Ty, this, Size, Align); + return Size * 8; +} + unsigned char TargetData::getTypeAlignmentABI(const Type *Ty) const { uint64_t Size; unsigned char Align; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.45 -> 1.46 --- Log message: Implement a getTypeSizeInBits method. This helps in transforms that want to ensure the bit size of a type is identical before proceeding. --- Diffs of the changes: (+4 -0) TargetData.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.45 llvm/include/llvm/Target/TargetData.h:1.46 --- llvm/include/llvm/Target/TargetData.h:1.45 Sat Jan 20 17:07:13 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 17:32:04 2007 @@ -221,6 +221,10 @@ /// uint64_t getTypeSize(const Type *Ty) const; + /// getTypeSizeInBits - Return the number of bytes necessary to hold the + /// specified type. + uint64_t getTypeSizeInBits(const Type* Ty) const; + /// getTypeAlignmentABI - Return the minimum ABI-required alignment for the /// specified type. unsigned char getTypeAlignmentABI(const Type *Ty) const; ___ 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/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.606 -> 1.607 --- Log message: Revise the store V, (cast P) -> store (cast V) -> P transform. We only want to do this if the src and destination types have the same bit width. This patch uses TargetData::getTypeSizeInBits() instead of making a special case for integer types and avoiding the transform if they don't match. --- Diffs of the changes: (+4 -9) InstructionCombining.cpp | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.606 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.607 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.606 Sat Jan 20 16:35:55 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Jan 20 17:35:48 2007 @@ -8192,10 +8192,9 @@ SrcPTy = SrcTy->getElementType(); } - if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) || - isa(SrcPTy)) && - IC.getTargetData().getTypeSize(SrcPTy) == - IC.getTargetData().getTypeSize(DestPTy)) { + if ((SrcPTy->isInteger() || isa(SrcPTy)) && + IC.getTargetData().getTypeSizeInBits(SrcPTy) == + IC.getTargetData().getTypeSizeInBits(DestPTy)) { // Okay, we are casting from one integer or pointer type to another of // the same size. Instead of casting the pointer before @@ -8208,13 +8207,9 @@ if (isa(CastDstTy)) { if (CastSrcTy->isInteger()) opcode = Instruction::IntToPtr; -} else if (const IntegerType* DITy = dyn_cast(CastDstTy)) { +} else if (isa(CastDstTy)) { if (isa(SIOp0->getType())) opcode = Instruction::PtrToInt; - else if (const IntegerType* SITy = dyn_cast(CastSrcTy)) -if (SITy->getBitWidth() != DITy->getBitWidth()) - return 0; // Don't do this transform on unequal bit widths. -// else, BitCast is fine } if (Constant *C = dyn_cast(SIOp0)) NewCast = ConstantExpr::getCast(opcode, C, CastDstTy); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.201 -> 1.202 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+2 -5) LangRef.html |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.201 llvm/docs/LangRef.html:1.202 --- llvm/docs/LangRef.html:1.201Fri Jan 19 11:11:12 2007 +++ llvm/docs/LangRef.html Sat Jan 20 18:29:25 2007 @@ -2867,7 +2867,7 @@ - 'fptoui .. to' Instruction + 'fptoui .. to' Instruction @@ -3270,9 +3270,6 @@ uno: yields true if either operand is a QNAN. true: always yields true, regardless of operands. -If the operands are packed typed, the elements of -the vector are compared in turn and the predicate must hold for all elements. - Example:= fcmp oeq float 4.0, 5.0; yields: result=false @@ -4484,7 +4481,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2007/01/19 17:11:12 $ + Last modified: $Date: 2007/01/21 00:29:25 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constants.h
Changes in directory llvm/include/llvm: Constants.h updated: 1.120 -> 1.121 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+6 -1) Constants.h |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.120 llvm/include/llvm/Constants.h:1.121 --- llvm/include/llvm/Constants.h:1.120 Fri Jan 19 15:13:56 2007 +++ llvm/include/llvm/Constants.h Sat Jan 20 18:29:25 2007 @@ -36,7 +36,7 @@ struct ConvertConstantType; //===--===// -/// This is the shared class of boolean and integrer constants. This class +/// This is the shared class of boolean and integer constants. This class /// represents both boolean and integral constants. /// @brief Class for constant integers. class ConstantInt : public Constant { @@ -585,6 +585,11 @@ static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx); static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask); + /// Floating point negation must be implemented with f(x) = -0.0 - x. This + /// method returns the negative zero constant for floating point or packed + /// floating point types; for all other types, it returns the null value. + static Constant *getZeroValueForNegationExpr(const Type *Ty); + /// isNullValue - Return true if this is the value that would be returned by /// getNullValue. virtual bool isNullValue() const { return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h
Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.16 -> 1.17 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+0 -31) PatternMatch.h | 31 --- 1 files changed, 31 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.16 llvm/include/llvm/Support/PatternMatch.h:1.17 --- llvm/include/llvm/Support/PatternMatch.h:1.16 Thu Jan 11 06:24:13 2007 +++ llvm/include/llvm/Support/PatternMatch.hSat Jan 20 18:29:25 2007 @@ -306,37 +306,6 @@ // template -struct neg_match { - LHS_t L; - - neg_match(const LHS_t &LHS) : L(LHS) {} - - template - bool match(OpTy *V) { -if (Instruction *I = dyn_cast(V)) - if (I->getOpcode() == Instruction::Sub) -return matchIfNeg(I->getOperand(0), I->getOperand(1)); -if (ConstantExpr *CE = dyn_cast(V)) - if (CE->getOpcode() == Instruction::Sub) -return matchIfNeg(CE->getOperand(0), CE->getOperand(1)); -if (ConstantInt *CI = dyn_cast(V)) - return L.match(ConstantExpr::getNeg(CI)); -return false; - } -private: - bool matchIfNeg(Value *LHS, Value *RHS) { -if (!LHS->getType()->isFloatingPoint()) - return LHS == Constant::getNullValue(LHS->getType()) && L.match(RHS); -else - return LHS == ConstantFP::get(LHS->getType(), -0.0) && L.match(RHS); - } -}; - -template -inline neg_match m_Neg(const LHS &L) { return L; } - - -template struct not_match { LHS_t L; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Instructions.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.202 -> 1.203 Instructions.cpp updated: 1.64 -> 1.65 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+31 -34) Constants.cpp| 21 + Instructions.cpp | 44 ++-- 2 files changed, 31 insertions(+), 34 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.202 llvm/lib/VMCore/Constants.cpp:1.203 --- llvm/lib/VMCore/Constants.cpp:1.202 Fri Jan 19 15:13:56 2007 +++ llvm/lib/VMCore/Constants.cpp Sat Jan 20 18:29:26 2007 @@ -378,10 +378,9 @@ /// specify the full Instruction::OPCODE identifier. /// Constant *ConstantExpr::getNeg(Constant *C) { - if (!C->getType()->isFloatingPoint()) -return get(Instruction::Sub, getNullValue(C->getType()), C); - else -return get(Instruction::Sub, ConstantFP::get(C->getType(), -0.0), C); + return get(Instruction::Sub, + ConstantExpr::getZeroValueForNegationExpr(C->getType()), + C); } Constant *ConstantExpr::getNot(Constant *C) { assert(isa(C) && "Cannot NOT a nonintegral type!"); @@ -1882,6 +1881,20 @@ return getShuffleVectorTy(V1->getType(), V1, V2, Mask); } +Constant *ConstantExpr::getZeroValueForNegationExpr(const Type *Ty) { + if ((const PackedType *PTy = dyn_cast(Ty)) && + PTy->getElementType()->isFloatingPoint()) { +std::vector zeros(PTy->getNumElements(), + ConstantFP::get(PTy->getElementType(), -0.0)); +return ConstantPacked::get(PTy, zeros); + } + + if (Ty->isFloatingPoint()) +return ConstantFP::get(Ty, -0.0); + + return Constant::getNullValue(Ty); +} + // destroyConstant - Remove the constant from the constant table... // void ConstantExpr::destroyConstant() { Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.64 llvm/lib/VMCore/Instructions.cpp:1.65 --- llvm/lib/VMCore/Instructions.cpp:1.64 Tue Jan 16 20:46:11 2007 +++ llvm/lib/VMCore/Instructions.cppSat Jan 20 18:29:26 2007 @@ -1092,26 +1092,18 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name, Instruction *InsertBefore) { - if (!Op->getType()->isFloatingPoint()) -return new BinaryOperator(Instruction::Sub, - Constant::getNullValue(Op->getType()), Op, - Op->getType(), Name, InsertBefore); - else -return new BinaryOperator(Instruction::Sub, - ConstantFP::get(Op->getType(), -0.0), Op, - Op->getType(), Name, InsertBefore); + Value *zero = ConstantExpr::getZeroValueForNegationExpr(Op->getType()); + return new BinaryOperator(Instruction::Sub, +zero, Op, +Op->getType(), Name, InsertBefore); } BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name, BasicBlock *InsertAtEnd) { - if (!Op->getType()->isFloatingPoint()) -return new BinaryOperator(Instruction::Sub, - Constant::getNullValue(Op->getType()), Op, - Op->getType(), Name, InsertAtEnd); - else -return new BinaryOperator(Instruction::Sub, - ConstantFP::get(Op->getType(), -0.0), Op, - Op->getType(), Name, InsertAtEnd); + Value *zero = ConstantExpr::getZeroValueForNegationExpr(Op->getType()); + return new BinaryOperator(Instruction::Sub, +zero, Op, +Op->getType(), Name, InsertAtEnd); } BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name, @@ -1153,10 +1145,8 @@ bool BinaryOperator::isNeg(const Value *V) { if (const BinaryOperator *Bop = dyn_cast(V)) if (Bop->getOpcode() == Instruction::Sub) - if (!V->getType()->isFloatingPoint()) -return Bop->getOperand(0) == Constant::getNullValue(Bop->getType()); - else -return Bop->getOperand(0) == ConstantFP::get(Bop->getType(), -0.0); + return Bop->getOperand(0) == + ConstantExpr::getZeroValueForNegationExpr(Bop->getType()); return false; } @@ -1913,9 +1903,7 @@ assert(Op0Ty == Op1Ty && "Both operands to ICmp instruction are not of the same type!"); // Check that the operands are the right type -assert(Op0Ty->isInteger() || isa(Op0Ty) || - (isa(Op0Ty) && -cast(Op0Ty)->getElementType()->isInteger()) && +assert((Op0Ty->isInteger() || isa(Op0Ty)) && "Invalid operand types for ICmp instruction"); return; } @@ -1927,8 +1915,7 @@ assert(Op0Ty == Op1Ty && "Both operands to FCmp instruction are not of the same type!"); // Ch
[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpander.h updated: 1.12 -> 1.13 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+1 -2) ScalarEvolutionExpander.h |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.12 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.13 --- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.12 Sun Jan 14 20:27:26 2007 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.hSat Jan 20 18:29:25 2007 @@ -60,8 +60,7 @@ /// loop (inserting one if there is none). A canonical induction variable /// starts at zero and steps by one on each iteration. Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty){ - assert((Ty->isInteger() || Ty->isFloatingPoint()) && - "Can only insert integer or floating point induction variables!"); + assert(Ty->isInteger() && "Can only insert integer induction variables!"); SCEVHandle H = SCEVAddRecExpr::get(SCEVUnknown::getIntegerSCEV(0, Ty), SCEVUnknown::getIntegerSCEV(1, Ty), L); return expand(H); ___ 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/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.343 -> 1.344 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+51 -45) SelectionDAGISel.cpp | 96 +++ 1 files changed, 51 insertions(+), 45 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.343 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.344 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.343Sat Jan 20 16:35:55 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 20 18:29:25 2007 @@ -499,32 +499,37 @@ void visitInvoke(InvokeInst &I) { assert(0 && "TODO"); } void visitUnwind(UnwindInst &I) { assert(0 && "TODO"); } - void visitIntBinary(User &I, unsigned IntOp, unsigned VecOp); - void visitFPBinary(User &I, unsigned FPOp, unsigned VecOp); + void visitScalarBinary(User &I, unsigned OpCode); + void visitVectorBinary(User &I, unsigned OpCode); + void visitEitherBinary(User &I, unsigned ScalarOp, unsigned VectorOp); void visitShift(User &I, unsigned Opcode); void visitAdd(User &I) { -if (I.getType()->isFloatingPoint()) - visitFPBinary(I, ISD::FADD, ISD::VADD); +if (isa(I.getType())) + visitVectorBinary(I, ISD::VADD); +else if (I.getType()->isFloatingPoint()) + visitScalarBinary(I, ISD::FADD); else - visitIntBinary(I, ISD::ADD, ISD::VADD); + visitScalarBinary(I, ISD::ADD); } void visitSub(User &I); void visitMul(User &I) { -if (I.getType()->isFloatingPoint()) - visitFPBinary(I, ISD::FMUL, ISD::VMUL); +if (isa(I.getType())) + visitVectorBinary(I, ISD::VMUL); +else if (I.getType()->isFloatingPoint()) + visitScalarBinary(I, ISD::FMUL); else - visitIntBinary(I, ISD::MUL, ISD::VMUL); + visitScalarBinary(I, ISD::MUL); } - void visitURem(User &I) { visitIntBinary(I, ISD::UREM, 0); } - void visitSRem(User &I) { visitIntBinary(I, ISD::SREM, 0); } - void visitFRem(User &I) { visitFPBinary (I, ISD::FREM, 0); } - void visitUDiv(User &I) { visitIntBinary(I, ISD::UDIV, ISD::VUDIV); } - void visitSDiv(User &I) { visitIntBinary(I, ISD::SDIV, ISD::VSDIV); } - void visitFDiv(User &I) { visitFPBinary (I, ISD::FDIV, ISD::VSDIV); } - void visitAnd(User &I) { visitIntBinary(I, ISD::AND, ISD::VAND); } - void visitOr (User &I) { visitIntBinary(I, ISD::OR, ISD::VOR); } - void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); } - void visitShl(User &I) { visitShift(I, ISD::SHL); } + void visitURem(User &I) { visitScalarBinary(I, ISD::UREM); } + void visitSRem(User &I) { visitScalarBinary(I, ISD::SREM); } + void visitFRem(User &I) { visitScalarBinary(I, ISD::FREM); } + void visitUDiv(User &I) { visitEitherBinary(I, ISD::UDIV, ISD::VUDIV); } + void visitSDiv(User &I) { visitEitherBinary(I, ISD::SDIV, ISD::VSDIV); } + void visitFDiv(User &I) { visitEitherBinary(I, ISD::FDIV, ISD::VSDIV); } + void visitAnd (User &I) { visitEitherBinary(I, ISD::AND, ISD::VAND ); } + void visitOr (User &I) { visitEitherBinary(I, ISD::OR, ISD::VOR ); } + void visitXor (User &I) { visitEitherBinary(I, ISD::XOR, ISD::VXOR ); } + void visitShl (User &I) { visitShift(I, ISD::SHL); } void visitLShr(User &I) { visitShift(I, ISD::SRL); } void visitAShr(User &I) { visitShift(I, ISD::SRA); } void visitICmp(User &I); @@ -1369,46 +1374,47 @@ void SelectionDAGLowering::visitSub(User &I) { // -0.0 - X --> fneg - if (I.getType()->isFloatingPoint()) { + const Type *Ty = I.getType(); + if (isa(Ty)) { +visitVectorBinary(I, ISD::VSUB); + } else if (Ty->isFloatingPoint()) { if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) if (CFP->isExactlyValue(-0.0)) { SDOperand Op2 = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FNEG, Op2.getValueType(), Op2)); return; } -visitFPBinary(I, ISD::FSUB, ISD::VSUB); +visitScalarBinary(I, ISD::FSUB); } else -visitIntBinary(I, ISD::SUB, ISD::VSUB); +visitScalarBinary(I, ISD::SUB); } -void -SelectionDAGLowering::visitIntBinary(User &I, unsigned IntOp, unsigned VecOp) { - const Type *Ty = I.getType(); +void SelectionDAGLowering::visitScalarBinary(User &I, unsigned OpCode) { SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); - - if (const PackedType *PTy = dyn_cast(Ty)) { -SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); -SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); -setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); - } else { -setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); - } + + setValue(&I, DAG.getNode(OpCode, Op1.getValueType(), Op1, Op2)); } -void -SelectionDAG
[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp
Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.121 -> 1.122 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+2 -2) ExprTypeConvert.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.121 llvm/lib/Transforms/ExprTypeConvert.cpp:1.122 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.121 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Sat Jan 20 18:29:25 2007 @@ -576,8 +576,8 @@ // Can convert store if the incoming value is convertible and if the // result will preserve semantics... const Type *Op0Ty = I->getOperand(0)->getType(); - if (!(Op0Ty->isInteger() ^ ElTy->isInteger()) && - !(Op0Ty->isFloatingPoint() ^ ElTy->isFloatingPoint())) + if (Op0Ty->isInteger() == ElTy->isInteger() && + Op0Ty->isFloatingPoint() == ElTy->isFloatingPoint()) return ExpressionConvertibleToType(I->getOperand(0), ElTy, CTMap, TD); } 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/Analysis/ScalarEvolutionExpander.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolutionExpander.cpp updated: 1.12 -> 1.13 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+1 -2) ScalarEvolutionExpander.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.12 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.13 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.12 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Sat Jan 20 18:29:25 2007 @@ -123,8 +123,7 @@ // Insert a unit add instruction right before the terminator corresponding // to the back-edge. -Constant *One = Ty->isFloatingPoint() ? (Constant*)ConstantFP::get(Ty, 1.0) - : ConstantInt::get(Ty, 1); +Constant *One = ConstantInt::get(Ty, 1); Instruction *Add = BinaryOperator::createAdd(PN, One, "indvar.next", (*HPI)->getTerminator()); ___ 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/Reassociate.cpp ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: Reassociate.cpp updated: 1.72 -> 1.73 ScalarReplAggregates.cpp updated: 1.67 -> 1.68 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+25 -29) Reassociate.cpp | 52 +-- ScalarReplAggregates.cpp |2 - 2 files changed, 25 insertions(+), 29 deletions(-) Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.72 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.73 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.72 Sun Jan 14 20:27:26 2007 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Sat Jan 20 18:29:25 2007 @@ -186,11 +186,7 @@ /// LowerNegateToMultiply - Replace 0-X with X*-1. /// static Instruction *LowerNegateToMultiply(Instruction *Neg) { - Constant *Cst; - if (Neg->getType()->isFloatingPoint()) -Cst = ConstantFP::get(Neg->getType(), -1); - else -Cst = ConstantInt::getAllOnesValue(Neg->getType()); + Constant *Cst = ConstantInt::getAllOnesValue(Neg->getType()); std::string NegName = Neg->getName(); Neg->setName(""); Instruction *Res = BinaryOperator::createMul(Neg->getOperand(1), Cst, NegName, @@ -661,32 +657,32 @@ std::map FactorOccurrences; unsigned MaxOcc = 0; Value *MaxOccVal = 0; -if (!I->getType()->isFloatingPoint()) { - for (unsigned i = 0, e = Ops.size(); i != e; ++i) { -if (BinaryOperator *BOp = dyn_cast(Ops[i].Op)) - if (BOp->getOpcode() == Instruction::Mul && BOp->use_empty()) { -// Compute all of the factors of this added value. -std::vector Factors; -FindSingleUseMultiplyFactors(BOp, Factors); -assert(Factors.size() > 1 && "Bad linearize!"); - -// Add one to FactorOccurrences for each unique factor in this op. -if (Factors.size() == 2) { - unsigned Occ = ++FactorOccurrences[Factors[0]]; - if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[0]; } - if (Factors[0] != Factors[1]) { // Don't double count A*A. -Occ = ++FactorOccurrences[Factors[1]]; -if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[1]; } +for (unsigned i = 0, e = Ops.size(); i != e; ++i) { + if (BinaryOperator *BOp = dyn_cast(Ops[i].Op)) { +if (BOp->getOpcode() == Instruction::Mul && BOp->use_empty()) { + // Compute all of the factors of this added value. + std::vector Factors; + FindSingleUseMultiplyFactors(BOp, Factors); + assert(Factors.size() > 1 && "Bad linearize!"); + + // Add one to FactorOccurrences for each unique factor in this op. + if (Factors.size() == 2) { +unsigned Occ = ++FactorOccurrences[Factors[0]]; +if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[0]; } +if (Factors[0] != Factors[1]) { // Don't double count A*A. + Occ = ++FactorOccurrences[Factors[1]]; + if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[1]; } +} + } else { +std::set Duplicates; +for (unsigned i = 0, e = Factors.size(); i != e; ++i) { + if (Duplicates.insert(Factors[i]).second) { +unsigned Occ = ++FactorOccurrences[Factors[i]]; +if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[i]; } } -} else { - std::set Duplicates; - for (unsigned i = 0, e = Factors.size(); i != e; ++i) -if (Duplicates.insert(Factors[i]).second) { - unsigned Occ = ++FactorOccurrences[Factors[i]]; - if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factors[i]; } -} } } +} } } Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.67 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.68 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.67Fri Jan 19 15:13:56 2007 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat Jan 20 18:29:25 2007 @@ -519,7 +519,7 @@ return 0; } else if (StoreInst *SI = dyn_cast(User)) { - // Storing the pointer, not the into the value? + // Storing the pointer, not into the value? if (SI->getOperand(0) == V) return 0; // NOTE: We could handle storing of FP imms into integers here! ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.164 -> 1.165 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+1 -1) Execution.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.164 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.165 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.164Sat Jan 20 14:12:29 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Sat Jan 20 18:29:25 2007 @@ -1498,7 +1498,7 @@ const IntegerType *SITy = cast(SrcTy); unsigned SBitWidth = SITy->getBitWidth(); assert(SBitWidth <= 64 && "Integer types > 64 bits not supported"); - assert(DstTy->isFloatingPoint() && "Invalid UIToFP instruction"); + assert(DstTy->isFloatingPoint() && "Invalid SIToFP instruction"); int64_t Converted = 0; if (SBitWidth == 1) Converted = 0LL - Src.Int1Val; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp
Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.87 -> 1.88 --- Log message: For PR970: http://llvm.org/PR970 : Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! --- Diffs of the changes: (+1 -0) GlobalOpt.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.87 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.88 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.87 Fri Jan 12 12:30:11 2007 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sat Jan 20 18:29:25 2007 @@ -1343,6 +1343,7 @@ if (Constant *SOVConstant = dyn_cast(GS.StoredOnceValue)) if (GV->getType()->getElementType() != Type::Int1Ty && !GV->getType()->getElementType()->isFloatingPoint() && +!isa(GV->getType()->getElementType()) && !GS.HasPHIUser) { DOUT << " *** SHRINKING TO BOOL: " << *GV; ShrinkGlobalToBoolean(GV, SOVConstant); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [PATCH] PR970: isFloatingPoint audit 5 of 5
Hi Gordon, Thanks for the patches. I've committed all 5 in your patch series. There were only minor issues which I corrected: 1. I just remove m_Neg pattern matcher since you commented it out and it appears to be dead in llvm. 2. Your changes to CmpInst::CmpInst were not correct. We currently don't allow comparison of packed types in the assembler or the verifier. I changed the assertions to match the verifier. This wasn't your fault, it was left over cruft from a time when we though comparison of packed types was going to be implemented. 3. Minor nit in ConstantExpr::getZeroValueForNegationExpr: the PTy variable should be moved into the if statement. The rest looked good. Applied. Thanks, Gordon! Reid. P.S. If you're done with your review of FP use in LLVM, please close PR970. Thanks. On Sat, 2007-01-20 at 14:56 -0500, Gordon Henriksen wrote: > This final patch simplifies the logic in SelectionDAGISel.cpp with no > functional change. This construct was in use: > > > if (I.getType()->isFloatingPoint()) > visitFPBinary(I, ISD::FADD, ISD::VADD); > else > visitIntBinary(I, ISD::ADD, ISD::VADD); > > > Which confusingly sent even floating-point vector operations through > the visitIntBinary routine. However, this was not a bug because > visitFPBinary and visitIntBinary were identical (as is the vector > opcode parameter). > > > This patch streamlines the logic and eliminates redundant methods. > > > — Gordon > > > > > > > ___ > 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/CFrontend/2007-01-20-VectorICE.c
Changes in directory llvm/test/CFrontend: 2007-01-20-VectorICE.c added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+11 -0) 2007-01-20-VectorICE.c | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/CFrontend/2007-01-20-VectorICE.c diff -c /dev/null llvm/test/CFrontend/2007-01-20-VectorICE.c:1.1 *** /dev/null Sat Jan 20 18:56:52 2007 --- llvm/test/CFrontend/2007-01-20-VectorICE.c Sat Jan 20 18:56:42 2007 *** *** 0 --- 1,11 + // RUN: %llvmgcc %s -S -o - + + typedef float __m128 __attribute__((__vector_size__(16))); + typedef long long __v2di __attribute__((__vector_size__(16))); + typedef int __v4si __attribute__((__vector_size__(16))); + + __v2di bar(void); + void foo(int X, __v4si *P) { + *P = X == 2 ? bar() : bar(); + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] Fix regression on vector code
This fixes test/CFrontend/2007-01-20-VectorICE.c This is a short-term fix that reverts a recent part of the merge from apple gcc head. I will track down the real problem shortly. Patch here: === --- convert.c (revision 122668) +++ convert.c (working copy) @@ -750,8 +750,7 @@ return convert (type, build_compound_literal_vector (TREE_TYPE (expr), expr)); /* APPLE LOCAL end AltiVec */ - /* APPLE LOCAL mainline 4253848 */ - return build1 (VIEW_CONVERT_EXPR, type, expr); + return build1 (NOP_EXPR, type, expr); default: error ("can't convert value to a vector"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Fix regression on vector code
On Jan 20, 2007, at 4:57 PM, Chris Lattner wrote: This fixes test/CFrontend/2007-01-20-VectorICE.c This is a short-term fix that reverts a recent part of the merge from apple gcc head. I will track down the real problem shortly. Patch here: === --- convert.c (revision 122668) +++ convert.c (working copy) @@ -750,8 +750,7 @@ return convert (type, build_compound_literal_vector (TREE_TYPE (expr), expr)); /* APPLE LOCAL end AltiVec */ - /* APPLE LOCAL mainline 4253848 */ - return build1 (VIEW_CONVERT_EXPR, type, expr); + return build1 (NOP_EXPR, type, expr); default: error ("can't convert value to a vector"); Okay, here's the real fix. Apparently DECL_GIMPLE_FORMAL_TEMP_P's are allowed to have their address taken. When this happens, TREE_ADDRESSABLE is set, but DECL_GIMPLE_FORMAL_TEMP_P isn't cleared. As such, only consider DECL_GIMPLE_FORMAL_TEMP_P's that don't have TREE_ADDRESSABLE to be SSA values. Index: llvm-convert.cpp === --- llvm-convert.cpp(revision 122670) +++ llvm-convert.cpp(working copy) @@ -74,7 +74,7 @@ /// "gimple_formal_tmp_var". static bool isGCC_SSA_Temporary(tree decl) { return TREE_CODE(decl) == VAR_DECL && - DECL_GIMPLE_FORMAL_TEMP_P(decl) && + DECL_GIMPLE_FORMAL_TEMP_P(decl) && !TREE_ADDRESSABLE(decl) && !isAggregateType(TREE_TYPE(decl)); } Index: convert.c === --- convert.c (revision 122671) +++ convert.c (working copy) @@ -750,7 +750,8 @@ return convert (type, build_compound_literal_vector (TREE_TYPE (expr), expr)); /* APPLE LOCAL end AltiVec */ - return build1 (NOP_EXPR, type, expr); + /* APPLE LOCAL mainline 4253848 */ + return build1 (VIEW_CONVERT_EXPR, type, expr); default: error ("can't convert value to a vector"); -Chris___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.203 -> 1.204 --- Log message: Whoops, fix typo in last commit. --- Diffs of the changes: (+6 -6) Constants.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.203 llvm/lib/VMCore/Constants.cpp:1.204 --- llvm/lib/VMCore/Constants.cpp:1.203 Sat Jan 20 18:29:26 2007 +++ llvm/lib/VMCore/Constants.cpp Sat Jan 20 20:29:10 2007 @@ -1882,12 +1882,12 @@ } Constant *ConstantExpr::getZeroValueForNegationExpr(const Type *Ty) { - if ((const PackedType *PTy = dyn_cast(Ty)) && - PTy->getElementType()->isFloatingPoint()) { -std::vector zeros(PTy->getNumElements(), - ConstantFP::get(PTy->getElementType(), -0.0)); -return ConstantPacked::get(PTy, zeros); - } + if (const PackedType *PTy = dyn_cast(Ty)) +if (PTy->getElementType()->isFloatingPoint()) { + std::vector zeros(PTy->getNumElements(), + ConstantFP::get(PTy->getElementType(),-0.0)); + return ConstantPacked::get(PTy, zeros); +} if (Ty->isFloatingPoint()) return ConstantFP::get(Ty, -0.0); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/opt/opt.cpp
Changes in directory llvm/tools/opt: opt.cpp updated: 1.125 -> 1.126 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) opt.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.125 llvm/tools/opt/opt.cpp:1.126 --- llvm/tools/opt/opt.cpp:1.125Wed Dec 6 19:30:32 2006 +++ llvm/tools/opt/opt.cpp Sun Jan 21 00:28:44 2007 @@ -41,7 +41,7 @@ static cl::list PassList(cl::desc("Optimizations available:")); -static cl::opt NoCompress("disable-compression", cl::init(false), +static cl::opt NoCompress("disable-compression", cl::init(true), cl::desc("Don't compress the generated bytecode")); // Other command line options... ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/gccas/gccas.cpp
Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.124 -> 1.125 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) gccas.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.124 llvm/tools/gccas/gccas.cpp:1.125 --- llvm/tools/gccas/gccas.cpp:1.124Mon Jan 15 01:41:51 2007 +++ llvm/tools/gccas/gccas.cpp Sun Jan 21 00:29:11 2007 @@ -54,7 +54,7 @@ cl::desc("Strip debugger symbol info from translation unit")); cl::opt - NoCompress("disable-compression", cl::init(false), + NoCompress("disable-compression", cl::init(true), cl::desc("Don't compress the generated bytecode")); cl::opt TF("traditional-format", cl::Hidden, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp
Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.67 -> 1.68 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) GenerateCode.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.67 llvm/tools/gccld/GenerateCode.cpp:1.68 --- llvm/tools/gccld/GenerateCode.cpp:1.67 Wed Dec 6 19:30:31 2006 +++ llvm/tools/gccld/GenerateCode.cpp Sun Jan 21 00:29:39 2007 @@ -42,7 +42,7 @@ cl::desc("Do not run any optimization passes")); cl::opt - NoCompress("disable-compression", cl::init(false), + NoCompress("disable-compression", cl::init(true), cl::desc("Don't compress the generated bytecode")); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-as/llvm-as.cpp
Changes in directory llvm/tools/llvm-as: llvm-as.cpp updated: 1.50 -> 1.51 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) llvm-as.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-as/llvm-as.cpp diff -u llvm/tools/llvm-as/llvm-as.cpp:1.50 llvm/tools/llvm-as/llvm-as.cpp:1.51 --- llvm/tools/llvm-as/llvm-as.cpp:1.50 Wed Dec 6 19:30:31 2006 +++ llvm/tools/llvm-as/llvm-as.cpp Sun Jan 21 00:29:53 2007 @@ -43,7 +43,7 @@ DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden); static cl::opt -NoCompress("disable-compression", cl::init(false), +NoCompress("disable-compression", cl::init(true), cl::desc("Don't compress the generated bytecode")); static cl::opt ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-link/llvm-link.cpp
Changes in directory llvm/tools/llvm-link: llvm-link.cpp updated: 1.61 -> 1.62 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) llvm-link.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-link/llvm-link.cpp diff -u llvm/tools/llvm-link/llvm-link.cpp:1.61 llvm/tools/llvm-link/llvm-link.cpp:1.62 --- llvm/tools/llvm-link/llvm-link.cpp:1.61 Wed Dec 6 19:30:31 2006 +++ llvm/tools/llvm-link/llvm-link.cpp Sun Jan 21 00:30:37 2007 @@ -43,7 +43,7 @@ static cl::opt DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden); -static cl::opt NoCompress("disable-compression", cl::init(false), +static cl::opt NoCompress("disable-compression", cl::init(true), cl::desc("Don't compress the generated bytecode")); // LoadFile - Read the specified bytecode file in and return it. This routine ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bytecode/WriteBytecodePass.h
Changes in directory llvm/include/llvm/Bytecode: WriteBytecodePass.h updated: 1.18 -> 1.19 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+2 -2) WriteBytecodePass.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Bytecode/WriteBytecodePass.h diff -u llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.18 llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.19 --- llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.18 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Bytecode/WriteBytecodePass.h Sun Jan 21 00:31:34 2007 @@ -27,8 +27,8 @@ bool CompressFile; public: WriteBytecodePass() -: Out(&cout), DeleteStream(false), CompressFile(true) {} - WriteBytecodePass(OStream *o, bool DS = false, bool CF = true) +: Out(&cout), DeleteStream(false), CompressFile(false) {} + WriteBytecodePass(OStream *o, bool DS = false, bool CF = false) : Out(o), DeleteStream(DS), CompressFile(CF) {} inline ~WriteBytecodePass() { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/OptimizerDriver.cpp
Changes in directory llvm/tools/bugpoint: OptimizerDriver.cpp updated: 1.48 -> 1.49 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) OptimizerDriver.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/bugpoint/OptimizerDriver.cpp diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.48 llvm/tools/bugpoint/OptimizerDriver.cpp:1.49 --- llvm/tools/bugpoint/OptimizerDriver.cpp:1.48Wed Dec 6 19:30:31 2006 +++ llvm/tools/bugpoint/OptimizerDriver.cpp Sun Jan 21 00:31:25 2007 @@ -57,7 +57,7 @@ if (!Out.good()) return true; try { OStream L(Out); -WriteBytecodeToFile(M ? M : Program, L, /*compression=*/true); +WriteBytecodeToFile(M ? M : Program, L, /*compression=*/false); } catch (...) { return true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/autoconf/configure.ac
Changes in directory llvm/autoconf: configure.ac updated: 1.262 -> 1.263 --- Log message: Add support for the ARM target in the target configuration processing. --- Diffs of the changes: (+4 -0) configure.ac |4 1 files changed, 4 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.262 llvm/autoconf/configure.ac:1.263 --- llvm/autoconf/configure.ac:1.262Sat Jan 20 14:43:35 2007 +++ llvm/autoconf/configure.ac Sun Jan 21 00:31:55 2007 @@ -213,6 +213,7 @@ powerpc*-*) llvm_cv_target_arch="PowerPC" ;; alpha*-*) llvm_cv_target_arch="Alpha" ;; ia64-*) llvm_cv_target_arch="IA64" ;; + arm-*) llvm_cv_target_arch="ARM" ;; *) llvm_cv_target_arch="Unknown" ;; esac]) @@ -298,6 +299,7 @@ x86_64) AC_SUBST(TARGET_HAS_JIT,0) ;; Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;; IA64)AC_SUBST(TARGET_HAS_JIT,0) ;; +ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; *) AC_SUBST(TARGET_HAS_JIT,0) ;; esac fi @@ -356,6 +358,7 @@ PowerPC) TARGETS_TO_BUILD="PowerPC" ;; Alpha) TARGETS_TO_BUILD="Alpha" ;; IA64)TARGETS_TO_BUILD="IA64" ;; + ARM) TARGETS_TO_BUILD="ARM" ;; *) AC_MSG_ERROR([Can not set target to build]) ;; esac ;; @@ -367,6 +370,7 @@ powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;; ia64)TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;; +arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; esac done ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bytecode/Writer.h
Changes in directory llvm/include/llvm/Bytecode: Writer.h updated: 1.13 -> 1.14 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) Writer.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Bytecode/Writer.h diff -u llvm/include/llvm/Bytecode/Writer.h:1.13 llvm/include/llvm/Bytecode/Writer.h:1.14 --- llvm/include/llvm/Bytecode/Writer.h:1.13Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Bytecode/Writer.h Sun Jan 21 00:32:48 2007 @@ -23,7 +23,7 @@ /// stream. If compress is set to true, try to use compression when writing /// out the file. This can never fail if M is a well-formed module. void WriteBytecodeToFile(const Module *M, OStream &Out, - bool compress = true); + bool compress = false); } // End llvm namespace #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/configure
Changes in directory llvm: configure updated: 1.267 -> 1.268 --- Log message: For PR1128: http://llvm.org/PR1128 : Regenerate for ARM support. --- Diffs of the changes: (+29 -24) configure | 53 + 1 files changed, 29 insertions(+), 24 deletions(-) Index: llvm/configure diff -u llvm/configure:1.267 llvm/configure:1.268 --- llvm/configure:1.267Sat Jan 20 14:45:39 2007 +++ llvm/configure Sun Jan 21 00:32:59 2007 @@ -2351,6 +2351,7 @@ powerpc*-*) llvm_cv_target_arch="PowerPC" ;; alpha*-*) llvm_cv_target_arch="Alpha" ;; ia64-*) llvm_cv_target_arch="IA64" ;; + arm-*) llvm_cv_target_arch="ARM" ;; *) llvm_cv_target_arch="Unknown" ;; esac fi @@ -4615,6 +4616,8 @@ ;; IA64)TARGET_HAS_JIT=0 ;; +ARM) TARGET_HAS_JIT=1 + ;; *) TARGET_HAS_JIT=0 ;; esac @@ -4705,6 +4708,7 @@ PowerPC) TARGETS_TO_BUILD="PowerPC" ;; Alpha) TARGETS_TO_BUILD="Alpha" ;; IA64)TARGETS_TO_BUILD="IA64" ;; + ARM) TARGETS_TO_BUILD="ARM" ;; *) { { echo "$as_me:$LINENO: error: Can not set target to build" >&5 echo "$as_me: error: Can not set target to build" >&2;} { (exit 1); exit 1; }; } ;; @@ -4718,6 +4722,7 @@ powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;; ia64)TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;; +arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; *) { { echo "$as_me:$LINENO: error: Unrecognized target $a_target" >&5 echo "$as_me: error: Unrecognized target $a_target" >&2;} { (exit 1); exit 1; }; } ;; @@ -10334,7 +10339,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12486 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14196,11 +14201,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14199: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14204: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14203: \$? = $ac_status" >&5 + echo "$as_me:14208: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14464,11 +14469,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14467: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14472: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14471: \$? = $ac_status" >&5 + echo "$as_me:14476: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14568,11 +14573,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14571: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14576: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14575: \$? = $ac_status" >&5 + echo "$as_me:14580: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17020,7 +17025,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19496: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19495: \$? = $ac_status" >&5 + echo "$as_me:19500: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19592,11 +19597,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19595: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19600: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19599: \$? = $ac_status" >&5 + echo "$as_me:19604: \$?
[llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp
Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.45 -> 1.46 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+1 -1) llvm-ld.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.45 llvm/tools/llvm-ld/llvm-ld.cpp:1.46 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.45 Wed Dec 6 19:30:31 2006 +++ llvm/tools/llvm-ld/llvm-ld.cpp Sun Jan 21 00:33:59 2007 @@ -74,7 +74,7 @@ static cl::optNativeCBE("native-cbe", cl::desc("Generate a native binary with the C backend and GCC")); -static cl::optDisableCompression("disable-compression",cl::init(false), +static cl::optDisableCompression("disable-compression", cl::init(true), cl::desc("Disable writing of compressed bytecode files")); static cl::list PostLinkOpts("post-link-opts", ___ 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.30 -> 1.31 --- Log message: default to emiting an uncompressed .bc file --- Diffs of the changes: (+2 -2) lto.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.30 llvm/tools/lto/lto.cpp:1.31 --- llvm/tools/lto/lto.cpp:1.30 Mon Jan 8 12:42:27 2007 +++ llvm/tools/lto/lto.cpp Sun Jan 21 00:34:18 2007 @@ -364,7 +364,7 @@ tempFileName += "0.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); OStream L(Out); -WriteBytecodeToFile(bigOne, L, true); +WriteBytecodeToFile(bigOne, L); } // Strip leading underscore because it was added to match names @@ -418,7 +418,7 @@ tempFileName += "1.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); OStream L(Out); -WriteBytecodeToFile(bigOne, L, true); +WriteBytecodeToFile(bigOne, L); } targetTriple = bigOne->getTargetTriple(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/autoconf/configure.ac
Changes in directory llvm/autoconf: configure.ac updated: 1.263 -> 1.264 --- Log message: Fix the TARGET_HAS_JIT settings. Sparc doesn't, x86_64 does, ARM doesn't. --- Diffs of the changes: (+3 -3) configure.ac |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.263 llvm/autoconf/configure.ac:1.264 --- llvm/autoconf/configure.ac:1.263Sun Jan 21 00:31:55 2007 +++ llvm/autoconf/configure.ac Sun Jan 21 00:41:11 2007 @@ -294,12 +294,12 @@ else case "$llvm_cv_target_arch" in x86) AC_SUBST(TARGET_HAS_JIT,1) ;; -Sparc) AC_SUBST(TARGET_HAS_JIT,1) ;; +Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;; PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; -x86_64) AC_SUBST(TARGET_HAS_JIT,0) ;; +x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;; Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;; IA64)AC_SUBST(TARGET_HAS_JIT,0) ;; -ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; +ARM) AC_SUBST(TARGET_HAS_JIT,0) ;; *) AC_SUBST(TARGET_HAS_JIT,0) ;; esac fi ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/configure
Changes in directory llvm: configure updated: 1.268 -> 1.269 --- Log message: Regenerate. --- Diffs of the changes: (+3 -3) configure |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/configure diff -u llvm/configure:1.268 llvm/configure:1.269 --- llvm/configure:1.268Sun Jan 21 00:32:59 2007 +++ llvm/configure Sun Jan 21 00:42:03 2007 @@ -4606,17 +4606,17 @@ case "$llvm_cv_target_arch" in x86) TARGET_HAS_JIT=1 ;; -Sparc) TARGET_HAS_JIT=1 +Sparc) TARGET_HAS_JIT=0 ;; PowerPC) TARGET_HAS_JIT=1 ;; -x86_64) TARGET_HAS_JIT=0 +x86_64) TARGET_HAS_JIT=1 ;; Alpha) TARGET_HAS_JIT=1 ;; IA64)TARGET_HAS_JIT=0 ;; -ARM) TARGET_HAS_JIT=1 +ARM) TARGET_HAS_JIT=0 ;; *) TARGET_HAS_JIT=0 ;; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/README.txt
Changes in directory llvm/lib/Target/X86: README.txt updated: 1.152 -> 1.153 --- Log message: add a note --- Diffs of the changes: (+52 -0) README.txt | 52 1 files changed, 52 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.152 llvm/lib/Target/X86/README.txt:1.153 --- llvm/lib/Target/X86/README.txt:1.152Mon Jan 15 00:25:39 2007 +++ llvm/lib/Target/X86/README.txt Sun Jan 21 01:03:37 2007 @@ -830,3 +830,55 @@ the pxor is not needed, we could compare the value against itself. +//===-===// + +These two functions have identical effects: + +unsigned int f(unsigned int i, unsigned int n) {++i; if (i == n) ++i; return i;} +unsigned int f2(unsigned int i, unsigned int n) {++i; i += i == n; return i;} + +We currently compile them to: + +_f: +movl 4(%esp), %eax +movl %eax, %ecx +incl %ecx +movl 8(%esp), %edx +cmpl %edx, %ecx +jne LBB1_2 #UnifiedReturnBlock +LBB1_1: #cond_true +addl $2, %eax +ret +LBB1_2: #UnifiedReturnBlock +movl %ecx, %eax +ret +_f2: +movl 4(%esp), %eax +movl %eax, %ecx +incl %ecx +cmpl 8(%esp), %ecx +sete %cl +movzbl %cl, %ecx +leal 1(%ecx,%eax), %eax +ret + +both of which are inferior to GCC's: + +_f: +movl4(%esp), %edx +leal1(%edx), %eax +addl$2, %edx +cmpl8(%esp), %eax +cmove %edx, %eax +ret +_f2: +movl4(%esp), %eax +addl$1, %eax +xorl%edx, %edx +cmpl8(%esp), %eax +sete%dl +addl%edx, %eax +ret + +//===-===// + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits