[llvm-commits] CVS: llvm/docs/FAQ.html

2006-04-26 Thread Reid Spencer


Changes in directory llvm/docs:

FAQ.html updated: 1.31 - 1.32
---
Log message:

Add some notes about the current state of source (front end) languages 
so we can point to them on llvm-dev.


---
Diffs of the changes:  (+44 -1)

 FAQ.html |   45 -
 1 files changed, 44 insertions(+), 1 deletion(-)


Index: llvm/docs/FAQ.html
diff -u llvm/docs/FAQ.html:1.31 llvm/docs/FAQ.html:1.32
--- llvm/docs/FAQ.html:1.31 Mon Mar 13 23:39:39 2006
+++ llvm/docs/FAQ.html  Wed Apr 26 09:52:19 2006
@@ -55,6 +55,13 @@
   target./li
   /ol/li
 
+  lia href=#felangsSource Languages/a
+  ol
+lia href=#langsWhat source languages are supported?/a/li
+lia href=#langhlsuppWhat support is there for higher level source
+  language constructs for building a compiler?/a/li
+  /ol
+
   lia href=#cfeUsing the GCC Front End/a
   ol
 li
@@ -385,6 +392,42 @@
 
 !-- *** 
--
 div class=doc_section
+  a name=felangsSource Languages/a
+/div
+
+div class=questionpWhat source languages are supported?/p/div
+div name=langs class=answer
+  pLLVM currently has full support for C and C++ source languages. These are
+  available through a special version of GCC that LLVM calls the 
+  a href=#cfeC Front End/a/p
+  pThere is an incomplete version of a Java front end available in the
+  ttllvm-java/tt CVS repository. There is no documentation on this yet so
+  you'll need to download the code, compile it, and try it./p
+  pIn the ttexamples/BFtoLLVM/tt directory is a translator for the 
+  BrainF*** language (2002 Language Specification)./p
+  pIn the ttprojects/Stacker/tt directory is a compiler and runtime
+  library for the Stacker language, a toy language loosely based on 
Forth./p
+  pThe PyPy developers are working on integrating LLVM into the PyPy backend
+  so that PyPy language can translate to LLVM./p
+/div
+div name=langhlsupp class=question
+  pWhat support is there for a higher level source language constructs for 
+  building a compiler?/p
+/div
+div class=answer
+  pCurrently, there isn't much. LLVM supports an intermediate representation
+  which is useful for code representation but will not support the high level
+  (abstract syntax tree) representation needed by most compilers. There are no
+  facilities for lexical nor semantica analysis. There is, however, a imostly
+implemented/i configuration-driven 
+  a href=CompilerDriver.htmlcompiler driver/a which simplifies the task
+  of running optimizations, linking, and executable generation./p
+  pYou might be interested in following the progress of the a
+href=http://hlvm.org;HLVM Project/a which is attempting to address 
these
+  issues./p
+/div
+!-- *** 
--
+div class=doc_section
   a name=cfeUsing the GCC Front End/a
 /div
 
@@ -574,7 +617,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/03/14 05:39:39 $
+  Last modified: $Date: 2006/04/26 14:52:19 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/FAQ.html

2006-04-26 Thread Reid Spencer


Changes in directory llvm/docs:

FAQ.html updated: 1.32 - 1.33
---
Log message:

Fix some anchors.


---
Diffs of the changes:  (+8 -8)

 FAQ.html |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/docs/FAQ.html
diff -u llvm/docs/FAQ.html:1.32 llvm/docs/FAQ.html:1.33
--- llvm/docs/FAQ.html:1.32 Wed Apr 26 09:52:19 2006
+++ llvm/docs/FAQ.html  Wed Apr 26 10:46:53 2006
@@ -391,12 +391,12 @@
 /div
 
 !-- *** 
--
-div class=doc_section
-  a name=felangsSource Languages/a
-/div
+div class=doc_sectiona name=felangsSource Languages/a/div
 
-div class=questionpWhat source languages are supported?/p/div
-div name=langs class=answer
+div class=questionp
+  a name=langsWhat source languages are supported?/a/p
+/div
+div class=answer
   pLLVM currently has full support for C and C++ source languages. These are
   available through a special version of GCC that LLVM calls the 
   a href=#cfeC Front End/a/p
