From edwintorok at gmail.com Mon Jun 2 02:23:42 2008
From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=)
Date: Mon, 02 Jun 2008 10:23:42 +0300
Subject: [llvm-commits] value range analysis based on scalar-evolutions
In-Reply-To: <48436EF1.8020203@mxc.ca>
References: <48436EF1.8020203@mxc.ca>
Message-ID: <48439FFE.9040804@gmail.com>
Nick Lewycky wrote:
> I've implemented an analysis pass that uses SCEV to determine value
> ranges of integer-typed registers.
>
> Currently it maintains a map of Value* to ConstantRange*, which is
> rather inelegant.
There is a SCEVHandle->getValueRange(), perhaps you could move the
implementation there and then you wouldn't need the map?
> I was thinking we could have one analysis which would do that and
> others that would update the central analysis.
There is also Transforms/Scalar/PredicateSimplifier that tracks value
ranges.
It would be nice to have all that value range info available to other
passes as well.
Best regards,
--Edwin
From rafael.espindola at gmail.com Mon Jun 2 02:52:44 2008
From: rafael.espindola at gmail.com (Rafael Espindola)
Date: Mon, 02 Jun 2008 07:52:44 -0000
Subject: [llvm-commits] [llvm] r51865 -
/llvm/trunk/lib/Target/X86/X86Subtarget.cpp
Message-ID: <200806020752.m527qiO6026315@zion.cs.uiuc.edu>
Author: rafael
Date: Mon Jun 2 02:52:43 2008
New Revision: 51865
URL: http://llvm.org/viewvc/llvm-project?rev=51865&view=rev
Log:
Don't use the GOT for symbols that are not externally visible.
Modified:
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=51865&r1=51864&r2=51865&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun 2 02:52:43 2008
@@ -44,9 +44,12 @@
GV->hasCommonLinkage() ||
(GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode())));
} else if (isTargetELF()) {
- // Extra load is needed for all non-statics.
- return (!isDirectCall &&
- (GV->isDeclaration() || !GV->hasInternalLinkage()));
+ // Extra load is needed for all externally visible.
+ if (isDirectCall)
+ return false;
+ if (GV->hasInternalLinkage() || GV->hasHiddenVisibility())
+ return false;
+ return true;
} else if (isTargetCygMing() || isTargetWindows()) {
return (GV->hasDLLImportLinkage());
}
From matthijs at stdin.nl Mon Jun 2 08:39:30 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 2 Jun 2008 15:39:30 +0200
Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html
include/llvm/Constants.h include/llvm/DerivedTypes.h
include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs
lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp
lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp
lib/VMCore/Type.cpp test/Assembler/insertextractvalue.ll
In-Reply-To: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu>
References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu>
Message-ID: <20080602133930.GG25337@katherina.student.utwente.nl>
Hi Dan,
there are still some constructors missing, find a patch for them attached.
With that patch applied, I can succesfully create extractvalue and insertvalue
instructions with a single index. I only tested the InsertBefore variants, but
I guess the InsertAtEnd should work identically.
I'm not really sure if that setName should be there, it's a bit weird that one
of the init methods does set the name, but the others don't. Perhaps adding a
Name argument to all init methods is better?
Gr.
Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: insertextract.diff
Type: text/x-diff
Size: 2593 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080602/dffcecb4/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080602/dffcecb4/attachment-0001.bin
From resistor at mac.com Mon Jun 2 09:58:42 2008
From: resistor at mac.com (Owen Anderson)
Date: Mon, 02 Jun 2008 07:58:42 -0700
Subject: [llvm-commits] value range analysis based on scalar-evolutions
In-Reply-To: <48439FFE.9040804@gmail.com>
References: <48436EF1.8020203@mxc.ca> <48439FFE.9040804@gmail.com>
Message-ID: <63D0BCDF-C482-4701-AF07-1D98B56DA86A@mac.com>
On Jun 2, 2008, at 12:23 AM, T?r?k Edwin wrote:
> Nick Lewycky wrote:
>
>> I was thinking we could have one analysis which would do that and
>> others that would update the central analysis.
>
> There is also Transforms/Scalar/PredicateSimplifier that tracks value
> ranges.
> It would be nice to have all that value range info available to other
> passes as well.
He's the author of PredSimplify. ;-)
--Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4260 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080602/5d2d9507/attachment.bin
From baldrick at free.fr Mon Jun 2 10:56:49 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 02 Jun 2008 15:56:49 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r51866 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Message-ID: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jun 2 10:56:49 2008
New Revision: 51866
URL: http://llvm.org/viewvc/llvm-project?rev=51866&view=rev
Log:
Fix 2003-10-09-UnionInitializerBug.c on x86-64.
The problem was that in ConvertUNION if the
new field was less aligned than a previous one
but was also the biggest field seen so far then
it was selected. But the most aligned field is
supposed to always be selected. This caused a
crash in ConvertStructFieldInitializerToType
which relies on initializers not being more
aligned than the LLVM type. In the long run
I think ConvertStructFieldInitializerToType
should be modified to not care about the
alignment.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=51866&r1=51865&r2=51866&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jun 2 10:56:49 2008
@@ -2179,7 +2179,7 @@
const TargetData &TD = getTargetData();
const Type *UnionTy = 0;
tree GccUnionTy = 0;
- unsigned MaxSize = 0, MaxAlign = 0;
+ unsigned MaxAlignSize = 0, MaxAlign = 0;
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) {
if (TREE_CODE(Field) != FIELD_DECL) continue;
// assert(getFieldOffsetInBits(Field) == 0 && "Union with non-zero offset?");
@@ -2233,29 +2233,27 @@
const Type *TheTy = ConvertType(TheGccTy);
unsigned Size = TD.getABITypeSize(TheTy);
unsigned Align = TD.getABITypeAlignment(TheTy);
-
+
adjustPaddingElement(GccUnionTy, TheGccTy);
- // Select TheTy as union type if it meets one of the following criteria
- // 1) UnionTy is 0
- // 2) TheTy alignment is more then UnionTy
- // 3) TheTy size is greater than UnionTy size and TheTy alignment is
- // equal to UnionTy
- // 4) TheTy size is greater then UnionTy size and TheTy is packed
- bool useTheTy = false;
+ // Select TheTy as union type if it is more aligned than any other. If more
+ // than one field achieves the maximum alignment then choose the biggest.
+ bool useTheTy;
if (UnionTy == 0)
useTheTy = true;
+ else if (Align < MaxAlign)
+ useTheTy = false;
else if (Align > MaxAlign)
useTheTy = true;
- else if (MaxAlign == Align && Size > MaxSize)
- useTheTy = true;
- else if (Size > MaxSize)
+ else if (Size > MaxAlignSize)
useTheTy = true;
+ else
+ useTheTy = false;
if (useTheTy) {
UnionTy = TheTy;
GccUnionTy = TheGccTy;
- MaxSize = MAX(MaxSize, Size);
+ MaxAlignSize = Size;
MaxAlign = Align;
}
From snaroff at apple.com Mon Jun 2 11:37:37 2008
From: snaroff at apple.com (Steve Naroff)
Date: Mon, 02 Jun 2008 16:37:37 -0000
Subject: [llvm-commits] [llvm] r51867 -
/llvm/trunk/win32/Configure/Configure.vcproj
Message-ID: <200806021637.m52Gbb63009558@zion.cs.uiuc.edu>
Author: snaroff
Date: Mon Jun 2 11:37:36 2008
New Revision: 51867
URL: http://llvm.org/viewvc/llvm-project?rev=51867&view=rev
Log:
update vc configure project for renaming of
hash_map/hash_set/iterator to have a .h suffix.
Modified:
llvm/trunk/win32/Configure/Configure.vcproj
Modified: llvm/trunk/win32/Configure/Configure.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Configure/Configure.vcproj?rev=51867&r1=51866&r2=51867&view=diff
==============================================================================
--- llvm/trunk/win32/Configure/Configure.vcproj (original)
+++ llvm/trunk/win32/Configure/Configure.vcproj Mon Jun 2 11:37:36 2008
@@ -235,16 +235,16 @@
Author: tbrethou
Date: Mon Jun 2 11:39:20 2008
New Revision: 51868
URL: http://llvm.org/viewvc/llvm-project?rev=51868&view=rev
Log:
Merge from mainline.
Modified:
llvm/branches/release_23/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll
Modified: llvm/branches/release_23/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_23/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll?rev=51868&r1=51867&r2=51868&view=diff
==============================================================================
--- llvm/branches/release_23/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll (original)
+++ llvm/branches/release_23/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll Mon Jun 2 11:39:20 2008
@@ -1,6 +1,5 @@
; For PR1099
-; RUN: llvm-as < %s | llc -march=c | \
-; RUN: grep {return ((((llvm_cbe_tmp2 == llvm_cbe_b_2e_0_2e_0_2e_val)) ? (1) : (0)))}
+; RUN: llvm-as < %s | llc -march=c | grep {(llvm_cbe_tmp2 == llvm_cbe_b_2e_0_2e_0_2e_val)}
target datalayout = "e-p:32:32"
target triple = "i686-apple-darwin8"
From tonic at nondot.org Mon Jun 2 11:40:49 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Mon, 02 Jun 2008 16:40:49 -0000
Subject: [llvm-commits] [llvm] r51869 - in /llvm/branches/release_23:
lib/Target/CBackend/CBackend.cpp
test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll
Message-ID: <200806021640.m52GenWF009695@zion.cs.uiuc.edu>
Author: tbrethou
Date: Mon Jun 2 11:40:49 2008
New Revision: 51869
URL: http://llvm.org/viewvc/llvm-project?rev=51869&view=rev
Log:
Merge from mainline.
Added:
llvm/branches/release_23/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll
- copied unchanged from r51813, llvm/trunk/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll
Modified:
llvm/branches/release_23/lib/Target/CBackend/CBackend.cpp
Modified: llvm/branches/release_23/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_23/lib/Target/CBackend/CBackend.cpp?rev=51869&r1=51868&r2=51869&view=diff
==============================================================================
--- llvm/branches/release_23/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/branches/release_23/lib/Target/CBackend/CBackend.cpp Mon Jun 2 11:40:49 2008
@@ -155,6 +155,7 @@
void writeOperand(Value *Operand);
void writeOperandRaw(Value *Operand);
+ void writeInstComputationInline(Instruction &I);
void writeOperandInternal(Value *Operand);
void writeOperandWithCast(Value* Operand, unsigned Opcode);
void writeOperandWithCast(Value* Operand, const ICmpInst &I);
@@ -1217,12 +1218,32 @@
return Name;
}
+/// writeInstComputationInline - Emit the computation for the specified
+/// instruction inline, with no destination provided.
+void CWriter::writeInstComputationInline(Instruction &I) {
+ // If this is a non-trivial bool computation, make sure to truncate down to
+ // a 1 bit value. This is important because we want "add i1 x, y" to return
+ // "0" when x and y are true, not "2" for example.
+ bool NeedBoolTrunc = false;
+ if (I.getType() == Type::Int1Ty && !isa(I) && !isa(I))
+ NeedBoolTrunc = true;
+
+ if (NeedBoolTrunc)
+ Out << "((";
+
+ visit(I);
+
+ if (NeedBoolTrunc)
+ Out << ")&1)";
+}
+
+
void CWriter::writeOperandInternal(Value *Operand) {
if (Instruction *I = dyn_cast(Operand))
+ // Should we inline this instruction to build a tree?
if (isInlinableInst(*I) && !isDirectAlloca(I)) {
- // Should we inline this instruction to build a tree?
Out << '(';
- visit(*I);
+ writeInstComputationInline(*I);
Out << ')';
return;
}
@@ -2146,12 +2167,12 @@
outputLValue(II);
else
Out << " ";
- visit(*II);
+ writeInstComputationInline(*II);
Out << ";\n";
}
}
- // Don't emit prefix or suffix for the terminator...
+ // Don't emit prefix or suffix for the terminator.
visit(*BB->getTerminator());
}
@@ -2475,29 +2496,34 @@
void CWriter::visitCastInst(CastInst &I) {
const Type *DstTy = I.getType();
const Type *SrcTy = I.getOperand(0)->getType();
- Out << '(';
if (isFPIntBitCast(I)) {
+ Out << '(';
// These int<->float and long<->double casts need to be handled specially
Out << GetValueName(&I) << "__BITCAST_TEMPORARY."
<< getFloatBitCastField(I.getOperand(0)->getType()) << " = ";
writeOperand(I.getOperand(0));
Out << ", " << GetValueName(&I) << "__BITCAST_TEMPORARY."
<< getFloatBitCastField(I.getType());
- } else {
- printCast(I.getOpcode(), SrcTy, DstTy);
- if (I.getOpcode() == Instruction::SExt && SrcTy == Type::Int1Ty) {
- // Make sure we really get a sext from bool by subtracing the bool from 0
- Out << "0-";
- }
- writeOperand(I.getOperand(0));
- if (DstTy == Type::Int1Ty &&
- (I.getOpcode() == Instruction::Trunc ||
- I.getOpcode() == Instruction::FPToUI ||
- I.getOpcode() == Instruction::FPToSI ||
- I.getOpcode() == Instruction::PtrToInt)) {
- // Make sure we really get a trunc to bool by anding the operand with 1
- Out << "&1u";
- }
+ Out << ')';
+ return;
+ }
+
+ Out << '(';
+ printCast(I.getOpcode(), SrcTy, DstTy);
+
+ // Make a sext from i1 work by subtracting the i1 from 0 (an int).
+ if (SrcTy == Type::Int1Ty && I.getOpcode() == Instruction::SExt)
+ Out << "0-";
+
+ writeOperand(I.getOperand(0));
+
+ if (DstTy == Type::Int1Ty &&
+ (I.getOpcode() == Instruction::Trunc ||
+ I.getOpcode() == Instruction::FPToUI ||
+ I.getOpcode() == Instruction::FPToSI ||
+ I.getOpcode() == Instruction::PtrToInt)) {
+ // Make sure we really get a trunc to bool by anding the operand with 1
+ Out << "&1u";
}
Out << ')';
}
From tonic at nondot.org Mon Jun 2 11:54:16 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Mon, 02 Jun 2008 16:54:16 -0000
Subject: [llvm-commits] [test-suite] r51870 -
/test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Message-ID: <200806021654.m52GsGXB010267@zion.cs.uiuc.edu>
Author: tbrethou
Date: Mon Jun 2 11:54:15 2008
New Revision: 51870
URL: http://llvm.org/viewvc/llvm-project?rev=51870&view=rev
Log:
Merge from mainline.
Modified:
test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Modified: test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp?rev=51870&r1=51869&r2=51870&view=diff
==============================================================================
--- test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp (original)
+++ test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp Mon Jun 2 11:54:15 2008
@@ -46,7 +46,7 @@
#ifdef SMALL_PROBLEM_SIZE
static const int TEST_SIZE = 50000;
#else
-static const int TEST_SIZE = 2097152;
+static const int TEST_SIZE = 2097152/2;
#endif
#endif
From kremenek at apple.com Mon Jun 2 12:15:46 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 02 Jun 2008 17:15:46 -0000
Subject: [llvm-commits] [llvm] r51873 - /llvm/tags/checker/checker-35/
Message-ID: <200806021715.m52HFkB5010907@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Jun 2 12:15:46 2008
New Revision: 51873
URL: http://llvm.org/viewvc/llvm-project?rev=51873&view=rev
Log:
Tagging checker-35.
Added:
llvm/tags/checker/checker-35/
- copied from r51872, llvm/trunk/
From wmatyjewicz at fastmail.fm Mon Jun 2 12:26:12 2008
From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz)
Date: Mon, 02 Jun 2008 17:26:12 -0000
Subject: [llvm-commits] [llvm] r51875 - in /llvm/trunk:
lib/Analysis/BasicAliasAnalysis.cpp
test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
Message-ID: <200806021726.m52HQCpu011191@zion.cs.uiuc.edu>
Author: wmat
Date: Mon Jun 2 12:26:12 2008
New Revision: 51875
URL: http://llvm.org/viewvc/llvm-project?rev=51875&view=rev
Log:
Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP
is longer than the second one) should stop after finding one. Added break
instruction guarantees it. It also changes difference between offsets to
absolute value of this difference in the condition.
Added:
llvm/trunk/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=51875&r1=51874&r2=51875&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Jun 2 12:26:12 2008
@@ -687,7 +687,7 @@
if (isa(GEP1Ops[i]) &&
!cast(GEP1Ops[i])->isZero()) {
// Yup, there's a constant in the tail. Set all variables to
- // constants in the GEP instruction to make it suiteable for
+ // constants in the GEP instruction to make it suitable for
// TargetData::getIndexedOffset.
for (i = 0; i != MaxOperands; ++i)
if (!isa(GEP1Ops[i]))
@@ -702,9 +702,15 @@
int64_t Offset2 = TD.getIndexedOffset(GEPPointerTy, GEP1Ops,
MinOperands);
+ // Make sure we compare the absolute difference.
+ if (Offset1 > Offset2)
+ std::swap(Offset1, Offset2);
+
// If the tail provided a bit enough offset, return noalias!
if ((uint64_t)(Offset2-Offset1) >= SizeMax)
return NoAlias;
+ // Otherwise break - we don't look for another constant in the tail.
+ break;
}
}
Added: llvm/trunk/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll?rev=51875&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll (added)
+++ llvm/trunk/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll Mon Jun 2 12:26:12 2008
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -gvn -disable-output
+; PR2395
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.S291 = type <{ %union.anon, i32 }>
+ %union.anon = type { }
+ at a291 = external global [5 x %struct.S291] ; <[5 x %struct.S291]*> [#uses=2]
+
+define void @test291() nounwind {
+entry:
+ store i32 1138410269, i32* getelementptr ([5 x %struct.S291]* @a291, i32 0, i32 2, i32 1)
+ %tmp54 = load i32* bitcast (%struct.S291* getelementptr ([5 x %struct.S291]* @a291, i32 0, i32 2) to i32*), align 4 ; [#uses=0]
+ unreachable
+}
From resistor at mac.com Mon Jun 2 12:36:36 2008
From: resistor at mac.com (Owen Anderson)
Date: Mon, 02 Jun 2008 17:36:36 -0000
Subject: [llvm-commits] [llvm] r51876 -
/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Message-ID: <200806021736.m52Haaci011474@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Jun 2 12:36:36 2008
New Revision: 51876
URL: http://llvm.org/viewvc/llvm-project?rev=51876&view=rev
Log:
Correctly handle removed instructions at the beginning of MBBs when renumbering.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=51876&r1=51875&r2=51876&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Jun 2 12:36:36 2008
@@ -128,13 +128,11 @@
i++;
} while (!newInstr);
- MachineInstr* preceding = i2miMap_[(mi2iMap_[newInstr] -
- InstrSlots::NUM) / InstrSlots::NUM];
- if (preceding->getParent() == newInstr->getParent() &&
- preceding->modifiesRegister(I->second.reg))
- LI->start = mi2iMap_[newInstr] - InstrSlots::NUM + offset;
- else
+ if (mi2iMap_[newInstr] ==
+ MBB2IdxMap[newInstr->getParent()->getNumber()].first)
LI->start = mi2iMap_[newInstr];
+ else
+ LI->start = mi2iMap_[newInstr] - InstrSlots::NUM + offset;
}
// Remap the ending index in the same way that we remapped the start,
@@ -172,13 +170,11 @@
i++;
} while (!newInstr);
- MachineInstr* preceding = i2miMap_[(mi2iMap_[newInstr] -
- InstrSlots::NUM) / InstrSlots::NUM];
- if (preceding->getParent() == newInstr->getParent() &&
- preceding->modifiesRegister(I->second.reg))
- vni->def = mi2iMap_[newInstr] - InstrSlots::NUM + offset;
- else
+ if (mi2iMap_[newInstr] ==
+ MBB2IdxMap[newInstr->getParent()->getNumber()].first)
vni->def = mi2iMap_[newInstr];
+ else
+ vni->def = mi2iMap_[newInstr] - InstrSlots::NUM + offset;
}
// Remap the VNInfo kill indices, which works the same as
From gohman at apple.com Mon Jun 2 12:40:39 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 02 Jun 2008 17:40:39 -0000
Subject: [llvm-commits] [llvm] r51877 - in /llvm/trunk:
test/CodeGen/X86/variadic-node-pic.ll utils/TableGen/DAGISelEmitter.cpp
Message-ID: <200806021740.m52Hedhq011599@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 12:40:38 2008
New Revision: 51877
URL: http://llvm.org/viewvc/llvm-project?rev=51877&view=rev
Log:
Fix the position of MemOperands in nodes that use variadic_ops
in DAGISelEmitter output. This bug was recently uncovered by the
addition of patterns for CALL32m and CALL64m, which are nodes
that now have both MemOperands and variadic_ops.
This bug was especially visible with PIC in various configurations,
because the new patterns are matching the indirect call code used
in many PIC configurations.
Added:
llvm/trunk/test/CodeGen/X86/variadic-node-pic.ll
Modified:
llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
Added: llvm/trunk/test/CodeGen/X86/variadic-node-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/variadic-node-pic.ll?rev=51877&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/variadic-node-pic.ll (added)
+++ llvm/trunk/test/CodeGen/X86/variadic-node-pic.ll Mon Jun 2 12:40:38 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -relocation-model=pic -code-model=large
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+declare void @xscanf(i64) nounwind
+
+define void @foo() nounwind {
+ call void (i64)* @xscanf( i64 0 ) nounwind
+ unreachable
+}
Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=51877&r1=51876&r2=51877&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Jun 2 12:40:38 2008
@@ -992,18 +992,6 @@
}
}
- // Generate MemOperandSDNodes nodes for each memory accesses covered by
- // this pattern.
- if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
- std::vector::const_iterator mi, mie;
- for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
- emitCode("SDOperand LSI_" + *mi + " = "
- "CurDAG->getMemOperand(cast(" +
- *mi + ")->getMemOperand());");
- AllOps.push_back("LSI_" + *mi);
- }
- }
-
// Emit all the chain and CopyToReg stuff.
bool ChainEmitted = NodeHasChain;
if (NodeHasChain)
@@ -1088,6 +1076,21 @@
emitCode("}");
}
+ // Generate MemOperandSDNodes nodes for each memory accesses covered by
+ // this pattern.
+ if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
+ std::vector::const_iterator mi, mie;
+ for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
+ emitCode("SDOperand LSI_" + *mi + " = "
+ "CurDAG->getMemOperand(cast(" +
+ *mi + ")->getMemOperand());");
+ if (IsVariadic)
+ emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + *mi + ");");
+ else
+ AllOps.push_back("LSI_" + *mi);
+ }
+ }
+
if (NodeHasChain) {
if (IsVariadic)
emitCode("Ops" + utostr(OpsNo) + ".push_back(" + ChainName + ");");
From gohman at apple.com Mon Jun 2 12:47:29 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 2 Jun 2008 10:47:29 -0700
Subject: [llvm-commits] [llvm] r51863 - in /llvm/trunk:
include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
In-Reply-To: <200806020118.m521ILWG007059@zion.cs.uiuc.edu>
References: <200806020118.m521ILWG007059@zion.cs.uiuc.edu>
Message-ID:
On Jun 1, 2008, at 6:18 PM, Chris Lattner wrote:
> Author: lattner
> Date: Sun Jun 1 20:18:21 2008
> New Revision: 51863
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51863&view=rev
> Log:
> move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits
> out of instcombine into a new file in libanalysis. This also teaches
> ComputeNumSignBits about the number of sign bits in a constantint.
Hi Chris,
ComputeNumSignBits has fallback code that uses ComputeMaskedBits
to compute a result for any node that it doesn't have special
logic for. That logic should have handled ConstantInt; was it
failing to do so?
Dan
From gohman at apple.com Mon Jun 2 12:52:55 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 2 Jun 2008 10:52:55 -0700
Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk:
docs/LangRef.html include/llvm/Constants.h
include/llvm/DerivedTypes.h include/llvm/Instructions.h
lib/AsmParser/llvmAsmParser.cpp.cvs
lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y
lib/AsmParser/llvmAsmParser.y.cvs
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp
lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
test/Assembler/insertextractvalue.ll
In-Reply-To: <1F0682CE-29D4-483E-BE8D-324DEE70F17C@mac.com>
References: <1F0682CE-29D4-483E-BE8D-324DEE70F17C@mac.com>
Message-ID: <40C0FD9E-4F8A-49EB-83FB-82B72B1C2483@apple.com>
On May 31, 2008, at 12:25 AM, Gabor Greif wrote:
> Hi Dan,
>
> please find my comments inline:
Hi Gabor,
Thanks a lot for reviewing this! I neglected to mention that
51820 and 51821 fix the issues you found.
Dan
From sabre at nondot.org Mon Jun 2 13:39:07 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 02 Jun 2008 18:39:07 -0000
Subject: [llvm-commits] [llvm] r51878 -
/llvm/trunk/lib/Analysis/ValueTracking.cpp
Message-ID: <200806021839.m52Id80o013239@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jun 2 13:39:07 2008
New Revision: 51878
URL: http://llvm.org/viewvc/llvm-project?rev=51878&view=rev
Log:
Remove unneeded code I added.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=51878&r1=51877&r2=51878&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Jun 2 13:39:07 2008
@@ -565,12 +565,9 @@
unsigned Tmp, Tmp2;
unsigned FirstAnswer = 1;
- if (ConstantInt *CI = dyn_cast(V)) {
- if (CI->getValue().isNegative())
- return CI->getValue().countLeadingOnes();
- return CI->getValue().countLeadingZeros();
- }
-
+ // Note that ConstantInt is handled by the general ComputeMaskedBits case
+ // below.
+
if (Depth == 6)
return 1; // Limit search depth.
From clattner at apple.com Mon Jun 2 13:39:28 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 2 Jun 2008 11:39:28 -0700
Subject: [llvm-commits] [llvm] r51863 - in /llvm/trunk:
include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
In-Reply-To:
References: <200806020118.m521ILWG007059@zion.cs.uiuc.edu>
Message-ID: <6B9303D7-5957-4115-92CA-1C3DE34869ED@apple.com>
On Jun 2, 2008, at 10:47 AM, Dan Gohman wrote:
>
> On Jun 1, 2008, at 6:18 PM, Chris Lattner wrote:
>
>> Author: lattner
>> Date: Sun Jun 1 20:18:21 2008
>> New Revision: 51863
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51863&view=rev
>> Log:
>> move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits
>> out of instcombine into a new file in libanalysis. This also teaches
>> ComputeNumSignBits about the number of sign bits in a constantint.
>
> Hi Chris,
>
> ComputeNumSignBits has fallback code that uses ComputeMaskedBits
> to compute a result for any node that it doesn't have special
> logic for. That logic should have handled ConstantInt; was it
> failing to do so?
Very subtle, I missed that. Thanks, I added a comment and removed the
code.
-Chris
From gohman at apple.com Mon Jun 2 14:47:10 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 02 Jun 2008 19:47:10 -0000
Subject: [llvm-commits] [llvm] r51879 - /llvm/trunk/utils/llvm.grm
Message-ID: <200806021947.m52JlA1t015313@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 14:47:09 2008
New Revision: 51879
URL: http://llvm.org/viewvc/llvm-project?rev=51879&view=rev
Log:
Update the polygen grammer for the new insertvalue and extractvalue syntax.
Modified:
llvm/trunk/utils/llvm.grm
Modified: llvm/trunk/utils/llvm.grm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?rev=51879&r1=51878&r2=51879&view=diff
==============================================================================
--- llvm/trunk/utils/llvm.grm (original)
+++ llvm/trunk/utils/llvm.grm Mon Jun 2 14:47:09 2008
@@ -223,8 +223,8 @@
| extractelement "(" ^ ConstVal ^ "," ConstVal ^ ")"
| insertelement "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")"
| shufflevector "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")"
- | extractvalue "(" ^ ConstVal IndexList ^ ")"
- | insertvalue "(" ^ ConstVal ^ "," ConstVal IndexList ^ ")" ;
+ | extractvalue "(" ^ ConstVal ^ ConstantIndexList ^ ")"
+ | insertvalue "(" ^ ConstVal ^ "," ConstVal ^ ConstantIndexList ^ ")" ;
ConstVector ::= ConstVector ^ "," ConstVal | ConstVal ;
@@ -345,6 +345,8 @@
IndexList ::= _ | IndexList ^ "," ResolvedVal ;
+ConstantIndexList ::= "," EUINT64VAL | ConstantIndexList ^ "," EUINT64VAL ;
+
OptTailCall ::= tail call | call ;
InstVal ::=
@@ -376,5 +378,5 @@
| OptVolatile store ResolvedVal ^ "," Types ValueRef OptCAlign
| getresult Types ValueRef ^ "," EUINT64VAL
| getelementptr Types ValueRef IndexList
- | extractvalue Types ValueRef IndexList
- | insertvalue Types ValueRef ^ "," Types ValueRef IndexList ;
+ | extractvalue Types ValueRef ^ ConstantIndexList
+ | insertvalue Types ValueRef ^ "," Types ValueRef ^ ConstantIndexList ;
From gohman at apple.com Mon Jun 2 15:15:53 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 2 Jun 2008 13:15:53 -0700
Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html
include/llvm/Constants.h include/llvm/DerivedTypes.h
include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs
lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y
lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp
lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
test/Assembler/insertextractvalue.ll
In-Reply-To: <20080602133930.GG25337@katherina.student.utwente.nl>
References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu>
<20080602133930.GG25337@katherina.student.utwente.nl>
Message-ID: <04C413B9-0D61-4F4F-A605-786B2D735CF6@apple.com>
Hi Matthijs,
This looks good; please commit it.
I agree the setName situation is a little inconsistent. This
code is actually modeled after the getelementptr code which
works the same way. Would you mind preparing a patch to
fix this?
Thanks,
Dan
On Jun 2, 2008, at 6:39 AM, Matthijs Kooijman wrote:
> Hi Dan,
>
> there are still some constructors missing, find a patch for them
> attached.
>
> With that patch applied, I can succesfully create extractvalue and
> insertvalue
> instructions with a single index. I only tested the InsertBefore
> variants, but
> I guess the InsertAtEnd should work identically.
>
> I'm not really sure if that setName should be there, it's a bit
> weird that one
> of the init methods does set the name, but the others don't. Perhaps
> adding a
> Name argument to all init methods is better?
>
> Gr.
>
> Matthijs
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From gohman at apple.com Mon Jun 2 16:30:50 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 02 Jun 2008 21:30:50 -0000
Subject: [llvm-commits] [llvm] r51881 - in /llvm/trunk:
lib/Target/CBackend/CBackend.cpp
test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
Message-ID: <200806022130.m52LUoxf025539@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 16:30:49 2008
New Revision: 51881
URL: http://llvm.org/viewvc/llvm-project?rev=51881&view=rev
Log:
Implement CBE support for first-class structs and array values,
and insertvalue and extractvalue instructions.
First-class array values are not trivial because C doesn't
support them. The approach I took here is to wrap all arrays
in structs. Feedback is welcome.
The 2007-01-15-NamedArrayType.ll test needed to be modified
because it has a "not grep" for a string that now exists,
because array types now have associated struct types, and
those struct types have names.
Modified:
llvm/trunk/lib/Target/CBackend/CBackend.cpp
llvm/trunk/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=51881&r1=51880&r2=51881&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Jun 2 16:30:49 2008
@@ -171,7 +171,7 @@
void printModule(Module *M);
void printModuleTypes(const TypeSymbolTable &ST);
- void printContainedStructs(const Type *Ty, std::set &);
+ void printContainedStructs(const Type *Ty, std::set &);
void printFloatingPointConstants(Function &F);
void printFunctionSignature(const Function *F, bool Prototype);
@@ -210,7 +210,8 @@
// emit it inline where it would go.
if (I.getType() == Type::VoidTy || !I.hasOneUse() ||
isa(I) || isa(I) || isa(I) ||
- isa(I) || isa(I) || isa(I))
+ isa(I) || isa(I) || isa(I) ||
+ isa(I))
// Don't inline a load across a store or other bad things!
return false;
@@ -286,6 +287,9 @@
void visitShuffleVectorInst(ShuffleVectorInst &SVI);
void visitGetResultInst(GetResultInst &GRI);
+ void visitInsertValueInst(InsertValueInst &I);
+ void visitExtractValueInst(ExtractValueInst &I);
+
void visitInstruction(Instruction &I) {
cerr << "C Writer does not know about " << I;
abort();
@@ -325,9 +329,10 @@
TI != TE; ) {
TypeSymbolTable::iterator I = TI++;
- // If this isn't a struct type, remove it from our set of types to name.
- // This simplifies emission later.
- if (!isa(I->second) && !isa(I->second)) {
+ // If this isn't a struct or array type, remove it from our set of types
+ // to name. This simplifies emission later.
+ if (!isa(I->second) && !isa(I->second) &&
+ !isa(I->second)) {
TST.remove(I);
} else {
// If this is not used, remove it from the symbol table.
@@ -346,8 +351,8 @@
unsigned RenameCounter = 0;
for (std::set::const_iterator I = UT.begin(), E = UT.end();
I != E; ++I)
- if (const StructType *ST = dyn_cast(*I)) {
- while (M.addTypeName("unnamed"+utostr(RenameCounter), ST))
+ if (isa(*I) || isa(*I)) {
+ while (M.addTypeName("unnamed"+utostr(RenameCounter), *I))
++RenameCounter;
Changed = true;
}
@@ -557,8 +562,12 @@
const ArrayType *ATy = cast(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
- return printType(Out, ATy->getElementType(), false,
- NameSoFar + "[" + utostr(NumElements) + "]");
+ // Arrays are wrapped in structs to allow them to have normal
+ // value semantics (avoiding the array "decay").
+ Out << NameSoFar << " { ";
+ printType(Out, ATy->getElementType(), false,
+ "array[" + utostr(NumElements) + "]");
+ return Out << "; }";
}
case Type::OpaqueTyID: {
@@ -1013,6 +1022,7 @@
}
case Type::ArrayTyID:
+ Out << "{ "; // Arrays are wrapped in struct types.
if (ConstantArray *CA = dyn_cast(CPV)) {
printConstantArray(CA);
} else {
@@ -1030,6 +1040,7 @@
}
Out << " }";
}
+ Out << " }"; // Arrays are wrapped in struct types.
break;
case Type::VectorTyID:
@@ -1760,9 +1771,12 @@
// the compiler figure out the rest of the zeros.
Out << " = " ;
if (isa(I->getInitializer()->getType()) ||
- isa(I->getInitializer()->getType()) ||
isa(I->getInitializer()->getType())) {
Out << "{ 0 }";
+ } else if (isa(I->getInitializer()->getType())) {
+ // As with structs and vectors, but with an extra set of braces
+ // because arrays are wrapped in structs.
+ Out << "{ { 0 } }";
} else {
// Just print it out normally.
writeOperand(I->getInitializer());
@@ -1904,16 +1918,16 @@
Out << '\n';
// Keep track of which structures have been printed so far...
- std::set StructPrinted;
+ std::set StructPrinted;
// Loop over all structures then push them into the stack so they are
// printed in the correct order.
//
Out << "/* Structure contents */\n";
for (I = TST.begin(); I != End; ++I)
- if (const StructType *STy = dyn_cast(I->second))
+ if (isa(I->second) || isa(I->second))
// Only print out used types!
- printContainedStructs(STy, StructPrinted);
+ printContainedStructs(I->second, StructPrinted);
}
// Push the struct onto the stack and recursively push all structs
@@ -1922,7 +1936,7 @@
// TODO: Make this work properly with vector types
//
void CWriter::printContainedStructs(const Type *Ty,
- std::set &StructPrinted){
+ std::set &StructPrinted) {
// Don't walk through pointers.
if (isa(Ty) || Ty->isPrimitiveType() || Ty->isInteger()) return;
@@ -1931,12 +1945,12 @@
E = Ty->subtype_end(); I != E; ++I)
printContainedStructs(*I, StructPrinted);
- if (const StructType *STy = dyn_cast(Ty)) {
+ if (isa(Ty) || isa(Ty)) {
// Check to see if we have already printed this struct.
- if (StructPrinted.insert(STy).second) {
+ if (StructPrinted.insert(Ty).second) {
// Print structure type out.
- std::string Name = TypeNames[STy];
- printType(Out, STy, false, Name, true);
+ std::string Name = TypeNames[Ty];
+ printType(Out, Ty, false, Name, true);
Out << ";\n\n";
}
}
@@ -3097,6 +3111,10 @@
for (; I != E; ++I) {
if (isa(*I)) {
Out << ".field" << cast(I.getOperand())->getZExtValue();
+ } else if (isa(*I)) {
+ Out << ".array[";
+ writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
+ Out << ']';
} else if (!isa(*I)) {
Out << '[';
writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
@@ -3255,6 +3273,47 @@
Out << ")";
}
+void CWriter::visitInsertValueInst(InsertValueInst &IVI) {
+ // Start by copying the entire aggregate value into the result variable.
+ writeOperand(IVI.getOperand(0));
+ Out << ";\n ";
+
+ // Then do the insert to update the field.
+ Out << GetValueName(&IVI);
+ for (const unsigned *b = IVI.idx_begin(), *i = b, *e = IVI.idx_end();
+ i != e; ++i) {
+ const Type *IndexedTy =
+ ExtractValueInst::getIndexedType(IVI.getOperand(0)->getType(), b, i+1);
+ if (isa(IndexedTy))
+ Out << ".array[" << *i << "]";
+ else
+ Out << ".field" << *i;
+ }
+ Out << " = ";
+ writeOperand(IVI.getOperand(1));
+}
+
+void CWriter::visitExtractValueInst(ExtractValueInst &EVI) {
+ Out << "(";
+ if (isa(EVI.getOperand(0))) {
+ Out << "(";
+ printType(Out, EVI.getType());
+ Out << ") 0/*UNDEF*/";
+ } else {
+ Out << GetValueName(EVI.getOperand(0));
+ for (const unsigned *b = EVI.idx_begin(), *i = b, *e = EVI.idx_end();
+ i != e; ++i) {
+ const Type *IndexedTy =
+ ExtractValueInst::getIndexedType(EVI.getOperand(0)->getType(), b, i+1);
+ if (isa(IndexedTy))
+ Out << ".array[" << *i << "]";
+ else
+ Out << ".field" << *i;
+ }
+ }
+ Out << ")";
+}
+
//===----------------------------------------------------------------------===//
// External Interface declaration
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll?rev=51881&r1=51880&r2=51881&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll (original)
+++ llvm/trunk/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll Mon Jun 2 16:30:49 2008
@@ -1,5 +1,5 @@
; PR918
-; RUN: llvm-as < %s | llc -march=c | not grep fixarray_array3
+; RUN: llvm-as < %s | llc -march=c | not grep {l_structtype_s l_fixarray_array3}
%structtype_s = type { i32 }
%fixarray_array3 = type [3 x %structtype_s]
From scottm at aero.org Mon Jun 2 17:18:03 2008
From: scottm at aero.org (Scott Michel)
Date: Mon, 02 Jun 2008 22:18:03 -0000
Subject: [llvm-commits] [llvm] r51884 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.h
lib/Target/CellSPU/SPUInstrInfo.td lib/Target/CellSPU/SPUNodes.td
lib/Target/CellSPU/SPUOperands.td test/CodeGen/CellSPU/immed64.ll
Message-ID: <200806022218.m52MI4Ud024127@zion.cs.uiuc.edu>
Author: pingbak
Date: Mon Jun 2 17:18:03 2008
New Revision: 51884
URL: http://llvm.org/viewvc/llvm-project?rev=51884&view=rev
Log:
Add necessary 64-bit support so that gcc frontend compiles (mostly). Current
issue is operand promotion for setcc/select... but looks like the fundamental
stuff is implemented for CellSPU.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td
llvm/trunk/lib/Target/CellSPU/SPUNodes.td
llvm/trunk/lib/Target/CellSPU/SPUOperands.td
llvm/trunk/test/CodeGen/CellSPU/immed64.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jun 2 17:18:03 2008
@@ -4441,11 +4441,20 @@
AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1)));
break;
}
- case ISD::SELECT:
+ case ISD::SELECT: {
Tmp2 = PromoteOp(Node->getOperand(1)); // Legalize the op0
Tmp3 = PromoteOp(Node->getOperand(2)); // Legalize the op1
+
+ unsigned VT2 = Tmp2.getValueType();
+ assert(VT2 == Tmp3.getValueType()
+ && "PromoteOp: Operands 2 and 3 ValueTypes don't match");
+ // Ensure tha NVT is the same as the operands' value types, because we
+ // cannot assume that TLI.getSetCCValueType() is constant.
+ if (NVT != VT2)
+ NVT = VT2;
Result = DAG.getNode(ISD::SELECT, NVT, Node->getOperand(0), Tmp2, Tmp3);
break;
+ }
case ISD::SELECT_CC:
Tmp2 = PromoteOp(Node->getOperand(2)); // True
Tmp3 = PromoteOp(Node->getOperand(3)); // False
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Jun 2 17:18:03 2008
@@ -219,8 +219,10 @@
// Custom lower i32 multiplications
setOperationAction(ISD::MUL, MVT::i32, Custom);
- // Need to custom handle (some) common i8 math ops
+ // Need to custom handle (some) common i8, i64 math ops
+ setOperationAction(ISD::ADD, MVT::i64, Custom);
setOperationAction(ISD::SUB, MVT::i8, Custom);
+ setOperationAction(ISD::SUB, MVT::i64, Custom);
setOperationAction(ISD::MUL, MVT::i8, Custom);
// SPU does not have BSWAP. It does have i32 support CTLZ.
@@ -238,7 +240,7 @@
setOperationAction(ISD::CTLZ , MVT::i32, Legal);
- // SPU has a version of select that implements (a&~c)|(b|c), just like
+ // SPU has a version of select that implements (a&~c)|(b&c), just like
// select ought to work:
setOperationAction(ISD::SELECT, MVT::i1, Promote);
setOperationAction(ISD::SELECT, MVT::i8, Legal);
@@ -427,8 +429,14 @@
node_names[(unsigned) SPUISD::ROTBYTES_LEFT] = "SPUISD::ROTBYTES_LEFT";
node_names[(unsigned) SPUISD::ROTBYTES_LEFT_CHAINED] =
"SPUISD::ROTBYTES_LEFT_CHAINED";
- node_names[(unsigned) SPUISD::FSMBI] = "SPUISD::FSMBI";
+ node_names[(unsigned) SPUISD::ROTBYTES_LEFT_BITS] =
+ "SPUISD::ROTBYTES_LEFT_BITS";
+ node_names[(unsigned) SPUISD::SELECT_MASK] = "SPUISD::SELECT_MASK";
node_names[(unsigned) SPUISD::SELB] = "SPUISD::SELB";
+ node_names[(unsigned) SPUISD::ADD_EXTENDED] = "SPUISD::ADD_EXTENDED";
+ node_names[(unsigned) SPUISD::CARRY_GENERATE] = "SPUISD::CARRY_GENERATE";
+ node_names[(unsigned) SPUISD::SUB_EXTENDED] = "SPUISD::SUB_EXTENDED";
+ node_names[(unsigned) SPUISD::BORROW_GENERATE] = "SPUISD::BORROW_GENERATE";
node_names[(unsigned) SPUISD::FPInterp] = "SPUISD::FPInterp";
node_names[(unsigned) SPUISD::FPRecipEst] = "SPUISD::FPRecipEst";
node_names[(unsigned) SPUISD::SEXT32TO64] = "SPUISD::SEXT32TO64";
@@ -1706,33 +1714,33 @@
}
for (int i = 0; i < 4; ++i) {
+ uint64_t val = 0;
for (int j = 0; j < 4; ++j) {
SDOperand V;
bool process_upper, process_lower;
- uint64_t val = 0;
-
+ val <<= 8;
process_upper = (upper_special && (i & 1) == 0);
process_lower = (lower_special && (i & 1) == 1);
if (process_upper || process_lower) {
if ((process_upper && upper == 0)
|| (process_lower && lower == 0))
- val = 0x80;
+ val |= 0x80;
else if ((process_upper && upper == 0xffffffff)
|| (process_lower && lower == 0xffffffff))
- val = 0xc0;
+ val |= 0xc0;
else if ((process_upper && upper == 0x80000000)
|| (process_lower && lower == 0x80000000))
- val = (j == 0 ? 0xe0 : 0x80);
+ val |= (j == 0 ? 0xe0 : 0x80);
} else
- val = i * 4 + j + ((i & 1) * 16);
-
- ShufBytes.push_back(DAG.getConstant(val, MVT::i8));
+ val |= i * 4 + j + ((i & 1) * 16);
}
+
+ ShufBytes.push_back(DAG.getConstant(val, MVT::i32));
}
return DAG.getNode(SPUISD::SHUFB, VT, HI32, LO32,
- DAG.getNode(ISD::BUILD_VECTOR, MVT::v16i8,
+ DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32,
&ShufBytes[0], ShufBytes.size()));
}
}
@@ -1904,7 +1912,7 @@
// b) multiply upper halves, rotate left by 16 bits (inserts 16 lower zeroes)
// c) Use SELB to select upper and lower halves from the intermediate results
//
- // NOTE: We really want to move the FSMBI to earlier to actually get the
+ // NOTE: We really want to move the SELECT_MASK to earlier to actually get the
// dual-issue. This code does manage to do this, even if it's a little on
// the wacky side
case MVT::v8i16: {
@@ -1918,7 +1926,7 @@
SDOperand FSMBOp =
DAG.getCopyToReg(Chain, FSMBIreg,
- DAG.getNode(SPUISD::FSMBI, MVT::v8i16,
+ DAG.getNode(SPUISD::SELECT_MASK, MVT::v8i16,
DAG.getConstant(0xcccc, MVT::i16)));
SDOperand HHProd =
@@ -1962,7 +1970,7 @@
DAG.getNode(SPUISD::VEC_SHL, MVT::v8i16,
DAG.getNode(SPUISD::MPY, MVT::v8i16, rALH, rBLH), c8);
- SDOperand FSMBmask = DAG.getNode(SPUISD::FSMBI, MVT::v8i16,
+ SDOperand FSMBmask = DAG.getNode(SPUISD::SELECT_MASK, MVT::v8i16,
DAG.getConstant(0x2222, MVT::i16));
SDOperand LoProdParts =
@@ -2293,6 +2301,64 @@
DAG.getConstant(4, MVT::i32))));
}
+ case ISD::ADD: {
+ // Turn operands into vectors to satisfy type checking (shufb works on
+ // vectors)
+ SDOperand Op0 =
+ DAG.getNode(SPUISD::PROMOTE_SCALAR, MVT::v2i64, Op.getOperand(0));
+ SDOperand Op1 =
+ DAG.getNode(SPUISD::PROMOTE_SCALAR, MVT::v2i64, Op.getOperand(1));
+ SmallVector ShufBytes;
+
+ // Create the shuffle mask for "rotating" the borrow up one register slot
+ // once the borrow is generated.
+ ShufBytes.push_back(DAG.getConstant(0x04050607, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0x80808080, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0x0c0d0e0f, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0x80808080, MVT::i32));
+
+ SDOperand CarryGen =
+ DAG.getNode(SPUISD::CARRY_GENERATE, MVT::v2i64, Op0, Op1);
+ SDOperand ShiftedCarry =
+ DAG.getNode(SPUISD::SHUFB, MVT::v2i64,
+ CarryGen, CarryGen,
+ DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32,
+ &ShufBytes[0], ShufBytes.size()));
+
+ return DAG.getNode(SPUISD::EXTRACT_ELT0, MVT::i64,
+ DAG.getNode(SPUISD::ADD_EXTENDED, MVT::v2i64,
+ Op0, Op1, ShiftedCarry));
+ }
+
+ case ISD::SUB: {
+ // Turn operands into vectors to satisfy type checking (shufb works on
+ // vectors)
+ SDOperand Op0 =
+ DAG.getNode(SPUISD::PROMOTE_SCALAR, MVT::v2i64, Op.getOperand(0));
+ SDOperand Op1 =
+ DAG.getNode(SPUISD::PROMOTE_SCALAR, MVT::v2i64, Op.getOperand(1));
+ SmallVector ShufBytes;
+
+ // Create the shuffle mask for "rotating" the borrow up one register slot
+ // once the borrow is generated.
+ ShufBytes.push_back(DAG.getConstant(0x04050607, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0xc0c0c0c0, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0x0c0d0e0f, MVT::i32));
+ ShufBytes.push_back(DAG.getConstant(0xc0c0c0c0, MVT::i32));
+
+ SDOperand BorrowGen =
+ DAG.getNode(SPUISD::BORROW_GENERATE, MVT::v2i64, Op0, Op1);
+ SDOperand ShiftedBorrow =
+ DAG.getNode(SPUISD::SHUFB, MVT::v2i64,
+ BorrowGen, BorrowGen,
+ DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32,
+ &ShufBytes[0], ShufBytes.size()));
+
+ return DAG.getNode(SPUISD::EXTRACT_ELT0, MVT::i64,
+ DAG.getNode(SPUISD::SUB_EXTENDED, MVT::v2i64,
+ Op0, Op1, ShiftedBorrow));
+ }
+
case ISD::SHL: {
SDOperand ShiftAmt = Op.getOperand(1);
unsigned ShiftAmtVT = unsigned(ShiftAmt.getValueType());
@@ -2301,7 +2367,7 @@
DAG.getNode(SPUISD::SELB, VecVT,
Op0Vec,
DAG.getConstant(0, VecVT),
- DAG.getNode(SPUISD::FSMBI, VecVT,
+ DAG.getNode(SPUISD::SELECT_MASK, VecVT,
DAG.getConstant(0xff00ULL, MVT::i16)));
SDOperand ShiftAmtBytes =
DAG.getNode(ISD::SRL, ShiftAmtVT,
@@ -2337,6 +2403,43 @@
Op0, ShiftAmtBytes),
ShiftAmtBits);
}
+
+ case ISD::SRA: {
+ // Promote Op0 to vector
+ SDOperand Op0 =
+ DAG.getNode(SPUISD::PROMOTE_SCALAR, MVT::v2i64, Op.getOperand(0));
+ SDOperand ShiftAmt = Op.getOperand(1);
+ unsigned ShiftVT = ShiftAmt.getValueType();
+
+ // Negate variable shift amounts
+ if (!isa(ShiftAmt)) {
+ ShiftAmt = DAG.getNode(ISD::SUB, ShiftVT,
+ DAG.getConstant(0, ShiftVT), ShiftAmt);
+ }
+
+ SDOperand UpperHalfSign =
+ DAG.getNode(SPUISD::EXTRACT_ELT0, MVT::i32,
+ DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32,
+ DAG.getNode(SPUISD::VEC_SRA, MVT::v2i64,
+ Op0, DAG.getConstant(31, MVT::i32))));
+ SDOperand UpperHalfSignMask =
+ DAG.getNode(SPUISD::SELECT_MASK, MVT::v2i64, UpperHalfSign);
+ SDOperand UpperLowerMask =
+ DAG.getNode(SPUISD::SELECT_MASK, MVT::v2i64,
+ DAG.getConstant(0xff00, MVT::i16));
+ SDOperand UpperLowerSelect =
+ DAG.getNode(SPUISD::SELB, MVT::v2i64,
+ UpperHalfSignMask, Op0, UpperLowerMask);
+ SDOperand RotateLeftBytes =
+ DAG.getNode(SPUISD::ROTBYTES_LEFT_BITS, MVT::v2i64,
+ UpperLowerSelect, ShiftAmt);
+ SDOperand RotateLeftBits =
+ DAG.getNode(SPUISD::ROTBYTES_LEFT, MVT::v2i64,
+ RotateLeftBytes, ShiftAmt);
+
+ return DAG.getNode(SPUISD::EXTRACT_ELT0, MVT::i64,
+ RotateLeftBits);
+ }
}
return SDOperand();
@@ -2567,17 +2670,19 @@
case ISD::ZERO_EXTEND:
case ISD::SIGN_EXTEND:
case ISD::ANY_EXTEND:
+ case ISD::ADD:
case ISD::SUB:
case ISD::ROTR:
case ISD::ROTL:
case ISD::SRL:
case ISD::SHL:
- case ISD::SRA:
+ case ISD::SRA: {
if (VT == MVT::i8)
return LowerI8Math(Op, DAG, Opc);
else if (VT == MVT::i64)
return LowerI64Math(Op, DAG, Opc);
break;
+ }
// Vector-related lowering.
case ISD::BUILD_VECTOR:
@@ -2641,9 +2746,7 @@
case ISD::ADD: {
SDOperand Op1 = N->getOperand(1);
- if ((Op1.getOpcode() == ISD::Constant
- || Op1.getOpcode() == ISD::TargetConstant)
- && Op0.getOpcode() == SPUISD::IndirectAddr) {
+ if (isa(Op1) && Op0.getOpcode() == SPUISD::IndirectAddr) {
SDOperand Op01 = Op0.getOperand(1);
if (Op01.getOpcode() == ISD::Constant
|| Op01.getOpcode() == ISD::TargetConstant) {
@@ -2662,8 +2765,7 @@
return DAG.getNode(SPUISD::IndirectAddr, Op0.getValueType(),
Op0.getOperand(0), combinedConst);
}
- } else if ((Op0.getOpcode() == ISD::Constant
- || Op0.getOpcode() == ISD::TargetConstant)
+ } else if (isa(Op0)
&& Op1.getOpcode() == SPUISD::IndirectAddr) {
SDOperand Op11 = Op1.getOperand(1);
if (Op11.getOpcode() == ISD::Constant
@@ -2899,11 +3001,11 @@
case SPUISD::ROTBYTES_RIGHT_S:
case SPUISD::ROTBYTES_LEFT:
case SPUISD::ROTBYTES_LEFT_CHAINED:
- case FSMBI:
- case SELB:
- case FPInterp:
- case FPRecipEst:
- case SEXT32TO64:
+ case SPUISD::SELECT_MASK:
+ case SPUISD::SELB:
+ case SPUISD::FPInterp:
+ case SPUISD::FPRecipEst:
+ case SPUISD::SEXT32TO64:
#endif
}
}
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Mon Jun 2 17:18:03 2008
@@ -62,8 +62,13 @@
ROTBYTES_RIGHT_S, ///< Vector rotate right, by bytes, sign fill
ROTBYTES_LEFT, ///< Rotate bytes (loads -> ROTQBYI)
ROTBYTES_LEFT_CHAINED, ///< Rotate bytes (loads -> ROTQBYI), with chain
- FSMBI, ///< Form Select Mask for Bytes, Immediate
+ ROTBYTES_LEFT_BITS, ///< Rotate bytes left by bit shift count
+ SELECT_MASK, ///< Select Mask (FSM, FSMB, FSMH, FSMBI)
SELB, ///< Select bits -> (b & mask) | (a & ~mask)
+ ADD_EXTENDED, ///< Add extended, with carry
+ CARRY_GENERATE, ///< Carry generate for ADD_EXTENDED
+ SUB_EXTENDED, ///< Subtract extended, with borrow
+ BORROW_GENERATE, ///< Borrow generate for SUB_EXTENDED
FPInterp, ///< Floating point interpolate
FPRecipEst, ///< Floating point reciprocal estimate
SEXT32TO64, ///< Sign-extended 32-bit const -> 64-bits
Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Mon Jun 2 17:18:03 2008
@@ -469,7 +469,7 @@
RI16Form<0b101001100, (outs VECREG:$rT), (ins u16imm:$val),
"fsmbi\t$rT, $val",
SelectOp,
- [(set (vectype VECREG:$rT), (SPUfsmbi (i16 immU16:$val)))]>;
+ [(set (vectype VECREG:$rT), (SPUselmask (i16 immU16:$val)))]>;
multiclass FormSelectMaskBytesImm
{
@@ -485,21 +485,37 @@
def FSMB:
RRForm_1<0b01101101100, (outs VECREG:$rT), (ins R16C:$rA),
"fsmb\t$rT, $rA", SelectOp,
- [(set (v16i8 VECREG:$rT), (SPUfsmbi R16C:$rA))]>;
+ [(set (v16i8 VECREG:$rT), (SPUselmask R16C:$rA))]>;
// fsmh: Form select mask for halfwords. N.B., Input operand, $rA, is
// only 8-bits wide (even though it's input as 16-bits here)
def FSMH:
RRForm_1<0b10101101100, (outs VECREG:$rT), (ins R16C:$rA),
"fsmh\t$rT, $rA", SelectOp,
- [(set (v8i16 VECREG:$rT), (SPUfsmbi R16C:$rA))]>;
+ [(set (v8i16 VECREG:$rT), (SPUselmask R16C:$rA))]>;
// fsm: Form select mask for words. Like the other fsm* instructions,
// only the lower 4 bits of $rA are significant.
-def FSM:
- RRForm_1<0b00101101100, (outs VECREG:$rT), (ins R16C:$rA),
- "fsm\t$rT, $rA", SelectOp,
- [(set (v4i32 VECREG:$rT), (SPUfsmbi R16C:$rA))]>;
+class FSMInst:
+ RRForm_1<0b00101101100, (outs VECREG:$rT), (ins rclass:$rA),
+ "fsm\t$rT, $rA",
+ SelectOp,
+ [(set (vectype VECREG:$rT), (SPUselmask rclass:$rA))]>;
+
+multiclass FormSelectMaskWord {
+ def r32 : FSMInst;
+ def r16 : FSMInst;
+}
+
+defm FSM : FormSelectMaskWord;
+
+// Special case when used for i64 math operations
+multiclass FormSelectMaskWord64 {
+ def r32 : FSMInst;
+ def r16 : FSMInst;
+}
+
+defm FSM64 : FormSelectMaskWord64;
//===----------------------------------------------------------------------===//
// Integer and Logical Operations:
@@ -545,7 +561,7 @@
def Ar8:
RRForm<0b00000011000, (outs R8C:$rT), (ins R8C:$rA, R8C:$rB),
"a\t$rT, $rA, $rB", IntegerOp,
- [(set R8C:$rT, (add R8C:$rA, R8C:$rB))]>;
+ [/* no pattern */]>;
def AIvec:
RI10Form<0b00111000, (outs VECREG:$rT), (ins VECREG:$rA, s10imm:$val),
@@ -600,42 +616,125 @@
[(set R32C:$rT, (sub i32ImmSExt10:$val, R32C:$rA))]>;
// ADDX: only available in vector form, doesn't match a pattern.
-def ADDXvec:
- RRForm<0b00000010110, (outs VECREG:$rT), (ins VECREG:$rA, VECREG:$rB,
- VECREG:$rCarry),
- "addx\t$rT, $rA, $rB", IntegerOp,
- []>,
+class ADDXInst pattern>:
+ RRForm<0b00000010110, OOL, IOL,
+ "addx\t$rT, $rA, $rB",
+ IntegerOp, pattern>;
+
+class ADDXVecInst:
+ ADDXInst<(outs VECREG:$rT),
+ (ins VECREG:$rA, VECREG:$rB, VECREG:$rCarry),
+ [(set (vectype VECREG:$rT),
+ (SPUaddx (vectype VECREG:$rA), (vectype VECREG:$rB),
+ (vectype VECREG:$rCarry)))]>,
RegConstraint<"$rCarry = $rT">,
NoEncode<"$rCarry">;
-// CG: only available in vector form, doesn't match a pattern.
-def CGvec:
- RRForm<0b01000011000, (outs VECREG:$rT), (ins VECREG:$rA, VECREG:$rB,
- VECREG:$rCarry),
- "cg\t$rT, $rA, $rB", IntegerOp,
- []>,
+class ADDXRegInst:
+ ADDXInst<(outs rclass:$rT),
+ (ins rclass:$rA, rclass:$rB, rclass:$rCarry),
+ [(set rclass:$rT,
+ (SPUaddx rclass:$rA, rclass:$rB, rclass:$rCarry))]>,
RegConstraint<"$rCarry = $rT">,
NoEncode<"$rCarry">;
-// SFX: only available in vector form, doesn't match a pattern
-def SFXvec:
- RRForm<0b10000010110, (outs VECREG:$rT), (ins VECREG:$rA, VECREG:$rB,
- VECREG:$rCarry),
- "sfx\t$rT, $rA, $rB", IntegerOp,
- []>,
+multiclass AddExtended {
+ def v2i64 : ADDXVecInst;
+ def v4i32 : ADDXVecInst;
+ def r64 : ADDXRegInst;
+ def r32 : ADDXRegInst;
+}
+
+defm ADDX : AddExtended;
+
+// CG: Generate carry for add
+class CGInst pattern>:
+ RRForm<0b01000011000, OOL, IOL,
+ "cg\t$rT, $rA, $rB",
+ IntegerOp, pattern>;
+
+class CGVecInst:
+ CGInst<(outs VECREG:$rT),
+ (ins VECREG:$rA, VECREG:$rB),
+ [(set (vectype VECREG:$rT),
+ (SPUcarry_gen (vectype VECREG:$rA), (vectype VECREG:$rB)))]>;
+
+class CGRegInst:
+ CGInst<(outs rclass:$rT),
+ (ins rclass:$rA, rclass:$rB),
+ [(set rclass:$rT,
+ (SPUcarry_gen rclass:$rA, rclass:$rB))]>;
+
+multiclass CarryGenerate {
+ def v2i64 : CGVecInst;
+ def v4i32 : CGVecInst;
+ def r64 : CGRegInst;
+ def r32 : CGRegInst;
+}
+
+defm CG : CarryGenerate;
+
+// SFX: Subract from, extended. This is used in conjunction with BG to subtract
+// with carry (borrow, in this case)
+class SFXInst pattern>:
+ RRForm<0b10000010110, OOL, IOL,
+ "sfx\t$rT, $rA, $rB",
+ IntegerOp, pattern>;
+
+class SFXVecInst:
+ SFXInst<(outs VECREG:$rT),
+ (ins VECREG:$rA, VECREG:$rB, VECREG:$rCarry),
+ [(set (vectype VECREG:$rT),
+ (SPUsubx (vectype VECREG:$rA), (vectype VECREG:$rB),
+ (vectype VECREG:$rCarry)))]>,
RegConstraint<"$rCarry = $rT">,
NoEncode<"$rCarry">;
-// BG: only available in vector form, doesn't match a pattern.
-def BGvec:
- RRForm<0b01000010000, (outs VECREG:$rT), (ins VECREG:$rA, VECREG:$rB,
- VECREG:$rCarry),
- "bg\t$rT, $rA, $rB", IntegerOp,
- []>,
+class SFXRegInst:
+ SFXInst<(outs rclass:$rT),
+ (ins rclass:$rA, rclass:$rB, rclass:$rCarry),
+ [(set rclass:$rT,
+ (SPUsubx rclass:$rA, rclass:$rB, rclass:$rCarry))]>,
RegConstraint<"$rCarry = $rT">,
NoEncode<"$rCarry">;
-// BGX: only available in vector form, doesn't match a pattern.
+multiclass SubtractExtended {
+ def v2i64 : SFXVecInst;
+ def v4i32 : SFXVecInst;
+ def r64 : SFXRegInst;
+ def r32 : SFXRegInst;
+}
+
+defm SFX : SubtractExtended;
+
+// BG: only available in vector form, doesn't match a pattern.
+class BGInst pattern>:
+ RRForm<0b01000010000, OOL, IOL,
+ "bg\t$rT, $rA, $rB",
+ IntegerOp, pattern>;
+
+class BGVecInst:
+ BGInst<(outs VECREG:$rT),
+ (ins VECREG:$rA, VECREG:$rB),
+ [(set (vectype VECREG:$rT),
+ (SPUborrow_gen (vectype VECREG:$rA), (vectype VECREG:$rB)))]>;
+
+class BGRegInst:
+ BGInst<(outs rclass:$rT),
+ (ins rclass:$rA, rclass:$rB),
+ [(set rclass:$rT,
+ (SPUborrow_gen rclass:$rA, rclass:$rB))]>;
+
+multiclass BorrowGenerate {
+ def v4i32 : BGVecInst;
+ def v2i64 : BGVecInst;
+ def r64 : BGRegInst;
+ def r32 : BGRegInst;
+}
+
+defm BG : BorrowGenerate;
+
+// BGX: Borrow generate, extended.
def BGXvec:
RRForm<0b11000010110, (outs VECREG:$rT), (ins VECREG:$rA, VECREG:$rB,
VECREG:$rCarry),
@@ -817,17 +916,17 @@
def CNTBv16i8:
RRForm_1<0b00101101010, (outs VECREG:$rT), (ins VECREG:$rA),
"cntb\t$rT, $rA", IntegerOp,
- [(set (v16i8 VECREG:$rT), (SPUcntb_v16i8 (v16i8 VECREG:$rA)))]>;
+ [(set (v16i8 VECREG:$rT), (SPUcntb (v16i8 VECREG:$rA)))]>;
def CNTBv8i16 :
RRForm_1<0b00101101010, (outs VECREG:$rT), (ins VECREG:$rA),
"cntb\t$rT, $rA", IntegerOp,
- [(set (v8i16 VECREG:$rT), (SPUcntb_v8i16 (v8i16 VECREG:$rA)))]>;
+ [(set (v8i16 VECREG:$rT), (SPUcntb (v8i16 VECREG:$rA)))]>;
def CNTBv4i32 :
RRForm_1<0b00101101010, (outs VECREG:$rT), (ins VECREG:$rA),
"cntb\t$rT, $rA", IntegerOp,
- [(set (v4i32 VECREG:$rT), (SPUcntb_v4i32 (v4i32 VECREG:$rA)))]>;
+ [(set (v4i32 VECREG:$rT), (SPUcntb (v4i32 VECREG:$rA)))]>;
// gbb: Gather all low order bits from each byte in $rA into a single 16-bit
// quantity stored into $rT
@@ -869,31 +968,38 @@
[]>;
// Sign extension operations:
-def XSBHvec:
- RRForm_1<0b01101101010, (outs VECREG:$rDst), (ins VECREG:$rSrc),
- "xsbh\t$rDst, $rSrc", IntegerOp,
- [(set (v8i16 VECREG:$rDst), (sext (v16i8 VECREG:$rSrc)))]>;
-
-// Ordinary form for XSBH
-def XSBHr16:
- RRForm_1<0b01101101010, (outs R16C:$rDst), (ins R16C:$rSrc),
- "xsbh\t$rDst, $rSrc", IntegerOp,
- [(set R16C:$rDst, (sext_inreg R16C:$rSrc, i8))]>;
+class XSBHInst pattern>:
+ RRForm_1<0b01101101010, OOL, IOL,
+ "xsbh\t$rDst, $rSrc",
+ IntegerOp, pattern>;
+
+class XSBHVecInst:
+ XSBHInst<(outs VECREG:$rDst), (ins VECREG:$rSrc),
+ [(set (v8i16 VECREG:$rDst), (sext (vectype VECREG:$rSrc)))]>;
+
+class XSBHRegInst:
+ XSBHInst<(outs rclass:$rDst), (ins rclass:$rSrc),
+ [(set rclass:$rDst, (sext_inreg rclass:$rSrc, i8))]>;
+
+multiclass ExtendByteHalfword {
+ def v16i8: XSBHVecInst;
+ def r16: XSBHRegInst;
+
+ // 32-bit form for XSBH: used to sign extend 8-bit quantities to 16-bit
+ // quantities to 32-bit quantities via a 32-bit register (see the sext 8->32
+ // pattern below). Intentionally doesn't match a pattern because we want the
+ // sext 8->32 pattern to do the work for us, namely because we need the extra
+ // XSHWr32.
+ def r32: XSBHRegInst;
+}
+
+defm XSBH : ExtendByteHalfword;
+// Sign-extend, but take an 8-bit register to a 16-bit register (not done as
+// sext_inreg)
def XSBHr8:
- RRForm_1<0b01101101010, (outs R16C:$rDst), (ins R8C:$rSrc),
- "xsbh\t$rDst, $rSrc", IntegerOp,
- [(set R16C:$rDst, (sext R8C:$rSrc))]>;
-
-// 32-bit form for XSBH: used to sign extend 8-bit quantities to 16-bit
-// quantities to 32-bit quantities via a 32-bit register (see the sext 8->32
-// pattern below). Intentionally doesn't match a pattern because we want the
-// sext 8->32 pattern to do the work for us, namely because we need the extra
-// XSHWr32.
-def XSBHr32:
- RRForm_1<0b01101101010, (outs R32C:$rDst), (ins R32C:$rSrc),
- "xsbh\t$rDst, $rSrc", IntegerOp,
- [(set R32C:$rDst, (sext_inreg R32C:$rSrc, i8))]>;
+ XSBHInst<(outs R16C:$rDst), (ins R8C:$rSrc),
+ [(set R16C:$rDst, (sext R8C:$rSrc))]>;
// Sign extend halfwords to words:
def XSHWvec:
@@ -1658,9 +1764,9 @@
// It's this pattern that's probably the most useful, since SPUISelLowering
// methods create a v16i8 vector for $rC:
-class SHUFBVecPat1:
+class SHUFBVecPat1:
Pat<(SPUshuffle (vectype VECREG:$rA), (vectype VECREG:$rB),
- (v16i8 VECREG:$rC)),
+ (masktype VECREG:$rC)),
(inst VECREG:$rA, VECREG:$rB, VECREG:$rC)>;
multiclass ShuffleBytes
@@ -1676,11 +1782,19 @@
defm SHUFB : ShuffleBytes;
-def : SHUFBVecPat1;
-def : SHUFBVecPat1;
-def : SHUFBVecPat1;
-def : SHUFBVecPat1;
-def : SHUFBVecPat1;
+// Shuffle mask is a v16i8 vector
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+
+// Shuffle mask is a v4i32 vector:
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
+def : SHUFBVecPat1;
//===----------------------------------------------------------------------===//
// Shift and rotate group:
@@ -2079,10 +2193,24 @@
(ROTQBYIv2i64 VECREG:$rA, uimm7:$val)>;
// See ROTQBY note above.
-def ROTQBYBIvec:
- RI7Form<0b00110011100, (outs VECREG:$rT), (ins VECREG:$rA, u7imm:$val),
- "rotqbybi\t$rT, $rA, $val", RotateShift,
- [/* intrinsic */]>;
+class ROTQBYBIInst pattern>:
+ RI7Form<0b00110011100, OOL, IOL,
+ "rotqbybi\t$rT, $rA, $shift",
+ RotateShift, pattern>;
+
+class ROTQBYBIVecInst:
+ ROTQBYBIInst<(outs VECREG:$rT), (ins VECREG:$rA, rclass:$shift),
+ [(set (vectype VECREG:$rT),
+ (SPUrotbytes_left_bits (vectype VECREG:$rA), rclass:$shift))]>;
+
+multiclass RotateQuadByBytesByBitshift {
+ def v16i8_r32: ROTQBYBIVecInst;
+ def v8i16_r32: ROTQBYBIVecInst;
+ def v4i32_r32: ROTQBYBIVecInst;
+ def v2i64_r32: ROTQBYBIVecInst;
+}
+
+defm ROTQBYBI : RotateQuadByBytesByBitshift;
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
// See ROTQBY note above.
@@ -2358,7 +2486,6 @@
defm ROTQMBYI : RotateQuadBytesImm;
-
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
// Rotate right and mask by bit count
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
@@ -2545,25 +2672,28 @@
(ROTMAr32 R32C:$rA,
(SFIr32 (XSHWr16 (XSBHr8 R8C:$rB)), 0))>;
-def ROTMAIv4i32:
- RRForm<0b01011110000, (outs VECREG:$rT), (ins VECREG:$rA, rotNeg7imm:$val),
- "rotmai\t$rT, $rA, $val", RotateShift,
- [(set (v4i32 VECREG:$rT),
- (SPUvec_sra VECREG:$rA, (i32 uimm7:$val)))]>;
-
-def : Pat<(SPUvec_sra VECREG:$rA, (i16 uimm7:$val)),
- (ROTMAIv4i32 VECREG:$rA, uimm7:$val)>;
-
-def ROTMAIr32:
- RRForm<0b01011110000, (outs R32C:$rT), (ins R32C:$rA, rotNeg7imm:$val),
- "rotmai\t$rT, $rA, $val", RotateShift,
- [(set R32C:$rT, (sra R32C:$rA, (i32 uimm7:$val)))]>;
-
-def : Pat<(sra R32C:$rA, (i16 uimm7:$val)),
- (ROTMAIr32 R32C:$rA, uimm7:$val)>;
+class ROTMAIInst pattern>:
+ RRForm<0b01011110000, OOL, IOL,
+ "rotmai\t$rT, $rA, $val",
+ RotateShift, pattern>;
+
+class ROTMAIVecInst:
+ ROTMAIInst<(outs VECREG:$rT), (ins VECREG:$rA, intop:$val),
+ [(set (vectype VECREG:$rT),
+ (SPUvec_sra VECREG:$rA, (inttype uimm7:$val)))]>;
+
+class ROTMAIRegInst:
+ ROTMAIInst<(outs rclass:$rT), (ins rclass:$rA, intop:$val),
+ [(set rclass:$rT, (sra rclass:$rA, (inttype uimm7:$val)))]>;
+
+multiclass RotateMaskAlgebraicImm {
+ def v2i64_i32 : ROTMAIVecInst;
+ def v4i32_i32 : ROTMAIVecInst;
+ def r64_i32 : ROTMAIRegInst;
+ def r32_i32 : ROTMAIRegInst;
+}
-def : Pat<(sra R32C:$rA, (i8 uimm7:$val)),
- (ROTMAIr32 R32C:$rA, uimm7:$val)>;
+defm ROTMAI : RotateMaskAlgebraicImm;
//===----------------------------------------------------------------------===//
// Branch and conditionals:
Modified: llvm/trunk/lib/Target/CellSPU/SPUNodes.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUNodes.td?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUNodes.td (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUNodes.td Mon Jun 2 17:18:03 2008
@@ -36,29 +36,25 @@
]>;
// Unary, binary v16i8 operator type constraints:
-def SPUv16i8_unop: SDTypeProfile<1, 1, [
- SDTCisVT<0, v16i8>, SDTCisSameAs<0, 1>]>;
-
def SPUv16i8_binop: SDTypeProfile<1, 2, [
SDTCisVT<0, v16i8>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
// Binary v8i16 operator type constraints:
-def SPUv8i16_unop: SDTypeProfile<1, 1, [
- SDTCisVT<0, v8i16>, SDTCisSameAs<0, 1>]>;
-
def SPUv8i16_binop: SDTypeProfile<1, 2, [
SDTCisVT<0, v8i16>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
// Binary v4i32 operator type constraints:
-def SPUv4i32_unop: SDTypeProfile<1, 1, [
- SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>]>;
-
def SPUv4i32_binop: SDTypeProfile<1, 2, [
SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
-// FSMBI type constraints: There are several variations for the various
+// Trinary operators, e.g., addx, carry generate
+def SPUIntTrinaryOp : SDTypeProfile<1, 3, [
+ SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisInt<0>
+]>;
+
+// SELECT_MASK type constraints: There are several variations for the various
// vector types (this avoids having to bit_convert all over the place.)
-def SPUfsmbi_type: SDTypeProfile<1, 1, [
+def SPUselmask_type: SDTypeProfile<1, 1, [
SDTCisInt<1>
]>;
@@ -74,10 +70,16 @@
// Synthetic/pseudo-instructions
//===----------------------------------------------------------------------===//
+/// Add extended, carry generate:
+def SPUaddx : SDNode<"SPUISD::ADD_EXTENDED", SPUIntTrinaryOp, []>;
+def SPUcarry_gen : SDNode<"SPUISD::CARRY_GENERATE", SDTIntBinOp, []>;
+
+// Subtract extended, borrow generate
+def SPUsubx : SDNode<"SPUISD::SUB_EXTENDED", SPUIntTrinaryOp, []>;
+def SPUborrow_gen : SDNode<"SPUISD::BORROW_GENERATE", SDTIntBinOp, []>;
+
// SPU CNTB:
-def SPUcntb_v16i8: SDNode<"SPUISD::CNTB", SPUv16i8_unop, []>;
-def SPUcntb_v8i16: SDNode<"SPUISD::CNTB", SPUv8i16_unop, []>;
-def SPUcntb_v4i32: SDNode<"SPUISD::CNTB", SPUv4i32_unop, []>;
+def SPUcntb : SDNode<"SPUISD::CNTB", SDTIntUnaryOp>;
// SPU vector shuffle node, matched by the SPUISD::SHUFB enum (see
// SPUISelLowering.h):
@@ -122,14 +124,23 @@
def SPUrotbytes_right_sfill: SDNode<"SPUISD::ROTBYTES_RIGHT_S",
SPUvecshift_type, []>;
+// Vector rotate left, bits shifted out of the left are rotated in on the right
def SPUrotbytes_left: SDNode<"SPUISD::ROTBYTES_LEFT",
SPUvecshift_type, []>;
+// Same as above, but the node also has a chain associated (used in loads and
+// stores)
def SPUrotbytes_left_chained : SDNode<"SPUISD::ROTBYTES_LEFT_CHAINED",
SPUvecshift_type, [SDNPHasChain]>;
+// Vector rotate left by bytes, but the count is given in bits and the SPU
+// internally converts it to bytes (saves an instruction to mask off lower
+// three bits)
+def SPUrotbytes_left_bits : SDNode<"SPUISD::ROTBYTES_LEFT_BITS",
+ SPUvecshift_type>;
+
// SPU form select mask for bytes, immediate
-def SPUfsmbi: SDNode<"SPUISD::FSMBI", SPUfsmbi_type, []>;
+def SPUselmask: SDNode<"SPUISD::SELECT_MASK", SPUselmask_type, []>;
// SPU select bits instruction
def SPUselb: SDNode<"SPUISD::SELB", SPUselb_type, []>;
Modified: llvm/trunk/lib/Target/CellSPU/SPUOperands.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUOperands.td?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUOperands.td (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUOperands.td Mon Jun 2 17:18:03 2008
@@ -559,6 +559,10 @@
let PrintMethod = "printROTNeg7Imm";
}
+def rotNeg7imm_i8 : Operand {
+ let PrintMethod = "printROTNeg7Imm";
+}
+
def target : Operand {
let PrintMethod = "printBranchOperand";
}
Modified: llvm/trunk/test/CodeGen/CellSPU/immed64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/immed64.ll?rev=51884&r1=51883&r2=51884&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/immed64.ll (original)
+++ llvm/trunk/test/CodeGen/CellSPU/immed64.ll Mon Jun 2 17:18:03 2008
@@ -1,16 +1,16 @@
; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
-; RUN: grep lqa %t1.s | count 13
-; RUN: grep il %t1.s | count 22
-; RUN: grep shufb %t1.s | count 13
-; RUN: grep 65520 %t1.s | count 1
-; RUN: grep 43981 %t1.s | count 1
-; RUN: grep 13702 %t1.s | count 1
-; RUN: grep 81 %t1.s | count 2
-; RUN: grep 28225 %t1.s | count 1
-; RUN: grep 30720 %t1.s | count 1
-; RUN: grep 192 %t1.s | count 32
-; RUN: grep 128 %t1.s | count 30
-; RUN: grep 224 %t1.s | count 2
+; RUN: grep lqa %t1.s | count 13
+; RUN: grep il %t1.s | count 22
+; RUN: grep shufb %t1.s | count 13
+; RUN: grep 65520 %t1.s | count 1
+; RUN: grep 43981 %t1.s | count 1
+; RUN: grep 13702 %t1.s | count 1
+; RUN: grep 28225 %t1.s | count 1
+; RUN: grep 30720 %t1.s | count 1
+; RUN: grep 3233857728 %t1.s | count 8
+; RUN: grep 2155905152 %t1.s | count 6
+; RUN: grep 66051 %t1.s | count 7
+; RUN: grep 471670303 %t1.s | count 11
target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
target triple = "spu"
From scottm at aero.org Mon Jun 2 17:19:12 2008
From: scottm at aero.org (Scott Michel)
Date: Mon, 02 Jun 2008 22:19:12 -0000
Subject: [llvm-commits] [llvm] r51885 -
/llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200806022219.m52MJCeZ024222@zion.cs.uiuc.edu>
Author: pingbak
Date: Mon Jun 2 17:19:12 2008
New Revision: 51885
URL: http://llvm.org/viewvc/llvm-project?rev=51885&view=rev
Log:
Minor cosmetic patch so that the hex equivalent of a decimal
constant shows up in the assembly language output. Helps with
debugging without a HP calculator having to be handy.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51885&r1=51884&r2=51885&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jun 2 17:19:12 2008
@@ -742,7 +742,9 @@
if (CV->isNullValue() || isa(CV))
O << "0";
else if (const ConstantInt *CI = dyn_cast(CV)) {
- O << CI->getZExtValue();
+ O << CI->getZExtValue() << "\t\t\t"
+ << TAI->getCommentString() << " 0x"
+ << CI->getValue().toStringUnsigned(16);
} else if (const GlobalValue *GV = dyn_cast(CV)) {
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value, possibly
From gohman at apple.com Mon Jun 2 17:27:05 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 02 Jun 2008 22:27:05 -0000
Subject: [llvm-commits] [llvm] r51886 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Message-ID: <200806022227.m52MR5aw025627@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 17:27:05 2008
New Revision: 51886
URL: http://llvm.org/viewvc/llvm-project?rev=51886&view=rev
Log:
Fold adds and subtracts of zero immediately, instead of waiting
for dagcombine to do this.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=51886&r1=51885&r2=51886&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jun 2 17:27:05 2008
@@ -2115,10 +2115,12 @@
break;
case ISD::OR:
case ISD::XOR:
+ case ISD::ADD:
+ case ISD::SUB:
assert(MVT::isInteger(VT) && N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!");
- // (X ^| 0) -> X. This commonly occurs when legalizing i64 values, so it's
- // worth handling here.
+ // (X ^|+- 0) -> X. This commonly occurs when legalizing i64 values, so
+ // it's worth handling here.
if (N2C && N2C->isNullValue())
return N1;
break;
@@ -2128,8 +2130,6 @@
case ISD::MULHS:
assert(MVT::isInteger(VT) && "This operator does not apply to FP types!");
// fall through
- case ISD::ADD:
- case ISD::SUB:
case ISD::MUL:
case ISD::SDIV:
case ISD::SREM:
From dpatel at apple.com Mon Jun 2 17:52:57 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 02 Jun 2008 22:52:57 -0000
Subject: [llvm-commits] [llvm] r51887 - in /llvm/trunk:
lib/Transforms/Scalar/LoopUnswitch.cpp
test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
Message-ID: <200806022252.m52MqvZl003079@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Jun 2 17:52:56 2008
New Revision: 51887
URL: http://llvm.org/viewvc/llvm-project?rev=51887&view=rev
Log:
Update dom tree. Fix PR 2372.
Added:
llvm/trunk/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=51887&r1=51886&r2=51887&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Jun 2 17:52:56 2008
@@ -569,7 +569,6 @@
// Insert the new branch.
BranchInst::Create(TrueDest, FalseDest, BranchVal, InsertPt);
-
}
@@ -607,6 +606,10 @@
// insert the new conditional branch.
EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH,
OrigPH->getTerminator());
+ if (DT) {
+ DT->changeImmediateDominator(NewExit, OrigPH);
+ DT->changeImmediateDominator(NewPH, OrigPH);
+ }
LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L);
OrigPH->getTerminator()->eraseFromParent();
Added: llvm/trunk/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll?rev=51887&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll (added)
+++ llvm/trunk/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll Mon Jun 2 17:52:56 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -instcombine -gvn -disable-output
+; PR2372
+target triple = "i386-pc-linux-gnu"
+
+define i32 @func_3(i16 signext %p_5, i16 signext %p_6) nounwind {
+entry:
+ %tmp3 = icmp eq i16 %p_5, 0 ; [#uses=1]
+ %tmp1314 = sext i16 %p_6 to i32 ; [#uses=1]
+ %tmp28 = icmp ugt i32 %tmp1314, 3 ; [#uses=1]
+ %bothcond = or i1 %tmp28, false ; [#uses=1]
+ br label %bb
+bb: ; preds = %bb54, %entry
+ br i1 %tmp3, label %bb54, label %bb5
+bb5: ; preds = %bb
+ br i1 %bothcond, label %bb54, label %bb31
+bb31: ; preds = %bb5
+ br label %bb54
+bb54: ; preds = %bb31, %bb5, %bb
+ br i1 false, label %bb64, label %bb
+bb64: ; preds = %bb54
+ %tmp6566 = sext i16 %p_6 to i32 ; [#uses=1]
+ %tmp68 = tail call i32 (...)* @func_18( i32 1, i32 %tmp6566, i32 1 ) nounwind ; [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @func_18(...)
From gohman at apple.com Mon Jun 2 19:15:21 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 03 Jun 2008 00:15:21 -0000
Subject: [llvm-commits] [llvm] r51889 - in /llvm/trunk:
lib/VMCore/ConstantFold.cpp lib/VMCore/ConstantFold.h
lib/VMCore/Constants.cpp test/Assembler/insertextractvalue.ll
Message-ID: <200806030015.m530FLlc003023@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 19:15:20 2008
New Revision: 51889
URL: http://llvm.org/viewvc/llvm-project?rev=51889&view=rev
Log:
Constant folding for insertvalue and extractvalue.
Modified:
llvm/trunk/lib/VMCore/ConstantFold.cpp
llvm/trunk/lib/VMCore/ConstantFold.h
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/test/Assembler/insertextractvalue.ll
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=51889&r1=51888&r2=51889&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Jun 2 19:15:20 2008
@@ -394,6 +394,7 @@
}
return ConstantVector::get(Ops);
}
+
return 0;
}
@@ -447,18 +448,112 @@
return ConstantVector::get(&Result[0], Result.size());
}
-Constant *llvm::ConstantFoldExtractValue(const Constant *Agg,
- Constant* const *Idxs,
- unsigned NumIdx) {
- // FIXME: implement some constant folds
- return 0;
+Constant *llvm::ConstantFoldExtractValueInstruction(const Constant *Agg,
+ const unsigned *Idxs,
+ unsigned NumIdx) {
+ // Base case: no indices, so return the entire value.
+ if (NumIdx == 0)
+ return const_cast(Agg);
+
+ if (isa(Agg)) // ev(undef, x) -> undef
+ return UndefValue::get(ExtractValueInst::getIndexedType(Agg->getType(),
+ Idxs,
+ Idxs + NumIdx));
+
+ if (isa(Agg)) // ev(0, x) -> 0
+ return
+ Constant::getNullValue(ExtractValueInst::getIndexedType(Agg->getType(),
+ Idxs,
+ Idxs + NumIdx));
+
+ // Otherwise recurse.
+ return ConstantFoldExtractValueInstruction(Agg->getOperand(*Idxs),
+ Idxs+1, NumIdx-1);
}
-Constant *llvm::ConstantFoldInsertValue(const Constant *Agg,
- const Constant *Val,
- Constant* const *Idxs,
- unsigned NumIdx) {
- // FIXME: implement some constant folds
+Constant *llvm::ConstantFoldInsertValueInstruction(const Constant *Agg,
+ const Constant *Val,
+ const unsigned *Idxs,
+ unsigned NumIdx) {
+ // Base case: no indices, so replace the entire value.
+ if (NumIdx == 0)
+ return const_cast(Val);
+
+ if (isa(Agg)) {
+ // Insertion of constant into aggregate undef
+ // Optimize away insertion of undef
+ if (isa(Val))
+ return const_cast(Agg);
+ // Otherwise break the aggregate undef into multiple undefs and do
+ // the insertion
+ const CompositeType *AggTy = cast(Agg->getType());
+ unsigned numOps;
+ if (const ArrayType *AR = dyn_cast(AggTy))
+ numOps = AR->getNumElements();
+ else
+ numOps = cast(AggTy)->getNumElements();
+ std::vector Ops(numOps);
+ for (unsigned i = 0; i < numOps; ++i) {
+ const Type *MemberTy = AggTy->getTypeAtIndex(i);
+ const Constant *Op =
+ (*Idxs == i) ?
+ ConstantFoldInsertValueInstruction(UndefValue::get(MemberTy),
+ Val, Idxs+1, NumIdx-1) :
+ UndefValue::get(MemberTy);
+ Ops[i] = const_cast(Op);
+ }
+ if (isa(AggTy))
+ return ConstantStruct::get(Ops);
+ else
+ return ConstantArray::get(cast(AggTy), Ops);
+ }
+ if (isa(Agg)) {
+ // Insertion of constant into aggregate zero
+ // Optimize away insertion of zero
+ if (Val->isNullValue())
+ return const_cast(Agg);
+ // Otherwise break the aggregate zero into multiple zeros and do
+ // the insertion
+ const CompositeType *AggTy = cast(Agg->getType());
+ unsigned numOps;
+ if (const ArrayType *AR = dyn_cast(AggTy))
+ numOps = AR->getNumElements();
+ else
+ numOps = cast(AggTy)->getNumElements();
+ std::vector Ops(numOps);
+ for (unsigned i = 0; i < numOps; ++i) {
+ const Type *MemberTy = AggTy->getTypeAtIndex(i);
+ const Constant *Op =
+ (*Idxs == i) ?
+ ConstantFoldInsertValueInstruction(Constant::getNullValue(MemberTy),
+ Val, Idxs+1, NumIdx-1) :
+ Constant::getNullValue(MemberTy);
+ Ops[i] = const_cast(Op);
+ }
+ if (isa(AggTy))
+ return ConstantStruct::get(Ops);
+ else
+ return ConstantArray::get(cast(AggTy), Ops);
+ }
+ if (isa(Agg) || isa(Agg)) {
+ // Insertion of constant into aggregate constant
+ std::vector Ops(Agg->getNumOperands());
+ for (unsigned i = 0; i < Agg->getNumOperands(); ++i) {
+ const Constant *Op =
+ (*Idxs == i) ?
+ ConstantFoldInsertValueInstruction(Agg->getOperand(i),
+ Val, Idxs+1, NumIdx-1) :
+ Agg->getOperand(i);
+ Ops[i] = const_cast(Op);
+ }
+ Constant *C;
+ if (isa(Agg->getType()))
+ C = ConstantStruct::get(Ops);
+ else
+ C = ConstantArray::get(cast(Agg->getType()), Ops);
+ return C;
+ }
+
return 0;
}
Modified: llvm/trunk/lib/VMCore/ConstantFold.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.h?rev=51889&r1=51888&r2=51889&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.h (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.h Mon Jun 2 19:15:20 2008
@@ -41,10 +41,13 @@
Constant *ConstantFoldShuffleVectorInstruction(const Constant *V1,
const Constant *V2,
const Constant *Mask);
- Constant *ConstantFoldExtractValue(const Constant *Agg,
- Constant* const *Idxs, unsigned NumIdx);
- Constant *ConstantFoldInsertValue(const Constant *Agg, const Constant *Val,
- Constant* const *Idxs, unsigned NumIdx);
+ Constant *ConstantFoldExtractValueInstruction(const Constant *Agg,
+ const unsigned *Idxs,
+ unsigned NumIdx);
+ Constant *ConstantFoldInsertValueInstruction(const Constant *Agg,
+ const Constant *Val,
+ const unsigned* Idxs,
+ unsigned NumIdx);
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
const Constant *V2);
Constant *ConstantFoldCompareInstruction(unsigned short predicate,
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=51889&r1=51888&r2=51889&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jun 2 19:15:20 2008
@@ -2305,9 +2305,10 @@
"insertvalue indices invalid!");
assert(Agg->getType() == ReqTy &&
"insertvalue type invalid!");
-
assert(Agg->getType()->isFirstClassType() &&
"Non-first-class type for constant InsertValue expression");
+ if (Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs, NumIdx))
+ return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
std::vector ArgVec;
ArgVec.push_back(Agg);
@@ -2336,6 +2337,8 @@
"extractvalue indices invalid!");
assert(Agg->getType()->isFirstClassType() &&
"Non-first-class type for constant extractvalue expression");
+ if (Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs, NumIdx))
+ return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
std::vector ArgVec;
ArgVec.push_back(Agg);
Modified: llvm/trunk/test/Assembler/insertextractvalue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/insertextractvalue.ll?rev=51889&r1=51888&r2=51889&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/insertextractvalue.ll (original)
+++ llvm/trunk/test/Assembler/insertextractvalue.ll Mon Jun 2 19:15:20 2008
@@ -1,4 +1,6 @@
-; RUN: llvm-as < %s
+; RUN: llvm-as < %s | llvm-dis > %t
+; RUN: grep insertvalue %t | count 1
+; RUN: grep extractvalue %t | count 1
define float @foo({{i32},{float, double}}* %p) {
%t = load {{i32},{float, double}}* %p
@@ -11,3 +13,11 @@
store {{i32},{float, double}} insertvalue ({{i32},{float, double}}{{i32}{i32 4},{float, double}{float 4.0, double 5.0}}, double 20.0, 1, 1), {{i32},{float, double}}* %p
ret float extractvalue ({{i32},{float, double}}{{i32}{i32 3},{float, double}{float 7.0, double 9.0}}, 1, 0)
}
+define float @car({{i32},{float, double}}* %p) {
+ store {{i32},{float, double}} insertvalue ({{i32},{float, double}} undef, double 20.0, 1, 1), {{i32},{float, double}}* %p
+ ret float extractvalue ({{i32},{float, double}} undef, 1, 0)
+}
+define float @dar({{i32},{float, double}}* %p) {
+ store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p
+ ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0)
+}
From evan.cheng at apple.com Mon Jun 2 19:35:41 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 2 Jun 2008 17:35:41 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
Message-ID: <4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
Hi Dale,
Looks like this patch broke 447.dealII on x86-64. Try this:
make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
disable-fp-elim" clean Output/447.dealII.diff-llc
Evan
On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
> Author: johannes
> Date: Thu May 29 20:23:12 2008
> New Revision: 51723
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
> Log:
> X86-64 ABI fix. Revert isSingleElementStructOrArray
> change in favor of a more general version which handles
> the case where there's more than one element correctly.
> Fixes gcc.dg/compat/struct-layout-1.exp/t003
> and many more.
>
>
> Modified:
> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>
> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May 29
> 20:23:12 2008
> @@ -95,17 +95,18 @@
> considered as if they were the type of the data field. */
> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
> - isSingleElementStructOrArray(X, true, false, false)
> + isSingleElementStructOrArray(X, true, false)
> #endif
>
> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
> unsigned*);
> +
> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if this
> aggregate
> value should be passed in integer registers. This differs from
> the usual
> - handling in that x86-64 passes single-int-element unions as the
> type of the
> - field. */
> -#define
> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
> -
> (TARGET_64BIT ? \
> - !isSingleElementStructOrArray((X), true, true,
> true) : \
> - !isSingleElementStructOrArray((X), false, true, false))
> + handling in that x86-64 passes 128-bit structs and unions which
> only
> + contain data in the first 64 bits, as 64-bit objects. (These
> can be
> + created by abusing __attribute__((aligned)). */
> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
> Y) \
> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>
> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>
>
> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
> 20:23:12 2008
> @@ -1288,4 +1288,38 @@
> return Loc;
> }
>
> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is same
> as the
> +/// default. x86-64 detects the case where a type is 16 bytes long
> but
> +/// only 8 of them are passed, the rest being padding (*size is set
> to 8
> +/// to identify this case).
> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
> unsigned *size)
> +{
> + *size = 0;
> + if (TARGET_64BIT) {
> + enum x86_64_reg_class Class[MAX_CLASSES];
> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
> + Class[0] == X86_64_INTEGER_CLASS)) {
> + /* 8 byte object, one int register */
> + return true;
> + }
> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
> + Class[0] == X86_64_INTEGER_CLASS)) {
> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
> + Class[1] == X86_64_INTEGER_CLASS)
> + /* 16 byte object, 2 int registers */
> + return true;
> + if (Class[1] == X86_64_NO_CLASS) {
> + /* 16 byte object, only 1st register has information */
> + *size = 8;
> + return true;
> + }
> + }
> + return false;
> + }
> + else
> + return !isSingleElementStructOrArray(type, false, true);
> +}
> +
> /* LLVM LOCAL end (ENTIRE FILE!) */
>
> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May 29
> 20:23:12 2008
> @@ -404,7 +404,7 @@
> // some zero-length fields as well, must be passed as the field
> type.
> // Note this does not apply to long double.
> // This is required for ABI correctness.
> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
> false);
> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
> =TFmode &&
> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
> return false;
> @@ -437,7 +437,7 @@
> // Other single-element structs may be passed this way as well, but
> // only if the type size matches the element's type size (structs
> that
> // violate this can be created with __aligned__).
> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
> false);
> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
> if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!
> =TFmode &&
> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
> Elts.push_back(ConvertType(tType));
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
> @@ -138,21 +138,17 @@
> /// rejectFatBitField, and the single element is a bitfield of a
> type that's
> /// bigger than the struct, return null anyway.
> static tree isSingleElementStructOrArray(tree type, bool
> ignoreZeroLength,
> - bool rejectFatBitfield,
> - bool acceptUnions) {
> + bool rejectFatBitfield) {
> // Scalars are good.
> if (!isAggregateTreeType(type)) return type;
>
> tree FoundField = 0;
> switch (TREE_CODE(type)) {
> case QUAL_UNION_TYPE:
> + case UNION_TYPE: // Single element unions don't count.
> case COMPLEX_TYPE: // Complex values are like 2-element records.
> default:
> return 0;
> - case UNION_TYPE: // Single element unions don't count.
> - if (!acceptUnions)
> - return 0;
> - // fall through
> case RECORD_TYPE:
> // If this record has variable length, reject it.
> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
> @@ -178,15 +174,13 @@
> }
> }
> return FoundField ? isSingleElementStructOrArray(FoundField,
> -
> ignoreZeroLength, false,
> - false)
> +
> ignoreZeroLength, false)
> : 0;
> case ARRAY_TYPE:
> const ArrayType *Ty = dyn_cast(ConvertType(type));
> if (!Ty || Ty->getNumElements() != 1)
> return 0;
> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
> false,
> - false);
> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
> false);
> }
> }
>
> @@ -283,8 +277,8 @@
> // single element is a bitfield of a type bigger than the struct;
> the code
> // for field-by-field struct passing does not handle this one right.
> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
> - !isSingleElementStructOrArray(X, false, true, false)
> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
> + !isSingleElementStructOrArray((X), false, true)
> #endif
>
> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree if
> this single
> @@ -295,7 +289,7 @@
> // by abusing the __aligned__ attribute.)
> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
> - isSingleElementStructOrArray(X, false, false, false)
> + isSingleElementStructOrArray(X, false, false)
> #endif
>
> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if this
> vector type
> @@ -408,6 +402,7 @@
> /// their fields.
> void HandleArgument(tree type, std::vector &ScalarElts,
> ParameterAttributes *Attributes = NULL) {
> + unsigned Size = 0;
> const Type *Ty = ConvertType(type);
> // Figure out if this field is zero bits wide, e.g. {} or [0 x
> int]. Do
> // not include variable sized fields here.
> @@ -418,7 +413,7 @@
> ScalarElts.push_back(PtrTy);
> } else if (Ty->getTypeID()==Type::VectorTyID) {
> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
> - PassInIntegerRegisters(type, Ty, ScalarElts);
> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
> } else {
> C.HandleScalarArgument(Ty, type);
> ScalarElts.push_back(Ty);
> @@ -444,8 +439,8 @@
> *Attributes |=
>
> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
> }
> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
> - PassInIntegerRegisters(type, Ty, ScalarElts);
> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
> &Size)) {
> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
> } else if (isZeroSizedStructOrUnion(type)) {
> // Zero sized struct or union, just drop it!
> ;
> @@ -526,10 +521,15 @@
>
> /// PassInIntegerRegisters - Given an aggregate value that should
> be passed in
> /// integer registers, convert it to a structure containing ints
> and pass all
> - /// of the struct elements in.
> + /// of the struct elements in. If Size is set we pass only that
> many bytes.
> void PassInIntegerRegisters(tree type, const Type *Ty,
> - std::vector &ScalarElts) {
> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
> + std::vector &ScalarElts,
> + unsigned origSize) {
> + unsigned Size;
> + if (origSize)
> + Size = origSize;
> + else
> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>
> // FIXME: We should preserve all aggregate value alignment
> information.
> // Work around to preserve some aggregate value alignment
> information:
> @@ -568,7 +568,7 @@
> Elts.push_back(Type::Int8Ty);
> Size -= 1;
> }
> - assert(Size == 0 && "Didn't cover value?");
> + assert((origSize || Size == 0) && "Didn't cover value?");
> const StructType *STy = StructType::get(Elts, false);
>
> unsigned i = 0;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dalej at apple.com Mon Jun 2 19:40:20 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 2 Jun 2008 17:40:20 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
Message-ID:
I'll look.
On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
> Hi Dale,
>
> Looks like this patch broke 447.dealII on x86-64. Try this:
>
> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
> disable-fp-elim" clean Output/447.dealII.diff-llc
>
> Evan
>
> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Thu May 29 20:23:12 2008
>> New Revision: 51723
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>> Log:
>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>> change in favor of a more general version which handles
>> the case where there's more than one element correctly.
>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>> and many more.
>>
>>
>> Modified:
>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May
>> 29 20:23:12 2008
>> @@ -95,17 +95,18 @@
>> considered as if they were the type of the data field. */
>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>> - isSingleElementStructOrArray(X, true, false, false)
>> + isSingleElementStructOrArray(X, true, false)
>> #endif
>>
>> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
>> unsigned*);
>> +
>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if this
>> aggregate
>> value should be passed in integer registers. This differs from
>> the usual
>> - handling in that x86-64 passes single-int-element unions as the
>> type of the
>> - field. */
>> -#define
>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>> -
>> (TARGET_64BIT ? \
>> - !isSingleElementStructOrArray((X), true, true,
>> true) : \
>> - !isSingleElementStructOrArray((X), false, true, false))
>> + handling in that x86-64 passes 128-bit structs and unions which
>> only
>> + contain data in the first 64 bits, as 64-bit objects. (These
>> can be
>> + created by abusing __attribute__((aligned)). */
>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>> Y) \
>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>
>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>> 20:23:12 2008
>> @@ -1288,4 +1288,38 @@
>> return Loc;
>> }
>>
>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>> same as the
>> +/// default. x86-64 detects the case where a type is 16 bytes
>> long but
>> +/// only 8 of them are passed, the rest being padding (*size is
>> set to 8
>> +/// to identify this case).
>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>> unsigned *size)
>> +{
>> + *size = 0;
>> + if (TARGET_64BIT) {
>> + enum x86_64_reg_class Class[MAX_CLASSES];
>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>> + Class[0] == X86_64_INTEGER_CLASS)) {
>> + /* 8 byte object, one int register */
>> + return true;
>> + }
>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>> + Class[0] == X86_64_INTEGER_CLASS)) {
>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>> + Class[1] == X86_64_INTEGER_CLASS)
>> + /* 16 byte object, 2 int registers */
>> + return true;
>> + if (Class[1] == X86_64_NO_CLASS) {
>> + /* 16 byte object, only 1st register has information */
>> + *size = 8;
>> + return true;
>> + }
>> + }
>> + return false;
>> + }
>> + else
>> + return !isSingleElementStructOrArray(type, false, true);
>> +}
>> +
>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May 29
>> 20:23:12 2008
>> @@ -404,7 +404,7 @@
>> // some zero-length fields as well, must be passed as the field
>> type.
>> // Note this does not apply to long double.
>> // This is required for ABI correctness.
>> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
>> false);
>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>> =TFmode &&
>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>> return false;
>> @@ -437,7 +437,7 @@
>> // Other single-element structs may be passed this way as well, but
>> // only if the type size matches the element's type size (structs
>> that
>> // violate this can be created with __aligned__).
>> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
>> false);
>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>> if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!
>> =TFmode &&
>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>> Elts.push_back(ConvertType(tType));
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>> @@ -138,21 +138,17 @@
>> /// rejectFatBitField, and the single element is a bitfield of a
>> type that's
>> /// bigger than the struct, return null anyway.
>> static tree isSingleElementStructOrArray(tree type, bool
>> ignoreZeroLength,
>> - bool rejectFatBitfield,
>> - bool acceptUnions) {
>> + bool rejectFatBitfield) {
>> // Scalars are good.
>> if (!isAggregateTreeType(type)) return type;
>>
>> tree FoundField = 0;
>> switch (TREE_CODE(type)) {
>> case QUAL_UNION_TYPE:
>> + case UNION_TYPE: // Single element unions don't count.
>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>> default:
>> return 0;
>> - case UNION_TYPE: // Single element unions don't count.
>> - if (!acceptUnions)
>> - return 0;
>> - // fall through
>> case RECORD_TYPE:
>> // If this record has variable length, reject it.
>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>> @@ -178,15 +174,13 @@
>> }
>> }
>> return FoundField ? isSingleElementStructOrArray(FoundField,
>> -
>> ignoreZeroLength, false,
>> - false)
>> +
>> ignoreZeroLength, false)
>> : 0;
>> case ARRAY_TYPE:
>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>> if (!Ty || Ty->getNumElements() != 1)
>> return 0;
>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>> false,
>> - false);
>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>> false);
>> }
>> }
>>
>> @@ -283,8 +277,8 @@
>> // single element is a bitfield of a type bigger than the struct;
>> the code
>> // for field-by-field struct passing does not handle this one right.
>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>> - !isSingleElementStructOrArray(X, false, true, false)
>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>> + !isSingleElementStructOrArray((X), false, true)
>> #endif
>>
>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree if
>> this single
>> @@ -295,7 +289,7 @@
>> // by abusing the __aligned__ attribute.)
>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>> - isSingleElementStructOrArray(X, false, false, false)
>> + isSingleElementStructOrArray(X, false, false)
>> #endif
>>
>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if this
>> vector type
>> @@ -408,6 +402,7 @@
>> /// their fields.
>> void HandleArgument(tree type, std::vector &ScalarElts,
>> ParameterAttributes *Attributes = NULL) {
>> + unsigned Size = 0;
>> const Type *Ty = ConvertType(type);
>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>> int]. Do
>> // not include variable sized fields here.
>> @@ -418,7 +413,7 @@
>> ScalarElts.push_back(PtrTy);
>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>> } else {
>> C.HandleScalarArgument(Ty, type);
>> ScalarElts.push_back(Ty);
>> @@ -444,8 +439,8 @@
>> *Attributes |=
>>
>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>> }
>> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>> &Size)) {
>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>> } else if (isZeroSizedStructOrUnion(type)) {
>> // Zero sized struct or union, just drop it!
>> ;
>> @@ -526,10 +521,15 @@
>>
>> /// PassInIntegerRegisters - Given an aggregate value that should
>> be passed in
>> /// integer registers, convert it to a structure containing ints
>> and pass all
>> - /// of the struct elements in.
>> + /// of the struct elements in. If Size is set we pass only that
>> many bytes.
>> void PassInIntegerRegisters(tree type, const Type *Ty,
>> - std::vector
>> &ScalarElts) {
>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>> + std::vector &ScalarElts,
>> + unsigned origSize) {
>> + unsigned Size;
>> + if (origSize)
>> + Size = origSize;
>> + else
>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>
>> // FIXME: We should preserve all aggregate value alignment
>> information.
>> // Work around to preserve some aggregate value alignment
>> information:
>> @@ -568,7 +568,7 @@
>> Elts.push_back(Type::Int8Ty);
>> Size -= 1;
>> }
>> - assert(Size == 0 && "Didn't cover value?");
>> + assert((origSize || Size == 0) && "Didn't cover value?");
>> const StructType *STy = StructType::get(Elts, false);
>>
>> unsigned i = 0;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From evan.cheng at apple.com Mon Jun 2 19:49:40 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 2 Jun 2008 17:49:40 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To:
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
Message-ID: <8EAC15B2-AC97-489B-A223-B2BA78AE6AC9@apple.com>
Thanks!
Evan
On Jun 2, 2008, at 5:40 PM, Dale Johannesen wrote:
> I'll look.
>
> On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
>
>> Hi Dale,
>>
>> Looks like this patch broke 447.dealII on x86-64. Try this:
>>
>> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
>> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
>> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
>> disable-fp-elim" clean Output/447.dealII.diff-llc
>>
>> Evan
>>
>> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>>
>>> Author: johannes
>>> Date: Thu May 29 20:23:12 2008
>>> New Revision: 51723
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>>> Log:
>>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>>> change in favor of a more general version which handles
>>> the case where there's more than one element correctly.
>>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>>> and many more.
>>>
>>>
>>> Modified:
>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May
>>> 29 20:23:12 2008
>>> @@ -95,17 +95,18 @@
>>> considered as if they were the type of the data field. */
>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>> - isSingleElementStructOrArray(X, true, false, false)
>>> + isSingleElementStructOrArray(X, true, false)
>>> #endif
>>>
>>> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
>>> unsigned*);
>>> +
>>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if
>>> this aggregate
>>> value should be passed in integer registers. This differs from
>>> the usual
>>> - handling in that x86-64 passes single-int-element unions as
>>> the type of the
>>> - field. */
>>> -#define
>>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>> -
>>> (TARGET_64BIT ? \
>>> - !isSingleElementStructOrArray((X), true, true,
>>> true) : \
>>> - !isSingleElementStructOrArray((X), false, true, false))
>>> + handling in that x86-64 passes 128-bit structs and unions
>>> which only
>>> + contain data in the first 64 bits, as 64-bit objects. (These
>>> can be
>>> + created by abusing __attribute__((aligned)). */
>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>>> Y) \
>>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>>
>>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>>
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>>> 20:23:12 2008
>>> @@ -1288,4 +1288,38 @@
>>> return Loc;
>>> }
>>>
>>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>>> same as the
>>> +/// default. x86-64 detects the case where a type is 16 bytes
>>> long but
>>> +/// only 8 of them are passed, the rest being padding (*size is
>>> set to 8
>>> +/// to identify this case).
>>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>>> unsigned *size)
>>> +{
>>> + *size = 0;
>>> + if (TARGET_64BIT) {
>>> + enum x86_64_reg_class Class[MAX_CLASSES];
>>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>> + /* 8 byte object, one int register */
>>> + return true;
>>> + }
>>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>>> + Class[1] == X86_64_INTEGER_CLASS)
>>> + /* 16 byte object, 2 int registers */
>>> + return true;
>>> + if (Class[1] == X86_64_NO_CLASS) {
>>> + /* 16 byte object, only 1st register has information */
>>> + *size = 8;
>>> + return true;
>>> + }
>>> + }
>>> + return false;
>>> + }
>>> + else
>>> + return !isSingleElementStructOrArray(type, false, true);
>>> +}
>>> +
>>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May
>>> 29 20:23:12 2008
>>> @@ -404,7 +404,7 @@
>>> // some zero-length fields as well, must be passed as the field
>>> type.
>>> // Note this does not apply to long double.
>>> // This is required for ABI correctness.
>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>> false, false);
>>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>>> =TFmode &&
>>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>>> return false;
>>> @@ -437,7 +437,7 @@
>>> // Other single-element structs may be passed this way as well, but
>>> // only if the type size matches the element's type size (structs
>>> that
>>> // violate this can be created with __aligned__).
>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>> false, false);
>>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>>> if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!
>>> =TFmode &&
>>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>>> Elts.push_back(ConvertType(tType));
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>>> @@ -138,21 +138,17 @@
>>> /// rejectFatBitField, and the single element is a bitfield of a
>>> type that's
>>> /// bigger than the struct, return null anyway.
>>> static tree isSingleElementStructOrArray(tree type, bool
>>> ignoreZeroLength,
>>> - bool rejectFatBitfield,
>>> - bool acceptUnions) {
>>> + bool rejectFatBitfield) {
>>> // Scalars are good.
>>> if (!isAggregateTreeType(type)) return type;
>>>
>>> tree FoundField = 0;
>>> switch (TREE_CODE(type)) {
>>> case QUAL_UNION_TYPE:
>>> + case UNION_TYPE: // Single element unions don't count.
>>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>>> default:
>>> return 0;
>>> - case UNION_TYPE: // Single element unions don't count.
>>> - if (!acceptUnions)
>>> - return 0;
>>> - // fall through
>>> case RECORD_TYPE:
>>> // If this record has variable length, reject it.
>>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>>> @@ -178,15 +174,13 @@
>>> }
>>> }
>>> return FoundField ? isSingleElementStructOrArray(FoundField,
>>> -
>>> ignoreZeroLength, false,
>>> - false)
>>> +
>>> ignoreZeroLength, false)
>>> : 0;
>>> case ARRAY_TYPE:
>>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>>> if (!Ty || Ty->getNumElements() != 1)
>>> return 0;
>>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>> false,
>>> - false);
>>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>> false);
>>> }
>>> }
>>>
>>> @@ -283,8 +277,8 @@
>>> // single element is a bitfield of a type bigger than the struct;
>>> the code
>>> // for field-by-field struct passing does not handle this one right.
>>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>> - !isSingleElementStructOrArray(X, false, true, false)
>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>>> + !isSingleElementStructOrArray((X), false, true)
>>> #endif
>>>
>>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree
>>> if this single
>>> @@ -295,7 +289,7 @@
>>> // by abusing the __aligned__ attribute.)
>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>> - isSingleElementStructOrArray(X, false, false, false)
>>> + isSingleElementStructOrArray(X, false, false)
>>> #endif
>>>
>>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if
>>> this vector type
>>> @@ -408,6 +402,7 @@
>>> /// their fields.
>>> void HandleArgument(tree type, std::vector &ScalarElts,
>>> ParameterAttributes *Attributes = NULL) {
>>> + unsigned Size = 0;
>>> const Type *Ty = ConvertType(type);
>>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>>> int]. Do
>>> // not include variable sized fields here.
>>> @@ -418,7 +413,7 @@
>>> ScalarElts.push_back(PtrTy);
>>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>>> } else {
>>> C.HandleScalarArgument(Ty, type);
>>> ScalarElts.push_back(Ty);
>>> @@ -444,8 +439,8 @@
>>> *Attributes |=
>>>
>>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>>> }
>>> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>>> &Size)) {
>>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>>> } else if (isZeroSizedStructOrUnion(type)) {
>>> // Zero sized struct or union, just drop it!
>>> ;
>>> @@ -526,10 +521,15 @@
>>>
>>> /// PassInIntegerRegisters - Given an aggregate value that should
>>> be passed in
>>> /// integer registers, convert it to a structure containing ints
>>> and pass all
>>> - /// of the struct elements in.
>>> + /// of the struct elements in. If Size is set we pass only
>>> that many bytes.
>>> void PassInIntegerRegisters(tree type, const Type *Ty,
>>> - std::vector
>>> &ScalarElts) {
>>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>> + std::vector &ScalarElts,
>>> + unsigned origSize) {
>>> + unsigned Size;
>>> + if (origSize)
>>> + Size = origSize;
>>> + else
>>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>
>>> // FIXME: We should preserve all aggregate value alignment
>>> information.
>>> // Work around to preserve some aggregate value alignment
>>> information:
>>> @@ -568,7 +568,7 @@
>>> Elts.push_back(Type::Int8Ty);
>>> Size -= 1;
>>> }
>>> - assert(Size == 0 && "Didn't cover value?");
>>> + assert((origSize || Size == 0) && "Didn't cover value?");
>>> const StructType *STy = StructType::get(Elts, false);
>>>
>>> unsigned i = 0;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
From gohman at apple.com Mon Jun 2 19:57:23 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 03 Jun 2008 00:57:23 -0000
Subject: [llvm-commits] [llvm] r51890 -
/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
Message-ID: <200806030057.m530vN9j012718@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 19:57:21 2008
New Revision: 51890
URL: http://llvm.org/viewvc/llvm-project?rev=51890&view=rev
Log:
Fix whitespace in whitespace-significant pseudocode in a comment.
Modified:
llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=51890&r1=51889&r2=51890&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Mon Jun 2 19:57:21 2008
@@ -17,8 +17,8 @@
// else else
// X2 = ... X2 = ...
// X3 = phi(X1, X2) X3 = phi(X1, X2)
-// ... = X3 + 4 X4 = phi(X3)
-// ... = X4 + 4
+// ... = X3 + 4 X4 = phi(X3)
+// ... = X4 + 4
//
// This is still valid LLVM; the extra phi nodes are purely redundant, and will
// be trivially eliminated by InstCombine. The major benefit of this
From dpatel at apple.com Mon Jun 2 20:02:16 2008
From: dpatel at apple.com (Devang Patel)
Date: Tue, 03 Jun 2008 01:02:16 -0000
Subject: [llvm-commits] [llvm] r51891 -
/llvm/trunk/lib/VMCore/PassManager.cpp
Message-ID: <200806030102.m5312GuL013087@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Jun 2 20:02:16 2008
New Revision: 51891
URL: http://llvm.org/viewvc/llvm-project?rev=51891&view=rev
Log:
Add debugging aid.
Modified:
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=51891&r1=51890&r2=51891&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 2 20:02:16 2008
@@ -621,9 +621,15 @@
std::map::iterator Info = I++;
if (!dynamic_cast(Info->second)
&& std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
- PreservedSet.end())
+ PreservedSet.end()) {
// Remove this analysis
AvailableAnalysis.erase(Info);
+ if (PassDebugging >= Details) {
+ Pass *S = Info->second;
+ cerr << " -- " << P->getPassName() << " is not preserving ";
+ cerr << S->getPassName() << "\n";
+ }
+ }
}
// Check inherited analysis also. If P is not preserving analysis
From isanbard at gmail.com Mon Jun 2 20:13:02 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 2 Jun 2008 18:13:02 -0700
Subject: [llvm-commits] [llvm] r51891 -
/llvm/trunk/lib/VMCore/PassManager.cpp
In-Reply-To: <200806030102.m5312GuL013087@zion.cs.uiuc.edu>
References: <200806030102.m5312GuL013087@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90806021813l6fc839ecj34fb4c881d231738@mail.gmail.com>
If you use "DOUT" instead of "cerr", then this checking part will be
removed for a release build.
-bw
On Mon, Jun 2, 2008 at 6:02 PM, Devang Patel wrote:
> Author: dpatel
> Date: Mon Jun 2 20:02:16 2008
> New Revision: 51891
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51891&view=rev
> Log:
> Add debugging aid.
>
> Modified:
> llvm/trunk/lib/VMCore/PassManager.cpp
>
> Modified: llvm/trunk/lib/VMCore/PassManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=51891&r1=51890&r2=51891&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/VMCore/PassManager.cpp (original)
> +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 2 20:02:16 2008
> @@ -621,9 +621,15 @@
> std::map::iterator Info = I++;
> if (!dynamic_cast(Info->second)
> && std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
> - PreservedSet.end())
> + PreservedSet.end()) {
> // Remove this analysis
> AvailableAnalysis.erase(Info);
> + if (PassDebugging >= Details) {
> + Pass *S = Info->second;
> + cerr << " -- " << P->getPassName() << " is not preserving ";
> + cerr << S->getPassName() << "\n";
> + }
> + }
> }
>
> // Check inherited analysis also. If P is not preserving analysis
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From bruno.cardoso at gmail.com Mon Jun 2 20:19:39 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Mon, 2 Jun 2008 22:19:39 -0300
Subject: [llvm-commits] [PATCH] mips and mipsel support in llvm-gcc 4.2
Message-ID: <275e64e40806021819ie62f9c5jdab6348c885eab7b@mail.gmail.com>
Is it ok to commit this?
--
Bruno Cardoso Lopes ( now @ Cocos Island )
http://www.brunocardoso.cc
++ The saddest aspect of life right now is that
science gathers knowledge faster than society
gathers wisdom + Isaac Asimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips.patch
Type: application/octet-stream
Size: 439 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080602/283caeb1/attachment.obj
From dpatel at apple.com Mon Jun 2 20:20:02 2008
From: dpatel at apple.com (Devang Patel)
Date: Tue, 03 Jun 2008 01:20:02 -0000
Subject: [llvm-commits] [llvm] r51892 -
/llvm/trunk/lib/VMCore/PassManager.cpp
Message-ID: <200806030120.m531K2JU013559@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Jun 2 20:20:02 2008
New Revision: 51892
URL: http://llvm.org/viewvc/llvm-project?rev=51892&view=rev
Log:
"Unable to schedule required by " is more helpful then
"Unable to handle Pass that requires lower level Analysis pass"
Modified:
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=51892&r1=51891&r2=51892&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 2 20:20:02 2008
@@ -930,7 +930,11 @@
// When Pass manager is not able to order required analysis info, Pass manager
// checks whether any lower level manager will be able to provide this
// analysis info on demand or not.
- assert (0 && "Unable to handle Pass that requires lower level Analysis pass");
+#ifndef NDEBUG
+ cerr << "Unable to schedule " << RequiredPass->getPassName();
+ cerr << " required by " << P->getPassName() << "\n";
+#endif
+ assert (0 && "Unable to schedule pass");
}
// Destructor
From gohman at apple.com Mon Jun 2 20:21:11 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 03 Jun 2008 01:21:11 -0000
Subject: [llvm-commits] [llvm] r51893 -
/llvm/trunk/test/Assembler/insertextractvalue.ll
Message-ID: <200806030121.m531LBQW013605@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jun 2 20:21:11 2008
New Revision: 51893
URL: http://llvm.org/viewvc/llvm-project?rev=51893&view=rev
Log:
nounwindify.
Modified:
llvm/trunk/test/Assembler/insertextractvalue.ll
Modified: llvm/trunk/test/Assembler/insertextractvalue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/insertextractvalue.ll?rev=51893&r1=51892&r2=51893&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/insertextractvalue.ll (original)
+++ llvm/trunk/test/Assembler/insertextractvalue.ll Mon Jun 2 20:21:11 2008
@@ -2,22 +2,22 @@
; RUN: grep insertvalue %t | count 1
; RUN: grep extractvalue %t | count 1
-define float @foo({{i32},{float, double}}* %p) {
+define float @foo({{i32},{float, double}}* %p) nounwind {
%t = load {{i32},{float, double}}* %p
%s = extractvalue {{i32},{float, double}} %t, 1, 0
%r = insertvalue {{i32},{float, double}} %t, double 2.0, 1, 1
store {{i32},{float, double}} %r, {{i32},{float, double}}* %p
ret float %s
}
-define float @bar({{i32},{float, double}}* %p) {
+define float @bar({{i32},{float, double}}* %p) nounwind {
store {{i32},{float, double}} insertvalue ({{i32},{float, double}}{{i32}{i32 4},{float, double}{float 4.0, double 5.0}}, double 20.0, 1, 1), {{i32},{float, double}}* %p
ret float extractvalue ({{i32},{float, double}}{{i32}{i32 3},{float, double}{float 7.0, double 9.0}}, 1, 0)
}
-define float @car({{i32},{float, double}}* %p) {
+define float @car({{i32},{float, double}}* %p) nounwind {
store {{i32},{float, double}} insertvalue ({{i32},{float, double}} undef, double 20.0, 1, 1), {{i32},{float, double}}* %p
ret float extractvalue ({{i32},{float, double}} undef, 1, 0)
}
-define float @dar({{i32},{float, double}}* %p) {
+define float @dar({{i32},{float, double}}* %p) nounwind {
store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p
ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0)
}
From echristo at apple.com Mon Jun 2 20:21:16 2008
From: echristo at apple.com (Eric Christopher)
Date: Mon, 2 Jun 2008 18:21:16 -0700
Subject: [llvm-commits] [PATCH] mips and mipsel support in llvm-gcc 4.2
In-Reply-To: <275e64e40806021819ie62f9c5jdab6348c885eab7b@mail.gmail.com>
References: <275e64e40806021819ie62f9c5jdab6348c885eab7b@mail.gmail.com>
Message-ID: <3F45BAD1-A42D-4156-83CB-93D6AD5C6FB2@apple.com>
On Jun 2, 2008, at 6:19 PM, Bruno Cardoso Lopes wrote:
> Is it ok to commit this?
Should be just fine.
-eric
From dalej at apple.com Mon Jun 2 20:21:17 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 2 Jun 2008 18:21:17 -0700
Subject: [llvm-commits] [llvm] r51885
- /llvm/trunk/lib/CodeGen/AsmPrinter.cpp
In-Reply-To: <200806022219.m52MJCeZ024222@zion.cs.uiuc.edu>
References: <200806022219.m52MJCeZ024222@zion.cs.uiuc.edu>
Message-ID: <13962B00-98F4-4D0C-9CC8-93330280ABD6@apple.com>
This makes the assembly produced for address+constant look like
.long (symbol) + (constant #comment)
Darwin's as actually accepts this, although it whines, but this isn't
right.
On Jun 2, 2008, at 3:19 PM, Scott Michel wrote:
> Author: pingbak
> Date: Mon Jun 2 17:19:12 2008
> New Revision: 51885
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51885&view=rev
> Log:
> Minor cosmetic patch so that the hex equivalent of a decimal
> constant shows up in the assembly language output. Helps with
> debugging without a HP calculator having to be handy.
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51885&r1=51884&r2=51885&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jun 2 17:19:12 2008
> @@ -742,7 +742,9 @@
> if (CV->isNullValue() || isa(CV))
> O << "0";
> else if (const ConstantInt *CI = dyn_cast(CV)) {
> - O << CI->getZExtValue();
> + O << CI->getZExtValue() << "\t\t\t"
> + << TAI->getCommentString() << " 0x"
> + << CI->getValue().toStringUnsigned(16);
> } else if (const GlobalValue *GV = dyn_cast(CV)) {
> // This is a constant address for a global variable or function.
> Use the
> // name of the variable or function as the address value, possibly
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From bruno.cardoso at gmail.com Mon Jun 2 20:25:30 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Mon, 2 Jun 2008 22:25:30 -0300
Subject: [llvm-commits] [PATCH] llvm-gcc 4.2 mips cross-compiler!
Message-ID: <275e64e40806021825o643f300foe43b2d0629454658@mail.gmail.com>
When cross-compiling for Mips some ifndef are needed
to solve some undefined references into mips.c
Is it ok to commit this too?
--
Bruno Cardoso Lopes ( now @ Cocos Island )
http://www.brunocardoso.cc
++ The saddest aspect of life right now is that
science gathers knowledge faster than society
gathers wisdom + Isaac Asimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips.c.patch
Type: application/octet-stream
Size: 2046 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080602/c881d609/attachment.obj
From echristo at apple.com Mon Jun 2 20:29:30 2008
From: echristo at apple.com (Eric Christopher)
Date: Mon, 2 Jun 2008 18:29:30 -0700
Subject: [llvm-commits] [PATCH] llvm-gcc 4.2 mips cross-compiler!
In-Reply-To: <275e64e40806021825o643f300foe43b2d0629454658@mail.gmail.com>
References: <275e64e40806021825o643f300foe43b2d0629454658@mail.gmail.com>
Message-ID:
On Jun 2, 2008, at 6:25 PM, Bruno Cardoso Lopes wrote:
>
This should work just fine, but you can also likely comment out the
containing functions. For now, don't worry about it :)
-eric
From bruno.cardoso at gmail.com Mon Jun 2 20:33:26 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 03 Jun 2008 01:33:26 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r51894 - in /llvm-gcc-4.2/trunk/gcc:
Makefile.in config/mips/mips.c
Message-ID: <200806030133.m531XR5Y013940@zion.cs.uiuc.edu>
Author: bruno
Date: Mon Jun 2 20:33:26 2008
New Revision: 51894
URL: http://llvm.org/viewvc/llvm-project?rev=51894&view=rev
Log:
Added mips and mipsel support and fixed undefined references in mips.c
Modified:
llvm-gcc-4.2/trunk/gcc/Makefile.in
llvm-gcc-4.2/trunk/gcc/config/mips/mips.c
Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=51894&r1=51893&r2=51894&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/Makefile.in (original)
+++ llvm-gcc-4.2/trunk/gcc/Makefile.in Mon Jun 2 20:33:26 2008
@@ -1140,6 +1140,8 @@
ia64-*-*) echo ia64;; \
i[34567]86-*-*) echo x86;; \
x86_64-*-*) echo x86;; \
+ mips-*-*) echo mips;; \
+ mipsel-*-*) echo mipsel;; \
powerpc*-*-*) echo powerpc;; \
sparc-*-*) echo sparc;; \
sparcv9-*-*) echo sparc;; \
Modified: llvm-gcc-4.2/trunk/gcc/config/mips/mips.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/mips.c?rev=51894&r1=51893&r2=51894&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/mips.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/mips.c Mon Jun 2 20:33:26 2008
@@ -7219,7 +7219,9 @@
split_all_insns_noflow ();
if (TARGET_MIPS16)
mips16_lay_out_constants ();
+#ifndef ENABLE_LLVM
shorten_branches (insn);
+#endif
final_start_function (insn, file, 1);
final (insn, file, 1);
final_end_function ();
@@ -9022,7 +9024,9 @@
/* Recalculate instruction lengths without taking nops into account. */
cfun->machine->ignore_hazard_length_p = true;
+#ifndef ENABLE_LLVM
shorten_branches (get_insns ());
+#endif
cfun->machine->all_noreorder_p = true;
@@ -9344,15 +9348,16 @@
delay slot if is not annulled. */
if (!INSN_ANNULLED_BRANCH_P (insn))
{
+#ifndef ENABLE_LLVM
final_scan_insn (XVECEXP (final_sequence, 0, 1),
asm_out_file, optimize, 1, NULL);
+#endif
INSN_DELETED_P (XVECEXP (final_sequence, 0, 1)) = 1;
}
else
output_asm_insn ("nop", 0);
fprintf (asm_out_file, "\n");
}
-
/* Output the unconditional branch to TAKEN. */
if (length <= 16)
output_asm_insn ("j\t%0%/", &taken);
@@ -9369,8 +9374,10 @@
Use INSN's delay slot if is annulled. */
if (INSN_ANNULLED_BRANCH_P (insn))
{
+#ifndef ENABLE_LLVM
final_scan_insn (XVECEXP (final_sequence, 0, 1),
asm_out_file, optimize, 1, NULL);
+#endif
INSN_DELETED_P (XVECEXP (final_sequence, 0, 1)) = 1;
}
else
@@ -9808,12 +9815,14 @@
If INSN1 is the last instruction blocking X, it would better to
choose (INSN1, X) over (INSN2, INSN1). */
+#ifndef ENABLE_LLVM
for (dep = INSN_DEPEND (insn1); dep != 0; dep = XEXP (dep, 1))
if (REG_NOTE_KIND (dep) == REG_DEP_ANTI
&& INSN_PRIORITY (XEXP (dep, 0)) > INSN_PRIORITY (insn2)
&& recog_memoized (XEXP (dep, 0)) >= 0
&& get_attr_vr4130_class (XEXP (dep, 0)) == VR4130_CLASS_ALU)
return false;
+#endif
if (vr4130_last_insn != 0
&& recog_memoized (insn1) >= 0
From dalej at apple.com Mon Jun 2 21:35:29 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 2 Jun 2008 19:35:29 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
Message-ID: <983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
Not saying you're wrong, but why do you think it's this patch?
On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
> Hi Dale,
>
> Looks like this patch broke 447.dealII on x86-64. Try this:
>
> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
> disable-fp-elim" clean Output/447.dealII.diff-llc
>
> Evan
>
> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Thu May 29 20:23:12 2008
>> New Revision: 51723
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>> Log:
>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>> change in favor of a more general version which handles
>> the case where there's more than one element correctly.
>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>> and many more.
>>
>>
>> Modified:
>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May
>> 29 20:23:12 2008
>> @@ -95,17 +95,18 @@
>> considered as if they were the type of the data field. */
>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>> - isSingleElementStructOrArray(X, true, false, false)
>> + isSingleElementStructOrArray(X, true, false)
>> #endif
>>
>> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
>> unsigned*);
>> +
>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if this
>> aggregate
>> value should be passed in integer registers. This differs from
>> the usual
>> - handling in that x86-64 passes single-int-element unions as the
>> type of the
>> - field. */
>> -#define
>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>> -
>> (TARGET_64BIT ? \
>> - !isSingleElementStructOrArray((X), true, true,
>> true) : \
>> - !isSingleElementStructOrArray((X), false, true, false))
>> + handling in that x86-64 passes 128-bit structs and unions which
>> only
>> + contain data in the first 64 bits, as 64-bit objects. (These
>> can be
>> + created by abusing __attribute__((aligned)). */
>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>> Y) \
>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>
>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>> 20:23:12 2008
>> @@ -1288,4 +1288,38 @@
>> return Loc;
>> }
>>
>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>> same as the
>> +/// default. x86-64 detects the case where a type is 16 bytes
>> long but
>> +/// only 8 of them are passed, the rest being padding (*size is
>> set to 8
>> +/// to identify this case).
>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>> unsigned *size)
>> +{
>> + *size = 0;
>> + if (TARGET_64BIT) {
>> + enum x86_64_reg_class Class[MAX_CLASSES];
>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>> + Class[0] == X86_64_INTEGER_CLASS)) {
>> + /* 8 byte object, one int register */
>> + return true;
>> + }
>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>> + Class[0] == X86_64_INTEGER_CLASS)) {
>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>> + Class[1] == X86_64_INTEGER_CLASS)
>> + /* 16 byte object, 2 int registers */
>> + return true;
>> + if (Class[1] == X86_64_NO_CLASS) {
>> + /* 16 byte object, only 1st register has information */
>> + *size = 8;
>> + return true;
>> + }
>> + }
>> + return false;
>> + }
>> + else
>> + return !isSingleElementStructOrArray(type, false, true);
>> +}
>> +
>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May 29
>> 20:23:12 2008
>> @@ -404,7 +404,7 @@
>> // some zero-length fields as well, must be passed as the field
>> type.
>> // Note this does not apply to long double.
>> // This is required for ABI correctness.
>> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
>> false);
>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>> =TFmode &&
>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>> return false;
>> @@ -437,7 +437,7 @@
>> // Other single-element structs may be passed this way as well, but
>> // only if the type size matches the element's type size (structs
>> that
>> // violate this can be created with __aligned__).
>> - tree tType = isSingleElementStructOrArray(TreeType, true, false,
>> false);
>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>> if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!
>> =TFmode &&
>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>> Elts.push_back(ConvertType(tType));
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>> @@ -138,21 +138,17 @@
>> /// rejectFatBitField, and the single element is a bitfield of a
>> type that's
>> /// bigger than the struct, return null anyway.
>> static tree isSingleElementStructOrArray(tree type, bool
>> ignoreZeroLength,
>> - bool rejectFatBitfield,
>> - bool acceptUnions) {
>> + bool rejectFatBitfield) {
>> // Scalars are good.
>> if (!isAggregateTreeType(type)) return type;
>>
>> tree FoundField = 0;
>> switch (TREE_CODE(type)) {
>> case QUAL_UNION_TYPE:
>> + case UNION_TYPE: // Single element unions don't count.
>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>> default:
>> return 0;
>> - case UNION_TYPE: // Single element unions don't count.
>> - if (!acceptUnions)
>> - return 0;
>> - // fall through
>> case RECORD_TYPE:
>> // If this record has variable length, reject it.
>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>> @@ -178,15 +174,13 @@
>> }
>> }
>> return FoundField ? isSingleElementStructOrArray(FoundField,
>> -
>> ignoreZeroLength, false,
>> - false)
>> +
>> ignoreZeroLength, false)
>> : 0;
>> case ARRAY_TYPE:
>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>> if (!Ty || Ty->getNumElements() != 1)
>> return 0;
>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>> false,
>> - false);
>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>> false);
>> }
>> }
>>
>> @@ -283,8 +277,8 @@
>> // single element is a bitfield of a type bigger than the struct;
>> the code
>> // for field-by-field struct passing does not handle this one right.
>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>> - !isSingleElementStructOrArray(X, false, true, false)
>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>> + !isSingleElementStructOrArray((X), false, true)
>> #endif
>>
>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree if
>> this single
>> @@ -295,7 +289,7 @@
>> // by abusing the __aligned__ attribute.)
>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>> - isSingleElementStructOrArray(X, false, false, false)
>> + isSingleElementStructOrArray(X, false, false)
>> #endif
>>
>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if this
>> vector type
>> @@ -408,6 +402,7 @@
>> /// their fields.
>> void HandleArgument(tree type, std::vector &ScalarElts,
>> ParameterAttributes *Attributes = NULL) {
>> + unsigned Size = 0;
>> const Type *Ty = ConvertType(type);
>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>> int]. Do
>> // not include variable sized fields here.
>> @@ -418,7 +413,7 @@
>> ScalarElts.push_back(PtrTy);
>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>> } else {
>> C.HandleScalarArgument(Ty, type);
>> ScalarElts.push_back(Ty);
>> @@ -444,8 +439,8 @@
>> *Attributes |=
>>
>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>> }
>> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>> &Size)) {
>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>> } else if (isZeroSizedStructOrUnion(type)) {
>> // Zero sized struct or union, just drop it!
>> ;
>> @@ -526,10 +521,15 @@
>>
>> /// PassInIntegerRegisters - Given an aggregate value that should
>> be passed in
>> /// integer registers, convert it to a structure containing ints
>> and pass all
>> - /// of the struct elements in.
>> + /// of the struct elements in. If Size is set we pass only that
>> many bytes.
>> void PassInIntegerRegisters(tree type, const Type *Ty,
>> - std::vector
>> &ScalarElts) {
>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>> + std::vector &ScalarElts,
>> + unsigned origSize) {
>> + unsigned Size;
>> + if (origSize)
>> + Size = origSize;
>> + else
>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>
>> // FIXME: We should preserve all aggregate value alignment
>> information.
>> // Work around to preserve some aggregate value alignment
>> information:
>> @@ -568,7 +568,7 @@
>> Elts.push_back(Type::Int8Ty);
>> Size -= 1;
>> }
>> - assert(Size == 0 && "Didn't cover value?");
>> + assert((origSize || Size == 0) && "Didn't cover value?");
>> const StructType *STy = StructType::get(Elts, false);
>>
>> unsigned i = 0;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From nicholas at mxc.ca Mon Jun 2 21:58:19 2008
From: nicholas at mxc.ca (Nick Lewycky)
Date: Mon, 02 Jun 2008 19:58:19 -0700
Subject: [llvm-commits] value range analysis based on scalar-evolutions
In-Reply-To: <48439FFE.9040804@gmail.com>
References: <48436EF1.8020203@mxc.ca> <48439FFE.9040804@gmail.com>
Message-ID: <4844B34B.9010307@mxc.ca>
T?r?k Edwin wrote:
> Nick Lewycky wrote:
>> I've implemented an analysis pass that uses SCEV to determine value
>> ranges of integer-typed registers.
>>
>> Currently it maintains a map of Value* to ConstantRange*, which is
>> rather inelegant.
>
> There is a SCEVHandle->getValueRange(), perhaps you could move the
> implementation there and then you wouldn't need the map?
I was planning to delete that. It's unfinished and unused. Alternately,
I could move the LoopVR implementation stuff over there, and leave just
a map as an analysis to be updated. (But who would fill that map? We
don't want scalar-evolutions to waste its time when nobody's requested
that data.)
>> I was thinking we could have one analysis which would do that and
>> others that would update the central analysis.
>
> There is also Transforms/Scalar/PredicateSimplifier that tracks value
> ranges.
> It would be nice to have all that value range info available to other
> passes as well.
Yup! I'm trying to break predsimplify down into its composite pieces to
replace the behemoth that is the current predsimplify pass.
Nick
From clattner at apple.com Tue Jun 3 00:08:02 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 2 Jun 2008 22:08:02 -0700
Subject: [llvm-commits] [llvm] r51885 -
/llvm/trunk/lib/CodeGen/AsmPrinter.cpp
In-Reply-To: <13962B00-98F4-4D0C-9CC8-93330280ABD6@apple.com>
References: <200806022219.m52MJCeZ024222@zion.cs.uiuc.edu>
<13962B00-98F4-4D0C-9CC8-93330280ABD6@apple.com>
Message-ID: <23F52D58-8791-487A-86AF-EABA2DEC3E11@apple.com>
On Jun 2, 2008, at 6:21 PM, Dale Johannesen wrote:
> This makes the assembly produced for address+constant look like
>
> .long (symbol) + (constant #comment)
>
> Darwin's as actually accepts this, although it whines, but this isn't
> right.
Please revert the patch until it is fixed.
-Chris
>
>
> On Jun 2, 2008, at 3:19 PM, Scott Michel wrote:
>
>> Author: pingbak
>> Date: Mon Jun 2 17:19:12 2008
>> New Revision: 51885
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51885&view=rev
>> Log:
>> Minor cosmetic patch so that the hex equivalent of a decimal
>> constant shows up in the assembly language output. Helps with
>> debugging without a HP calculator having to be handy.
>>
>> Modified:
>> llvm/trunk/lib/CodeGen/AsmPrinter.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51885&r1=51884&r2=51885&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jun 2 17:19:12 2008
>> @@ -742,7 +742,9 @@
>> if (CV->isNullValue() || isa(CV))
>> O << "0";
>> else if (const ConstantInt *CI = dyn_cast(CV)) {
>> - O << CI->getZExtValue();
>> + O << CI->getZExtValue() << "\t\t\t"
>> + << TAI->getCommentString() << " 0x"
>> + << CI->getValue().toStringUnsigned(16);
>> } else if (const GlobalValue *GV = dyn_cast(CV)) {
>> // This is a constant address for a global variable or function.
>> Use the
>> // name of the variable or function as the address value, possibly
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From bruno.cardoso at gmail.com Tue Jun 3 01:11:38 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 3 Jun 2008 03:11:38 -0300
Subject: [llvm-commits] [PATCH] bad behavior in calculateFrameObjectOffsets
Message-ID: <275e64e40806022311r3f05338fhbaf20747ab081a9@mail.gmail.com>
Using unsigned in the loop below can lead to bad stack objects access,
one example is when
MinCSFrameIndex = 0, the variable i doesnt go negative
and the loop starts to access fixed objects locations (since getObjectAlignment
param is int) overwriting previous calculated stack locations. This is
breaking callee
saved register spill in Mips.
lib/CodeGen/PrologEpilogInserter.cpp, line 365
for (unsigned i = MaxCSFrameIndex; i >= MinCSFrameIndex; --i) {
unsigned Align = FFI->getObjectAlignment(i);
--
Bruno Cardoso Lopes ( now @ Cocos Island )
http://www.brunocardoso.cc
++ The saddest aspect of life right now is that
science gathers knowledge faster than society
gathers wisdom + Isaac Asimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrologEpilogInserter.cpp.patch
Type: application/octet-stream
Size: 655 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080603/3c1116da/attachment.obj
From scottm at aero.org Tue Jun 3 01:18:20 2008
From: scottm at aero.org (Scott Michel)
Date: Tue, 03 Jun 2008 06:18:20 -0000
Subject: [llvm-commits] [llvm] r51897 -
/llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200806030618.m536IKvD022419@zion.cs.uiuc.edu>
Author: pingbak
Date: Tue Jun 3 01:18:19 2008
New Revision: 51897
URL: http://llvm.org/viewvc/llvm-project?rev=51897&view=rev
Log:
Revert this patch
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51897&r1=51896&r2=51897&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Jun 3 01:18:19 2008
@@ -742,9 +742,7 @@
if (CV->isNullValue() || isa(CV))
O << "0";
else if (const ConstantInt *CI = dyn_cast(CV)) {
- O << CI->getZExtValue() << "\t\t\t"
- << TAI->getCommentString() << " 0x"
- << CI->getValue().toStringUnsigned(16);
+ O << CI->getZExtValue();
} else if (const GlobalValue *GV = dyn_cast(CV)) {
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value, possibly
From evan.cheng at apple.com Tue Jun 3 01:56:08 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 03 Jun 2008 06:56:08 -0000
Subject: [llvm-commits] [llvm] r51898 -
/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
Message-ID: <200806030656.m536u8JR023508@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Jun 3 01:56:08 2008
New Revision: 51898
URL: http://llvm.org/viewvc/llvm-project?rev=51898&view=rev
Log:
Do not run loop-aligner at -fast (e.g. -O0).
Modified:
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Jun 3 01:56:08 2008
@@ -140,7 +140,7 @@
if (addPreEmitPass(PM, Fast) && PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));
- if (AlignLoops && !OptimizeForSize)
+ if (AlignLoops && !Fast && !OptimizeForSize)
PM.add(createLoopAlignerPass());
switch (FileType) {
From evan.cheng at apple.com Tue Jun 3 01:58:34 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 2 Jun 2008 23:58:34 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
<983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
Message-ID: <97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
Purely trial and error. llvm-gcc before this patch works. :-)
Evan
On Jun 2, 2008, at 7:35 PM, Dale Johannesen wrote:
> Not saying you're wrong, but why do you think it's this patch?
>
> On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
>
>> Hi Dale,
>>
>> Looks like this patch broke 447.dealII on x86-64. Try this:
>>
>> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
>> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
>> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
>> disable-fp-elim" clean Output/447.dealII.diff-llc
>>
>> Evan
>>
>> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>>
>>> Author: johannes
>>> Date: Thu May 29 20:23:12 2008
>>> New Revision: 51723
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>>> Log:
>>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>>> change in favor of a more general version which handles
>>> the case where there's more than one element correctly.
>>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>>> and many more.
>>>
>>>
>>> Modified:
>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May
>>> 29 20:23:12 2008
>>> @@ -95,17 +95,18 @@
>>> considered as if they were the type of the data field. */
>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>> - isSingleElementStructOrArray(X, true, false, false)
>>> + isSingleElementStructOrArray(X, true, false)
>>> #endif
>>>
>>> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
>>> unsigned*);
>>> +
>>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if
>>> this aggregate
>>> value should be passed in integer registers. This differs from
>>> the usual
>>> - handling in that x86-64 passes single-int-element unions as
>>> the type of the
>>> - field. */
>>> -#define
>>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>> -
>>> (TARGET_64BIT ? \
>>> - !isSingleElementStructOrArray((X), true, true,
>>> true) : \
>>> - !isSingleElementStructOrArray((X), false, true, false))
>>> + handling in that x86-64 passes 128-bit structs and unions
>>> which only
>>> + contain data in the first 64 bits, as 64-bit objects. (These
>>> can be
>>> + created by abusing __attribute__((aligned)). */
>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>>> Y) \
>>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>>
>>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>>
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>>> 20:23:12 2008
>>> @@ -1288,4 +1288,38 @@
>>> return Loc;
>>> }
>>>
>>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>>> same as the
>>> +/// default. x86-64 detects the case where a type is 16 bytes
>>> long but
>>> +/// only 8 of them are passed, the rest being padding (*size is
>>> set to 8
>>> +/// to identify this case).
>>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>>> unsigned *size)
>>> +{
>>> + *size = 0;
>>> + if (TARGET_64BIT) {
>>> + enum x86_64_reg_class Class[MAX_CLASSES];
>>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>> + /* 8 byte object, one int register */
>>> + return true;
>>> + }
>>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>>> + Class[1] == X86_64_INTEGER_CLASS)
>>> + /* 16 byte object, 2 int registers */
>>> + return true;
>>> + if (Class[1] == X86_64_NO_CLASS) {
>>> + /* 16 byte object, only 1st register has information */
>>> + *size = 8;
>>> + return true;
>>> + }
>>> + }
>>> + return false;
>>> + }
>>> + else
>>> + return !isSingleElementStructOrArray(type, false, true);
>>> +}
>>> +
>>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May
>>> 29 20:23:12 2008
>>> @@ -404,7 +404,7 @@
>>> // some zero-length fields as well, must be passed as the field
>>> type.
>>> // Note this does not apply to long double.
>>> // This is required for ABI correctness.
>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>> false, false);
>>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>>> =TFmode &&
>>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>>> return false;
>>> @@ -437,7 +437,7 @@
>>> // Other single-element structs may be passed this way as well, but
>>> // only if the type size matches the element's type size (structs
>>> that
>>> // violate this can be created with __aligned__).
>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>> false, false);
>>> + tree tType = isSingleElementStructOrArray(TreeType, true, false);
>>> if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!
>>> =TFmode &&
>>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>>> Elts.push_back(ConvertType(tType));
>>>
>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>>> @@ -138,21 +138,17 @@
>>> /// rejectFatBitField, and the single element is a bitfield of a
>>> type that's
>>> /// bigger than the struct, return null anyway.
>>> static tree isSingleElementStructOrArray(tree type, bool
>>> ignoreZeroLength,
>>> - bool rejectFatBitfield,
>>> - bool acceptUnions) {
>>> + bool rejectFatBitfield) {
>>> // Scalars are good.
>>> if (!isAggregateTreeType(type)) return type;
>>>
>>> tree FoundField = 0;
>>> switch (TREE_CODE(type)) {
>>> case QUAL_UNION_TYPE:
>>> + case UNION_TYPE: // Single element unions don't count.
>>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>>> default:
>>> return 0;
>>> - case UNION_TYPE: // Single element unions don't count.
>>> - if (!acceptUnions)
>>> - return 0;
>>> - // fall through
>>> case RECORD_TYPE:
>>> // If this record has variable length, reject it.
>>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>>> @@ -178,15 +174,13 @@
>>> }
>>> }
>>> return FoundField ? isSingleElementStructOrArray(FoundField,
>>> -
>>> ignoreZeroLength, false,
>>> - false)
>>> +
>>> ignoreZeroLength, false)
>>> : 0;
>>> case ARRAY_TYPE:
>>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>>> if (!Ty || Ty->getNumElements() != 1)
>>> return 0;
>>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>> false,
>>> - false);
>>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>> false);
>>> }
>>> }
>>>
>>> @@ -283,8 +277,8 @@
>>> // single element is a bitfield of a type bigger than the struct;
>>> the code
>>> // for field-by-field struct passing does not handle this one right.
>>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>> - !isSingleElementStructOrArray(X, false, true, false)
>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>>> + !isSingleElementStructOrArray((X), false, true)
>>> #endif
>>>
>>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree
>>> if this single
>>> @@ -295,7 +289,7 @@
>>> // by abusing the __aligned__ attribute.)
>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>> - isSingleElementStructOrArray(X, false, false, false)
>>> + isSingleElementStructOrArray(X, false, false)
>>> #endif
>>>
>>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if
>>> this vector type
>>> @@ -408,6 +402,7 @@
>>> /// their fields.
>>> void HandleArgument(tree type, std::vector &ScalarElts,
>>> ParameterAttributes *Attributes = NULL) {
>>> + unsigned Size = 0;
>>> const Type *Ty = ConvertType(type);
>>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>>> int]. Do
>>> // not include variable sized fields here.
>>> @@ -418,7 +413,7 @@
>>> ScalarElts.push_back(PtrTy);
>>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>>> } else {
>>> C.HandleScalarArgument(Ty, type);
>>> ScalarElts.push_back(Ty);
>>> @@ -444,8 +439,8 @@
>>> *Attributes |=
>>>
>>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>>> }
>>> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>>> &Size)) {
>>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>>> } else if (isZeroSizedStructOrUnion(type)) {
>>> // Zero sized struct or union, just drop it!
>>> ;
>>> @@ -526,10 +521,15 @@
>>>
>>> /// PassInIntegerRegisters - Given an aggregate value that should
>>> be passed in
>>> /// integer registers, convert it to a structure containing ints
>>> and pass all
>>> - /// of the struct elements in.
>>> + /// of the struct elements in. If Size is set we pass only
>>> that many bytes.
>>> void PassInIntegerRegisters(tree type, const Type *Ty,
>>> - std::vector
>>> &ScalarElts) {
>>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>> + std::vector &ScalarElts,
>>> + unsigned origSize) {
>>> + unsigned Size;
>>> + if (origSize)
>>> + Size = origSize;
>>> + else
>>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>
>>> // FIXME: We should preserve all aggregate value alignment
>>> information.
>>> // Work around to preserve some aggregate value alignment
>>> information:
>>> @@ -568,7 +568,7 @@
>>> Elts.push_back(Type::Int8Ty);
>>> Size -= 1;
>>> }
>>> - assert(Size == 0 && "Didn't cover value?");
>>> + assert((origSize || Size == 0) && "Didn't cover value?");
>>> const StructType *STy = StructType::get(Elts, false);
>>>
>>> unsigned i = 0;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
From evan.cheng at apple.com Tue Jun 3 02:00:25 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 3 Jun 2008 00:00:25 -0700
Subject: [llvm-commits] [PATCH] bad behavior in
calculateFrameObjectOffsets
In-Reply-To: <275e64e40806022311r3f05338fhbaf20747ab081a9@mail.gmail.com>
References: <275e64e40806022311r3f05338fhbaf20747ab081a9@mail.gmail.com>
Message-ID: <3FE0314A-0385-402A-A695-247B38DE101A@apple.com>
Oops. Please commit.
Evan
On Jun 2, 2008, at 11:11 PM, Bruno Cardoso Lopes wrote:
> Using unsigned in the loop below can lead to bad stack objects access,
> one example is when
> MinCSFrameIndex = 0, the variable i doesnt go negative
> and the loop starts to access fixed objects locations (since
> getObjectAlignment
> param is int) overwriting previous calculated stack locations. This is
> breaking callee
> saved register spill in Mips.
>
> lib/CodeGen/PrologEpilogInserter.cpp, line 365
> for (unsigned i = MaxCSFrameIndex; i >= MinCSFrameIndex; --i) {
> unsigned Align = FFI->getObjectAlignment(i);
>
> --
> Bruno Cardoso Lopes ( now @ Cocos Island )
> http://www.brunocardoso.cc
>
> ++ The saddest aspect of life right now is that
> science gathers knowledge faster than society
> gathers wisdom + Isaac Asimov
> <
> PrologEpilogInserter
> .cpp.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From baldrick at free.fr Tue Jun 3 02:59:39 2008
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 3 Jun 2008 09:59:39 +0200
Subject: [llvm-commits] [llvm] r51884 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/Target/CellSPU/SPUISelLowering.cpp
lib/Target/CellSPU/SPUISelLowering.h
lib/Target/CellSPU/SPUInstrInfo.td lib/Target/CellSPU/SPUNodes.td
lib/Target/CellSPU/SPUOperands.td test/CodeGen/CellSPU/immed64.ll
In-Reply-To: <200806022218.m52MI4Ud024127@zion.cs.uiuc.edu>
References: <200806022218.m52MI4Ud024127@zion.cs.uiuc.edu>
Message-ID: <200806030959.39385.baldrick@free.fr>
Hi,
> + assert(VT2 == Tmp3.getValueType()
> + && "PromoteOp: Operands 2 and 3 ValueTypes don't match");
it is not usual for assertions to mention the function in which they occur.
> + // Ensure tha NVT is the same as the operands' value types, because we
Ensure tha -> Ensure that
Ciao,
Duncan.
From bruno.cardoso at gmail.com Tue Jun 3 03:47:00 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Tue, 03 Jun 2008 08:47:00 -0000
Subject: [llvm-commits] [llvm] r51899 -
/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
Message-ID: <200806030847.m538l0Gj002654@zion.cs.uiuc.edu>
Author: bruno
Date: Tue Jun 3 03:46:59 2008
New Revision: 51899
URL: http://llvm.org/viewvc/llvm-project?rev=51899&view=rev
Log:
Fixed bug in bad behavior in calculateFrameObjectOffsets,
the solution commited is different from the previous patch to
avoid int and unsigned comparison
Modified:
llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=51899&r1=51898&r2=51899&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Tue Jun 3 03:46:59 2008
@@ -362,7 +362,8 @@
FFI->setObjectOffset(i, -Offset); // Set the computed offset
}
} else {
- for (unsigned i = MaxCSFrameIndex; i >= MinCSFrameIndex; --i) {
+ int MaxCSFI = MaxCSFrameIndex, MinCSFI = MinCSFrameIndex;
+ for (int i = MaxCSFI; i >= MinCSFI ; --i) {
unsigned Align = FFI->getObjectAlignment(i);
// If the alignment of this object is greater than that of the stack, then
// increase the stack alignment to match.
From matthijs at stdin.nl Tue Jun 3 04:23:08 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Tue, 3 Jun 2008 11:23:08 +0200
Subject: [llvm-commits] [PATCH] Add support for loads and stores
of first class aggregrates to ScalarReplaceAggregrates
In-Reply-To: <20080530144352.GI13410@katherina.student.utwente.nl>
References: <20080530144352.GI13410@katherina.student.utwente.nl>
Message-ID: <20080603092308.GM25337@katherina.student.utwente.nl>
Hi All,
can I conclude from the lack of replies that this is okay to go in? I don't
think there will be any direct benefit or influence, since first class scalars
aren't really generated anywhere yet.
Attached is an updated patch, that compiles again after Dan's changes to the
insert/extractvalue instructions.
Gr.
Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scalarrepl.diff
Type: text/x-diff
Size: 3135 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080603/cb9c9e5f/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080603/cb9c9e5f/attachment-0001.bin
From baldrick at free.fr Tue Jun 3 10:18:05 2008
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 03 Jun 2008 15:18:05 -0000
Subject: [llvm-commits] [test-suite] r51903 -
/test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile
Message-ID: <200806031518.m53FI5Ru015250@zion.cs.uiuc.edu>
Author: baldrick
Date: Tue Jun 3 10:18:05 2008
New Revision: 51903
URL: http://llvm.org/viewvc/llvm-project?rev=51903&view=rev
Log:
Add -lm, needed by the CBE.
Modified:
test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile
Modified: test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile?rev=51903&r1=51902&r2=51903&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/SSE/Makefile Tue Jun 3 10:18:05 2008
@@ -3,6 +3,7 @@
DIRS =
LEVEL = ../../../..
FP_TOLERANCE := 0.016
+LDFLAGS += -lm
include $(LEVEL)/SingleSource/Makefile.singlesrc
From scottm at aero.org Tue Jun 3 10:39:51 2008
From: scottm at aero.org (Scott Michel)
Date: Tue, 03 Jun 2008 15:39:51 -0000
Subject: [llvm-commits] [llvm] r51904 -
/llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200806031539.m53FdpdY015874@zion.cs.uiuc.edu>
Author: pingbak
Date: Tue Jun 3 10:39:51 2008
New Revision: 51904
URL: http://llvm.org/viewvc/llvm-project?rev=51904&view=rev
Log:
Find a better place to output hex constants corresponding to integers.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51904&r1=51903&r2=51904&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Jun 3 10:39:51 2008
@@ -1074,6 +1074,11 @@
const Type *type = CV->getType();
printDataDirective(type);
EmitConstantValueOnly(CV);
+ if (const ConstantInt *CI = dyn_cast(CV)) {
+ O << "\t\t\t"
+ << TAI->getCommentString()
+ << " 0x" << CI->getValue().toStringUnsigned(16);
+ }
O << "\n";
}
From asl at math.spbu.ru Tue Jun 3 11:03:12 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 03 Jun 2008 16:03:12 -0000
Subject: [llvm-commits] [test-suite] r51905 -
/test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Message-ID: <200806031603.m53G3CEj016861@zion.cs.uiuc.edu>
Author: asl
Date: Tue Jun 3 11:03:12 2008
New Revision: 51905
URL: http://llvm.org/viewvc/llvm-project?rev=51905&view=rev
Log:
Reduce testsize even more. This is needed at least on x86-32/linux
Modified:
test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Modified: test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp?rev=51905&r1=51904&r2=51905&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp (original)
+++ test-suite/trunk/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp Tue Jun 3 11:03:12 2008
@@ -46,7 +46,7 @@
#ifdef SMALL_PROBLEM_SIZE
static const int TEST_SIZE = 50000;
#else
-static const int TEST_SIZE = 2097152/2;
+static const int TEST_SIZE = 2097152/4;
#endif
#endif
From tonic at nondot.org Tue Jun 3 11:08:20 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Tue, 03 Jun 2008 16:08:20 -0000
Subject: [llvm-commits] [test-suite] r51906 -
/test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Message-ID: <200806031608.m53G8Kgj017037@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Jun 3 11:08:19 2008
New Revision: 51906
URL: http://llvm.org/viewvc/llvm-project?rev=51906&view=rev
Log:
Merge from mainline.
Modified:
test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
Modified: test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp?rev=51906&r1=51905&r2=51906&view=diff
==============================================================================
--- test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp (original)
+++ test-suite/branches/release_23/SingleSource/Benchmarks/CoyoteBench/fftbench.cpp Tue Jun 3 11:08:19 2008
@@ -46,7 +46,7 @@
#ifdef SMALL_PROBLEM_SIZE
static const int TEST_SIZE = 50000;
#else
-static const int TEST_SIZE = 2097152/2;
+static const int TEST_SIZE = 2097152/4;
#endif
#endif
From clattner at apple.com Tue Jun 3 11:29:03 2008
From: clattner at apple.com (Chris Lattner)
Date: Tue, 3 Jun 2008 09:29:03 -0700
Subject: [llvm-commits] [llvm] r51904
- /llvm/trunk/lib/CodeGen/AsmPrinter.cpp
In-Reply-To: <200806031539.m53FdpdY015874@zion.cs.uiuc.edu>
References: <200806031539.m53FdpdY015874@zion.cs.uiuc.edu>
Message-ID: <4965F0E1-15C5-45EC-B084-22A5FFA5A6D5@apple.com>
> URL: http://llvm.org/viewvc/llvm-project?rev=51904&view=rev
> Log:
> Find a better place to output hex constants corresponding to integers.
Hey Scott, how much does this affect -O0 compile times? Doing at
least one extra malloc/free is very bad for each constant.
-Chris
>
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=51904&r1=51903&r2=51904&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Jun 3 10:39:51 2008
> @@ -1074,6 +1074,11 @@
> const Type *type = CV->getType();
> printDataDirective(type);
> EmitConstantValueOnly(CV);
> + if (const ConstantInt *CI = dyn_cast(CV)) {
> + O << "\t\t\t"
> + << TAI->getCommentString()
> + << " 0x" << CI->getValue().toStringUnsigned(16);
> + }
> O << "\n";
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dalej at apple.com Tue Jun 3 12:57:17 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 3 Jun 2008 10:57:17 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51866 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
In-Reply-To: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
References: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
Message-ID:
This patch breaks FrontendC/2008-01-28-UnionSize.c and FrontendC/
2007-09-28-PackedUnionMember.c on Darwin x86-32.
FAIL: /Volumes/MacOS9/gcc/llvm/test/FrontendC/2007-09-28-
PackedUnionMember.c
Failed with exit(1) at line 1
while running: /usr/local/bin/llvm-gcc -emit-llvm /Volumes/MacOS9/gcc/
llvm/test/FrontendC/2007-09-28-PackedUnionMember.c -S -o -
Assertion failed: ((!TYPE_SIZE(Tr) || !Ty->isSized() || !
isInt64(TYPE_SIZE(Tr), true) || getInt64(TYPE_SIZE(Tr), true) ==
getTargetData().getABITypeSizeInBits(Ty)) && "LLVM type size doesn't
match GCC type size!"), function llvm_set_type, file ../../llvm-
gcc-4.2/gcc/llvm-types.cpp, line 84.
/Volumes/MacOS9/gcc/llvm/test/FrontendC/2007-09-28-
PackedUnionMember.c: In function ?hndlr?:
It's odd that the nightly testers aren't showing this. I suspect they
aren't rebuilding llvm-gcc every night.
On Jun 2, 2008, at 8:56 AM, Duncan Sands wrote:
> Author: baldrick
> Date: Mon Jun 2 10:56:49 2008
> New Revision: 51866
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51866&view=rev
> Log:
> Fix 2003-10-09-UnionInitializerBug.c on x86-64.
> The problem was that in ConvertUNION if the
> new field was less aligned than a previous one
> but was also the biggest field seen so far then
> it was selected. But the most aligned field is
> supposed to always be selected. This caused a
> crash in ConvertStructFieldInitializerToType
> which relies on initializers not being more
> aligned than the LLVM type. In the long run
> I think ConvertStructFieldInitializerToType
> should be modified to not care about the
> alignment.
>
> Modified:
> llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=51866&r1=51865&r2=51866&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jun 2 10:56:49 2008
> @@ -2179,7 +2179,7 @@
> const TargetData &TD = getTargetData();
> const Type *UnionTy = 0;
> tree GccUnionTy = 0;
> - unsigned MaxSize = 0, MaxAlign = 0;
> + unsigned MaxAlignSize = 0, MaxAlign = 0;
> for (tree Field = TYPE_FIELDS(type); Field; Field =
> TREE_CHAIN(Field)) {
> if (TREE_CODE(Field) != FIELD_DECL) continue;
> // assert(getFieldOffsetInBits(Field) == 0 && "Union with non-
> zero offset?");
> @@ -2233,29 +2233,27 @@
> const Type *TheTy = ConvertType(TheGccTy);
> unsigned Size = TD.getABITypeSize(TheTy);
> unsigned Align = TD.getABITypeAlignment(TheTy);
> -
> +
> adjustPaddingElement(GccUnionTy, TheGccTy);
>
> - // Select TheTy as union type if it meets one of the following
> criteria
> - // 1) UnionTy is 0
> - // 2) TheTy alignment is more then UnionTy
> - // 3) TheTy size is greater than UnionTy size and TheTy
> alignment is
> - // equal to UnionTy
> - // 4) TheTy size is greater then UnionTy size and TheTy is packed
> - bool useTheTy = false;
> + // Select TheTy as union type if it is more aligned than any
> other. If more
> + // than one field achieves the maximum alignment then choose
> the biggest.
> + bool useTheTy;
> if (UnionTy == 0)
> useTheTy = true;
> + else if (Align < MaxAlign)
> + useTheTy = false;
> else if (Align > MaxAlign)
> useTheTy = true;
> - else if (MaxAlign == Align && Size > MaxSize)
> - useTheTy = true;
> - else if (Size > MaxSize)
> + else if (Size > MaxAlignSize)
> useTheTy = true;
> + else
> + useTheTy = false;
>
> if (useTheTy) {
> UnionTy = TheTy;
> GccUnionTy = TheGccTy;
> - MaxSize = MAX(MaxSize, Size);
> + MaxAlignSize = Size;
> MaxAlign = Align;
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dalej at apple.com Tue Jun 3 13:09:06 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 03 Jun 2008 18:09:06 -0000
Subject: [llvm-commits] [llvm] r51909 - in /llvm/trunk:
include/llvm/Target/TargetAsmInfo.h lib/Target/ARM/ARMTargetAsmInfo.cpp
lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.cpp
Message-ID: <200806031809.m53I97kY022205@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Jun 3 13:09:06 2008
New Revision: 51909
URL: http://llvm.org/viewvc/llvm-project?rev=51909&view=rev
Log:
Add StringConstantPrefix to control what the
assembler names of string constants look like.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=51909&r1=51908&r2=51909&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jun 3 13:09:06 2008
@@ -147,6 +147,10 @@
/// AssemblerDialect - Which dialect of an assembler variant to use.
unsigned AssemblerDialect; // Defaults to 0
+ /// StringConstantPrefix - Prefix to use when generating unnamed
+ /// constant strings. These names get run through the Mangler later.
+ const char *StringConstantPrefix; // Defaults to ".str"
+
//===--- Data Emission Directives -------------------------------------===//
/// ZeroDirective - this should be set to the directive used to get some
@@ -496,6 +500,9 @@
unsigned getAssemblerDialect() const {
return AssemblerDialect;
}
+ const char *getStringConstantPrefix() const {
+ return StringConstantPrefix;
+ }
const char *getZeroDirective() const {
return ZeroDirective;
}
Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=51909&r1=51908&r2=51909&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Tue Jun 3 13:09:06 2008
@@ -48,6 +48,7 @@
if (Subtarget->isTargetDarwin()) {
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ StringConstantPrefix = "\1LC";
BSSSection = 0; // no BSS section.
ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill
SetDirective = "\t.set\t";
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=51909&r1=51908&r2=51909&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Jun 3 13:09:06 2008
@@ -39,6 +39,7 @@
CommentString = ";";
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ StringConstantPrefix = "\1LC";
ConstantPoolSection = "\t.const\t";
JumpTableDataSection = ".const";
CStringSection = "\t.cstring";
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=51909&r1=51908&r2=51909&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jun 3 13:09:06 2008
@@ -45,6 +45,7 @@
InlineAsmStart("#APP"),
InlineAsmEnd("#NO_APP"),
AssemblerDialect(0),
+ StringConstantPrefix(".str"),
ZeroDirective("\t.zero\t"),
ZeroDirectiveSuffix(0),
AsciiDirective("\t.ascii\t"),
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=51909&r1=51908&r2=51909&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Jun 3 13:09:06 2008
@@ -66,6 +66,7 @@
ReadOnlySection = "\t.const\n";
LCOMMDirective = "\t.lcomm\t";
SwitchToSectionDirective = "\t.section ";
+ StringConstantPrefix = "\1LC";
COMMDirectiveTakesAlignment = false;
HasDotTypeDotSizeDirective = false;
if (TM.getRelocationModel() == Reloc::Static) {
From dalej at apple.com Tue Jun 3 13:14:30 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 03 Jun 2008 18:14:30 -0000
Subject: [llvm-commits] [llvm] r51910 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Message-ID: <200806031814.m53IEUIA022419@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Jun 3 13:14:29 2008
New Revision: 51910
URL: http://llvm.org/viewvc/llvm-project?rev=51910&view=rev
Log:
Prevent a crash in debug dumps.
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Jun 3 13:14:29 2008
@@ -979,7 +979,11 @@
}
void AssemblyWriter::printAlias(const GlobalAlias *GA) {
- Out << getLLVMName(GA->getName(), GlobalPrefix) << " = ";
+ // Don't crash when dumping partially built GA
+ if (!GA->hasName())
+ Out << "<> = ";
+ else
+ Out << getLLVMName(GA->getName(), GlobalPrefix) << " = ";
switch (GA->getVisibility()) {
default: assert(0 && "Invalid visibility style!");
case GlobalValue::DefaultVisibility: break;
From dalej at apple.com Tue Jun 3 13:15:04 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 03 Jun 2008 18:15:04 -0000
Subject: [llvm-commits] [llvm] r51911 -
/llvm/trunk/include/llvm/Target/TargetAsmInfo.h
Message-ID: <200806031815.m53IF4Y5022450@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Jun 3 13:15:03 2008
New Revision: 51911
URL: http://llvm.org/viewvc/llvm-project?rev=51911&view=rev
Log:
Expand documentation of StringConstantPrefix.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=51911&r1=51910&r2=51911&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jun 3 13:15:03 2008
@@ -147,8 +147,10 @@
/// AssemblerDialect - Which dialect of an assembler variant to use.
unsigned AssemblerDialect; // Defaults to 0
- /// StringConstantPrefix - Prefix to use when generating unnamed
- /// constant strings. These names get run through the Mangler later.
+ /// StringConstantPrefix - Prefix for FEs to use when generating unnamed
+ /// constant strings. These names get run through the Mangler later; if
+ /// you want the Mangler not to add the GlobalPrefix as well,
+ /// use '\1' as the first character.
const char *StringConstantPrefix; // Defaults to ".str"
//===--- Data Emission Directives -------------------------------------===//
From dalej at apple.com Tue Jun 3 13:16:19 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 03 Jun 2008 18:16:19 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r51912 -
/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Message-ID: <200806031816.m53IGKuF022489@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Jun 3 13:16:19 2008
New Revision: 51912
URL: http://llvm.org/viewvc/llvm-project?rev=51912&view=rev
Log:
Use StringConstantPrefix to control the names of
constant strings in the IR.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=51912&r1=51911&r2=51912&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 3 13:16:19 2008
@@ -6604,9 +6604,12 @@
}
// Create a new string global.
+ const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo();
GlobalVariable *GV = new GlobalVariable(Init->getType(), StringIsConstant,
- GlobalVariable::InternalLinkage,
- Init, ".str", TheModule);
+ GlobalVariable::InternalLinkage, Init,
+ TAI ?
+ TAI->getStringConstantPrefix() :
+ ".str", TheModule);
if (SlotP) *SlotP = GV;
return GV;
}
From dalej at apple.com Tue Jun 3 13:21:35 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 03 Jun 2008 18:21:35 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r51914 -
/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Message-ID: <200806031821.m53ILZMc022692@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Jun 3 13:21:34 2008
New Revision: 51914
URL: http://llvm.org/viewvc/llvm-project?rev=51914&view=rev
Log:
Handle some cases of mixed register use on x86-64.
Fixes a few more struct-layout-1 cases.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51914&r1=51913&r2=51914&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Jun 3 13:21:34 2008
@@ -743,14 +743,18 @@
case X86_64_SSE_CLASS:
// If it's a SSE class argument, then one of the followings are possible:
// 1. 1 x SSE, size is 8: 1 x Double.
- // 2. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>,
+ // 2. 1 x SSE, size is 4: 1 x Float.
+ // 3. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>,
// <2 x i64>, or <2 x f64>.
- // 3. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float.
- // 4. 2 x SSE, size is 16: 2 x Double.
+ // 4. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float.
+ // 5. 2 x SSE, size is 16: 2 x Double.
if ((NumClasses-i) == 1) {
if (Bytes == 8) {
Elts.push_back(Type::DoubleTy);
Bytes -= 8;
+ } else if (Bytes == 4) {
+ Elts.push_back (Type::FloatTy);
+ Bytes -= 4;
} else
assert(0 && "Not yet handled!");
} else if ((NumClasses-i) == 2) {
@@ -799,6 +803,10 @@
} else if (Class[i+1] == X86_64_INTEGER_CLASS) {
Elts.push_back(VectorType::get(Type::FloatTy, 2));
Elts.push_back(Type::Int64Ty);
+ } else if (Class[i+1] == X86_64_NO_CLASS) {
+ // padding bytes, don't pass
+ Elts.push_back(Type::DoubleTy);
+ Bytes -= 16;
} else
assert(0 && "Not yet handled!");
++i; // Already handled the next one.
@@ -1001,14 +1009,18 @@
case X86_64_SSE_CLASS:
// If it's a SSE class argument, then one of the followings are possible:
// 1. 1 x SSE, size is 8: 1 x Double.
- // 2. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>,
+ // 2. 1 x SSE, size is 4: 1 x Float.
+ // 3. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>,
// <2 x i64>, or <2 x f64>.
- // 3. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float.
- // 4. 2 x SSE, size is 16: 2 x Double.
+ // 4. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float.
+ // 5. 2 x SSE, size is 16: 2 x Double.
if ((NumClasses-i) == 1) {
if (Bytes == 8) {
Elts.push_back(Type::DoubleTy);
Bytes -= 8;
+ } else if (Bytes == 4) {
+ Elts.push_back(Type::FloatTy);
+ Bytes -= 4;
} else
assert(0 && "Not yet handled!");
} else if ((NumClasses-i) == 2) {
From resistor at mac.com Tue Jun 3 13:29:48 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 03 Jun 2008 18:29:48 -0000
Subject: [llvm-commits] [llvm] r51915 -
/llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp
Message-ID: <200806031829.m53ITmJS022939@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Jun 3 13:29:48 2008
New Revision: 51915
URL: http://llvm.org/viewvc/llvm-project?rev=51915&view=rev
Log:
LoopIndexSplit can sometimes result in cases where a block in its own domfrontier.
Don't crash when we encounter one of these.
Modified:
llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp
Modified: llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp?rev=51915&r1=51914&r2=51915&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp Tue Jun 3 13:29:48 2008
@@ -235,9 +235,12 @@
DominanceFrontier::iterator I = DF->find(DestBB);
if (I != DF->end()) {
DF->addBasicBlock(NewBB, I->second);
- // However NewBB's frontier does not include DestBB.
- DominanceFrontier::iterator NF = DF->find(NewBB);
- DF->removeFromFrontier(NF, DestBB);
+
+ if (I->second.count(DestBB)) {
+ // However NewBB's frontier does not include DestBB.
+ DominanceFrontier::iterator NF = DF->find(NewBB);
+ DF->removeFromFrontier(NF, DestBB);
+ }
}
else
DF->addBasicBlock(NewBB, DominanceFrontier::DomSetType());
From resistor at mac.com Tue Jun 3 13:32:27 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 03 Jun 2008 18:32:27 -0000
Subject: [llvm-commits] [llvm] r51916 -
/llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
Message-ID: <200806031832.m53IWR3A023014@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Jun 3 13:32:27 2008
New Revision: 51916
URL: http://llvm.org/viewvc/llvm-project?rev=51916&view=rev
Log:
Testcase for LoopIndexSplit and DomFrontier.
Added:
llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
Added: llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll?rev=51916&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll (added)
+++ llvm/trunk/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll Tue Jun 3 13:32:27 2008
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-rotate -loop-unswitch -loop-index-split -instcombine -disable-output
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.__CFData = type opaque
+ %struct.__CFString = type opaque
+
+define %struct.__CFData* @WirelessCreatePSK(%struct.__CFString* %inPassphrase, %struct.__CFData* %inSSID) nounwind {
+entry:
+ br label %bb52
+
+bb52: ; preds = %bb142, %bb52, %entry
+ br i1 false, label %bb142, label %bb52
+
+bb63: ; preds = %bb142, %bb131
+ %t.0.reg2mem.0 = phi i32 [ %tmp133, %bb131 ], [ 0, %bb142 ] ; [#uses=2]
+ %tmp65 = icmp ult i32 %t.0.reg2mem.0, 16 ; [#uses=1]
+ br i1 %tmp65, label %bb68, label %bb89
+
+bb68: ; preds = %bb63
+ br label %bb131
+
+bb89: ; preds = %bb63
+ br label %bb131
+
+bb131: ; preds = %bb89, %bb68
+ %tmp133 = add i32 %t.0.reg2mem.0, 1 ; [#uses=2]
+ %tmp136 = icmp ult i32 %tmp133, 80 ; [#uses=1]
+ br i1 %tmp136, label %bb63, label %bb142
+
+bb142: ; preds = %bb131, %bb52
+ br i1 undef, label %bb63, label %bb52
+}
From scottm at aero.org Tue Jun 3 14:13:20 2008
From: scottm at aero.org (Scott Michel)
Date: Tue, 03 Jun 2008 19:13:20 -0000
Subject: [llvm-commits] [llvm] r51917 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Message-ID: <200806031913.m53JDKLZ024341@zion.cs.uiuc.edu>
Author: pingbak
Date: Tue Jun 3 14:13:20 2008
New Revision: 51917
URL: http://llvm.org/viewvc/llvm-project?rev=51917&view=rev
Log:
Fix spellnig error
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=51917&r1=51916&r2=51917&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jun 3 14:13:20 2008
@@ -4447,12 +4447,11 @@
unsigned VT2 = Tmp2.getValueType();
assert(VT2 == Tmp3.getValueType()
- && "PromoteOp: Operands 2 and 3 ValueTypes don't match");
- // Ensure tha NVT is the same as the operands' value types, because we
- // cannot assume that TLI.getSetCCValueType() is constant.
- if (NVT != VT2)
- NVT = VT2;
- Result = DAG.getNode(ISD::SELECT, NVT, Node->getOperand(0), Tmp2, Tmp3);
+ && "PromoteOp SELECT: Operands 2 and 3 ValueTypes don't match");
+ // Ensure that the resulting node is at least the same size as the operands'
+ // value types, because we cannot assume that TLI.getSetCCValueType() is
+ // constant.
+ Result = DAG.getNode(ISD::SELECT, VT2, Node->getOperand(0), Tmp2, Tmp3);
break;
}
case ISD::SELECT_CC:
From dalej at apple.com Tue Jun 3 14:23:35 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 3 Jun 2008 12:23:35 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
<983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
<97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
Message-ID:
On Jun 2, 2008, at 11:58 PM, Evan Cheng wrote:
> Purely trial and error. llvm-gcc before this patch works. :-)
>
> Evan
Revs 51722 and 51723 both work for me; it was broken after this.
Do we have a way to tell what rev was in effect when the nightly
tester first reported a failure?
> On Jun 2, 2008, at 7:35 PM, Dale Johannesen wrote:
>
>> Not saying you're wrong, but why do you think it's this patch?
>>
>> On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
>>
>>> Hi Dale,
>>>
>>> Looks like this patch broke 447.dealII on x86-64. Try this:
>>>
>>> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
>>> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
>>> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic -
>>> disable-fp-elim" clean Output/447.dealII.diff-llc
>>>
>>> Evan
>>>
>>> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>>>
>>>> Author: johannes
>>>> Date: Thu May 29 20:23:12 2008
>>>> New Revision: 51723
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>>>> Log:
>>>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>>>> change in favor of a more general version which handles
>>>> the case where there's more than one element correctly.
>>>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>>>> and many more.
>>>>
>>>>
>>>> Modified:
>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>>
>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>> (original)
>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu May
>>>> 29 20:23:12 2008
>>>> @@ -95,17 +95,18 @@
>>>> considered as if they were the type of the data field. */
>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>> - isSingleElementStructOrArray(X, true, false, false)
>>>> + isSingleElementStructOrArray(X, true, false)
>>>> #endif
>>>>
>>>> +extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree,
>>>> unsigned*);
>>>> +
>>>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if
>>>> this aggregate
>>>> value should be passed in integer registers. This differs from
>>>> the usual
>>>> - handling in that x86-64 passes single-int-element unions as
>>>> the type of the
>>>> - field. */
>>>> -#define
>>>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>> -
>>>> (TARGET_64BIT
>>>> ? \
>>>> - !isSingleElementStructOrArray((X), true, true,
>>>> true) : \
>>>> - !isSingleElementStructOrArray((X), false, true, false))
>>>> + handling in that x86-64 passes 128-bit structs and unions
>>>> which only
>>>> + contain data in the first 64 bits, as 64-bit objects. (These
>>>> can be
>>>> + created by abusing __attribute__((aligned)). */
>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>>>> Y) \
>>>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>>>
>>>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>>>
>>>>
>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>>>> 20:23:12 2008
>>>> @@ -1288,4 +1288,38 @@
>>>> return Loc;
>>>> }
>>>>
>>>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>>>> same as the
>>>> +/// default. x86-64 detects the case where a type is 16 bytes
>>>> long but
>>>> +/// only 8 of them are passed, the rest being padding (*size is
>>>> set to 8
>>>> +/// to identify this case).
>>>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>>>> unsigned *size)
>>>> +{
>>>> + *size = 0;
>>>> + if (TARGET_64BIT) {
>>>> + enum x86_64_reg_class Class[MAX_CLASSES];
>>>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>>>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>>>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>> + /* 8 byte object, one int register */
>>>> + return true;
>>>> + }
>>>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>>>> + Class[1] == X86_64_INTEGER_CLASS)
>>>> + /* 16 byte object, 2 int registers */
>>>> + return true;
>>>> + if (Class[1] == X86_64_NO_CLASS) {
>>>> + /* 16 byte object, only 1st register has information */
>>>> + *size = 8;
>>>> + return true;
>>>> + }
>>>> + }
>>>> + return false;
>>>> + }
>>>> + else
>>>> + return !isSingleElementStructOrArray(type, false, true);
>>>> +}
>>>> +
>>>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>>>
>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
>>>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May
>>>> 29 20:23:12 2008
>>>> @@ -404,7 +404,7 @@
>>>> // some zero-length fields as well, must be passed as the field
>>>> type.
>>>> // Note this does not apply to long double.
>>>> // This is required for ABI correctness.
>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>> false, false);
>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>> false);
>>>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>>>> =TFmode &&
>>>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>>>> return false;
>>>> @@ -437,7 +437,7 @@
>>>> // Other single-element structs may be passed this way as well, but
>>>> // only if the type size matches the element's type size (structs
>>>> that
>>>> // violate this can be created with __aligned__).
>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>> false, false);
>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>> false);
>>>> if (tType && int_size_in_bytes(tType)==SrcSize &&
>>>> TYPE_MODE(tType)!=TFmode &&
>>>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>>>> Elts.push_back(ConvertType(tType));
>>>>
>>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>>>> @@ -138,21 +138,17 @@
>>>> /// rejectFatBitField, and the single element is a bitfield of a
>>>> type that's
>>>> /// bigger than the struct, return null anyway.
>>>> static tree isSingleElementStructOrArray(tree type, bool
>>>> ignoreZeroLength,
>>>> - bool rejectFatBitfield,
>>>> - bool acceptUnions) {
>>>> + bool rejectFatBitfield) {
>>>> // Scalars are good.
>>>> if (!isAggregateTreeType(type)) return type;
>>>>
>>>> tree FoundField = 0;
>>>> switch (TREE_CODE(type)) {
>>>> case QUAL_UNION_TYPE:
>>>> + case UNION_TYPE: // Single element unions don't count.
>>>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>>>> default:
>>>> return 0;
>>>> - case UNION_TYPE: // Single element unions don't count.
>>>> - if (!acceptUnions)
>>>> - return 0;
>>>> - // fall through
>>>> case RECORD_TYPE:
>>>> // If this record has variable length, reject it.
>>>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>>>> @@ -178,15 +174,13 @@
>>>> }
>>>> }
>>>> return FoundField ? isSingleElementStructOrArray(FoundField,
>>>> -
>>>> ignoreZeroLength, false,
>>>> - false)
>>>> +
>>>> ignoreZeroLength, false)
>>>> : 0;
>>>> case ARRAY_TYPE:
>>>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>>>> if (!Ty || Ty->getNumElements() != 1)
>>>> return 0;
>>>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>>> false,
>>>> - false);
>>>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>>> false);
>>>> }
>>>> }
>>>>
>>>> @@ -283,8 +277,8 @@
>>>> // single element is a bitfield of a type bigger than the struct;
>>>> the code
>>>> // for field-by-field struct passing does not handle this one
>>>> right.
>>>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>>>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>> - !isSingleElementStructOrArray(X, false, true, false)
>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>>>> + !isSingleElementStructOrArray((X), false, true)
>>>> #endif
>>>>
>>>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree
>>>> if this single
>>>> @@ -295,7 +289,7 @@
>>>> // by abusing the __aligned__ attribute.)
>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>> - isSingleElementStructOrArray(X, false, false, false)
>>>> + isSingleElementStructOrArray(X, false, false)
>>>> #endif
>>>>
>>>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if
>>>> this vector type
>>>> @@ -408,6 +402,7 @@
>>>> /// their fields.
>>>> void HandleArgument(tree type, std::vector
>>>> &ScalarElts,
>>>> ParameterAttributes *Attributes = NULL) {
>>>> + unsigned Size = 0;
>>>> const Type *Ty = ConvertType(type);
>>>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>>>> int]. Do
>>>> // not include variable sized fields here.
>>>> @@ -418,7 +413,7 @@
>>>> ScalarElts.push_back(PtrTy);
>>>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>>>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>>>> } else {
>>>> C.HandleScalarArgument(Ty, type);
>>>> ScalarElts.push_back(Ty);
>>>> @@ -444,8 +439,8 @@
>>>> *Attributes |=
>>>>
>>>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>>>> }
>>>> - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>>>> &Size)) {
>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>>>> } else if (isZeroSizedStructOrUnion(type)) {
>>>> // Zero sized struct or union, just drop it!
>>>> ;
>>>> @@ -526,10 +521,15 @@
>>>>
>>>> /// PassInIntegerRegisters - Given an aggregate value that should
>>>> be passed in
>>>> /// integer registers, convert it to a structure containing ints
>>>> and pass all
>>>> - /// of the struct elements in.
>>>> + /// of the struct elements in. If Size is set we pass only
>>>> that many bytes.
>>>> void PassInIntegerRegisters(tree type, const Type *Ty,
>>>> - std::vector
>>>> &ScalarElts) {
>>>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>> + std::vector
>>>> &ScalarElts,
>>>> + unsigned origSize) {
>>>> + unsigned Size;
>>>> + if (origSize)
>>>> + Size = origSize;
>>>> + else
>>>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>>
>>>> // FIXME: We should preserve all aggregate value alignment
>>>> information.
>>>> // Work around to preserve some aggregate value alignment
>>>> information:
>>>> @@ -568,7 +568,7 @@
>>>> Elts.push_back(Type::Int8Ty);
>>>> Size -= 1;
>>>> }
>>>> - assert(Size == 0 && "Didn't cover value?");
>>>> + assert((origSize || Size == 0) && "Didn't cover value?");
>>>> const StructType *STy = StructType::get(Elts, false);
>>>>
>>>> unsigned i = 0;
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>
From isanbard at gmail.com Tue Jun 3 14:52:45 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 3 Jun 2008 12:52:45 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51866 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
In-Reply-To:
References: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90806031252p41168fffv17fefd3fb547b9d5@mail.gmail.com>
Please go ahead and revert this patch until Duncan can fix it.
Thanks!
-bw
On Tue, Jun 3, 2008 at 10:57 AM, Dale Johannesen wrote:
> This patch breaks FrontendC/2008-01-28-UnionSize.c and FrontendC/
> 2007-09-28-PackedUnionMember.c on Darwin x86-32.
>
> FAIL: /Volumes/MacOS9/gcc/llvm/test/FrontendC/2007-09-28-
> PackedUnionMember.c
> Failed with exit(1) at line 1
> while running: /usr/local/bin/llvm-gcc -emit-llvm /Volumes/MacOS9/gcc/
> llvm/test/FrontendC/2007-09-28-PackedUnionMember.c -S -o -
> Assertion failed: ((!TYPE_SIZE(Tr) || !Ty->isSized() || !
> isInt64(TYPE_SIZE(Tr), true) || getInt64(TYPE_SIZE(Tr), true) ==
> getTargetData().getABITypeSizeInBits(Ty)) && "LLVM type size doesn't
> match GCC type size!"), function llvm_set_type, file ../../llvm-
> gcc-4.2/gcc/llvm-types.cpp, line 84.
> /Volumes/MacOS9/gcc/llvm/test/FrontendC/2007-09-28-
> PackedUnionMember.c: In function 'hndlr':
>
> It's odd that the nightly testers aren't showing this. I suspect they
> aren't rebuilding llvm-gcc every night.
>
> On Jun 2, 2008, at 8:56 AM, Duncan Sands wrote:
>
>> Author: baldrick
>> Date: Mon Jun 2 10:56:49 2008
>> New Revision: 51866
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=51866&view=rev
>> Log:
>> Fix 2003-10-09-UnionInitializerBug.c on x86-64.
>> The problem was that in ConvertUNION if the
>> new field was less aligned than a previous one
>> but was also the biggest field seen so far then
>> it was selected. But the most aligned field is
>> supposed to always be selected. This caused a
>> crash in ConvertStructFieldInitializerToType
>> which relies on initializers not being more
>> aligned than the LLVM type. In the long run
>> I think ConvertStructFieldInitializerToType
>> should be modified to not care about the
>> alignment.
>>
>> Modified:
>> llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
>>
>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=51866&r1=51865&r2=51866&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jun 2 10:56:49 2008
>> @@ -2179,7 +2179,7 @@
>> const TargetData &TD = getTargetData();
>> const Type *UnionTy = 0;
>> tree GccUnionTy = 0;
>> - unsigned MaxSize = 0, MaxAlign = 0;
>> + unsigned MaxAlignSize = 0, MaxAlign = 0;
>> for (tree Field = TYPE_FIELDS(type); Field; Field =
>> TREE_CHAIN(Field)) {
>> if (TREE_CODE(Field) != FIELD_DECL) continue;
>> // assert(getFieldOffsetInBits(Field) == 0 && "Union with non-
>> zero offset?");
>> @@ -2233,29 +2233,27 @@
>> const Type *TheTy = ConvertType(TheGccTy);
>> unsigned Size = TD.getABITypeSize(TheTy);
>> unsigned Align = TD.getABITypeAlignment(TheTy);
>> -
>> +
>> adjustPaddingElement(GccUnionTy, TheGccTy);
>>
>> - // Select TheTy as union type if it meets one of the following
>> criteria
>> - // 1) UnionTy is 0
>> - // 2) TheTy alignment is more then UnionTy
>> - // 3) TheTy size is greater than UnionTy size and TheTy
>> alignment is
>> - // equal to UnionTy
>> - // 4) TheTy size is greater then UnionTy size and TheTy is packed
>> - bool useTheTy = false;
>> + // Select TheTy as union type if it is more aligned than any
>> other. If more
>> + // than one field achieves the maximum alignment then choose
>> the biggest.
>> + bool useTheTy;
>> if (UnionTy == 0)
>> useTheTy = true;
>> + else if (Align < MaxAlign)
>> + useTheTy = false;
>> else if (Align > MaxAlign)
>> useTheTy = true;
>> - else if (MaxAlign == Align && Size > MaxSize)
>> - useTheTy = true;
>> - else if (Size > MaxSize)
>> + else if (Size > MaxAlignSize)
>> useTheTy = true;
>> + else
>> + useTheTy = false;
>>
>> if (useTheTy) {
>> UnionTy = TheTy;
>> GccUnionTy = TheGccTy;
>> - MaxSize = MAX(MaxSize, Size);
>> + MaxAlignSize = Size;
>> MaxAlign = Align;
>> }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From dpatel at apple.com Tue Jun 3 15:15:57 2008
From: dpatel at apple.com (Devang Patel)
Date: Tue, 3 Jun 2008 13:15:57 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 -
in /llvm-gcc-4.2/trunk/gcc:
config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp
config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To:
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
<983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
<97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
Message-ID: <3ACA7950-FD16-4CAC-9D0C-F403E63CC2E5@apple.com>
On Jun 3, 2008, at 12:23 PM, Dale Johannesen wrote:
> Do we have a way to tell what rev was in effect when the nightly
> tester first reported a failure?
Nope, http://llvm.org/bugs/show_bug.cgi?id=1587
Hopefully one of the GSoC project will address this.
-
Devang
From dpatel at apple.com Tue Jun 3 15:46:04 2008
From: dpatel at apple.com (Devang Patel)
Date: Tue, 3 Jun 2008 13:46:04 -0700
Subject: [llvm-commits] value range analysis based on scalar-evolutions
In-Reply-To: <48436EF1.8020203@mxc.ca>
References: <48436EF1.8020203@mxc.ca>
Message-ID: <36D98FFC-7C90-448F-AA77-F84CE3F71013@apple.com>
On Jun 1, 2008, at 8:54 PM, Nick Lewycky wrote:
> I've implemented an analysis pass that uses SCEV to determine value
> ranges of integer-typed registers.
>
> Currently it maintains a map of Value* to ConstantRange*, which is
> rather inelegant. I was thinking we could have one analysis which
> would do that and others that would update the central analysis.
>
> I also implemented an optz'n pass based on it, but it hardly
> optimized anything and as such is not included in this patch.
>
> Please comment!
+static RegisterPass X("loopvr", "Loop Value Ranges");
You want to register this as an analysis pass and cfe-only pass.
+static SCEVHandle getTruncateOrZeroExtend(const SCEVHandle &V, const
Type *Ty,
+ ScalarEvolution &SE) {
Why not move this into ScalarEvolution.h ?
+ APInt Spread_X = X.getSetSize(), Spread_Y = Y.getSetSize();
+ APInt NewLower = X.getLower() + Y.getLower(),
+ NewUpper = X.getUpper() + Y.getUpper() - 1;
nit-pick. I'd prefer to write this as
APInt NewLower = ..;
APInt NewUpper = ..;
+bool LoopVR::runOnFunction(Function &F) {
Is there a reason to not make this a LoopPass ?
+ for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I) {
+ Loop *L = *I;
...
+ Loop *LL = LI.getLoopFor(*BI);
+ if (LL->isLoopInvariant(II)) continue;
Do you really want to check LL->isLoopInvariant(II) instead of L-
>isLoopInvariant(II) here ?
-
Devang
From baldrick at free.fr Tue Jun 3 15:51:49 2008
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 3 Jun 2008 22:51:49 +0200
Subject: [llvm-commits] [llvm-gcc-4.2] r51866 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
In-Reply-To:
References: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
Message-ID: <200806032251.50415.baldrick@free.fr>
Hi Dale,
> This patch breaks FrontendC/2008-01-28-UnionSize.c and FrontendC/
> 2007-09-28-PackedUnionMember.c on Darwin x86-32.
sorry about that, I don't understand why I didn't see it when testing
because I sure see it now (x86-64)! The problem is that gcc says that
this type
union {
struct opaque1 *f3;
struct opaque2 *f4;
struct {
struct opaque3 *f5;
unsigned short f6;
} f7;
};
is 16 byte aligned but has a size of 10 bytes. I thought gcc sizes
were always a multiple of the alignment? Anyway, ConvertUNION chooses
to represent this using "struct opaque1 *" (the reason being that f7
is packed, dunno why, so has alignment 1, which is less than the alignment
of the pointers). It then observes that the size (8 bytes) is less than
the gcc size (10 bytes) so tries to pad by adding 2 bytes, resulting in
{ opaque *, [2 x i8] }
This actually has an ABI size of 16 bytes - it is 10 bytes wide but is
8 bytes aligned -> 16 bytes. This is not the same as the gcc type size.
I'm rather taken aback that gcc is producing type sizes that are not a
multiple of the alignment. I also don't understand why the alignment
is 16.
I guess most of these oddities are related to the "#pragma pack(push, 2)"
on the first line of 2007-09-28-PackedUnionMember.c. What does that mean?
And if things are packed, shouldn't the union be converted to a packed type
or something?
Ciao,
Duncan.
From dalej at apple.com Tue Jun 3 16:28:56 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 3 Jun 2008 14:28:56 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51866 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
In-Reply-To: <200806032251.50415.baldrick@free.fr>
References: <200806021556.m52FunYg008136@zion.cs.uiuc.edu>
<200806032251.50415.baldrick@free.fr>
Message-ID: <528981CF-4D08-4B73-8E8A-55544FCA9090@apple.com>
On Jun 3, 2008, at 1:51 PM, Duncan Sands wrote:
> Hi Dale,
>
>> This patch breaks FrontendC/2008-01-28-UnionSize.c and FrontendC/
>> 2007-09-28-PackedUnionMember.c on Darwin x86-32.
>
> sorry about that, I don't understand why I didn't see it when testing
> because I sure see it now (x86-64)! The problem is that gcc says that
> this type
>
> union {
> struct opaque1 *f3;
> struct opaque2 *f4;
> struct {
> struct opaque3 *f5;
> unsigned short f6;
> } f7;
> };
>
> is 16 byte aligned but has a size of 10 bytes. I thought gcc sizes
> were always a multiple of the alignment? Anyway, ConvertUNION chooses
> to represent this using "struct opaque1 *" (the reason being that f7
> is packed, dunno why, so has alignment 1, which is less than the
> alignment
> of the pointers). It then observes that the size (8 bytes) is less
> than
> the gcc size (10 bytes) so tries to pad by adding 2 bytes, resulting
> in
> { opaque *, [2 x i8] }
> This actually has an ABI size of 16 bytes - it is 10 bytes wide but is
> 8 bytes aligned -> 16 bytes. This is not the same as the gcc type
> size.
>
> I'm rather taken aback that gcc is producing type sizes that are not a
> multiple of the alignment. I also don't understand why the alignment
> is 16.
>
> I guess most of these oddities are related to the "#pragma
> pack(push, 2)"
> on the first line of 2007-09-28-PackedUnionMember.c. What does that
> mean?
> And if things are packed, shouldn't the union be converted to a
> packed type
> or something?
The pragma means all struct/unions encountered thereafter (until the
next such pragma) have alignment 2 and max alignment of any field is
2. So
struct { char c; int x; };
is size 6, alignment 2.
So the size and alignment for that union are 10 and 2, and if you
compile it with gcc that's what they are. I'm not sure how that's
represented inside gcc, probably there's another field somewhere you
need to look at.
From dalej at apple.com Tue Jun 3 17:15:55 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 3 Jun 2008 15:15:55 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To:
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
<983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
<97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
Message-ID: <7B9EDBC2-D0D8-4258-BD1F-7BF8F914ED6C@apple.com>
On Jun 3, 2008, at 12:23 PM, Dale Johannesen wrote:
> On Jun 2, 2008, at 11:58 PM, Evan Cheng wrote:
>
>> Purely trial and error. llvm-gcc before this patch works. :-)
>>
>> Evan
>
> Revs 51722 and 51723 both work for me; it was broken after this.
It's 51799, so that is me.
> Do we have a way to tell what rev was in effect when the nightly
> tester first reported a failure?
>
>> On Jun 2, 2008, at 7:35 PM, Dale Johannesen wrote:
>>
>>> Not saying you're wrong, but why do you think it's this patch?
>>>
>>> On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
>>>
>>>> Hi Dale,
>>>>
>>>> Looks like this patch broke 447.dealII on x86-64. Try this:
>>>>
>>>> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
>>>> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
>>>> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-model=pic
>>>> -disable-fp-elim" clean Output/447.dealII.diff-llc
>>>>
>>>> Evan
>>>>
>>>> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>>>>
>>>>> Author: johannes
>>>>> Date: Thu May 29 20:23:12 2008
>>>>> New Revision: 51723
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>>>>> Log:
>>>>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>>>>> change in favor of a more general version which handles
>>>>> the case where there's more than one element correctly.
>>>>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>>>>> and many more.
>>>>>
>>>>>
>>>>> Modified:
>>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>>>
>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>>
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> ==================================================================
>>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>> (original)
>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu
>>>>> May 29 20:23:12 2008
>>>>> @@ -95,17 +95,18 @@
>>>>> considered as if they were the type of the data field. */
>>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>>> - isSingleElementStructOrArray(X, true, false, false)
>>>>> + isSingleElementStructOrArray(X, true, false)
>>>>> #endif
>>>>>
>>>>> +extern bool
>>>>> llvm_x86_should_pass_aggregate_in_integer_regs(tree, unsigned*);
>>>>> +
>>>>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if
>>>>> this aggregate
>>>>> value should be passed in integer registers. This differs from
>>>>> the usual
>>>>> - handling in that x86-64 passes single-int-element unions as
>>>>> the type of the
>>>>> - field. */
>>>>> -#define
>>>>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>>> -
>>>>> (TARGET_64BIT
>>>>> ? \
>>>>> - !isSingleElementStructOrArray((X), true, true,
>>>>> true) : \
>>>>> - !isSingleElementStructOrArray((X), false, true, false))
>>>>> + handling in that x86-64 passes 128-bit structs and unions
>>>>> which only
>>>>> + contain data in the first 64 bits, as 64-bit objects.
>>>>> (These can be
>>>>> + created by abusing __attribute__((aligned)). */
>>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>>>>> Y) \
>>>>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>>>>
>>>>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>>>>
>>>>>
>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>>
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> ==================================================================
>>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>>>>> 20:23:12 2008
>>>>> @@ -1288,4 +1288,38 @@
>>>>> return Loc;
>>>>> }
>>>>>
>>>>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>>>>> same as the
>>>>> +/// default. x86-64 detects the case where a type is 16 bytes
>>>>> long but
>>>>> +/// only 8 of them are passed, the rest being padding (*size is
>>>>> set to 8
>>>>> +/// to identify this case).
>>>>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>>>>> unsigned *size)
>>>>> +{
>>>>> + *size = 0;
>>>>> + if (TARGET_64BIT) {
>>>>> + enum x86_64_reg_class Class[MAX_CLASSES];
>>>>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>>>>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
>>>>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>>> + /* 8 byte object, one int register */
>>>>> + return true;
>>>>> + }
>>>>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
>>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>>>>> + Class[1] == X86_64_INTEGER_CLASS)
>>>>> + /* 16 byte object, 2 int registers */
>>>>> + return true;
>>>>> + if (Class[1] == X86_64_NO_CLASS) {
>>>>> + /* 16 byte object, only 1st register has information */
>>>>> + *size = 8;
>>>>> + return true;
>>>>> + }
>>>>> + }
>>>>> + return false;
>>>>> + }
>>>>> + else
>>>>> + return !isSingleElementStructOrArray(type, false, true);
>>>>> +}
>>>>> +
>>>>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>>>>
>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>>
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> ==================================================================
>>>>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>> (original)
>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu May
>>>>> 29 20:23:12 2008
>>>>> @@ -404,7 +404,7 @@
>>>>> // some zero-length fields as well, must be passed as the field
>>>>> type.
>>>>> // Note this does not apply to long double.
>>>>> // This is required for ABI correctness.
>>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>> false, false);
>>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>> false);
>>>>> if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!
>>>>> =TFmode &&
>>>>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>>>>> return false;
>>>>> @@ -437,7 +437,7 @@
>>>>> // Other single-element structs may be passed this way as well,
>>>>> but
>>>>> // only if the type size matches the element's type size
>>>>> (structs that
>>>>> // violate this can be created with __aligned__).
>>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>> false, false);
>>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>> false);
>>>>> if (tType && int_size_in_bytes(tType)==SrcSize &&
>>>>> TYPE_MODE(tType)!=TFmode &&
>>>>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>>>>> Elts.push_back(ConvertType(tType));
>>>>>
>>>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>>
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> =
>>>>> ==================================================================
>>>>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>>>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>>>>> @@ -138,21 +138,17 @@
>>>>> /// rejectFatBitField, and the single element is a bitfield of a
>>>>> type that's
>>>>> /// bigger than the struct, return null anyway.
>>>>> static tree isSingleElementStructOrArray(tree type, bool
>>>>> ignoreZeroLength,
>>>>> - bool rejectFatBitfield,
>>>>> - bool acceptUnions) {
>>>>> + bool
>>>>> rejectFatBitfield) {
>>>>> // Scalars are good.
>>>>> if (!isAggregateTreeType(type)) return type;
>>>>>
>>>>> tree FoundField = 0;
>>>>> switch (TREE_CODE(type)) {
>>>>> case QUAL_UNION_TYPE:
>>>>> + case UNION_TYPE: // Single element unions don't count.
>>>>> case COMPLEX_TYPE: // Complex values are like 2-element records.
>>>>> default:
>>>>> return 0;
>>>>> - case UNION_TYPE: // Single element unions don't count.
>>>>> - if (!acceptUnions)
>>>>> - return 0;
>>>>> - // fall through
>>>>> case RECORD_TYPE:
>>>>> // If this record has variable length, reject it.
>>>>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>>>>> @@ -178,15 +174,13 @@
>>>>> }
>>>>> }
>>>>> return FoundField ? isSingleElementStructOrArray(FoundField,
>>>>> -
>>>>> ignoreZeroLength, false,
>>>>> - false)
>>>>> +
>>>>> ignoreZeroLength, false)
>>>>> : 0;
>>>>> case ARRAY_TYPE:
>>>>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>>>>> if (!Ty || Ty->getNumElements() != 1)
>>>>> return 0;
>>>>> - return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>>>> false,
>>>>> - false);
>>>>> + return isSingleElementStructOrArray(TREE_TYPE(type), false,
>>>>> false);
>>>>> }
>>>>> }
>>>>>
>>>>> @@ -283,8 +277,8 @@
>>>>> // single element is a bitfield of a type bigger than the
>>>>> struct; the code
>>>>> // for field-by-field struct passing does not handle this one
>>>>> right.
>>>>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>>>>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>>> - !isSingleElementStructOrArray(X, false, true, false)
>>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>>>>> + !isSingleElementStructOrArray((X), false, true)
>>>>> #endif
>>>>>
>>>>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree
>>>>> if this single
>>>>> @@ -295,7 +289,7 @@
>>>>> // by abusing the __aligned__ attribute.)
>>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>>> - isSingleElementStructOrArray(X, false, false, false)
>>>>> + isSingleElementStructOrArray(X, false, false)
>>>>> #endif
>>>>>
>>>>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if
>>>>> this vector type
>>>>> @@ -408,6 +402,7 @@
>>>>> /// their fields.
>>>>> void HandleArgument(tree type, std::vector
>>>>> &ScalarElts,
>>>>> ParameterAttributes *Attributes = NULL) {
>>>>> + unsigned Size = 0;
>>>>> const Type *Ty = ConvertType(type);
>>>>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>>>>> int]. Do
>>>>> // not include variable sized fields here.
>>>>> @@ -418,7 +413,7 @@
>>>>> ScalarElts.push_back(PtrTy);
>>>>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>>>>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>>>>> } else {
>>>>> C.HandleScalarArgument(Ty, type);
>>>>> ScalarElts.push_back(Ty);
>>>>> @@ -444,8 +439,8 @@
>>>>> *Attributes |=
>>>>>
>>>>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>>>>> }
>>>>> - } else if
>>>>> (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>>> + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type,
>>>>> &Size)) {
>>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>>>>> } else if (isZeroSizedStructOrUnion(type)) {
>>>>> // Zero sized struct or union, just drop it!
>>>>> ;
>>>>> @@ -526,10 +521,15 @@
>>>>>
>>>>> /// PassInIntegerRegisters - Given an aggregate value that
>>>>> should be passed in
>>>>> /// integer registers, convert it to a structure containing ints
>>>>> and pass all
>>>>> - /// of the struct elements in.
>>>>> + /// of the struct elements in. If Size is set we pass only
>>>>> that many bytes.
>>>>> void PassInIntegerRegisters(tree type, const Type *Ty,
>>>>> - std::vector
>>>>> &ScalarElts) {
>>>>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>>> + std::vector
>>>>> &ScalarElts,
>>>>> + unsigned origSize) {
>>>>> + unsigned Size;
>>>>> + if (origSize)
>>>>> + Size = origSize;
>>>>> + else
>>>>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>>>
>>>>> // FIXME: We should preserve all aggregate value alignment
>>>>> information.
>>>>> // Work around to preserve some aggregate value alignment
>>>>> information:
>>>>> @@ -568,7 +568,7 @@
>>>>> Elts.push_back(Type::Int8Ty);
>>>>> Size -= 1;
>>>>> }
>>>>> - assert(Size == 0 && "Didn't cover value?");
>>>>> + assert((origSize || Size == 0) && "Didn't cover value?");
>>>>> const StructType *STy = StructType::get(Elts, false);
>>>>>
>>>>> unsigned i = 0;
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>
>>
>
From evan.cheng at apple.com Tue Jun 3 19:14:35 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 3 Jun 2008 17:14:35 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r51723 - in
/llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h
config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h
In-Reply-To: <7B9EDBC2-D0D8-4258-BD1F-7BF8F914ED6C@apple.com>
References: <200805300123.m4U1NDZl019942@zion.cs.uiuc.edu>
<4B25ACA3-2667-47BE-8483-B937CEA1719F@apple.com>
<983E84B7-0FC5-416B-A174-E1D5C0A50E87@apple.com>
<97A489F4-409F-47F6-9EC7-9CC3DCD7563B@apple.com>
<7B9EDBC2-D0D8-4258-BD1F-7BF8F914ED6C@apple.com>
Message-ID: <2A9725F3-E438-4037-A713-B9C295889A69@apple.com>
On Jun 3, 2008, at 3:15 PM, Dale Johannesen wrote:
> On Jun 3, 2008, at 12:23 PM, Dale Johannesen wrote:
>> On Jun 2, 2008, at 11:58 PM, Evan Cheng wrote:
>>
>>> Purely trial and error. llvm-gcc before this patch works. :-)
>>>
>>> Evan
>>
>> Revs 51722 and 51723 both work for me; it was broken after this.
>
> It's 51799, so that is me.
Close enough. :-) Thanks for tracking it down.
Evan
>
>
>> Do we have a way to tell what rev was in effect when the nightly
>> tester first reported a failure?
>>
>>> On Jun 2, 2008, at 7:35 PM, Dale Johannesen wrote:
>>>
>>>> Not saying you're wrong, but why do you think it's this patch?
>>>>
>>>> On Jun 2, 2008, at 5:35 PM, Evan Cheng wrote:
>>>>
>>>>> Hi Dale,
>>>>>
>>>>> Looks like this patch broke 447.dealII on x86-64. Try this:
>>>>>
>>>>> make ENABLE_OPTIMIZED=1 TEST=nightly TARGET_FLAGS="-m64 -
>>>>> DSPEC_CPU2000_LP64 -DSPEC_CPU_LP64" TARGET_LLCFLAGS="-relocation-
>>>>> model=pic -disable-fp-elim" EXTRA_LLI_OPTS="-relocation-
>>>>> model=pic -disable-fp-elim" clean Output/447.dealII.diff-llc
>>>>>
>>>>> Evan
>>>>>
>>>>> On May 29, 2008, at 6:23 PM, Dale Johannesen wrote:
>>>>>
>>>>>> Author: johannes
>>>>>> Date: Thu May 29 20:23:12 2008
>>>>>> New Revision: 51723
>>>>>>
>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=51723&view=rev
>>>>>> Log:
>>>>>> X86-64 ABI fix. Revert isSingleElementStructOrArray
>>>>>> change in favor of a more general version which handles
>>>>>> the case where there's more than one element correctly.
>>>>>> Fixes gcc.dg/compat/struct-layout-1.exp/t003
>>>>>> and many more.
>>>>>>
>>>>>>
>>>>>> Modified:
>>>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>>> llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>>>> llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>>> llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>>>>
>>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =================================================================
>>>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
>>>>>> (original)
>>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Thu
>>>>>> May 29 20:23:12 2008
>>>>>> @@ -95,17 +95,18 @@
>>>>>> considered as if they were the type of the data field. */
>>>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>>>> - isSingleElementStructOrArray(X, true, false, false)
>>>>>> + isSingleElementStructOrArray(X, true, false)
>>>>>> #endif
>>>>>>
>>>>>> +extern bool
>>>>>> llvm_x86_should_pass_aggregate_in_integer_regs(tree, unsigned*);
>>>>>> +
>>>>>> /* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if
>>>>>> this aggregate
>>>>>> value should be passed in integer registers. This differs from
>>>>>> the usual
>>>>>> - handling in that x86-64 passes single-int-element unions as
>>>>>> the type of the
>>>>>> - field. */
>>>>>> -#define
>>>>>> LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>>>> -
>>>>>> (TARGET_64BIT
>>>>>> ? \
>>>>>> - !isSingleElementStructOrArray((X), true, true,
>>>>>> true) : \
>>>>>> - !isSingleElementStructOrArray((X), false, true, false))
>>>>>> + handling in that x86-64 passes 128-bit structs and unions
>>>>>> which only
>>>>>> + contain data in the first 64 bits, as 64-bit objects.
>>>>>> (These can be
>>>>>> + created by abusing __attribute__((aligned)). */
>>>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X,
>>>>>> Y) \
>>>>>> + llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y))
>>>>>>
>>>>>> extern bool llvm_x86_should_pass_vector_in_integer_regs(tree);
>>>>>>
>>>>>>
>>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =================================================================
>>>>>> --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
>>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu May 29
>>>>>> 20:23:12 2008
>>>>>> @@ -1288,4 +1288,38 @@
>>>>>> return Loc;
>>>>>> }
>>>>>>
>>>>>> +/// llvm_x86_should_pass_aggregate_in_integer_regs - x86-32 is
>>>>>> same as the
>>>>>> +/// default. x86-64 detects the case where a type is 16 bytes
>>>>>> long but
>>>>>> +/// only 8 of them are passed, the rest being padding (*size
>>>>>> is set to 8
>>>>>> +/// to identify this case).
>>>>>> +bool llvm_x86_should_pass_aggregate_in_integer_regs(tree type,
>>>>>> unsigned *size)
>>>>>> +{
>>>>>> + *size = 0;
>>>>>> + if (TARGET_64BIT) {
>>>>>> + enum x86_64_reg_class Class[MAX_CLASSES];
>>>>>> + enum machine_mode Mode = ix86_getNaturalModeForType(type);
>>>>>> + int NumClasses = ix86_ClassifyArgument(Mode, type, Class,
>>>>>> 0);
>>>>>> + if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS
>>>>>> ||
>>>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>>>> + /* 8 byte object, one int register */
>>>>>> + return true;
>>>>>> + }
>>>>>> + if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS
>>>>>> ||
>>>>>> + Class[0] == X86_64_INTEGER_CLASS)) {
>>>>>> + if (Class[1] == X86_64_INTEGERSI_CLASS ||
>>>>>> + Class[1] == X86_64_INTEGER_CLASS)
>>>>>> + /* 16 byte object, 2 int registers */
>>>>>> + return true;
>>>>>> + if (Class[1] == X86_64_NO_CLASS) {
>>>>>> + /* 16 byte object, only 1st register has information */
>>>>>> + *size = 8;
>>>>>> + return true;
>>>>>> + }
>>>>>> + }
>>>>>> + return false;
>>>>>> + }
>>>>>> + else
>>>>>> + return !isSingleElementStructOrArray(type, false, true);
>>>>>> +}
>>>>>> +
>>>>>> /* LLVM LOCAL end (ENTIRE FILE!) */
>>>>>>
>>>>>> Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=51723&r1=51722&r2=51723&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =================================================================
>>>>>> --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
>>>>>> (original)
>>>>>> +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Thu
>>>>>> May 29 20:23:12 2008
>>>>>> @@ -404,7 +404,7 @@
>>>>>> // some zero-length fields as well, must be passed as the field
>>>>>> type.
>>>>>> // Note this does not apply to long double.
>>>>>> // This is required for ABI correctness.
>>>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>>> false, false);
>>>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>>> false);
>>>>>> if (tType && int_size_in_bytes(tType)==Bytes &&
>>>>>> TYPE_MODE(tType)!=TFmode &&
>>>>>> (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
>>>>>> return false;
>>>>>> @@ -437,7 +437,7 @@
>>>>>> // Other single-element structs may be passed this way as well,
>>>>>> but
>>>>>> // only if the type size matches the element's type size
>>>>>> (structs that
>>>>>> // violate this can be created with __aligned__).
>>>>>> - tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>>> false, false);
>>>>>> + tree tType = isSingleElementStructOrArray(TreeType, true,
>>>>>> false);
>>>>>> if (tType && int_size_in_bytes(tType)==SrcSize &&
>>>>>> TYPE_MODE(tType)!=TFmode &&
>>>>>> (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
>>>>>> Elts.push_back(ConvertType(tType));
>>>>>>
>>>>>> Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=51723&r1=51722&r2=51723&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =================================================================
>>>>>> --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
>>>>>> +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Thu May 29 20:23:12 2008
>>>>>> @@ -138,21 +138,17 @@
>>>>>> /// rejectFatBitField, and the single element is a bitfield of
>>>>>> a type that's
>>>>>> /// bigger than the struct, return null anyway.
>>>>>> static tree isSingleElementStructOrArray(tree type, bool
>>>>>> ignoreZeroLength,
>>>>>> - bool rejectFatBitfield,
>>>>>> - bool acceptUnions) {
>>>>>> + bool
>>>>>> rejectFatBitfield) {
>>>>>> // Scalars are good.
>>>>>> if (!isAggregateTreeType(type)) return type;
>>>>>>
>>>>>> tree FoundField = 0;
>>>>>> switch (TREE_CODE(type)) {
>>>>>> case QUAL_UNION_TYPE:
>>>>>> + case UNION_TYPE: // Single element unions don't count.
>>>>>> case COMPLEX_TYPE: // Complex values are like 2-element
>>>>>> records.
>>>>>> default:
>>>>>> return 0;
>>>>>> - case UNION_TYPE: // Single element unions don't count.
>>>>>> - if (!acceptUnions)
>>>>>> - return 0;
>>>>>> - // fall through
>>>>>> case RECORD_TYPE:
>>>>>> // If this record has variable length, reject it.
>>>>>> if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST)
>>>>>> @@ -178,15 +174,13 @@
>>>>>> }
>>>>>> }
>>>>>> return FoundField ? isSingleElementStructOrArray(FoundField,
>>>>>> -
>>>>>> ignoreZeroLength, false,
>>>>>> - false)
>>>>>> +
>>>>>> ignoreZeroLength, false)
>>>>>> : 0;
>>>>>> case ARRAY_TYPE:
>>>>>> const ArrayType *Ty = dyn_cast(ConvertType(type));
>>>>>> if (!Ty || Ty->getNumElements() != 1)
>>>>>> return 0;
>>>>>> - return isSingleElementStructOrArray(TREE_TYPE(type),
>>>>>> false, false,
>>>>>> - false);
>>>>>> + return isSingleElementStructOrArray(TREE_TYPE(type),
>>>>>> false, false);
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> @@ -283,8 +277,8 @@
>>>>>> // single element is a bitfield of a type bigger than the
>>>>>> struct; the code
>>>>>> // for field-by-field struct passing does not handle this one
>>>>>> right.
>>>>>> #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
>>>>>> -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
>>>>>> - !isSingleElementStructOrArray(X, false, true, false)
>>>>>> +#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y) \
>>>>>> + !isSingleElementStructOrArray((X), false, true)
>>>>>> #endif
>>>>>>
>>>>>> // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE
>>>>>> tree if this single
>>>>>> @@ -295,7 +289,7 @@
>>>>>> // by abusing the __aligned__ attribute.)
>>>>>> #ifndef LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR
>>>>>> #define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \
>>>>>> - isSingleElementStructOrArray(X, false, false, false)
>>>>>> + isSingleElementStructOrArray(X, false, false)
>>>>>> #endif
>>>>>>
>>>>>> // LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR - Return a TYPE tree if
>>>>>> this vector type
>>>>>> @@ -408,6 +402,7 @@
>>>>>> /// their fields.
>>>>>> void HandleArgument(tree type, std::vector
>>>>>> &ScalarElts,
>>>>>> ParameterAttributes *Attributes = NULL) {
>>>>>> + unsigned Size = 0;
>>>>>> const Type *Ty = ConvertType(type);
>>>>>> // Figure out if this field is zero bits wide, e.g. {} or [0 x
>>>>>> int]. Do
>>>>>> // not include variable sized fields here.
>>>>>> @@ -418,7 +413,7 @@
>>>>>> ScalarElts.push_back(PtrTy);
>>>>>> } else if (Ty->getTypeID()==Type::VectorTyID) {
>>>>>> if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
>>>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, 0);
>>>>>> } else {
>>>>>> C.HandleScalarArgument(Ty, type);
>>>>>> ScalarElts.push_back(Ty);
>>>>>> @@ -444,8 +439,8 @@
>>>>>> *Attributes |=
>>>>>>
>>>>>> ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type));
>>>>>> }
>>>>>> - } else if
>>>>>> (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
>>>>>> - PassInIntegerRegisters(type, Ty, ScalarElts);
>>>>>> + } else if
>>>>>> (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type, &Size)) {
>>>>>> + PassInIntegerRegisters(type, Ty, ScalarElts, Size);
>>>>>> } else if (isZeroSizedStructOrUnion(type)) {
>>>>>> // Zero sized struct or union, just drop it!
>>>>>> ;
>>>>>> @@ -526,10 +521,15 @@
>>>>>>
>>>>>> /// PassInIntegerRegisters - Given an aggregate value that
>>>>>> should be passed in
>>>>>> /// integer registers, convert it to a structure containing
>>>>>> ints and pass all
>>>>>> - /// of the struct elements in.
>>>>>> + /// of the struct elements in. If Size is set we pass only
>>>>>> that many bytes.
>>>>>> void PassInIntegerRegisters(tree type, const Type *Ty,
>>>>>> - std::vector
>>>>>> &ScalarElts) {
>>>>>> - unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>>>> + std::vector
>>>>>> &ScalarElts,
>>>>>> + unsigned origSize) {
>>>>>> + unsigned Size;
>>>>>> + if (origSize)
>>>>>> + Size = origSize;
>>>>>> + else
>>>>>> + Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8;
>>>>>>
>>>>>> // FIXME: We should preserve all aggregate value alignment
>>>>>> information.
>>>>>> // Work around to preserve some aggregate value alignment
>>>>>> information:
>>>>>> @@ -568,7 +568,7 @@
>>>>>> Elts.push_back(Type::Int8Ty);
>>>>>> Size -= 1;
>>>>>> }
>>>>>> - assert(Size == 0 && "Didn't cover value?");
>>>>>> + assert((origSize || Size == 0) && "Didn't cover value?");
>>>>>> const StructType *STy = StructType::get(Elts, false);
>>>>>>
>>>>>> unsigned i = 0;
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>
>>>>
>>>
>>
>
From resistor at mac.com Tue Jun 3 19:38:57 2008
From: resistor at mac.com (Owen Anderson)
Date: Wed, 04 Jun 2008 00:38:57 -0000
Subject: [llvm-commits] [llvm] r51922 -
/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Message-ID: <200806040038.m540cv9N001468@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Jun 3 19:38:56 2008
New Revision: 51922
URL: http://llvm.org/viewvc/llvm-project?rev=51922&view=rev
Log:
We need to subtract one from this index because live ranges are open at the end.
Modified:
llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=51922&r1=51921&r2=51922&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Jun 3 19:38:56 2008
@@ -467,7 +467,7 @@
} else {
// Otherwise, add it to the renaming set
LiveInterval& I = LI.getOrCreateInterval(SrcReg);
- unsigned idx = LI.getMBBEndIdx(P->getOperand(i).getMBB());
+ unsigned idx = LI.getMBBEndIdx(P->getOperand(i).getMBB()) - 1;
VNInfo* VN = I.getLiveRangeContaining(idx)->valno;
assert(VN && "No VNInfo for register?");
From echristo at apple.com Tue Jun 3 19:40:41 2008
From: echristo at apple.com (Eric Christopher)
Date: Tue, 3 Jun 2008 17:40:41 -0700
Subject: [llvm-commits] [llvm] r51922 -
/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
In-Reply-To: <200806040038.m540cv9N001468@zion.cs.uiuc.edu>
References: <200806040038.m540cv9N001468@zion.cs.uiuc.edu>
Message-ID: <2B698B86-C507-4C43-85FA-A19AC568C86D@apple.com>
>
> We need to subtract one from this index because live ranges are open
> at the end.
>
> - unsigned idx = LI.getMBBEndIdx(P->getOperand(i).getMBB());
> + unsigned idx = LI.getMBBEndIdx(P->getOperand(i).getMBB()) -
> 1;
> VNInfo* VN = I.getLiveRangeContaining(idx)->valno;
This would make a great comment right here :)
-eric
From bruno.cardoso at gmail.com Tue Jun 3 20:45:25 2008
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Wed, 04 Jun 2008 01:45:25 -0000
Subject: [llvm-commits] [llvm] r51923 - in /llvm/trunk/lib/Target/Mips:
MipsAsmPrinter.cpp MipsISelLowering.cpp MipsInstrInfo.td
MipsRegisterInfo.cpp MipsSubtarget.cpp MipsSubtarget.h
MipsTargetMachine.cpp MipsTargetMachine.h
Message-ID: <200806040145.m541jQs8003499@zion.cs.uiuc.edu>
Author: bruno
Date: Tue Jun 3 20:45:25 2008
New Revision: 51923
URL: http://llvm.org/viewvc/llvm-project?rev=51923&view=rev
Log:
Some Mips minor fixes
Added support for mips little endian arch => mipsel
Modified:
llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
llvm/trunk/lib/Target/Mips/MipsSubtarget.h
llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Tue Jun 3 20:45:25 2008
@@ -547,5 +547,7 @@
}
}
+ O << "\n";
+
return AsmPrinter::doFinalization(M);
}
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Jun 3 20:45:25 2008
@@ -365,6 +365,7 @@
Chain = DAG.getNode(MipsISD::JmpLink, NodeTys, &Ops[0], Ops.size());
InFlag = Chain.getValue(1);
+ // Create the CALLSEQ_END node.
Chain = DAG.getCALLSEQ_END(Chain,
DAG.getConstant(NumBytes, getPointerTy()),
DAG.getConstant(0, getPointerTy()),
@@ -400,8 +401,6 @@
InFlag = Chain.getValue(1);
}
- // Create the CALLSEQ_END node.
-
// Handle result values, copying them out of physregs into vregs that we
// return.
return SDOperand(LowerCallResult(Chain, InFlag, Op.Val, CC, DAG), Op.ResNo);
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Tue Jun 3 20:45:25 2008
@@ -135,7 +135,6 @@
[], IIAlu>;
// Arithmetic 2 register operands
-let isCommutable = 1 in
class ArithI op, string instr_asm, SDNode OpNode,
Operand Od, PatLeaf imm_type> :
FI< op,
Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Tue Jun 3 20:45:25 2008
@@ -147,7 +147,7 @@
//
// 0 ----------
// 4 Args to pass
-// . saved $GP (used in PIC - not supported yet)
+// . saved $GP (used in PIC)
// . Local Area
// . saved "Callee Saved" Registers
// . saved FP
@@ -369,7 +369,7 @@
// lw $ra, stack_loc($sp)
if (MFI->hasCalls()) {
BuildMI(MBB, MBBI, TII.get(Mips::LW))
- .addReg(Mips::RA).addImm(RAOffset).addReg(Mips::SP);
+ .addReg(Mips::RA).addImm(RAOffset).addReg(Mips::SP);
}
// adjust stack : insert addi sp, sp, (imm)
Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Tue Jun 3 20:45:25 2008
@@ -17,8 +17,9 @@
using namespace llvm;
MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M,
- const std::string &FS) :
- IsMipsIII(false)
+ const std::string &FS, bool little) :
+ IsMipsIII(false),
+ IsLittle(little)
{
std::string CPU = "mips1";
Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.h?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.h Tue Jun 3 20:45:25 2008
@@ -27,14 +27,14 @@
protected:
bool IsMipsIII;
+ bool IsLittle;
InstrItineraryData InstrItins;
public:
/// This constructor initializes the data members to match that
/// of the specified module.
- ///
MipsSubtarget(const TargetMachine &TM, const Module &M,
- const std::string &FS);
+ const std::string &FS, bool little);
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
@@ -43,6 +43,9 @@
/// isMipsIII - Return true if the selected CPU supports MipsIII ISA
/// support.
bool isMipsIII() const { return IsMipsIII; }
+
+ /// isMipsIII - Return true if the target is little endian.
+ bool isLittle() const { return IsLittle; }
};
} // End llvm namespace
Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=51923&r1=51922&r2=51923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Tue Jun 3 20:45:25 2008
@@ -20,7 +20,8 @@
using namespace llvm;
// Register the target.
-static RegisterTarget