@@ -410,9 +410,9 @@
   pThe PyPy developers are working on integrating LLVM into the PyPy backend
   so that PyPy language can translate to LLVM./p
 /div
-div name=langhlsupp class=question
+div class=questiona name=langhlsupp
   pWhat support is there for a higher level source language constructs for 
-  building a compiler?/p
+  building a compiler?/a/p
 /div
 div class=answer
   pCurrently, there isn't much. LLVM supports an intermediate representation
@@ -617,7 +617,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/04/26 14:52:19 $
+  Last modified: $Date: 2006/04/26 15:46:53 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/FAQ.html

2006-04-26 Thread Jeff Cohen


Changes in directory llvm/docs:

FAQ.html updated: 1.33 - 1.34
---
Log message:

Fix typo.

---
Diffs of the changes:  (+2 -2)

 FAQ.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/FAQ.html
diff -u llvm/docs/FAQ.html:1.33 llvm/docs/FAQ.html:1.34
--- llvm/docs/FAQ.html:1.33 Wed Apr 26 10:46:53 2006
+++ llvm/docs/FAQ.html  Wed Apr 26 13:05:25 2006
@@ -418,7 +418,7 @@
   pCurrently, there isn't much. LLVM supports an intermediate representation
   which is useful for code representation but will not support the high level
   (abstract syntax tree) representation needed by most compilers. There are no
-  facilities for lexical nor semantica analysis. There is, however, a imostly
+  facilities for lexical nor semantical analysis. There is, however, a 
imostly
 implemented/i configuration-driven 
   a href=CompilerDriver.htmlcompiler driver/a which simplifies the task
   of running optimizations, linking, and executable generation./p
@@ -617,7 +617,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/04/26 15:46:53 $
+  Last modified: $Date: 2006/04/26 18:05:25 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/FAQ.html

2006-04-26 Thread Chris Lattner


Changes in directory llvm/docs:

FAQ.html updated: 1.34 - 1.35
---
Log message:

Unfortunately this really isn't the place for advertisement.


---
Diffs of the changes:  (+1 -4)

 FAQ.html |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


Index: llvm/docs/FAQ.html
diff -u llvm/docs/FAQ.html:1.34 llvm/docs/FAQ.html:1.35
--- llvm/docs/FAQ.html:1.34 Wed Apr 26 13:05:25 2006
+++ llvm/docs/FAQ.html  Wed Apr 26 13:10:59 2006
@@ -422,9 +422,6 @@
 implemented/i configuration-driven 
   a href=CompilerDriver.htmlcompiler driver/a which simplifies the task
   of running optimizations, linking, and executable generation./p
-  pYou might be interested in following the progress of the a
-href=http://hlvm.org;HLVM Project/a which is attempting to address 
these
-  issues./p
 /div
 !-- *** 
--
 div class=doc_section
@@ -617,7 +614,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/04/26 18:05:25 $
+  Last modified: $Date: 2006/04/26 18:10:59 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2006-04-26 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.188 - 1.189
---
Log message:

Fix fastcc failures.


---
Diffs of the changes:  (+3 -0)

 X86ISelLowering.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.188 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.189
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.188   Tue Apr 25 20:20:17 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Apr 26 13:21:31 2006
@@ -937,6 +937,9 @@
 ArgValue = DAG.getConstantFP(0, ObjectVT);
 }
 FormalArgs.push_back(ArgValue);
+
+if (ObjSize)
+  ArgOffset += ArgIncrement;   // Move on to the next argument.
   }
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/complex-scev.ll

2006-04-26 Thread Chris Lattner


Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify:

complex-scev.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+28 -0)

 complex-scev.ll |   28 
 1 files changed, 28 insertions(+)


Index: llvm/test/Regression/Transforms/IndVarsSimplify/complex-scev.ll
diff -c /dev/null 
llvm/test/Regression/Transforms/IndVarsSimplify/complex-scev.ll:1.1
*** /dev/null   Wed Apr 26 13:33:09 2006
--- llvm/test/Regression/Transforms/IndVarsSimplify/complex-scev.ll Wed Apr 
26 13:32:59 2006
***
*** 0 
--- 1,28 
+ ; The i induction variable looks like a wrap-around, but it really is just
+ ; a simple affine IV.  Make sure that indvars eliminates it.
+ 
+ ; RUN: llvm-as  %s | opt -indvars | llvm-dis | grep phi | wc -l | grep 1
+ 
+ void %foo() {
+ entry:
+   br label %bb6
+ 
+ bb6:  ; preds = %cond_true, %entry
+   %j.0 = phi int [ 1, %entry ], [ %tmp5, %cond_true ] ; int 
[#uses=3]
+   %i.0 = phi int [ 0, %entry ], [ %j.0, %cond_true ]  ; int 
[#uses=1]
+   %tmp7 = call int (...)* %foo2( ); int [#uses=1]
+   %tmp = setne int %tmp7, 0   ; bool [#uses=1]
+   br bool %tmp, label %cond_true, label %return
+ 
+ cond_true:; preds = %bb6
+   %tmp2 = call int (...)* %bar( int %i.0, int %j.0 )  ; int 
[#uses=0]
+   %tmp5 = add int %j.0, 1 ; int [#uses=1]
+   br label %bb6
+ 
+ return:   ; preds = %bb6
+   ret void
+ }
+ 
+ declare int %bar(...)
+ 
+ declare int %foo2(...)



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2006-04-26 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.47 - 1.48
---
Log message:

Implement Transforms/IndVarsSimplify/complex-scev.ll, a case where we didn't
recognize some simple affine IV's.


---
Diffs of the changes:  (+25 -0)

 ScalarEvolution.cpp |   25 +
 1 files changed, 25 insertions(+)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.47 
llvm/lib/Analysis/ScalarEvolution.cpp:1.48
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.47  Tue Apr  4 01:11:42 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Wed Apr 26 13:34:07 2006
@@ -1304,6 +1304,31 @@
   return PHISCEV;
 }
   }
+} else if (SCEVAddRecExpr *AddRec = dyn_castSCEVAddRecExpr(BEValue)) 
{
+  // Otherwise, this could be a loop like this:
+  // i = 0;  for (j = 1; ..; ++j) {   i = j; }
+  // In this case, j = {1,+,1}  and BEValue is j.
+  // Because the other in-value of i (0) fits the evolution of BEValue
+  // i really is an addrec evolution.
+  if (AddRec-getLoop() == L  AddRec-isAffine()) {
+SCEVHandle StartVal = getSCEV(PN-getIncomingValue(IncomingEdge));
+
+// If StartVal = j.start - j.stride, we can use StartVal as the
+// initial step of the addrec evolution.
+if (StartVal == SCEV::getMinusSCEV(AddRec-getOperand(0),
+   AddRec-getOperand(1))) {
+  SCEVHandle PHISCEV = 
+ SCEVAddRecExpr::get(StartVal, AddRec-getOperand(1), L);
+
+  // Okay, for the entire analysis of this edge we assumed the PHI
+  // to be symbolic.  We now need to go back and update all of the
+  // entries for the scalars that use the PHI (except for the PHI
+  // itself) to use the new analyzed value instead of the 
symbolic
+  // value.
+  ReplaceSymbolicValueWithConcrete(PN, SymbolicName, PHISCEV);
+  return PHISCEV;
+}
+  }
 }
 
 return SymbolicName;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/FAQ.html

2006-04-26 Thread Jeff Cohen


Changes in directory llvm/docs:

FAQ.html updated: 1.35 - 1.36
---
Log message:

Actually, semantical doesn't appear to be a word.

---
Diffs of the changes:  (+2 -2)

 FAQ.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/FAQ.html
diff -u llvm/docs/FAQ.html:1.35 llvm/docs/FAQ.html:1.36
--- llvm/docs/FAQ.html:1.35 Wed Apr 26 13:10:59 2006
+++ llvm/docs/FAQ.html  Wed Apr 26 16:03:17 2006
@@ -418,7 +418,7 @@
   pCurrently, there isn't much. LLVM supports an intermediate representation
   which is useful for code representation but will not support the high level
   (abstract syntax tree) representation needed by most compilers. There are no
-  facilities for lexical nor semantical analysis. There is, however, a 
imostly
+  facilities for lexical nor semantic analysis. There is, however, a imostly
 implemented/i configuration-driven 
   a href=CompilerDriver.htmlcompiler driver/a which simplifies the task
   of running optimizations, linking, and executable generation./p
@@ -614,7 +614,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/04/26 18:10:59 $
+  Last modified: $Date: 2006/04/26 21:03:17 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2006-04-26 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

PromoteMemoryToRegister.cpp updated: 1.82 - 1.83
---
Log message:

Fix some nondeterminstic behavior in the mem2reg pass that (in addition to
nondeterminism being bad) could cause some trivial missed optimizations (dead 
phi nodes being left around for later passes to clean up).

With this, llvm-gcc4 now bootstraps and correctly compares.  I don't know
why I never tried to do it before... :)



---
Diffs of the changes:  (+38 -20)

 PromoteMemoryToRegister.cpp |   58 
 1 files changed, 38 insertions(+), 20 deletions(-)


Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.82 
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.83
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.82  Fri Nov 18 
01:31:42 2005
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp   Wed Apr 26 
20:14:43 2006
@@ -147,7 +147,7 @@
 if (AI-use_empty()) {
   // If there are no uses of the alloca, just delete it now.
   if (AST) AST-deleteValue(AI);
-  AI-getParent()-getInstList().erase(AI);
+  AI-eraseFromParent();
 
   // Remove the alloca from the Allocas list, since it has been processed
   Allocas[AllocaNum] = Allocas.back();
@@ -331,7 +331,7 @@
 
   if (AST  isaPointerType(PN-getType()))
 AST-deleteValue(PN);
-  PN-getParent()-getInstList().erase(PN);
+  PN-eraseFromParent();
 }
 
 // Keep the reverse mapping of the 'Allocas' array.
@@ -377,7 +377,7 @@
   // The renamer uses the Visited set to avoid infinite loops.  Clear it now.
   Visited.clear();
 
-  // Remove the allocas themselves from the function...
+  // Remove the allocas themselves from the function.
   for (unsigned i = 0, e = Allocas.size(); i != e; ++i) {
 Instruction *A = Allocas[i];
 
@@ -388,9 +388,41 @@
 if (!A-use_empty())
   A-replaceAllUsesWith(UndefValue::get(A-getType()));
 if (AST) AST-deleteValue(A);
-A-getParent()-getInstList().erase(A);
+A-eraseFromParent();
   }
 
+  
+  // Loop over all of the PHI nodes and see if there are any that we can get
+  // rid of because they merge all of the same incoming values.  This can
+  // happen due to undef values coming into the PHI nodes.  This process is
+  // iterative, because eliminating one PHI node can cause others to be 
removed.
+  bool EliminatedAPHI = true;
+  while (EliminatedAPHI) {
+EliminatedAPHI = false;
+
+for (std::mapBasicBlock*, std::vectorPHINode * ::iterator I =
+   NewPhiNodes.begin(), E = NewPhiNodes.end(); I != E; ++I) {
+  std::vectorPHINode* PNs = I-second;
+  for (unsigned i = 0, e = PNs.size(); i != e; ++i) {
+if (!PNs[i]) continue;
+
+// If this PHI node merges  one value and/or undefs, get the value.
+if (Value *V = PNs[i]-hasConstantValue(true)) {
+  if (!isaInstruction(V) ||
+  properlyDominates(castInstruction(V), PNs[i])) {
+if (AST  isaPointerType(PNs[i]-getType()))
+  AST-deleteValue(PNs[i]);
+PNs[i]-replaceAllUsesWith(V);
+PNs[i]-eraseFromParent();
+PNs[i] = 0;
+EliminatedAPHI = true;
+continue;
+  }
+}
+  }
+}
+  }
+  
   // At this point, the renamer has added entries to PHI nodes for all 
reachable
   // code.  Unfortunately, there may be blocks which are not reachable, which
   // the renamer hasn't traversed.  If this is the case, the PHI nodes may not
@@ -403,25 +435,11 @@
 std::vectorBasicBlock* Preds(pred_begin(I-first), pred_end(I-first));
 std::vectorPHINode* PNs = I-second;
 assert(!PNs.empty()  Empty PHI node list??);
-
-// Loop over all of the PHI nodes and see if there are any that we can get
-// rid of because they merge all of the same incoming values.  This can
-// happen due to undef values coming into the PHI nodes.
 PHINode *SomePHI = 0;
 for (unsigned i = 0, e = PNs.size(); i != e; ++i)
   if (PNs[i]) {
-if (Value *V = PNs[i]-hasConstantValue(true)) {
-  if (!isaInstruction(V) ||
-  properlyDominates(castInstruction(V), PNs[i])) {
-if (AST  isaPointerType(PNs[i]-getType()))
-  AST-deleteValue(PNs[i]);
-PNs[i]-replaceAllUsesWith(V);
-PNs[i]-eraseFromParent();
-PNs[i] = 0;
-  }
-}
-if (PNs[i])
-  SomePHI = PNs[i];
+SomePHI = PNs[i];
+break;
   }
 
 // Only do work here if there the PHI nodes are missing incoming values.  
We



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h

2006-04-26 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.189 - 1.190
X86ISelLowering.h updated: 1.60 - 1.61
---
Log message:

- Clean up formal argument lowering code. Prepare for vector pass by value work.
- Fixed vararg support.


---
Diffs of the changes:  (+237 -215)

 X86ISelLowering.cpp |  427 ++--
 X86ISelLowering.h   |   25 ++-
 2 files changed, 237 insertions(+), 215 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.189 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.190
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.189   Wed Apr 26 13:21:31 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Apr 26 20:32:22 2006
@@ -366,12 +366,14 @@
   std::vectorSDOperand Args = TargetLowering::LowerArguments(F, DAG);
 
   FormalArgs.clear();
+  FormalArgLocs.clear();
+
   // This sets BytesToPopOnReturn, BytesCallerReserves, etc. which have to be 
set
   // before the rest of the function can be lowered.
   if (F.getCallingConv() == CallingConv::Fast  EnableFastCC)
-PreprocessFastCCArguments(Args[0], F, DAG);
+PreprocessFastCCArguments(Args, F, DAG);
   else
-PreprocessCCCArguments(Args[0], F, DAG);
+PreprocessCCCArguments(Args, F, DAG);
   return Args;
 }
 
@@ -400,28 +402,74 @@
 //C Calling Convention implementation
 
//===--===//
 
-void X86TargetLowering::PreprocessCCCArguments(SDOperand Op, Function F,
-   SelectionDAG DAG) {
-  unsigned NumArgs = Op.Val-getNumValues();
+static unsigned getFormalArgSize(MVT::ValueType ObjectVT) {
+  unsigned ObjSize = 0;
+  switch (ObjectVT) {
+  default: assert(0  Unhandled argument type!);
+  case MVT::i1:
+  case MVT::i8:  ObjSize = 1; break;
+  case MVT::i16: ObjSize = 2; break;
+  case MVT::i32: ObjSize = 4; break;
+  case MVT::i64: ObjSize = 8; break;
+  case MVT::f32: ObjSize = 4; break;
+  case MVT::f64: ObjSize = 8; break;
+  }
+  return ObjSize;
+}
+
+static std::vectorSDOperand getFormalArgObjects(SDOperand Op) {
+  unsigned Opc = Op.getOpcode();
+  std::vectorSDOperand Objs;
+  if (Opc == ISD::TRUNCATE) {
+Op = Op.getOperand(0);
+assert(Op.getOpcode() == ISD::AssertSext ||
+   Op.getOpcode() == ISD::AssertZext);
+Objs.push_back(Op.getOperand(0));
+  } else if (Opc == ISD::FP_ROUND) {
+Objs.push_back(Op.getOperand(0));
+  } else if (Opc == ISD::BUILD_PAIR) {
+Objs.push_back(Op.getOperand(0));
+Objs.push_back(Op.getOperand(1));
+  } else {
+Objs.push_back(Op);
+  }
+  return Objs;
+}
+
+void X86TargetLowering::PreprocessCCCArguments(std::vectorSDOperandArgs,
+   Function F, SelectionDAG DAG) 
{
+  unsigned NumArgs = Args.size();
   MachineFunction MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
 
+  // Add DAG nodes to load the arguments...  On entry to a function on the X86,
+  // the stack frame looks like this:
+  //
+  // [ESP] -- return address
+  // [ESP + 4] -- first argument (leftmost lexically)
+  // [ESP + 8] -- second argument, if first argument is four bytes in size
+  //...
+  //
   unsigned ArgOffset = 0;   // Frame mechanisms handle retaddr slot
   for (unsigned i = 0; i  NumArgs; ++i) {
-MVT::ValueType ObjectVT = Op.Val-getValueType(i);
-unsigned ArgIncrement = 4;
-unsigned ObjSize;
-switch (ObjectVT) {
-default: assert(0  Unhandled argument type!);
-case MVT::i1:
-case MVT::i8:  ObjSize = 1;break;
-case MVT::i16: ObjSize = 2;break;
-case MVT::i32: ObjSize = 4;break;
-case MVT::i64: ObjSize = ArgIncrement = 8; break;
-case MVT::f32: ObjSize = 4;break;
-case MVT::f64: ObjSize = ArgIncrement = 8; break;
+SDOperand Op = Args[i];
+std::vectorSDOperand Objs = getFormalArgObjects(Op);
+for (std::vectorSDOperand::iterator I = Objs.begin(), E = Objs.end();
+ I != E; ++I) {
+  SDOperand Obj = *I;
+  MVT::ValueType ObjectVT = Obj.getValueType();
+  unsigned ArgIncrement = 4;
+  unsigned ObjSize = getFormalArgSize(ObjectVT);
+  if (ObjSize == 8)
+ArgIncrement = 8;
+
+  // Create the frame index object for this incoming parameter...
+  int FI = MFI-CreateFixedObject(ObjSize, ArgOffset);
+  std::pairFALocInfo, FALocInfo Loc =
+std::make_pair(FALocInfo(FALocInfo::StackFrameLoc, FI), FALocInfo());
+  FormalArgLocs.push_back(Loc);
+  ArgOffset += ArgIncrement;   // Move on to the next argument...
 }
-ArgOffset += ArgIncrement;   // Move on to the next argument...
   }
 
   // If the function takes variable number of arguments, make a frame index for
@@ -438,39 +486,13 @@
   MachineFunction MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
 
-  // Add DAG 

[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll

2006-04-26 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/Generic:

2006-04-26-SetCCAnd.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+43 -0)

 2006-04-26-SetCCAnd.ll |   43 +++
 1 files changed, 43 insertions(+)


Index: llvm/test/Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll:1.1
*** /dev/null   Thu Apr 27 00:00:53 2006
--- llvm/test/Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll Thu Apr 27 
00:00:43 2006
***
*** 0 
--- 1,43 
+ ; RUN: llvm-as  %s | llc
+ ; PR748
+ 
+ %G = external global ushort   ; ushort* [#uses=1]
+ 
+ implementation   ; Functions:
+ 
+ void %OmNewObjHdr() {
+ entry:
+   br bool false, label %endif.4, label %then.0
+ 
+ then.0:   ; preds = %entry
+   ret void
+ 
+ endif.4:  ; preds = %entry
+   br bool false, label %else.3, label %shortcirc_next.3
+ 
+ shortcirc_next.3: ; preds = %endif.4
+   ret void
+ 
+ else.3:   ; preds = %endif.4
+   switch int 0, label %endif.10 [
+int 5001, label %then.10
+int -5008, label %then.10
+   ]
+ 
+ then.10:  ; preds = %else.3, %else.3
+   %tmp.112 = load ushort* null; ushort [#uses=2]
+   %tmp.113 = load ushort* %G  ; ushort [#uses=2]
+   %tmp.114 = setgt ushort %tmp.112, %tmp.113  ; bool 
[#uses=1]
+   %tmp.120 = setlt ushort %tmp.112, %tmp.113  ; bool 
[#uses=1]
+   %bothcond = and bool %tmp.114, %tmp.120 ; bool [#uses=1]
+   br bool %bothcond, label %else.4, label %then.11
+ 
+ then.11:  ; preds = %then.10
+   ret void
+ 
+ else.4:   ; preds = %then.10
+   ret void
+ 
+ endif.10: ; preds = %else.3
+   ret void
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

2006-04-26 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.302 - 1.303
---
Log message:

Fix Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll and
PR748: http://llvm.cs.uiuc.edu/PR748 .


---
Diffs of the changes:  (+29 -1)

 SelectionDAG.cpp |   30 +-
 1 files changed, 29 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.303
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302Sat Apr 22 
13:53:45 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Thu Apr 27 00:01:07 2006
@@ -232,7 +232,22 @@
 return ISD::SETCC_INVALID;
 
   // Combine all of the condition bits.
-  return ISD::CondCode(Op1  Op2);
+  ISD::CondCode Result = ISD::CondCode(Op1  Op2);
+  
+  // Canonicalize illegal integer setcc's.
+  if (isInteger) {
+switch (Result) {
+default: break;
+case ISD::SETUO:   // e.g. SETUGT  SETULT
+  Result = ISD::SETFALSE;
+  break;
+case ISD::SETUEQ:  // e.g. SETUGE  SETULE
+  Result = ISD::SETEQ;
+  break;
+}
+  }
+  
+  return Result;
 }
 
 const TargetMachine SelectionDAG::getTarget() const {
@@ -849,6 +864,19 @@
   case ISD::SETFALSE2: return getConstant(0, VT);
   case ISD::SETTRUE:
   case ISD::SETTRUE2:  return getConstant(1, VT);
+
+  case ISD::SETOEQ:
+  case ISD::SETOGT:
+  case ISD::SETOGE:
+  case ISD::SETOLT:
+  case ISD::SETOLE:
+  case ISD::SETONE:
+  case ISD::SETO:
+  case ISD::SETUO:
+  case ISD::SETUEQ:
+  case ISD::SETUNE:
+assert(!MVT::isInteger(N1.getValueType())  Illegal setcc for integer!);
+break;
   }
 
   if (ConstantSDNode *N2C = dyn_castConstantSDNode(N2.Val)) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2006-04-26 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.190 - 1.191
---
Log message:

Bug fix: not updating NumIntRegs.

---
Diffs of the changes:  (+65 -60)

 X86ISelLowering.cpp |  125 +++-
 1 files changed, 65 insertions(+), 60 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.190 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.191
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.190   Wed Apr 26 20:32:22 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Apr 27 00:35:28 2006
@@ -402,6 +402,19 @@
 //C Calling Convention implementation
 
//===--===//
 
+/// AddLiveIn - This helper function adds the specified physical register to 
the
+/// MachineFunction as a live in value.  It also creates a corresponding 
virtual
+/// register for it.
+static unsigned AddLiveIn(MachineFunction MF, unsigned PReg,
+  TargetRegisterClass *RC) {
+  assert(RC-contains(PReg)  Not the correct regclass!);
+  unsigned VReg = MF.getSSARegMap()-createVirtualRegister(RC);
+  MF.addLiveIn(PReg, VReg);
+  return VReg;
+}
+
+/// getFormalArgSize - Return the minimum size of the stack frame needed to 
store
+/// an object of the specified type.
 static unsigned getFormalArgSize(MVT::ValueType ObjectVT) {
   unsigned ObjSize = 0;
   switch (ObjectVT) {
@@ -417,6 +430,8 @@
   return ObjSize;
 }
 
+/// getFormalArgObjects - Returns itself if Op is a FORMAL_ARGUMENTS, otherwise
+/// returns the FORMAL_ARGUMENTS node(s) that made up parts of the node.
 static std::vectorSDOperand getFormalArgObjects(SDOperand Op) {
   unsigned Opc = Op.getOpcode();
   std::vectorSDOperand Objs;
@@ -706,17 +721,6 @@
 // (when we have a global fp allocator) and do other tricks.
 //
 
-/// AddLiveIn - This helper function adds the specified physical register to 
the
-/// MachineFunction as a live in value.  It also creates a corresponding 
virtual
-/// register for it.
-static unsigned AddLiveIn(MachineFunction MF, unsigned PReg,
-  TargetRegisterClass *RC) {
-  assert(RC-contains(PReg)  Not the correct regclass!);
-  unsigned VReg = MF.getSSARegMap()-createVirtualRegister(RC);
-  MF.addLiveIn(PReg, VReg);
-  return VReg;
-}
-
 // FASTCC_NUM_INT_ARGS_INREGS - This is the max number of integer arguments
 // to pass in registers.  0 is none, 1 is is use EAX, 2 is use EAX and
 // EDX.  Anything more is illegal.
@@ -738,8 +742,8 @@
 
 
 static void
-DetermineFastCCFormalArgSizeNumRegs(MVT::ValueType ObjectVT,
-unsigned ObjSize, unsigned NumIntRegs) {
+HowToPassFastCCArgument(MVT::ValueType ObjectVT, unsigned NumIntRegs,
+unsigned ObjSize, unsigned ObjIntRegs) {
   ObjSize = 0;
   NumIntRegs = 0;
 
@@ -748,27 +752,27 @@
   case MVT::i1:
   case MVT::i8:
 if (NumIntRegs  FASTCC_NUM_INT_ARGS_INREGS)
-  NumIntRegs = 1;
+  ObjIntRegs = 1;
 else
   ObjSize = 1;
 break;
   case MVT::i16:
 if (NumIntRegs  FASTCC_NUM_INT_ARGS_INREGS)
-  NumIntRegs = 1;
+  ObjIntRegs = 1;
 else
   ObjSize = 2;
 break;
   case MVT::i32:
 if (NumIntRegs  FASTCC_NUM_INT_ARGS_INREGS)
-  NumIntRegs = 1;
+  ObjIntRegs = 1;
 else
   ObjSize = 4;
 break;
   case MVT::i64:
 if (NumIntRegs+2 = FASTCC_NUM_INT_ARGS_INREGS) {
-  NumIntRegs = 2;
+  ObjIntRegs = 2;
 } else if (NumIntRegs+1 = FASTCC_NUM_INT_ARGS_INREGS) {
-  NumIntRegs = 1;
+  ObjIntRegs = 1;
   ObjSize = 4;
 } else
   ObjSize = 8;
@@ -811,58 +815,59 @@
   MVT::ValueType ObjectVT = Obj.getValueType();
   unsigned ArgIncrement = 4;
   unsigned ObjSize = 0;
-  unsigned NumRegs = 0;
+  unsigned ObjIntRegs = 0;
 
-  DetermineFastCCFormalArgSizeNumRegs(ObjectVT, ObjSize, NumRegs);
+  HowToPassFastCCArgument(ObjectVT, NumIntRegs, ObjSize, ObjIntRegs);
   if (ObjSize == 8)
 ArgIncrement = 8;
 
   unsigned Reg;
   std::pairFALocInfo,FALocInfo Loc = std::make_pair(FALocInfo(),
   FALocInfo());
-  if (NumRegs) {
-   switch (ObjectVT) {
-   default: assert(0  Unhandled argument type!);
-   case MVT::i1:
-   case MVT::i8:
- Reg = AddLiveIn(MF, NumIntRegs ? X86::DL : X86::AL,
- X86::R8RegisterClass);
- Loc.first.Kind = FALocInfo::LiveInRegLoc;
- Loc.first.Loc = Reg;
- Loc.first.Typ = MVT::i8;
- break;
-   case MVT::i16:
- Reg = AddLiveIn(MF, NumIntRegs ? X86::DX : X86::AX,
- X86::R16RegisterClass);
- Loc.first.Kind = FALocInfo::LiveInRegLoc;
- Loc.first.Loc = Reg;
- Loc.first.Typ = MVT::i16;
- break;
-   case MVT::i32:
- Reg = AddLiveIn(MF, NumIntRegs ? 

[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2006-04-26 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.191 - 1.192
---
Log message:

Oops

---
Diffs of the changes:  (+1 -1)

 X86ISelLowering.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.191 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.192
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.191   Thu Apr 27 00:35:28 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Apr 27 00:44:50 2006
@@ -825,7 +825,6 @@
   std::pairFALocInfo,FALocInfo Loc = std::make_pair(FALocInfo(),
   FALocInfo());
   if (ObjIntRegs) {
-NumIntRegs += ObjIntRegs;
 switch (ObjectVT) {
 default: assert(0  Unhandled argument type!);
 case MVT::i1:
@@ -864,6 +863,7 @@
   }
   break;
 }
+NumIntRegs += ObjIntRegs;
   }
   if (ObjSize) {
 int FI = MFI-CreateFixedObject(ObjSize, ArgOffset);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits