[llvm-commits] CVS: llvm/test/AdaFrontend/

2007-03-05 Thread LLVM


Changes in directory llvm/test/AdaFrontend:

---
Log message:

Directory /var/cvs/llvm/llvm/test/AdaFrontend added to the repository


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/AdaFrontend/non_lvalue.adb non_lvalue.ads

2007-03-05 Thread Duncan Sands


Changes in directory llvm/test/AdaFrontend:

non_lvalue.adb added (r1.1)
non_lvalue.ads added (r1.1)
---
Log message:

New directory for Ada testcases.  Test handling of NON_LVALUE_EXPR.


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

 non_lvalue.adb |7 +++
 non_lvalue.ads |   11 +++
 2 files changed, 18 insertions(+)


Index: llvm/test/AdaFrontend/non_lvalue.adb
diff -c /dev/null llvm/test/AdaFrontend/non_lvalue.adb:1.1
*** /dev/null   Mon Mar  5 02:20:58 2007
--- llvm/test/AdaFrontend/non_lvalue.adbMon Mar  5 02:20:48 2007
***
*** 0 
--- 1,7 
+ -- RUN: %llvmgcc -c %s -o /dev/null
+ package body Non_LValue is
+function A (Y : U) return String is
+begin
+   return Y.X.B;
+end;
+ end;


Index: llvm/test/AdaFrontend/non_lvalue.ads
diff -c /dev/null llvm/test/AdaFrontend/non_lvalue.ads:1.1
*** /dev/null   Mon Mar  5 02:21:05 2007
--- llvm/test/AdaFrontend/non_lvalue.adsMon Mar  5 02:20:48 2007
***
*** 0 
--- 1,11 
+ package Non_LValue is
+type T (Length : Natural) is record
+   A : String (1 .. Length);
+   B : String (1 .. Length);
+end record;
+type T_Ptr is access all T;
+type U is record
+   X : T_Ptr;
+end record;
+function A (Y : U) return String;
+ end;



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


[llvm-commits] CVS: llvm/test/AdaFrontend/fat_fields.adb fat_fields.ads

2007-03-05 Thread Duncan Sands


Changes in directory llvm/test/AdaFrontend:

fat_fields.adb added (r1.1)
fat_fields.ads added (r1.1)
---
Log message:

Testcase causing the Ada front-end to create bogus constructor fields.


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

 fat_fields.adb |   10 ++
 fat_fields.ads |6 ++
 2 files changed, 16 insertions(+)


Index: llvm/test/AdaFrontend/fat_fields.adb
diff -c /dev/null llvm/test/AdaFrontend/fat_fields.adb:1.1
*** /dev/null   Mon Mar  5 02:34:45 2007
--- llvm/test/AdaFrontend/fat_fields.adbMon Mar  5 02:34:35 2007
***
*** 0 
--- 1,10 
+ -- RUN: %llvmgcc -c %s -o /dev/null
+ -- RUN: %llvmgcc -c %s -O2 -o /dev/null
+ package body Fat_Fields is
+procedure Proc is
+begin
+   if P = null then
+  null;
+   end if;
+end;
+ end;


Index: llvm/test/AdaFrontend/fat_fields.ads
diff -c /dev/null llvm/test/AdaFrontend/fat_fields.ads:1.1
*** /dev/null   Mon Mar  5 02:34:52 2007
--- llvm/test/AdaFrontend/fat_fields.adsMon Mar  5 02:34:35 2007
***
*** 0 
--- 1,6 
+ package Fat_Fields is
+pragma Elaborate_Body;
+type A is array (Positive range ) of Boolean;
+type A_Ptr is access A;
+P : A_Ptr := null;
+ end;



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


[llvm-commits] CVS: llvm/test/AdaFrontend/emit_var.ads

2007-03-05 Thread Duncan Sands


Changes in directory llvm/test/AdaFrontend:

emit_var.ads added (r1.1)
---
Log message:

Testcase for handling of static constant declarations in EmitBIND_EXPR.


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

 emit_var.ads |5 +
 1 files changed, 5 insertions(+)


Index: llvm/test/AdaFrontend/emit_var.ads
diff -c /dev/null llvm/test/AdaFrontend/emit_var.ads:1.1
*** /dev/null   Mon Mar  5 02:40:08 2007
--- llvm/test/AdaFrontend/emit_var.ads  Mon Mar  5 02:39:58 2007
***
*** 0 
--- 1,5 
+ -- RUN: %llvmgcc -c %s -o /dev/null
+ with Ada.Finalization;
+ package Emit_Var is
+type Search_Type is new Ada.Finalization.Controlled with null record;
+ end;



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


Re: [llvm-commits] llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp

2007-03-05 Thread Nicolas Geoffray
Chris Lattner wrote:

 Ok, so it's not related to NoFramePointerElim?  If that's the case, 
 you should just have Macho and ELF return different sets of callee 
 saved regs.

No, that's not the issue.

Let me rephrase why I need this patch :)

In PowerPC, whether it's on ELF ABI or MachO, R31 is a normal, 
callee-saved register. With one exception: when it is used as a frame 
pointer. When it is used as a frame pointer, both MachO and ELF remove 
R31 from the callee-saved registers set.

There are two different ways to use R31 as a frame pointer: 1) with an 
alloca when the stack is growing in a non-compilation deterministic 
size, or 2) when NoFramePointerElim is set.

1) When there is an alloca that modifies the size of the stack, 
compilation goes through the LowerDYNAMIC_STACKALLOC method. In this 
method, you find the code:


// Find out what the fix offset of the frame pointer save area.
int FPOffset = PPCFrameInfo::getFramePointerSaveOffset(IsPPC64, 
isMachoABI);
// Allocate the frame index for frame pointer save area.
FPSI = MF.getFrameInfo()-CreateFixedObject(IsPPC64? 8 : 4, FPOffset);
// Save the result.
FI-setFramePointerSaveIndex(FPSI);

With this code you give the info to the FrameInfo object that the frame 
pointer offset is at FPOffset. Therefore, this offset will never be used 
as an offset for another purpose. And this is _really_ important for 
ELF, because the frame pointer, R31, is saved in the callee-saved area. 
With this code, you are sure that no callee-saved register will be 
spilled to R31's offset.


2) When NoFramePointerElim is set, R31 is always used as a frame 
pointer. However, the stack size may be decided at a compilation time, 
therefore the compilation process never goes through the 
LowerDYNAMIC_STACKALLOC. And LowerDYNAMIC_STACKALLOC is the only method 
that saves the frame pointer offset in the frame info.
The bug arrives here: the frame info object never had the info that R31 
is saved in the callee-saved area. Therefore, it may allocate the frame 
pointer offset for spilling an other register. This was not an issue for 
the MachO ABI because the frame pointer offset in MachO is not in the 
callee-saved area.

With this patch I give the info to the FrameInfo object, before the 
callee-saved scan, that R31 is saved in the callee-saved area. Thus I am 
sure that no register will be spilled in R31's offset.


I hope it's clearer now (maybe it already was, but I was getting 
confused by your replies :))

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


[llvm-commits] CVS: llvm/CREDITS.TXT

2007-03-05 Thread Duncan Sands


Changes in directory llvm:

CREDITS.TXT updated: 1.70 - 1.71
---
Log message:

Credit self for Ada front-end.


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

 CREDITS.TXT |4 
 1 files changed, 4 insertions(+)


Index: llvm/CREDITS.TXT
diff -u llvm/CREDITS.TXT:1.70 llvm/CREDITS.TXT:1.71
--- llvm/CREDITS.TXT:1.70   Tue Feb 27 04:44:42 2007
+++ llvm/CREDITS.TXTMon Mar  5 03:21:11 2007
@@ -169,6 +169,10 @@
 E: [EMAIL PROTECTED]
 D: Made inst_iterator behave like a proper iterator, LowerConstantExprs pass
 
+N: Duncan Sands
+E: [EMAIL PROTECTED]
+D: Ada front-end
+
 N: Ruchira Sasanka
 E: [EMAIL PROTECTED]
 D: Graph coloring register allocator for the Sparc64 backend



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


[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h

2007-03-05 Thread Zhou Sheng


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.39 - 1.40
---
Log message:

Correct the calculation in APInt::logBase2().


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

 APInt.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.39 llvm/include/llvm/ADT/APInt.h:1.40
--- llvm/include/llvm/ADT/APInt.h:1.39  Sat Mar  3 02:34:02 2007
+++ llvm/include/llvm/ADT/APInt.h   Mon Mar  5 10:42:58 2007
@@ -697,7 +697,7 @@
 
   /// @returns the floor log base 2 of this APInt.
   inline uint32_t logBase2() const {
-return getNumWords() * APINT_BITS_PER_WORD - 1 - countLeadingZeros();
+return BitWidth - 1 - countLeadingZeros();
   }
 
   /// @brief Converts this APInt to a double value.



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp

2007-03-05 Thread Lauro Ramos Venancio


Changes in directory llvm/lib/Target/ARM:

ARMTargetAsmInfo.cpp updated: 1.11 - 1.12
---
Log message:

Use init_array/fini_array sections for static contructors/destructors when the 
ABI is AAPCS.
Fix SingleSource/Regression/C/ConstructorDestructorAttributes test on 
arm-linux-gnueabi.



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

 ARMTargetAsmInfo.cpp |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
diff -u llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.11 
llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.12
--- llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.11   Thu Feb  1 15:43:53 2007
+++ llvm/lib/Target/ARM/ARMTargetAsmInfo.cppMon Mar  5 11:59:58 2007
@@ -58,8 +58,13 @@
   } else {
 PrivateGlobalPrefix = .L;
 WeakRefDirective = \t.weak\t;
-StaticCtorsSection = \t.section .ctors,\aw\,%progbits;
-StaticDtorsSection = \t.section .dtors,\aw\,%progbits;
+if (Subtarget-isAAPCS_ABI()) {
+  StaticCtorsSection = \t.section .init_array,\aw\,%init_array;
+  StaticDtorsSection = \t.section .fini_array,\aw\,%fini_array;
+} else {
+  StaticCtorsSection = \t.section .ctors,\aw\,%progbits;
+  StaticDtorsSection = \t.section .dtors,\aw\,%progbits;
+}
   }
 
   ZeroDirective = \t.space\t;



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


[llvm-commits] CVS: llvm/test/CodeGen/ARM/ctors_dtors.ll

2007-03-05 Thread Lauro Ramos Venancio


Changes in directory llvm/test/CodeGen/ARM:

ctors_dtors.ll updated: 1.2 - 1.3
---
Log message:

Use init_array/fini_array sections for static contructors/destructors when the 
ABI is AAPCS.
Fix SingleSource/Regression/C/ConstructorDestructorAttributes test on 
arm-linux-gnueabi.



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

 ctors_dtors.ll |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/test/CodeGen/ARM/ctors_dtors.ll
diff -u llvm/test/CodeGen/ARM/ctors_dtors.ll:1.2 
llvm/test/CodeGen/ARM/ctors_dtors.ll:1.3
--- llvm/test/CodeGen/ARM/ctors_dtors.ll:1.2Fri Jan 19 03:20:23 2007
+++ llvm/test/CodeGen/ARM/ctors_dtors.llMon Mar  5 11:59:58 2007
@@ -1,8 +1,10 @@
 ; RUN: llvm-upgrade  %s | llvm-as | llc -march=arm 
 ; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-apple-darwin | grep 
'\.mod_init_func' 
 ; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-apple-darwin | grep 
'\.mod_term_func' 
-; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux | grep '\.section 
\.ctors,aw,.progbits' 
-; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux | grep '\.section 
\.dtors,aw,.progbits'
+; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux-gnu | grep 
'\.section \.ctors,aw,.progbits' 
+; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux-gnu | grep 
'\.section \.dtors,aw,.progbits' 
+; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux-gnueabi | grep 
'\.section \.init_array,aw,.init_array' 
+; RUN: llvm-upgrade  %s | llvm-as | llc -mtriple=arm-linux-gnueabi  | grep 
'\.section \.fini_array,aw,.fini_array'
 
 %llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int, void 
()* } { int 65535, void ()* %__mf_init } ] ; [1 x { int, void ()* }]* 
[#uses=0]
 %llvm.global_dtors = appending global [1 x { int, void ()* }] [ { int, void 
()* } { int 65535, void ()* %__mf_fini } ] ; [1 x { int, void ()* }]* 
[#uses=0]



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


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.139 - 1.140
---
Log message:

Account for time consumed by releaseMemory() properly.


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

 PassManager.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.139 
llvm/lib/VMCore/PassManager.cpp:1.140
--- llvm/lib/VMCore/PassManager.cpp:1.139   Sun Mar  4 18:00:42 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Mar  5 12:20:51 2007
@@ -564,9 +564,9 @@
 std::string Msg1 =   Freeing Pass ';
 dumpPassInfo(*I, Msg1, Msg);
 
-if (TheTimeInfo) TheTimeInfo-passStarted(P);
+if (TheTimeInfo) TheTimeInfo-passStarted(*I);
 (*I)-releaseMemory();
-if (TheTimeInfo) TheTimeInfo-passEnded(P);
+if (TheTimeInfo) TheTimeInfo-passEnded(*I);
 
 std::mapAnalysisID, Pass*::iterator Pos = 
   AvailableAnalysis.find((*I)-getPassInfo());



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


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

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/Analysis/IPA:

CallGraphSCCPass.cpp updated: 1.19 - 1.20
---
Log message:

Avoid constructing std::strings unless pass debugging is ON.


---
Diffs of the changes:  (+5 -10)

 CallGraphSCCPass.cpp |   15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)


Index: llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp
diff -u llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.19 
llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.20
--- llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.19 Tue Feb 27 09:00:39 2007
+++ llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp  Mon Mar  5 14:01:30 2007
@@ -77,9 +77,6 @@
   CallGraph CG = getAnalysisCallGraph();
   bool Changed = doInitialization(CG);
 
-  std::string Msg1 = Executing Pass ';
-  std::string Msg3 = ' Made Modification ';
-
   // Walk SCC
   for (scc_iteratorCallGraph* I = scc_begin(CG), E = scc_end(CG);
I != E; ++I) {
@@ -91,8 +88,7 @@
   AnalysisUsage AnUsage;
   P-getAnalysisUsage(AnUsage);
 
-  std::string Msg2 = ' on Call Graph ...\n';
-  dumpPassInfo(P, Msg1, Msg2);
+  dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, );
   dumpAnalysisSetInfo(Required, P, AnUsage.getRequiredSet());
 
   initializeAnalysisImpl(P);
@@ -109,21 +105,20 @@
for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
  Function *F = SCC[i]-getFunction();
  if (F) {
-std::string Msg4 = ' on Function ' + F-getName() + '...\n;
-dumpPassInfo(P, Msg1, Msg4);
-   Changed |= FPP-runOnFunction(*F);
+dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F-getName());
+Changed |= FPP-runOnFunction(*F);
   }
}
   }
   StopPassTimer(P);
 
   if (Changed)
-   dumpPassInfo(P, Msg3, Msg2);
+dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, );
   dumpAnalysisSetInfo(Preserved, P, AnUsage.getPreservedSet());
   
   removeNotPreservedAnalysis(P);
   recordAvailableAnalysis(P);
-  removeDeadPasses(P, Msg2);
+  removeDeadPasses(P, , ON_CG_MSG);
 }
   }
   Changed |= doFinalization(CG);



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


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.140 - 1.141
---
Log message:

Avoid constructing std::strings unless pass debugging is ON.


---
Diffs of the changes:  (+52 -32)

 PassManager.cpp |   84 ++--
 1 files changed, 52 insertions(+), 32 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.140 
llvm/lib/VMCore/PassManager.cpp:1.141
--- llvm/lib/VMCore/PassManager.cpp:1.140   Mon Mar  5 12:20:51 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Mar  5 14:01:30 2007
@@ -553,7 +553,8 @@
 }
 
 /// Remove analysis passes that are not used any longer
-void PMDataManager::removeDeadPasses(Pass *P, std::string Msg) {
+void PMDataManager::removeDeadPasses(Pass *P, std::string Msg,
+ enum PassDebuggingString DBG_STR) {
 
   std::vectorPass * DeadPasses;
   TPM-collectLastUses(DeadPasses, P);
@@ -561,8 +562,7 @@
   for (std::vectorPass *::iterator I = DeadPasses.begin(),
  E = DeadPasses.end(); I != E; ++I) {
 
-std::string Msg1 =   Freeing Pass ';
-dumpPassInfo(*I, Msg1, Msg);
+dumpPassInfo(*I, FREEING_MSG, DBG_STR, Msg);
 
 if (TheTimeInfo) TheTimeInfo-passStarted(*I);
 (*I)-releaseMemory();
@@ -720,14 +720,44 @@
   }
 }
 
-void PMDataManager:: dumpPassInfo(Pass *P,  std::string Msg1, 
-  std::string Msg2) const {
+void PMDataManager:: dumpPassInfo(Pass *P, enum PassDebuggingString S1,
+  enum PassDebuggingString S2,
+  std::string Msg) {
   if (PassDebugging  Executions)
 return;
   cerr  (void*)this  std::string(getDepth()*2+1, ' ');
-  cerr  Msg1;
-  cerr  P-getPassName();
-  cerr  Msg2;
+  switch (S1) {
+  case EXECUTION_MSG:
+cerr  Executing Pass '  P-getPassName();
+break;
+  case MODIFICATION_MSG:
+cerr  ' Made Modification '  P-getPassName();
+break;
+  case FREEING_MSG:
+cerr   Freeing Pass '  P-getPassName();
+break;
+  default:
+break;
+  }
+  switch (S2) {
+  case ON_BASICBLOCK_MSG:
+cerr  ' on BasicBlock '  Msg  ...\n;
+break;
+  case ON_FUNCTION_MSG:
+cerr  ' on Function '  Msg  ...\n;
+break;
+  case ON_MODULE_MSG:
+cerr  ' on Module '   Msg  ...\n;
+break;
+  case ON_LOOP_MSG:
+cerr  ' on Loop   Msg  ...\n;
+break;
+  case ON_CG_MSG:
+cerr  ' on Call Graph   Msg  ...\n;
+break;
+  default:
+break;
+  }
 }
 
 void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P,
@@ -774,17 +804,13 @@
 
   bool Changed = doInitialization(F);
 
-  std::string Msg1 = Executing Pass ';
-  std::string Msg3 = ' Made Modification ';
-
   for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
 for (unsigned Index = 0; Index  getNumContainedPasses(); ++Index) {
   BasicBlockPass *BP = getContainedPass(Index);
   AnalysisUsage AnUsage;
   BP-getAnalysisUsage(AnUsage);
 
-  std::string Msg2 = ' on BasicBlock ' + (*I).getName() + '...\n;
-  dumpPassInfo(BP, Msg1, Msg2);
+  dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, (*I).getName());
   dumpAnalysisSetInfo(Required, BP, AnUsage.getRequiredSet());
 
   initializeAnalysisImpl(BP);
@@ -793,13 +819,14 @@
   Changed |= BP-runOnBasicBlock(*I);
   if (TheTimeInfo) TheTimeInfo-passEnded(BP);
 
-  if (Changed)
-dumpPassInfo(BP, Msg3, Msg2);
+  if (Changed) 
+dumpPassInfo(BP, MODIFICATION_MSG, ON_BASICBLOCK_MSG, (*I).getName());
   dumpAnalysisSetInfo(Preserved, BP, AnUsage.getPreservedSet());
 
   removeNotPreservedAnalysis(BP);
   recordAvailableAnalysis(BP);
-  removeDeadPasses(BP, Msg2);
+  removeDeadPasses(BP, (*I).getName(), ON_BASICBLOCK_MSG);
+   
 }
   return Changed |= doFinalization(F);
 }
@@ -973,17 +1000,13 @@
   if (F.isDeclaration())
 return false;
 
-  std::string Msg1 = Executing Pass ';
-  std::string Msg3 = ' Made Modification ';
-
   for (unsigned Index = 0; Index  getNumContainedPasses(); ++Index) {
 FunctionPass *FP = getContainedPass(Index);
 
 AnalysisUsage AnUsage;
 FP-getAnalysisUsage(AnUsage);
 
-std::string Msg2 = ' on Function ' + F.getName() + '...\n;
-dumpPassInfo(FP, Msg1, Msg2);
+dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
 dumpAnalysisSetInfo(Required, FP, AnUsage.getRequiredSet());
 
 initializeAnalysisImpl(FP);
@@ -992,13 +1015,13 @@
 Changed |= FP-runOnFunction(F);
 if (TheTimeInfo) TheTimeInfo-passEnded(FP);
 
-if (Changed)
-  dumpPassInfo(FP, Msg3, Msg2);
+if (Changed) 
+  dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getName());
 dumpAnalysisSetInfo(Preserved, FP, AnUsage.getPreservedSet());
 
 removeNotPreservedAnalysis(FP);
 recordAvailableAnalysis(FP);
-removeDeadPasses(FP, Msg2);
+removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
   return 

[llvm-commits] CVS: llvm/include/llvm/PassManagers.h

2007-03-05 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManagers.h updated: 1.10 - 1.11
---
Log message:

Avoid constructing std::strings unless pass debugging is ON.


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

 PassManagers.h |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.10 
llvm/include/llvm/PassManagers.h:1.11
--- llvm/include/llvm/PassManagers.h:1.10   Tue Feb 27 09:00:39 2007
+++ llvm/include/llvm/PassManagers.hMon Mar  5 14:01:30 2007
@@ -93,6 +93,18 @@
   TLM_Pass   // PassManager
 };
 
+// enums for debugging strings
+enum PassDebuggingString {
+  EXECUTION_MSG, // Executing Pass '
+  MODIFICATION_MSG, // ' Made Modification '
+  FREEING_MSG, //  Freeing Pass '
+  ON_BASICBLOCK_MSG, // '  on BasicBlock ' + PassName + '...\n
+  ON_FUNCTION_MSG, // ' on Function ' + FunctionName + '...\n
+  ON_MODULE_MSG, // ' on Module ' + ModuleName + '...\n
+  ON_LOOP_MSG, //  'on Loop ...\n'
+  ON_CG_MSG // ' on Call Graph ...\n'
+};  
+
 
//===--===//
 // PMTopLevelManager
 //
@@ -202,7 +214,7 @@
   void removeNotPreservedAnalysis(Pass *P);
   
   /// Remove dead passes
-  void removeDeadPasses(Pass *P, std::string Msg);
+  void removeDeadPasses(Pass *P, std::string Msg, enum PassDebuggingString);
 
   /// Add pass P into the PassVector. Update 
   /// AvailableAnalysis appropriately if ProcessAnalysis is true.
@@ -238,7 +250,8 @@
   // Print routines used by debug-pass
   void dumpLastUses(Pass *P, unsigned Offset) const;
   void dumpPassArguments() const;
-  void dumpPassInfo(Pass *P,  std::string Msg1, std::string Msg2) const;
+  void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
+enum PassDebuggingString S2, std::string Msg);
   void dumpAnalysisSetInfo(const char *Msg, Pass *P,
const std::vectorAnalysisID Set) const;
 



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


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

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/Analysis:

LoopPass.cpp updated: 1.8 - 1.9
---
Log message:

Avoid constructing std::strings unless pass debugging is ON.


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

 LoopPass.cpp |   10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)


Index: llvm/lib/Analysis/LoopPass.cpp
diff -u llvm/lib/Analysis/LoopPass.cpp:1.8 llvm/lib/Analysis/LoopPass.cpp:1.9
--- llvm/lib/Analysis/LoopPass.cpp:1.8  Fri Feb 23 12:05:55 2007
+++ llvm/lib/Analysis/LoopPass.cpp  Mon Mar  5 14:01:30 2007
@@ -91,9 +91,6 @@
   for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
 addLoopIntoQueue(*I, LQ);
 
-  std::string Msg1 = Executing Pass ';
-  std::string Msg3 = ' Made Modification ';
-
   // Walk Loops
   while (!LQ-empty()) {
   
@@ -108,8 +105,7 @@
   AnalysisUsage AnUsage;
   P-getAnalysisUsage(AnUsage);
 
-  std::string Msg2 = ' on Loop ...\n';
-  dumpPassInfo(P, Msg1, Msg2);
+  dumpPassInfo(P, EXECUTION_MSG, ON_LOOP_MSG, );
   dumpAnalysisSetInfo(Required, P, AnUsage.getRequiredSet());
 
   initializeAnalysisImpl(P);
@@ -121,12 +117,12 @@
   StopPassTimer(P);
 
   if (Changed)
-   dumpPassInfo(P, Msg3, Msg2);
+dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG, );
   dumpAnalysisSetInfo(Preserved, P, AnUsage.getPreservedSet());
   
   removeNotPreservedAnalysis(P);
   recordAvailableAnalysis(P);
-  removeDeadPasses(P, Msg2);
+  removeDeadPasses(P, , ON_LOOP_MSG);
 
   if (skipThisLoop)
 // Do not run other passes on this loop.



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


[llvm-commits] CVS: llvm-test/SingleSource/Regression/C/casts.c

2007-03-05 Thread Lauro Ramos Venancio


Changes in directory llvm-test/SingleSource/Regression/C:

casts.c updated: 1.5 - 1.6
---
Log message:

Fix test bug: int64_t isn't the same thing that long


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

 casts.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-test/SingleSource/Regression/C/casts.c
diff -u llvm-test/SingleSource/Regression/C/casts.c:1.5 
llvm-test/SingleSource/Regression/C/casts.c:1.6
--- llvm-test/SingleSource/Regression/C/casts.c:1.5 Sat Nov 11 08:31:54 2006
+++ llvm-test/SingleSource/Regression/C/casts.c Mon Mar  5 14:28:30 2007
@@ -23,8 +23,8 @@
   int   i1, i;
   unsigned  ui1;
 
-  int64_t   L, l1;
-  uint64_t  ul1;
+  long  L, l1;
+  unsigned long ul1;
 
   float F;
   doubleD;



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


[llvm-commits] Bug In InstCombine?

2007-03-05 Thread Reid Spencer
Chris,

While reviewing some of Sheng's patches, I think I found an existing bug
in InstCombine. Please review this and if its okay I'll commit the
patch:

Index: InstructionCombining.cpp
===
RCS
file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/InstructionCombining.cpp,v
retrieving revision 1.647
diff -t -d -u -p -5 -r1.647 InstructionCombining.cpp
--- InstructionCombining.cpp5 Mar 2007 00:11:19 -   1.647
+++ InstructionCombining.cpp5 Mar 2007 21:37:17 -
@@ -2408,11 +2408,11 @@ Instruction *InstCombiner::visitUDiv(Bin
   // udiv X, (Select Cond, C1, C2) -- Select Cond, (shr X, C1), (shr
X, C2)
   // where C1C2 are powers of two.
   if (SelectInst *SI = dyn_castSelectInst(Op1)) {
 if (ConstantInt *STO = dyn_castConstantInt(SI-getOperand(1)))
   if (ConstantInt *SFO = dyn_castConstantInt(SI-getOperand(2)))
-if (!STO-isNullValue()  !STO-isNullValue()) {
+if (!STO-isZero()  !SFO-isZero()) {

While I've changed it to use the less expensive isZero, the real bug is
that this is testing X  X. That is, the second term should check SF0
against zero, not ST0. I can't think of any reason why testing ST0 twice
would be correct.

   uint64_t TVA = STO-getZExtValue(), FVA =
SFO-getZExtValue();
   if (isPowerOf2_64(TVA)  isPowerOf2_64(FVA)) {
 // Compute the shift amounts
 unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA);
 // Construct the on true case of the select


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


[llvm-commits] [124571] While reading PCH, Parse Bytecodes directly from memory.

2007-03-05 Thread dpatel
Revision: 124571
Author:   dpatel
Date: 2007-03-05 14:40:18 -0800 (Mon, 05 Mar 2007)

Log Message:
---
While reading PCH, Parse Bytecodes directly from memory.

Modified Paths:
--
apple-local/branches/llvm/gcc/c-pch.c
apple-local/branches/llvm/gcc/llvm-backend.cpp
apple-local/branches/llvm/gcc/llvm.h

Modified: apple-local/branches/llvm/gcc/c-pch.c
===
--- apple-local/branches/llvm/gcc/c-pch.c   2007-03-05 11:35:52 UTC (rev 
124570)
+++ apple-local/branches/llvm/gcc/c-pch.c   2007-03-05 22:40:18 UTC (rev 
124571)
@@ -415,6 +415,13 @@
 
   if (!flag_preprocess_only)
 {
+  /* APPLE LOCAL begin LLVM */
+#ifdef ENABLE_LLVM
+  unsigned char *buf = xmalloc (h.asm_size);
+  if (fread (buf, h.asm_size, 1, f) != 1)
+cpp_errno (pfile, CPP_DL_ERROR, reading);
+  llvm_pch_read(buf, h.asm_size);
+#else
   unsigned long written;
   char * buf = xmalloc (16384);
 
@@ -428,13 +435,9 @@
cpp_errno (pfile, CPP_DL_ERROR, reading);
  written += size;
}
+#endif
+  /* APPLE LOCAL end LLVM */
   free (buf);
-  /* APPLE LOCAL begin LLVM */
-#ifdef ENABLE_LLVM
-  llvm_pch_read();
-#endif
-  /* APPLE LOCAL end LLVM */
-
 }
   else
 {

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-03-05 11:35:52 UTC 
(rev 124570)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-03-05 22:40:18 UTC 
(rev 124571)
@@ -189,16 +189,16 @@
 
 /// Read bytecode from PCH file. Initialize TheModue and setup
 /// LTypes vector.
-void llvm_pch_read(void) {
+void llvm_pch_read(const unsigned char *Buffer, unsigned Size) {
 
+  std::string ModuleName = TheModule-getModuleIdentifier();
   if (TheModule)
 delete TheModule;
 
-  fclose (asm_out_file);
-  
-  std::string ErrMsg;
   clearTargetBuiltinCache();
-  TheModule = ParseBytecodeFile(asm_file_name,
+
+  std::string ErrMsg;
+  TheModule = ParseBytecodeBuffer(Buffer, Size, ModuleName,
 Compressor::decompressToNewBuffer,
 ErrMsg);
   if (!TheModule) {
@@ -207,12 +207,6 @@
 exit(1);
   }
 
-  // Reopen asm_out_file for the rest of the compiler's use.
-  // This also removes llvm byte code from the asm_out_file.
-  asm_out_file = fopen (asm_file_name, w+b);
-  if (asm_out_file == 0)
-fatal_error (can%'t open %s for writing: %m, asm_file_name);
-
   // Read LLVM Types string table
   readLLVMTypesStringTable();
   readLLVMValuesStringTable();

Modified: apple-local/branches/llvm/gcc/llvm.h
===
--- apple-local/branches/llvm/gcc/llvm.h2007-03-05 11:35:52 UTC (rev 
124570)
+++ apple-local/branches/llvm/gcc/llvm.h2007-03-05 22:40:18 UTC (rev 
124571)
@@ -89,7 +89,7 @@
 void llvm_pch_write_init(void);
 
 /* Read bytecodes from PCH file.  */
-void llvm_pch_read(void);
+void llvm_pch_read(const unsigned char *, unsigned);
 
 /* llvm_asm_file_start - Start the .s file. */
 void llvm_asm_file_start(void);


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


Re: [llvm-commits] Bug In InstCombine?

2007-03-05 Thread Chris Lattner

On Mar 5, 2007, at 1:39 PM, Reid Spencer wrote:

 Chris,

 While reviewing some of Sheng's patches, I think I found an  
 existing bug
 in InstCombine. Please review this and if its okay I'll commit the
 patch:

 Index: InstructionCombining.cpp
 ===
 RCS
 file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/ 
 InstructionCombining.cpp,v
 retrieving revision 1.647
 diff -t -d -u -p -5 -r1.647 InstructionCombining.cpp
 --- InstructionCombining.cpp5 Mar 2007 00:11:19 -   1.647
 +++ InstructionCombining.cpp5 Mar 2007 21:37:17 -
 @@ -2408,11 +2408,11 @@ Instruction *InstCombiner::visitUDiv(Bin
// udiv X, (Select Cond, C1, C2) -- Select Cond, (shr X, C1), (shr
 X, C2)
// where C1C2 are powers of two.
if (SelectInst *SI = dyn_castSelectInst(Op1)) {
  if (ConstantInt *STO = dyn_castConstantInt(SI-getOperand(1)))
if (ConstantInt *SFO = dyn_castConstantInt(SI-getOperand 
 (2)))
 -if (!STO-isNullValue()  !STO-isNullValue()) {
 +if (!STO-isZero()  !SFO-isZero()) {

 While I've changed it to use the less expensive isZero, the real  
 bug is
 that this is testing X  X. That is, the second term should check SF0
 against zero, not ST0. I can't think of any reason why testing ST0  
 twice
 would be correct.

Interesting case.  the full code looks like this:

 if (!STO-isNullValue()  !STO-isNullValue()) {
   uint64_t TVA = STO-getZExtValue(), FVA = SFO-getZExtValue 
();
   if (isPowerOf2_64(TVA)  isPowerOf2_64(FVA)) {

The isPowerOf2_64 calls check that the argument is not zero.  As  
such, you can drop the isNullValue checks entirely.

Thanks Reid,

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


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll

2007-03-05 Thread Reid Spencer


Changes in directory llvm/test/Transforms/InstCombine:

udiv_select_to_select_shift.ll added (r1.1)
---
Log message:

Add a test case for a particular udiv/select transform.


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

 udiv_select_to_select_shift.ll |   17 +
 1 files changed, 17 insertions(+)


Index: llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll
diff -c /dev/null 
llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll:1.1
*** /dev/null   Mon Mar  5 16:51:18 2007
--- llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll Mon Mar 
 5 16:51:08 2007
***
*** 0 
--- 1,17 
+ ; This tests that this transform:
+ ; udiv X, (Select Cond, C1, C2) -- Select Cond, (shr X, C1), (shr X, C2)
+ ;
+ ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis -f -o %t  \
+ ; RUN:   grep select %t | wc -l | grep 1  \
+ ; RUN:   grep lshr %t | wc -l | grep 2  \ 
+ ; RUN:   grep udiv %t | wc -l | grep 0
+ 
+ define i64 @test(i64 %X, i1 %Cond ) {
+ entry:
+ %divisor1 = select i1 %Cond, i64 8, i64 16
+ %quotient1 = udiv i64 %X, %divisor1
+ %divisor2 = select i1 %Cond, i64 8, i64 0
+ %quotient2 = udiv i64 %X, %divisor2
+ %sum = add i64 %quotient1, %quotient2
+ ret i64 %sum
+ }



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


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.141 - 1.142
---
Log message:

Current pass manager, not the parent pass manager,  assumes the role of 
last user when one of the managed pass uses info provided by parent pass 
manager.

This was exposed by LPPassManager work.


---
Diffs of the changes:  (+10 -22)

 PassManager.cpp |   32 ++--
 1 files changed, 10 insertions(+), 22 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.141 
llvm/lib/VMCore/PassManager.cpp:1.142
--- llvm/lib/VMCore/PassManager.cpp:1.141   Mon Mar  5 14:01:30 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Mar  5 16:57:49 2007
@@ -158,7 +158,6 @@
   recordAvailableAnalysis(IP);
 } else {
   P-assignPassManager(activeStack);
-  activeStack.handleLastUserOverflow();
 }
 
   }
@@ -259,7 +258,6 @@
   recordAvailableAnalysis(IP);
 } else {
   P-assignPassManager(activeStack);
-  activeStack.handleLastUserOverflow();
 }
 
   }
@@ -587,6 +585,10 @@
   AnalysisResolver *AR = new AnalysisResolver(*this);
   P-setResolver(AR);
 
+  // If a FunctionPass F is the last user of ModulePass info M
+  // then the F's manager, not F, records itself as a last user of M.
+  std::vectorPass * TransferLastUses;
+
   if (ProcessAnalysis) {
 
 // At the moment, this pass is the last user of all required passes.
@@ -622,6 +624,12 @@
   LastUses.push_back(P);
 TPM-setLastUser(LastUses, P);
 
+if (!TransferLastUses.empty()) {
+  Pass *My_PM = dynamic_castPass *(this);
+  TPM-setLastUser(TransferLastUses, My_PM);
+  TransferLastUses.clear();
+}
+
 // Take a note of analysis required and made available by this pass.
 // Remove the analysis not preserved by this pass
 removeNotPreservedAnalysis(P);
@@ -1231,26 +1239,6 @@
 printf (\n);
 }
 
-// Walk Pass Manager stack and set LastUse markers if any
-// manager is transfering this priviledge to its parent manager
-void PMStack::handleLastUserOverflow() {
-
-  for(PMStack::iterator I = this-begin(), E = this-end(); I != E;) {
-
-PMDataManager *Child = *I++;
-if (I != E) {
-  PMDataManager *Parent = *I++;
-  PMTopLevelManager *TPM = Parent-getTopLevelManager();
-  std::vectorPass * TLU = Child-getTransferredLastUses();
-  if (!TLU.empty()) {
-Pass *P = dynamic_castPass *(Parent);
-TPM-setLastUser(TLU, P);
-TLU.clear();
-  }
-}
-  }
-}
-
 /// Find appropriate Module Pass Manager in the PM Stack and
 /// add self into that manager. 
 void ModulePass::assignPassManager(PMStack PMS, 



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


[llvm-commits] CVS: llvm/include/llvm/PassManagers.h

2007-03-05 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManagers.h updated: 1.11 - 1.12
---
Log message:

Current pass manager, not the parent pass manager,  assumes the role of 
last user when one of the managed pass uses info provided by parent pass 
manager.

This was exposed by LPPassManager work.


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

 PassManagers.h |   11 ---
 1 files changed, 11 deletions(-)


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.11 
llvm/include/llvm/PassManagers.h:1.12
--- llvm/include/llvm/PassManagers.h:1.11   Mon Mar  5 14:01:30 2007
+++ llvm/include/llvm/PassManagers.hMon Mar  5 16:57:49 2007
@@ -222,7 +222,6 @@
 
   /// Initialize available analysis information.
   void initializeAnalysisInfo() { 
-TransferLastUses.clear();
 AvailableAnalysis.clear();
   }
 
@@ -255,10 +254,6 @@
   void dumpAnalysisSetInfo(const char *Msg, Pass *P,
const std::vectorAnalysisID Set) const;
 
-  std::vectorPass * getTransferredLastUses() {
-return TransferLastUses;
-  }
-
   virtual unsigned getNumContainedPasses() { 
 return PassVector.size();
   }
@@ -269,12 +264,6 @@
   }
 protected:
 
-  // If a FunctionPass F is the last user of ModulePass info M
-  // then the F's manager, not F, records itself as a last user of M.
-  // Current pass manage is requesting parent manager to record parent
-  // manager as the last user of these TrransferLastUses passes.
-  std::vectorPass * TransferLastUses;
-
   // Top level manager.
   PMTopLevelManager *TPM;
 



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


[llvm-commits] CVS: llvm/include/llvm/Value.h

2007-03-05 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Value.h updated: 1.98 - 1.99
---
Log message:

Document the use of getValueType() more accurately, specifically explain
that the instruction opcode is added to the InstructionVal value and the
consequences of that.


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

 Value.h |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Value.h
diff -u llvm/include/llvm/Value.h:1.98 llvm/include/llvm/Value.h:1.99
--- llvm/include/llvm/Value.h:1.98  Thu Feb 15 12:53:54 2007
+++ llvm/include/llvm/Value.h   Mon Mar  5 17:06:32 2007
@@ -181,10 +181,12 @@
   /// getValueType - Return an ID for the concrete type of this object.  This 
is
   /// used to implement the classof checks.  This should not be used for any
   /// other purpose, as the values may change as LLVM evolves.  Also, note that
-  /// starting with the InstructionVal value, the value stored is actually the
-  /// Instruction opcode, so there are more than just these values possible 
here
-  /// (and Instruction must be last).
-  ///
+  /// for instructions, the Instruction's opcode is added to InstructionVal. So
+  /// this means three things:
+  /// # there is no value with code InstructionVal (no opcode==0).
+  /// # there are more possible values for the value type than in ValueTy enum.
+  /// # the InstructionVal enumerator must be the highest valued enumerator in
+  ///   the ValueTy enum.
   unsigned getValueType() const {
 return SubclassID;
   }



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


[llvm-commits] CVS: llvm/include/llvm/IntrinsicsX86.td

2007-03-05 Thread Bill Wendling


Changes in directory llvm/include/llvm:

IntrinsicsX86.td updated: 1.31 - 1.32
---
Log message:

Add the emms intrinsic for MMX support.


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

 IntrinsicsX86.td |9 +
 1 files changed, 9 insertions(+)


Index: llvm/include/llvm/IntrinsicsX86.td
diff -u llvm/include/llvm/IntrinsicsX86.td:1.31 
llvm/include/llvm/IntrinsicsX86.td:1.32
--- llvm/include/llvm/IntrinsicsX86.td:1.31 Sun Dec 31 16:24:55 2006
+++ llvm/include/llvm/IntrinsicsX86.td  Mon Mar  5 17:09:45 2007
@@ -535,3 +535,12 @@
   Intrinsic[llvm_void_ty, llvm_i32_ty,
  llvm_i32_ty], [IntrWriteMem];
 }
+
+//===--===//
+// MMX
+
+// Empty MMX state op.
+let TargetPrefix = x86 in {  // All intrinsics start with llvm.x86..
+  def int_x86_mmx_emms : GCCBuiltin__builtin_ia32_emms,
+  Intrinsic[llvm_void_ty], [IntrWriteMem];
+}



___
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/X86InstrMMX.td

2007-03-05 Thread Bill Wendling


Changes in directory llvm/lib/Target/X86:

X86InstrMMX.td updated: 1.13 - 1.14
---
Log message:

Add the emms intrinsic for MMX support.


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

 X86InstrMMX.td |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrMMX.td
diff -u llvm/lib/Target/X86/X86InstrMMX.td:1.13 
llvm/lib/Target/X86/X86InstrMMX.td:1.14
--- llvm/lib/Target/X86/X86InstrMMX.td:1.13 Tue Jul 18 19:27:29 2006
+++ llvm/lib/Target/X86/X86InstrMMX.td  Mon Mar  5 17:09:45 2007
@@ -33,6 +33,10 @@
 def : Pat(v4i16 (undef)), (IMPLICIT_DEF_VR64),  Requires[HasMMX];
 def : Pat(v2i32 (undef)), (IMPLICIT_DEF_VR64),  Requires[HasMMX];
 
+// EMMS
+def EMMS : I0x77, RawFrm, (ops), emms, [(int_x86_mmx_emms)], TB,
+   Requires[HasMMX];
+
 // Move Instructions
 def MOVD64rr : I0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src),
  movd {$src, $dst|$dst, $src}, [], TB,
@@ -94,4 +98,3 @@
 def MASKMOVQ : I0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask),
  maskmovq {$mask, $src|$src, $mask}, [], TB,
Requires[HasMMX];
-



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/mmx-emms.ll

2007-03-05 Thread Bill Wendling


Changes in directory llvm/test/CodeGen/X86:

mmx-emms.ll added (r1.1)
---
Log message:

Add the emms intrinsic for MMX support.


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

 mmx-emms.ll |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/CodeGen/X86/mmx-emms.ll
diff -c /dev/null llvm/test/CodeGen/X86/mmx-emms.ll:1.1
*** /dev/null   Mon Mar  5 17:09:55 2007
--- llvm/test/CodeGen/X86/mmx-emms.ll   Mon Mar  5 17:09:45 2007
***
*** 0 
--- 1,11 
+ ; RUN: llvm-as  %s | llc -march=x86 -mattr=+mmx | grep emms
+ define void @foo() {
+ entry:
+   call void @llvm.x86.mmx.emms( )
+   br label %return
+ 
+ return:   ; preds = %entry
+   ret void
+ }
+ 
+ declare void @llvm.x86.mmx.emms()



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


Re: [llvm-commits] Bug In InstCombine?

2007-03-05 Thread Reid Spencer
On Mon, 2007-03-05 at 14:51 -0800, Chris Lattner wrote:

 Interesting case.  the full code looks like this:
 
  if (!STO-isNullValue()  !STO-isNullValue()) {
uint64_t TVA = STO-getZExtValue(), FVA = SFO-getZExtValue 
 ();
if (isPowerOf2_64(TVA)  isPowerOf2_64(FVA)) {
 
 The isPowerOf2_64 calls check that the argument is not zero.  As  
 such, you can drop the isNullValue checks entirely.

Yup! Even better.

Thanks,

Reid.


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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.647 - 1.648
---
Log message:

Remove an unnecessary if statement and adjust indentation.


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

 InstructionCombining.cpp |   42 --
 1 files changed, 20 insertions(+), 22 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.647 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.648
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.647   Sun Mar  4 
18:11:19 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar  5 17:36:13 2007
@@ -2407,31 +2407,29 @@
   
   // udiv X, (Select Cond, C1, C2) -- Select Cond, (shr X, C1), (shr X, C2)
   // where C1C2 are powers of two.
-  if (SelectInst *SI = dyn_castSelectInst(Op1)) {
+  if (SelectInst *SI = dyn_castSelectInst(Op1)) 
 if (ConstantInt *STO = dyn_castConstantInt(SI-getOperand(1)))
-  if (ConstantInt *SFO = dyn_castConstantInt(SI-getOperand(2))) 
-if (!STO-isNullValue()  !STO-isNullValue()) {
-  uint64_t TVA = STO-getZExtValue(), FVA = SFO-getZExtValue();
-  if (isPowerOf2_64(TVA)  isPowerOf2_64(FVA)) {
-// Compute the shift amounts
-unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA);
-// Construct the on true case of the select
-Constant *TC = ConstantInt::get(Op0-getType(), TSA);
-Instruction *TSI = BinaryOperator::createLShr(
-   Op0, TC, 
SI-getName()+.t);
-TSI = InsertNewInstBefore(TSI, I);
-
-// Construct the on false case of the select
-Constant *FC = ConstantInt::get(Op0-getType(), FSA); 
-Instruction *FSI = BinaryOperator::createLShr(
-   Op0, FC, 
SI-getName()+.f);
-FSI = InsertNewInstBefore(FSI, I);
+  if (ConstantInt *SFO = dyn_castConstantInt(SI-getOperand(2)))  {
+uint64_t TVA = STO-getZExtValue(), FVA = SFO-getZExtValue();
+if (isPowerOf2_64(TVA)  isPowerOf2_64(FVA)) {
+  // Compute the shift amounts
+  unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA);
+  // Construct the on true case of the select
+  Constant *TC = ConstantInt::get(Op0-getType(), TSA);
+  Instruction *TSI = BinaryOperator::createLShr(
+ Op0, TC, SI-getName()+.t);
+  TSI = InsertNewInstBefore(TSI, I);
+  
+  // Construct the on false case of the select
+  Constant *FC = ConstantInt::get(Op0-getType(), FSA); 
+  Instruction *FSI = BinaryOperator::createLShr(
+ Op0, FC, SI-getName()+.f);
+  FSI = InsertNewInstBefore(FSI, I);
 
-// construct the select instruction and return it.
-return new SelectInst(SI-getOperand(0), TSI, FSI, SI-getName());
-  }
+  // construct the select instruction and return it.
+  return new SelectInst(SI-getOperand(0), TSI, FSI, SI-getName());
 }
-  }
+  }
   return 0;
 }
 



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


[llvm-commits] [124572] Handle -mllvm.

2007-03-05 Thread dpatel
Revision: 124572
Author:   dpatel
Date: 2007-03-05 16:42:33 -0800 (Mon, 05 Mar 2007)

Log Message:
---
Handle -mllvm.

Modified Paths:
--
apple-local/branches/llvm/gcc/config/darwin.h
apple-local/branches/llvm/gcc/gcc.c

Modified: apple-local/branches/llvm/gcc/config/darwin.h
===
--- apple-local/branches/llvm/gcc/config/darwin.h   2007-03-05 22:40:18 UTC 
(rev 124571)
+++ apple-local/branches/llvm/gcc/config/darwin.h   2007-03-06 00:42:33 UTC 
(rev 124572)
@@ -156,6 +156,8 @@
   { -image_base, -Zimage_base },  \
   { -init, -Zinit },  \
   { -install_name, -Zinstall_name },  \
+  /* APPLE LOCAL llvm */ \
+  { -mllvm, -Zmllvm },  \
   /* APPLE LOCAL mainline */ \
   { -mkernel, -mkernel -static -Wa,-static }, \
   { -multiply_defined_unused, -Zmultiplydefinedunused },  \
@@ -305,6 +307,8 @@
!strcmp (STR, Zimage_base) ? 1 :   \
!strcmp (STR, Zinit) ? 1 : \
!strcmp (STR, Zinstall_name) ? 1 : \
+  /* APPLE LOCAL llvm */ \
+   !strcmp (STR, Zmllvm) ? 1 :\
!strcmp (STR, Zmultiplydefinedunused) ? 1 : \
!strcmp (STR, Zmultiply_defined) ? 1 : \
!strcmp (STR, precomp-trustfile) ? 1 : \

Modified: apple-local/branches/llvm/gcc/gcc.c
===
--- apple-local/branches/llvm/gcc/gcc.c 2007-03-05 22:40:18 UTC (rev 124571)
+++ apple-local/branches/llvm/gcc/gcc.c 2007-03-06 00:42:33 UTC (rev 124572)
@@ -829,7 +829,8 @@
  %{fastcp:-O3}
 /* APPLE LOCAL end -fast */
 %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+/* APPLE LOCAL llvm */\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{Zmllvm*: -mllvm %*} %{m*} %{a*}\
  %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
  %{g*} %{O*} %{W*pedantic*} %{w} %{std*ansitrigraphs}\
  %{v:-version} %{pg:-p} %{p} %{f*} %{undef}\


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


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCallingConv.td Makefile PPC.td PPCISelLowering.cpp

2007-03-05 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCCallingConv.td added (r1.1)
Makefile updated: 1.23 - 1.24
PPC.td updated: 1.19 - 1.20
PPCISelLowering.cpp updated: 1.259 - 1.260
---
Log message:

Switch PPC return lower to use an autogenerated CC description.


---
Diffs of the changes:  (+103 -41)

 Makefile|3 +-
 PPC.td  |6 
 PPCCallingConv.td   |   65 
 PPCISelLowering.cpp |   70 ++--
 4 files changed, 103 insertions(+), 41 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCCallingConv.td
diff -c /dev/null llvm/lib/Target/PowerPC/PPCCallingConv.td:1.1
*** /dev/null   Mon Mar  5 19:00:09 2007
--- llvm/lib/Target/PowerPC/PPCCallingConv.td   Mon Mar  5 18:59:59 2007
***
*** 0 
--- 1,65 
+ //===- PPCCallingConv.td - Calling Conventions for PowerPC --*- C++ 
-*-===//
+ // 
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Chris Lattner and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for 
details.
+ // 
+ 
//===--===//
+ //
+ // This describes the calling conventions for the PowerPC 32- and 64-bit
+ // architectures.
+ //
+ 
//===--===//
+ 
+ /// CCIfSubtarget - Match if the current subtarget has a feature F.
+ class CCIfSubtargetstring F, CCAction A
+  : CCIf!strconcat(State.getTarget().getSubtargetPPCSubtarget()., F), A;
+ 
+ 
//===--===//
+ // Return Value Calling Convention
+ 
//===--===//
+ 
+ // Return-value convention for PowerPC
+ def RetCC_PPC : CallingConv[
+   CCIfType[i32], CCAssignToReg[R3, R4],
+   CCIfType[i64], CCAssignToReg[X3, X4],
+   
+   CCIfType[f32, f64], CCAssignToReg[F1],
+   
+   // Vector types are always returned in V2.
+   CCIfType[v16i8, v8i16, v4i32, v4f32], CCAssignToReg[V2]
+ ];
+ 
+ 
+ 
//===--===//
+ // PowerPC Argument Calling Conventions
+ 
//===--===//
+ /*
+ def CC_PPC : CallingConv[
+   // The first 8 integer arguments are passed in integer registers.
+   CCIfType[i32], CCAssignToReg[R3, R4, R5, R6, R7, R8, R9, R10],
+   CCIfType[i64], CCAssignToReg[X3, X4, X5, X6, X7, X8, X9, X10],
+   
+   // Darwin passes FP values in F1 - F13
+   CCIfType[f32, f64], CCIfSubtargetisMachoABI(),
+CCAssignToReg[F1, F2, F3, F4, F5, F6, F7, 
F8,F9,F10,F11,F12,F13],
+   // Other sub-targets pass FP values in F1-10.
+   CCIfType[f32, f64], CCAssignToReg[F1, F2, F3, F4, F5, F6, F7, F8, 
F9,F10],
+
+   // The first 12 Vector arguments are passed in altivec registers.
+   CCIfType[v16i8, v8i16, v4i32, v4f32],
+   CCAssignToReg[V2, V3, V4, V5, V6, V7, V8, V9, 
V10,V11,V12,V13]
+ 
+ /*
+   // Integer/FP values get stored in stack slots that are 8 bytes in size and
+   // 8-byte aligned if there are no more registers to hold them.
+   CCIfType[i32, i64, f32, f64], CCAssignToStack8, 8,
+   
+   // Vectors get 16-byte stack slots that are 16-byte aligned.
+   CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
+   CCAssignToStack16, 16*/
+ ];
+ 
+ */
+ 


Index: llvm/lib/Target/PowerPC/Makefile
diff -u llvm/lib/Target/PowerPC/Makefile:1.23 
llvm/lib/Target/PowerPC/Makefile:1.24
--- llvm/lib/Target/PowerPC/Makefile:1.23   Fri Oct 27 19:49:54 2006
+++ llvm/lib/Target/PowerPC/MakefileMon Mar  5 18:59:59 2007
@@ -14,6 +14,7 @@
 BUILT_SOURCES = PPCGenInstrNames.inc PPCGenRegisterNames.inc \
 PPCGenAsmWriter.inc  PPCGenCodeEmitter.inc \
 PPCGenRegisterInfo.h.inc PPCGenRegisterInfo.inc \
-PPCGenInstrInfo.inc PPCGenDAGISel.inc PPCGenSubtarget.inc
+PPCGenInstrInfo.inc PPCGenDAGISel.inc \
+PPCGenSubtarget.inc PPCGenCallingConv.inc
 
 include $(LEVEL)/Makefile.common


Index: llvm/lib/Target/PowerPC/PPC.td
diff -u llvm/lib/Target/PowerPC/PPC.td:1.19 llvm/lib/Target/PowerPC/PPC.td:1.20
--- llvm/lib/Target/PowerPC/PPC.td:1.19 Tue Dec 12 14:57:07 2006
+++ llvm/lib/Target/PowerPC/PPC.td  Mon Mar  5 18:59:59 2007
@@ -89,6 +89,12 @@
Feature64Bit /*, Feature64BitRegs */];
 
 
+//===--===//
+// Calling Conventions
+//===--===//
+
+include PPCCallingConv.td
+
 def PPCInstrInfo : InstrInfo {
   // Define how we want to layout our TargetSpecific information field... This
   // should be kept up-to-date with the fields in the PPCInstrInfo.h file.


Index: 

[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.142 - 1.143
---
Log message:

Add preparePassManager() hook. This allows each pass to check whether
current active pass manager is appropriate or not. 

A loop pass may consider current LPPassManager in appropraite if loop
pass is not preserving analysis information that is used by other 
passes managed by current LPPassManager. In such situation, loop pass
can pop current LPPassManager from the PMStack using this  hook 
and use new LPPassManager for itself.


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

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


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.142 
llvm/lib/VMCore/PassManager.cpp:1.143
--- llvm/lib/VMCore/PassManager.cpp:1.142   Mon Mar  5 16:57:49 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Mar  5 19:06:16 2007
@@ -385,6 +385,9 @@
   if (findAnalysisPass(P-getPassInfo()))
   return;
 
+  // Give pass a chance to prepare the stage.
+  P-preparePassManager(activeStack);
+
   AnalysisUsage AnUsage;
   P-getAnalysisUsage(AnUsage);
   const std::vectorAnalysisID RequiredSet = AnUsage.getRequiredSet();



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


[llvm-commits] [124573] Fix http://llvm.org/bugs/show_bug.cgi?id=1242, by emitting a more-complete

2007-03-05 Thread clattner
Revision: 124573
Author:   clattner
Date: 2007-03-05 17:07:09 -0800 (Mon, 05 Mar 2007)

Log Message:
---
Fix http://llvm.org/bugs/show_bug.cgi?id=1242, by emitting a more-complete
target data string.  On darwin, we now emit:
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
instead of:
target datalayout = E-p:32:32

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-03-06 00:42:33 UTC 
(rev 124572)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-03-06 01:07:09 UTC 
(rev 124573)
@@ -140,11 +140,6 @@
 #endif
   TheModule-setTargetTriple(TargetTriple);
   
-  std::string DataLayout;
-  DataLayout.append(BITS_BIG_ENDIAN ? E : e);
-  DataLayout.append(POINTER_SIZE == 32 ? -p:32:32 : -p:64:64);
-  TheModule-setDataLayout(DataLayout);
-  
   TheTypeConverter = new TypeConverter();
   
   // Create the TargetMachine we will be generating code with.
@@ -156,7 +151,7 @@
 cerr  Did not get a target machine!\n;
 exit(1);
   }
-  
+
   // Figure out the subtarget feature string we pass to the target.
   std::string FeatureStr;
   // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
@@ -168,6 +163,11 @@
 #endif
   TheTarget = TME-CtorFn(*TheModule, FeatureStr);
 
+  // Install information about target datalayout stuff into the module for
+  // optimizer use.
+  TheModule-setDataLayout(TheTarget-getTargetData()-
+   getStringRepresentation());
+  
   if (optimize) {
 RegisterScheduler::setDefault(createDefaultScheduler);
   } else {


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


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.143 - 1.144
---
Log message:

Keep track of inherited analysis. For example, if a loop pass does not
preserve dominator info then it should update parent FPPassManager's 
available analysis info to reflect this.


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

 PassManager.cpp |   21 +
 1 files changed, 21 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.143 
llvm/lib/VMCore/PassManager.cpp:1.144
--- llvm/lib/VMCore/PassManager.cpp:1.143   Mon Mar  5 19:06:16 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Mar  5 19:55:46 2007
@@ -551,6 +551,27 @@
 AvailableAnalysis.erase(Info);
 }
   }
+
+  // Check inherited analysis also. If P is not preserving analysis
+  // provided by parent manager then remove it here.
+  for (unsigned Index = 0; Index  PMT_Last; ++Index) {
+
+if (!InheritedAnalysis[Index])
+  continue;
+
+for (std::mapAnalysisID, Pass*::iterator 
+   I = InheritedAnalysis[Index]-begin(),
+   E = InheritedAnalysis[Index]-end(); I != E; ) {
+  std::mapAnalysisID, Pass *::iterator Info = I++;
+  if (std::find(PreservedSet.begin(), PreservedSet.end(), Info-first) == 
+  PreservedSet.end()) {
+// Remove this analysis
+if (!dynamic_castImmutablePass*(Info-second))
+  InheritedAnalysis[Index]-erase(Info);
+  }
+}
+  }
+
 }
 
 /// Remove analysis passes that are not used any longer



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


[llvm-commits] CVS: llvm/include/llvm/Pass.h PassManagers.h

2007-03-05 Thread Devang Patel


Changes in directory llvm/include/llvm:

Pass.h updated: 1.80 - 1.81
PassManagers.h updated: 1.12 - 1.13
---
Log message:

Keep track of inherited analysis. For example, if a loop pass does not
preserve dominator info then it should update parent FPPassManager's 
available analysis info to reflect this.


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

 Pass.h |3 ++-
 PassManagers.h |   21 +
 2 files changed, 23 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.80 llvm/include/llvm/Pass.h:1.81
--- llvm/include/llvm/Pass.h:1.80   Mon Mar  5 19:06:16 2007
+++ llvm/include/llvm/Pass.hMon Mar  5 19:55:46 2007
@@ -64,7 +64,8 @@
   PMT_CallGraphPassManager,  /// CGPassManager
   PMT_FunctionPassManager,   /// FPPassManager
   PMT_LoopPassManager,   /// LPPassManager
-  PMT_BasicBlockPassManager  /// BBPassManager
+  PMT_BasicBlockPassManager, /// BBPassManager
+  PMT_Last
 };
 
 typedef enum PassManagerType PassManagerType;


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.12 
llvm/include/llvm/PassManagers.h:1.13
--- llvm/include/llvm/PassManagers.h:1.12   Mon Mar  5 16:57:49 2007
+++ llvm/include/llvm/PassManagers.hMon Mar  5 19:55:46 2007
@@ -197,6 +197,7 @@
 /// used by pass managers.
 class PMDataManager {
 public:
+
   PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
 initializeAnalysisInfo();
   }
@@ -223,6 +224,8 @@
   /// Initialize available analysis information.
   void initializeAnalysisInfo() { 
 AvailableAnalysis.clear();
+for (unsigned i = 0; i  PMT_Last; ++i)
+  InheritedAnalysis[i] = NULL;
   }
 
   /// Populate RequiredPasses with the analysis pass that are required by
@@ -262,6 +265,19 @@
 assert ( 0  Invalid use of getPassManagerType);
 return PMT_Unknown; 
   }
+
+  std::mapAnalysisID, Pass* *getAvailableAnalysis() {
+return AvailableAnalysis;
+  }
+
+  // Collect AvailableAnalysis from all the active Pass Managers.
+  void populateInheritedAnalysis(PMStack PMS) {
+unsigned Index = 0;
+for (PMStack::iterator I = PMS.begin(), E = PMS.end();
+ I != E; ++I)
+  InheritedAnalysis[Index++] = (*I)-getAvailableAnalysis();
+  }
+
 protected:
 
   // Top level manager.
@@ -270,6 +286,11 @@
   // Collection of pass that are managed by this manager
   std::vectorPass * PassVector;
 
+  // Collection of Analysis provided by Parent pass manager and
+  // used by current pass manager. At at time there can not be more
+  // then PMT_Last active pass mangers.
+  std::mapAnalysisID, Pass * *InheritedAnalysis[PMT_Last];
+
 private:
   // Set of available Analysis. This information is used while scheduling 
   // pass. If a pass requires an analysis which is not not available then 



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


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

2007-03-05 Thread Devang Patel


Changes in directory llvm/lib/Analysis:

LoopPass.cpp updated: 1.9 - 1.10
---
Log message:

Use std::deque to manage loop queue inside LPPassManager.


---
Diffs of the changes:  (+6 -40)

 LoopPass.cpp |   46 ++
 1 files changed, 6 insertions(+), 40 deletions(-)


Index: llvm/lib/Analysis/LoopPass.cpp
diff -u llvm/lib/Analysis/LoopPass.cpp:1.9 llvm/lib/Analysis/LoopPass.cpp:1.10
--- llvm/lib/Analysis/LoopPass.cpp:1.9  Mon Mar  5 14:01:30 2007
+++ llvm/lib/Analysis/LoopPass.cpp  Mon Mar  5 20:30:46 2007
@@ -14,38 +14,9 @@
 
//===--===//
 
 #include llvm/Analysis/LoopPass.h
-#include queue
 using namespace llvm;
 
 
//===--===//
-// LoopQueue
-
-namespace llvm {
-
-// Compare Two loops based on their depth in loop nest.
-class LoopCompare {
-public:
-  bool operator()( Loop *L1, Loop *L2) const {
-// Loops with highest depth has the highest priority.
-return L1-getLoopDepth()  L2-getLoopDepth();
-  }
-};
-
-// Loop queue used by Loop Pass Manager. This is a wrapper class
-// that hides implemenation detail (use of priority_queue) inside .cpp file.
-class LoopQueue {
-public:
-  inline void push(Loop *L) { LPQ.push(L); }
-  inline void pop() { LPQ.pop(); }
-  inline Loop *top() { return LPQ.top(); }
-  inline bool empty() { return LPQ.empty(); }
-private:
-  std::priority_queueLoop *, std::vectorLoop *, LoopCompare LPQ;
-};
-
-} // End of LLVM namespace
-
-//===--===//
 // LPPassManager
 //
 /// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
@@ -53,11 +24,6 @@
 LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) { 
   skipThisLoop = false;
   redoThisLoop = false;
-  LQ = new LoopQueue(); 
-}
-
-LPPassManager::~LPPassManager() {
-  delete LQ;
 }
 
 /// Delete loop from the loop queue. This is used by Loop pass to inform
@@ -75,10 +41,10 @@
 }
 
 // Recurse through all subloops and all loops  into LQ.
-static void addLoopIntoQueue(Loop *L, LoopQueue *LQ) {
+static void addLoopIntoQueue(Loop *L, std::dequeLoop * LQ) {
   for (Loop::iterator I = L-begin(), E = L-end(); I != E; ++I)
 addLoopIntoQueue(*I, LQ);
-  LQ-push(L);
+  LQ.push_back(L);
 }
 
 /// run - Execute all of the passes scheduled for execution.  Keep track of
@@ -92,9 +58,9 @@
 addLoopIntoQueue(*I, LQ);
 
   // Walk Loops
-  while (!LQ-empty()) {
+  while (!LQ.empty()) {
   
-Loop *L  = LQ-top();
+Loop *L  = LQ.back();
 skipThisLoop = false;
 redoThisLoop = false;
 
@@ -130,10 +96,10 @@
 }
 
 // Pop the loop from queue after running all passes.
-LQ-pop();
+LQ.pop_back();
 
 if (redoThisLoop)
-  LQ-push(L);
+  LQ.push_back(L);
   }
 
   return Changed;



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


[llvm-commits] CVS: llvm/include/llvm/Analysis/LoopPass.h

2007-03-05 Thread Devang Patel


Changes in directory llvm/include/llvm/Analysis:

LoopPass.h updated: 1.7 - 1.8
---
Log message:

Use std::deque to manage loop queue inside LPPassManager.


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

 LoopPass.h |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


Index: llvm/include/llvm/Analysis/LoopPass.h
diff -u llvm/include/llvm/Analysis/LoopPass.h:1.7 
llvm/include/llvm/Analysis/LoopPass.h:1.8
--- llvm/include/llvm/Analysis/LoopPass.h:1.7   Tue Feb 27 09:00:39 2007
+++ llvm/include/llvm/Analysis/LoopPass.h   Mon Mar  5 20:30:46 2007
@@ -25,7 +25,6 @@
 class LPPassManager;
 class Loop;
 class Function;
-class LoopQueue;
 
 class LoopPass : public Pass {
 
@@ -47,7 +46,6 @@
 
 public:
   LPPassManager(int Depth);
-  ~LPPassManager();
 
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
@@ -95,7 +93,7 @@
   // utility may send LPPassManager into infinite loops so use caution.
   void redoLoop(Loop *L);
 private:
-  LoopQueue *LQ;
+  std::dequeLoop * LQ;
   bool skipThisLoop;
   bool redoThisLoop;
 };



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


[llvm-commits] CVS: llvm/test/CFrontend/2007-03-05-DataLayout.c

2007-03-05 Thread Reid Spencer


Changes in directory llvm/test/CFrontend:

2007-03-05-DataLayout.c added (r1.1)
---
Log message:

Test to ensure that data layout is generated correctly for host platform.
This is for PR1242: http://llvm.org/PR1242 .


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

 2007-03-05-DataLayout.c |   51 
 1 files changed, 51 insertions(+)


Index: llvm/test/CFrontend/2007-03-05-DataLayout.c
diff -c /dev/null llvm/test/CFrontend/2007-03-05-DataLayout.c:1.1
*** /dev/null   Mon Mar  5 21:00:27 2007
--- llvm/test/CFrontend/2007-03-05-DataLayout.c Mon Mar  5 21:00:17 2007
***
*** 0 
--- 1,51 
+ // Testcase for PR1242
+ // RUN: %llvmgcc -c %s -o %t  lli --force-interpreter=1 %t
+ #include stdlib.h
+ #define NDIM 3
+ #define BODY 01
+ typedef double vector[NDIM];
+ typedef struct bnode* bodyptr;
+ // { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x
+ // double], double, \2 *, \2 * }
+ struct bnode {
+   short int type;
+   double mass;
+   vector pos;
+   int proc;
+   int new_proc;
+   vector vel;
+   vector acc;
+   vector new_acc;
+   double phi;
+   bodyptr next;
+   bodyptr proc_next;
+ } body;
+ 
+ #define Type(x) ((x)-type)
+ #define Mass(x) ((x)-mass)
+ #define Pos(x)  ((x)-pos)
+ #define Proc(x) ((x)-proc)
+ #define New_Proc(x) ((x)-new_proc)
+ #define Vel(x)  ((x)-vel)
+ #define Acc(x)  ((x)-acc)
+ #define New_Acc(x)  ((x)-new_acc)
+ #define Phi(x)  ((x)-phi)
+ #define Next(x) ((x)-next)
+ #define Proc_Next(x) ((x)-proc_next)
+ 
+ bodyptr ubody_alloc(int p)
+ { 
+   register bodyptr tmp;
+   tmp = (bodyptr)malloc(sizeof(body));
+ 
+   Type(tmp) = BODY;
+   Proc(tmp) = p;
+   Proc_Next(tmp) = NULL;
+   New_Proc(tmp) = p;
+   return tmp;
+ }
+ 
+ int main(int argc, char** argv) {
+   bodyptr b = ubody_alloc(17);
+   return 0;
+ }



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


[llvm-commits] CVS: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h GenericValue.h

2007-03-05 Thread Reid Spencer


Changes in directory llvm/include/llvm/ExecutionEngine:

ExecutionEngine.h updated: 1.43 - 1.44
GenericValue.h updated: 1.10 - 1.11
---
Log message:

Make GenericeValue into a struct with a union instead of just a union. This
allows an APInt value to be constructed. Remove all the native integer types
from the union. These are replaced with the single IntVal of type APInt.


---
Diffs of the changes:  (+16 -23)

 ExecutionEngine.h |2 +-
 GenericValue.h|   37 +++--
 2 files changed, 16 insertions(+), 23 deletions(-)


Index: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h
diff -u llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.43 
llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.44
--- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.43Sat Mar  3 
12:18:11 2007
+++ llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Mon Mar  5 21:01:54 2007
@@ -24,7 +24,7 @@
 
 namespace llvm {
 
-union GenericValue;
+struct GenericValue;
 class Constant;
 class Function;
 class GlobalVariable;


Index: llvm/include/llvm/ExecutionEngine/GenericValue.h
diff -u llvm/include/llvm/ExecutionEngine/GenericValue.h:1.10 
llvm/include/llvm/ExecutionEngine/GenericValue.h:1.11
--- llvm/include/llvm/ExecutionEngine/GenericValue.h:1.10   Sat Mar  3 
01:36:44 2007
+++ llvm/include/llvm/ExecutionEngine/GenericValue.hMon Mar  5 21:01:54 2007
@@ -15,37 +15,30 @@
 #ifndef GENERIC_VALUE_H
 #define GENERIC_VALUE_H
 
+#include llvm/ADT/APInt.h
 #include llvm/Support/DataTypes.h
 
 namespace llvm {
 
-typedef uintptr_t PointerTy;
+typedef void* PointerTy;
 class APInt;
-class Type;
 
-union GenericValue {
-  boolInt1Val;
-  unsigned char   Int8Val;
-  unsigned short  Int16Val;
-  unsigned intInt32Val;
-  uint64_tInt64Val;
-  APInt  *APIntVal;
-  double  DoubleVal;
-  float   FloatVal;
-  struct { unsigned int first; unsigned int second; } UIntPairVal;
-  PointerTy   PointerVal;
-  unsigned char   Untyped[8];
-
-  GenericValue() {}
-  GenericValue(void *V) {
-PointerVal = (PointerTy)(intptr_t)V;
-  }
+struct GenericValue {
+  union {
+double  DoubleVal;
+float   FloatVal;
+PointerTy   PointerVal;
+struct { unsigned int first; unsigned int second; } UIntPairVal;
+unsigned char   Untyped[8];
+  };
+  APInt IntVal;
+
+  GenericValue() : DoubleVal(0.0), IntVal(1,0) {}
+  GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
 };
 
 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
-inline void* GVTOP(const GenericValue GV) {
-  return (void*)(intptr_t)GV.PointerVal;
-}
+inline void* GVTOP(const GenericValue GV) { return GV.PointerVal; }
 
 } // End llvm namespace
 #endif



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.110 - 1.111
---
Log message:

Simplify things significantly because GenericValue now has a single integer
field, of type APInt, instead of multiple integer fields. Also, get rid of
the special endianness code in StoreValueToMemory and LoadValueToMemory.
ExecutionEngine is always used to execute on the host platform so this is
now unnecessary. 


---
Diffs of the changes:  (+72 -281)

 ExecutionEngine.cpp |  353 ++--
 1 files changed, 72 insertions(+), 281 deletions(-)


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.110 
llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.110  Sat Mar  3 12:19:18 2007
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Mar  5 21:04:04 2007
@@ -229,7 +229,7 @@
const char * const * envp) {
   std::vectorGenericValue GVArgs;
   GenericValue GVArgc;
-  GVArgc.Int32Val = argv.size();
+  GVArgc.IntVal = APInt(32, argv.size());
   unsigned NumArgs = Fn-getFunctionType()-getNumParams();
   if (NumArgs) {
 GVArgs.push_back(GVArgc); // Arg #0 = argc.
@@ -245,7 +245,7 @@
   }
 }
   }
-  return runFunction(Fn, GVArgs).Int32Val;
+  return runFunction(Fn, GVArgs).IntVal.getZExtValue();
 }
 
 /// If possible, create a JIT, unless the caller specifically requests an
@@ -298,28 +298,6 @@
   return state.getGlobalAddressMap(locked)[GV];
 }
 
-/// This macro is used to handle a variety of situations involing integer
-/// values where the action should be done to one of the GenericValue members.
-/// THEINTTY is a const Type * for the integer type. ACTION1 comes before
-/// the GenericValue, ACTION2 comes after.
-#define DO_FOR_INTEGER(THEINTTY, ACTION) \
-   { \
-  unsigned BitWidth = castIntegerType(THEINTTY)-getBitWidth(); \
-  if (BitWidth == 1) {\
-ACTION(Int1Val); \
-  } else if (BitWidth = 8) {\
-ACTION(Int8Val); \
-  } else if (BitWidth = 16) {\
-ACTION(Int16Val); \
-  } else if (BitWidth = 32) { \
-ACTION(Int32Val); \
-  } else if (BitWidth = 64) { \
-ACTION(Int64Val); \
-  } else   {\
-assert(0  Not implemented: integer types  64 bits); \
-  } \
-   }
-
 /// This function converts a Constant* into a GenericValue. The interesting 
 /// part is if C is a ConstantExpr.
 /// @brief Get a GenericValue for a Constnat*
@@ -341,10 +319,8 @@
 TD-getIndexedOffset(CE-getOperand(0)-getType(),
  Indices[0], Indices.size());
 
-  if (getTargetData()-getPointerSize() == 4)
-Result.Int32Val += Offset;
-  else
-Result.Int64Val += Offset;
+  char* tmp = (char*) Result.PointerVal;
+  Result = PTOGV(tmp + Offset);
   return Result;
 }
 case Instruction::Trunc:
@@ -375,21 +351,15 @@
   // IntToPtr casts are just so special. Cast to intptr_t first.
   Constant *Op = CE-getOperand(0);
   GenericValue GV = getConstantValue(Op);
-#define INT_TO_PTR_ACTION(FIELD) \
-return PTOGV((void*)(uintptr_t)GV.FIELD)
-  DO_FOR_INTEGER(Op-getType(), INT_TO_PTR_ACTION)
-#undef INT_TO_PTR_ACTION
+  return PTOGV((void*)(uintptr_t)GV.IntVal.getZExtValue());
   break;
 }
 case Instruction::Add:
   switch (CE-getOperand(0)-getType()-getTypeID()) {
   default: assert(0  Bad add type!); abort();
   case Type::IntegerTyID:
-#define ADD_ACTION(FIELD) \
-Result.FIELD = getConstantValue(CE-getOperand(0)).FIELD + \
-   getConstantValue(CE-getOperand(1)).FIELD;
-DO_FOR_INTEGER(CE-getOperand(0)-getType(),ADD_ACTION);
-#undef ADD_ACTION
+Result.IntVal = getConstantValue(CE-getOperand(0)).IntVal + \
+getConstantValue(CE-getOperand(1)).IntVal;
 break;
   case Type::FloatTyID:
 Result.FloatVal = getConstantValue(CE-getOperand(0)).FloatVal +
@@ -409,28 +379,15 @@
   }
 
   switch (C-getType()-getTypeID()) {
-#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \
-  case Type::TY##TyID: Result.TY##Val = (CTY)castCLASS(C)-GETMETH(); break
-GET_CONST_VAL(Float , float , ConstantFP, getValue);
-GET_CONST_VAL(Double, double, ConstantFP, getValue);
-#undef GET_CONST_VAL
-  case Type::IntegerTyID: {
-unsigned BitWidth = castIntegerType(C-getType())-getBitWidth();
-if (BitWidth == 1)
-  Result.Int1Val = (bool)castConstantInt(C)-getZExtValue();
-else if (BitWidth = 8)
-  Result.Int8Val = (uint8_t )castConstantInt(C)-getZExtValue();
-else if (BitWidth = 16)
-  Result.Int16Val = (uint16_t )castConstantInt(C)-getZExtValue();
-else if (BitWidth = 32)
-  Result.Int32Val = (uint32_t )castConstantInt(C)-getZExtValue();
-else if (BitWidth = 64)
-  Result.Int64Val = (uint64_t 

[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Interpreter.cpp updated: 1.38 - 1.39
---
Log message:

Remove the insufficient code in Interpreter::create that computed the
Target DataLayout incorrectly. For now, we'll trust that the module has
got the correct DataLayout. In the future, this needs to be changed to
tell the TargetData to be current host.


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

 Interpreter.cpp |   12 
 1 files changed, 12 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.38 
llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.39
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.38   Sat Mar  3 
12:29:16 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.cppMon Mar  5 
21:05:57 2007
@@ -46,18 +46,6 @@
   // when the module is deleted via the ExistingModuleProvide via EE.
   delete MP;
   
-  // FIXME: This should probably compute the entire data layout
-  std::string DataLayout;
-  int Test = 0;
-  *(char*)Test = 1;// Return true if the host is little endian
-  bool isLittleEndian = (Test == 1);
-  DataLayout.append(isLittleEndian ? e : E);
-
-  bool Ptr64 = sizeof(void*) == 8;
-  DataLayout.append(Ptr64 ? -p:64:64 : -p:32:32);
-   
-  M-setDataLayout(DataLayout);
-
   return new Interpreter(M);
 }
 



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Interpreter.h updated: 1.85 - 1.86
---
Log message:

APInt's are no longer allocated on the heap because they are direct 
members of GenericValue. Consequently the code to clean them up isn't 
needed.


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

 Interpreter.h |   12 
 1 files changed, 12 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.85 
llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.86
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.85 Sat Mar  3 
12:19:18 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h  Mon Mar  5 21:06:48 2007
@@ -76,18 +76,6 @@
   CallSite Caller; // Holds the call that called subframes.
// NULL if main func or debugger invoked fn
   AllocaHolderHandleAllocas;// Track memory allocated by alloca
-  std::vectorAPInt*   APInts; // Track memory allocated for APInts
-  APInt* getAPInt(uint32_t BitWidth) {
-APInt* Result = new APInt(BitWidth, 0);
-APInts.push_back(Result);
-return Result;
-  }
-  ~ExecutionContext() {
-while (!APInts.empty()) {
-  delete APInts.back();
-  APInts.pop_back();
-}
-  }
 };
 
 // Interpreter - This class represents the entirety of the interpreter.



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


[llvm-commits] CVS: llvm-test/Makefile.programs

2007-03-05 Thread Dale Johannesen


Changes in directory llvm-test:

Makefile.programs updated: 1.257 - 1.258
---
Log message:

Add -enable-tail-merge to PPC flags.


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

 Makefile.programs |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.257 llvm-test/Makefile.programs:1.258
--- llvm-test/Makefile.programs:1.257   Thu Feb  8 21:43:45 2007
+++ llvm-test/Makefile.programs Mon Mar  5 21:07:59 2007
@@ -211,7 +211,7 @@
 endif#DISABLE_DIFFS
 
 ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION :=  --enable-ppc-preinc
+LLCBETAOPTION :=  --enable-ppc-preinc  --enable-tail-merge
 #--enable-tail-merge
 #-regalloc=local -fast
 endif



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

ExternalFunctions.cpp updated: 1.95 - 1.96
---
Log message:

Adjust and simplify external function processing now that GenericValue has
a single integer field of type APInt.


---
Diffs of the changes:  (+41 -33)

 ExternalFunctions.cpp |   74 +++---
 1 files changed, 41 insertions(+), 33 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.95 
llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.96
--- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.95 Fri Jan 
12 01:05:13 2007
+++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp  Mon Mar  5 
21:08:12 2007
@@ -114,19 +114,19 @@
 
 // void putchar(sbyte)
 GenericValue lle_VB_putchar(FunctionType *M, const vectorGenericValue Args) 
{
-  cout  Args[0].Int8Val;
+  cout  ((char)Args[0].IntVal.getZExtValue());
   return GenericValue();
 }
 
 // int putchar(int)
 GenericValue lle_ii_putchar(FunctionType *M, const vectorGenericValue Args) 
{
-  cout  ((char)Args[0].Int32Val)  std::flush;
+  cout  ((char)Args[0].IntVal.getZExtValue())  std::flush;
   return Args[0];
 }
 
 // void putchar(ubyte)
 GenericValue lle_Vb_putchar(FunctionType *M, const vectorGenericValue Args) 
{
-  cout  Args[0].Int8Val  std::flush;
+  cout  ((char)Args[0].IntVal.getZExtValue())  std::flush;
   return Args[0];
 }
 
@@ -135,7 +135,7 @@
   assert(Args.size() == 1);
   TheInterpreter-addAtExitHandler((Function*)GVTOP(Args[0]));
   GenericValue GV;
-  GV.Int32Val = 0;
+  GV.IntVal = 0;
   return GV;
 }
 
@@ -154,13 +154,14 @@
 // void *malloc(uint)
 GenericValue lle_X_malloc(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 1  Malloc expects one argument!);
-  return PTOGV(malloc(Args[0].Int32Val));
+  return PTOGV(malloc(Args[0].IntVal.getZExtValue()));
 }
 
 // void *calloc(uint, uint)
 GenericValue lle_X_calloc(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 2  calloc expects two arguments!);
-  return PTOGV(calloc(Args[0].Int32Val, Args[1].Int32Val));
+  return PTOGV(calloc(Args[0].IntVal.getZExtValue(), 
+  Args[1].IntVal.getZExtValue()));
 }
 
 // void free(void *)
@@ -174,7 +175,7 @@
 GenericValue lle_X_atoi(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 1);
   GenericValue GV;
-  GV.Int32Val = atoi((char*)GVTOP(Args[0]));
+  GV.IntVal = APInt(32, atoi((char*)GVTOP(Args[0])));
   return GV;
 }
 
@@ -249,14 +250,14 @@
 GenericValue lle_X_rand(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 0);
   GenericValue GV;
-  GV.Int32Val = rand();
+  GV.IntVal = APInt(32, rand());
   return GV;
 }
 
 // void srand(uint)
 GenericValue lle_X_srand(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 1);
-  srand(Args[0].Int32Val);
+  srand(Args[0].IntVal.getZExtValue());
   return GenericValue();
 }
 
@@ -264,7 +265,7 @@
 GenericValue lle_X_puts(FunctionType *M, const vectorGenericValue Args) {
   assert(Args.size() == 1);
   GenericValue GV;
-  GV.Int32Val = puts((char*)GVTOP(Args[0]));
+  GV.IntVal = APInt(32, puts((char*)GVTOP(Args[0])));
   return GV;
 }
 
@@ -277,7 +278,8 @@
 
   // printf should return # chars printed.  This is completely incorrect, but
   // close enough for now.
-  GenericValue GV; GV.Int32Val = strlen(FmtStr);
+  GenericValue GV; 
+  GV.IntVal = APInt(32, strlen(FmtStr));
   while (1) {
 switch (*FmtStr) {
 case 0: return GV; // Null terminator...
@@ -308,7 +310,8 @@
   case '%':
 sprintf(Buffer, FmtBuf); break;
   case 'c':
-sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
+sprintf(Buffer, FmtBuf, uint32_t(Args[ArgNo++].IntVal.getZExtValue()));
+break;
   case 'd': case 'i':
   case 'u': case 'o':
   case 'x': case 'X':
@@ -323,9 +326,10 @@
 FmtBuf[Size+1] = 0;
 FmtBuf[Size-1] = 'l';
   }
-  sprintf(Buffer, FmtBuf, Args[ArgNo++].Int64Val);
+  sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal.getZExtValue());
 } else
-  sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
+  sprintf(Buffer, 
FmtBuf,uint32_t(Args[ArgNo++].IntVal.getZExtValue()));
+break;
   case 'e': case 'E': case 'g': case 'G': case 'f':
 sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
   case 'p':
@@ -439,8 +443,8 @@
 Args[i] = (char*)GVTOP(args[i]);
 
   GenericValue GV;
-  GV.Int32Val = sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
-   Args[5], Args[6], Args[7], Args[8], Args[9]);
+  GV.IntVal = APInt(32, sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
+Args[5], Args[6], Args[7], Args[8], Args[9]));
   ByteswapSCANFResults(Args[1], Args[2], Args[3], Args[4],

[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.172 - 1.173
---
Log message:

Radically simplify execution. This patch gets rid of all the special
handling for integer of various sizes. GenericValue now has just a single
integer field of type APInt. We use its facilities directly in the
execution of all instructions.


---
Diffs of the changes:  (+128 -636)

 Execution.cpp |  764 +-
 1 files changed, 128 insertions(+), 636 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.172 
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.173
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.172Sat Mar  3 
02:38:04 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp  Mon Mar  5 21:09:31 2007
@@ -32,12 +32,6 @@
 // Various Helper Functions
 
//===--===//
 
-inline void initializeAPInt(GenericValue GV, const Type* Ty, 
- ExecutionContext SF) {
-  if (const IntegerType *ITy = dyn_castIntegerType(Ty)) 
-GV.APIntVal = SF.getAPInt(ITy-getBitWidth());
-}
-
 static inline uint64_t doSignExtension(uint64_t Val, const IntegerType* ITy) {
   // Determine if the value is signed or not
   bool isSigned = (Val  (1  (ITy-getBitWidth()-1))) != 0;
@@ -47,22 +41,6 @@
   return Val;
 }
 
-static inline void maskToBitWidth(GenericValue GV, unsigned BitWidth) {
-  uint64_t BitMask = ~(uint64_t)(0ull)  (64-BitWidth);
-  if (BitWidth = 8)
-GV.Int8Val = BitMask;
-  else if (BitWidth = 16)
-GV.Int16Val = BitMask;
-  else if (BitWidth = 32)
-GV.Int32Val = BitMask;
-  else if (BitWidth = 64)
-GV.Int64Val = BitMask;
-  else {
-assert(GV.APIntVal  Unallocated GV.APIntVal);
-*(GV.APIntVal) = APInt::getAllOnesValue(BitWidth);
-  }
-}
-
 static void SetValue(Value *V, GenericValue Val, ExecutionContext SF) {
   SF.Values[V] = Val;
 }
@@ -76,79 +54,21 @@
 
//===--===//
 
 #define IMPLEMENT_BINARY_OPERATOR(OP, TY) \
-   case Type::TY##TyID: Dest.TY##Val = Src1.TY##Val OP Src2.TY##Val; break
+   case Type::TY##TyID: \
+ Dest.TY##Val = Src1.TY##Val OP Src2.TY##Val; \
+ break
 
-#define IMPLEMENT_INTEGER_BINOP(OP, TY) \
+#define IMPLEMENT_INTEGER_BINOP1(OP, TY) \
case Type::IntegerTyID: { \
- unsigned BitWidth = castIntegerType(TY)-getBitWidth(); \
- if (BitWidth == 1) {\
-   Dest.Int1Val = Src1.Int1Val OP Src2.Int1Val; \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 8) {\
-   Dest.Int8Val = Src1.Int8Val OP Src2.Int8Val; \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 16) {\
-   Dest.Int16Val = Src1.Int16Val OP Src2.Int16Val; \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 32) {\
-   Dest.Int32Val = Src1.Int32Val OP Src2.Int32Val; \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 64) {\
-   Dest.Int64Val = Src1.Int64Val OP Src2.Int64Val; \
-   maskToBitWidth(Dest, BitWidth); \
- } else \
-   *(Dest.APIntVal) = *(Src1.APIntVal) OP *(Src2.APIntVal); \
+ Dest.IntVal = Src1.IntVal OP Src2.IntVal; \
  break; \
}
 
-#define IMPLEMENT_SIGNED_BINOP(OP, TY, APOP) \
-   if (const IntegerType *ITy = dyn_castIntegerType(TY)) { \
- unsigned BitWidth = ITy-getBitWidth(); \
- if (BitWidth = 8) { \
-   Dest.Int8Val  = ((int8_t)Src1.Int8Val)   OP ((int8_t)Src2.Int8Val); \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 16) { \
-   Dest.Int16Val = ((int16_t)Src1.Int16Val) OP ((int16_t)Src2.Int16Val); \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 32) { \
-   Dest.Int32Val = ((int32_t)Src1.Int32Val) OP ((int32_t)Src2.Int32Val); \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 64) { \
-   Dest.Int64Val = ((int64_t)Src1.Int64Val) OP ((int64_t)Src2.Int64Val); \
-   maskToBitWidth(Dest, BitWidth); \
- } else \
-   *(Dest.APIntVal) = Src1.APIntVal-APOP(*(Src2.APIntVal)); \
-   } else { \
-cerr  Unhandled type for  #OP  operator:   *Ty  \n; \
-abort(); \
-   }
-
-#define IMPLEMENT_UNSIGNED_BINOP(OP, TY, APOP) \
-   if (const IntegerType *ITy = dyn_castIntegerType(TY)) { \
- unsigned BitWidth = ITy-getBitWidth(); \
- if (BitWidth = 8) {\
-   Dest.Int8Val  = ((uint8_t)Src1.Int8Val)   OP ((uint8_t)Src2.Int8Val); \
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 16) {\
-   Dest.Int16Val = ((uint16_t)Src1.Int16Val) OP ((uint16_t)Src2.Int16Val); 
\
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 32) {\
-   Dest.Int32Val = ((uint32_t)Src1.Int32Val) OP ((uint32_t)Src2.Int32Val); 
\
-   maskToBitWidth(Dest, BitWidth); \
- } else if (BitWidth = 

[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.93 - 1.94
---
Log message:

Simplify code as a result of the change in GenericValue to have a single
integer field of type APInt instead of different sized integer fields.


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

 JIT.cpp |   43 +++
 1 files changed, 15 insertions(+), 28 deletions(-)


Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.93 
llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.94
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.93   Tue Feb 13 23:52:17 2007
+++ llvm/lib/ExecutionEngine/JIT/JIT.cppMon Mar  5 21:11:31 2007
@@ -107,8 +107,9 @@
 
 // Call the function.
 GenericValue rv;
-rv.Int32Val = PF(ArgValues[0].Int32Val, (char **)GVTOP(ArgValues[1]),
-   (const char **)GVTOP(ArgValues[2]));
+rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(), 
+ (char **)GVTOP(ArgValues[1]),
+ (const char **)GVTOP(ArgValues[2])));
 return rv;
   }
   break;
@@ -120,7 +121,8 @@
 
 // Call the function.
 GenericValue rv;
-rv.Int32Val = PF(ArgValues[0].Int32Val, (char **)GVTOP(ArgValues[1]));
+rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(), 
+ (char **)GVTOP(ArgValues[1])));
 return rv;
   }
   break;
@@ -130,7 +132,7 @@
FTy-getParamType(0) == Type::Int32Ty)) {
 GenericValue rv;
 int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
-rv.Int32Val = PF(ArgValues[0].Int32Val);
+rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
 return rv;
   }
   break;
@@ -145,21 +147,21 @@
 case Type::IntegerTyID: {
   unsigned BitWidth = castIntegerType(RetTy)-getBitWidth();
   if (BitWidth == 1)
-rv.Int1Val = ((bool(*)())(intptr_t)FPtr)();
+rv.IntVal = APInt(BitWidth, ((bool(*)())(intptr_t)FPtr)());
   else if (BitWidth = 8)
-rv.Int8Val = ((char(*)())(intptr_t)FPtr)();
+rv.IntVal = APInt(BitWidth, ((char(*)())(intptr_t)FPtr)());
   else if (BitWidth = 16)
-rv.Int16Val = ((short(*)())(intptr_t)FPtr)();
+rv.IntVal = APInt(BitWidth, ((short(*)())(intptr_t)FPtr)());
   else if (BitWidth = 32)
-rv.Int32Val = ((int(*)())(intptr_t)FPtr)();
+rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)());
   else if (BitWidth = 64)
-rv.Int64Val = ((int64_t(*)())(intptr_t)FPtr)();
+rv.IntVal = APInt(BitWidth, ((int64_t(*)())(intptr_t)FPtr)());
   else 
 assert(0  Integer types  64 bits not supported);
   return rv;
 }
 case Type::VoidTyID:
-  rv.Int32Val = ((int(*)())(intptr_t)FPtr)();
+  rv.IntVal = APInt(32, ((int(*)())(intptr_t)FPtr)());
   return rv;
 case Type::FloatTyID:
   rv.FloatVal = ((float(*)())(intptr_t)FPtr)();
@@ -194,24 +196,9 @@
 const GenericValue AV = ArgValues[i];
 switch (ArgTy-getTypeID()) {
 default: assert(0  Unknown argument type for function call!);
-case Type::IntegerTyID: {
-  unsigned BitWidth = castIntegerType(ArgTy)-getBitWidth();
-  if (BitWidth == 1)
-C = ConstantInt::get(ArgTy, AV.Int1Val);
-  else if (BitWidth = 8)
-C = ConstantInt::get(ArgTy, AV.Int8Val);
-  else if (BitWidth = 16)
-C = ConstantInt::get(ArgTy, AV.Int16Val);
-  else if (BitWidth = 32)
-C = ConstantInt::get(ArgTy, AV.Int32Val); 
-  else if (BitWidth = 64)
-C = ConstantInt::get(ArgTy, AV.Int64Val);
-  else
-assert(0  Integer types  64 bits not supported);
-  break;
-}
-case Type::FloatTyID:  C = ConstantFP ::get(ArgTy, AV.FloatVal);  break;
-case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break;
+case Type::IntegerTyID: C = ConstantInt::get(AV.IntVal); break;
+case Type::FloatTyID:   C = ConstantFP ::get(ArgTy, AV.FloatVal);  break;
+case Type::DoubleTyID:  C = ConstantFP ::get(ArgTy, AV.DoubleVal); break;
 case Type::PointerTyID:
   void *ArgPtr = GVTOP(AV);
   if (sizeof(void*) == 4) {



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


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.68 - 1.69
---
Log message:

Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.


---
Diffs of the changes:  (+7 -5)

 lli.cpp |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.68 llvm/tools/lli/lli.cpp:1.69
--- llvm/tools/lli/lli.cpp:1.68 Sat Mar  3 12:21:44 2007
+++ llvm/tools/lli/lli.cpp  Mon Mar  5 21:12:55 2007
@@ -124,6 +124,10 @@
   return -1;
 }
 
+// If the program doesn't explicitly call exit, we will need the Exit 
+// function later on to make an explicit call, so get the function now. 
+Constant *Exit = Mod-getOrInsertFunction(exit, Type::VoidTy,
+  Type::Int32Ty, NULL);
 // Run static constructors.
 EE-runStaticConstructorsDestructors(false);
 
@@ -133,14 +137,12 @@
 // Run static destructors.
 EE-runStaticConstructorsDestructors(true);
 
-// If the program didn't explicitly call exit, call exit now, for the
-// program. This ensures that any atexit handlers get called correctly.
-Constant *Exit = Mod-getOrInsertFunction(exit, Type::VoidTy,
-  Type::Int32Ty, NULL);
+// If the program didn't call exit explicitly, we should call it now. 
+// This ensures that any atexit handlers get called correctly.
 if (Function *ExitF = dyn_castFunction(Exit)) {
   std::vectorGenericValue Args;
   GenericValue ResultGV;
-  ResultGV.Int32Val = Result;
+  ResultGV.IntVal = APInt(32, Result);
   Args.push_back(ResultGV);
   EE-runFunction(ExitF, Args);
   std::cerr  ERROR: exit(  Result  ) returned!\n;



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.173 - 1.174
---
Log message:

Fix a bug in IntToPtr. Truncating to 64-bits only works if the integer
is larger. Adjust so that it truncates to pointer width, only if necessary.


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

 Execution.cpp |6 +-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.173 
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.174
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.173Mon Mar  5 
21:09:31 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp  Mon Mar  5 21:41:50 2007
@@ -1058,7 +1058,11 @@
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
   assert(isaPointerType(DstTy)  Invalid PtrToInt instruction);
 
-  Dest.PointerVal = (PointerTy) Src.IntVal.trunc(64).getZExtValue();
+  uint32_t PtrSize = TD.getPointerSize();
+  if (PtrSize != Src.IntVal.getBitWidth())
+Src.IntVal = Src.IntVal.trunc(PtrSize);
+
+  Dest.PointerVal = (PointerTy) Src.IntVal.getZExtValue();
   return Dest;
 }
 



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.174 - 1.175
---
Log message:

Fix some thinko's in the last patch. PtrSize has to be in bits and we 
might need to zext not just trunc the value.


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

 Execution.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.174 
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.175
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.174Mon Mar  5 
21:41:50 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp  Mon Mar  5 21:46:41 2007
@@ -1058,9 +1058,9 @@
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
   assert(isaPointerType(DstTy)  Invalid PtrToInt instruction);
 
-  uint32_t PtrSize = TD.getPointerSize();
+  uint32_t PtrSize = TD.getPointerSizeInBits();
   if (PtrSize != Src.IntVal.getBitWidth())
-Src.IntVal = Src.IntVal.trunc(PtrSize);
+Src.IntVal = Src.IntVal.zextOrTrunc(PtrSize);
 
   Dest.PointerVal = (PointerTy) Src.IntVal.getZExtValue();
   return Dest;



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


[llvm-commits] [124625] Don't enable unrolling at -Os.

2007-03-05 Thread johannes
Revision: 124625
Author:   johannes
Date: 2007-03-05 18:43:49 -0800 (Mon, 05 Mar 2007)

Log Message:
---
Don't enable unrolling at -Os.

Modified Paths:
--
apple-local/branches/llvm/gcc/opts.c

Modified: apple-local/branches/llvm/gcc/opts.c
===
--- apple-local/branches/llvm/gcc/opts.c2007-03-06 02:26:56 UTC (rev 
124624)
+++ apple-local/branches/llvm/gcc/opts.c2007-03-06 02:43:49 UTC (rev 
124625)
@@ -576,7 +576,7 @@
}
   /* APPLE LOCAL begin LLVM */
   /* Enable loop unrolling at -O2 if -f[no-]unroll-loops is not used.  */
-  if (!flag_unroll_loops_set)
+  if (!flag_unroll_loops_set  !optimize_size)
 flag_unroll_loops = 1;
   /* APPLE LOCAL end LLVM */
 }


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


[llvm-commits] CVS: llvm-test/Makefile.programs

2007-03-05 Thread Chris Lattner


Changes in directory llvm-test:

Makefile.programs updated: 1.258 - 1.259
---
Log message:

ppc llc-beta can be just tail merging.


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

 Makefile.programs |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.258 llvm-test/Makefile.programs:1.259
--- llvm-test/Makefile.programs:1.258   Mon Mar  5 21:07:59 2007
+++ llvm-test/Makefile.programs Mon Mar  5 22:53:45 2007
@@ -211,8 +211,8 @@
 endif#DISABLE_DIFFS
 
 ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION :=  --enable-ppc-preinc  --enable-tail-merge
-#--enable-tail-merge
+LLCBETAOPTION :=  --enable-tail-merge
+# --enable-ppc-preinc
 #-regalloc=local -fast
 endif
 ifeq ($(ARCH),Alpha)



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


[llvm-commits] CVS: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h

2007-03-05 Thread Reid Spencer


Changes in directory llvm/include/llvm/ExecutionEngine:

ExecutionEngine.h updated: 1.44 - 1.45
---
Log message:

Make StoreValueToMemory a little more efficient by not copying a 
GenericValue to a temporary.


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

 ExecutionEngine.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h
diff -u llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.44 
llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.45
--- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.44Mon Mar  5 
21:01:54 2007
+++ llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Mon Mar  5 23:02:28 2007
@@ -176,7 +176,7 @@
   const GlobalValue *getGlobalValueAtAddress(void *Addr);
 
 
-  void StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty);
+  void StoreValueToMemory(const GenericValue Val, GenericValue *Ptr, const 
Type *Ty);
   void InitializeMemory(const Constant *Init, void *Addr);
 
   /// recompileAndRelinkFunction - This method is used to force a function



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.111 - 1.112
---
Log message:

1. Make StoreValueToMemory a little more efficient by not requiring caller
   to make a copy of the GenericValue.
2. Fix a copy  paste bug in StoreValueToMemory where 64-bit values were 
   truncated to 32


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

 ExecutionEngine.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111 
llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.112
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.111  Mon Mar  5 21:04:04 2007
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cppMon Mar  5 23:03:16 2007
@@ -410,7 +410,7 @@
 /// It is not a pointer to a GenericValue containing the address at which to
 /// store Val.
 ///
-void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
+void ExecutionEngine::StoreValueToMemory(const GenericValue Val, GenericValue 
*Ptr,
  const Type *Ty) {
   switch (Ty-getTypeID()) {
   case Type::IntegerTyID: {
@@ -423,7 +423,7 @@
 } else if (BitWidth = 32) {
   *((uint32_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue());
 } else if (BitWidth = 64) {
-  *((uint64_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue());
+  *((uint64_t*)Ptr) = uint64_t(Val.IntVal.getZExtValue());
 } else {
   uint64_t *Dest = (uint64_t*)Ptr;
   const uint64_t *Src = Val.IntVal.getRawData();



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


[llvm-commits] CVS: llvm/lib/System/Disassembler.cpp

2007-03-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/System:

Disassembler.cpp updated: 1.2 - 1.3
---
Log message:

Implement PR1240: http://llvm.org/PR1240 


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

 Disassembler.cpp |   10 ++
 1 files changed, 10 insertions(+)


Index: llvm/lib/System/Disassembler.cpp
diff -u llvm/lib/System/Disassembler.cpp:1.2 
llvm/lib/System/Disassembler.cpp:1.3
--- llvm/lib/System/Disassembler.cpp:1.2Sun Mar  4 00:36:24 2007
+++ llvm/lib/System/Disassembler.cppMon Mar  5 23:32:48 2007
@@ -26,6 +26,16 @@
 
 using namespace llvm;
 
+bool llvm::sys::hasDisassembler(void) 
+{
+#if defined (__i386__) || defined (__amd64__) || defined (__x86_64__)
+  // We have option to enable udis86 library.
+  return true;
+#else
+  return false;
+#endif
+}
+
 std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
  uint64_t pc) {
   std::stringstream res;



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


[llvm-commits] CVS: llvm/include/llvm/System/Disassembler.h

2007-03-05 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/System:

Disassembler.h updated: 1.1 - 1.2
---
Log message:

Implement PR1240: http://llvm.org/PR1240 


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

 Disassembler.h |4 
 1 files changed, 4 insertions(+)


Index: llvm/include/llvm/System/Disassembler.h
diff -u llvm/include/llvm/System/Disassembler.h:1.1 
llvm/include/llvm/System/Disassembler.h:1.2
--- llvm/include/llvm/System/Disassembler.h:1.1 Tue Jan 23 04:26:08 2007
+++ llvm/include/llvm/System/Disassembler.h Mon Mar  5 23:32:48 2007
@@ -21,6 +21,10 @@
 namespace llvm {
 namespace sys {
 
+/// This function returns true, if there is possible to use some external
+/// disassembler library. False otherwise.
+bool hasDisassembler(void); 
+
 /// This function provides some glue code to call external disassembler
 /// libraries.
 std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp

2007-03-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/ExecutionEngine/JIT:

JITEmitter.cpp updated: 1.130 - 1.131
---
Log message:

Implement PR1240: http://llvm.org/PR1240 


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

 JITEmitter.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.130 
llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.131
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.130   Fri Feb 23 20:57:03 2007
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Mar  5 23:32:48 2007
@@ -876,8 +876,9 @@
   Relocations.clear();
 
 #ifndef NDEBUG
-  DOUT  Disassembled code:\n
-sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
+  if (sys::hasDisassembler())
+DOUT  Disassembled code:\n
+  sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
 #endif
   
   return false;



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h

2007-03-05 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGISel.h updated: 1.31 - 1.32
---
Log message:

Enumerate SDISel formal parameter attributes. Make use of new 
enumeration.


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

 SelectionDAGISel.h |   14 ++
 1 files changed, 14 insertions(+)


Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.31 
llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.32
--- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.31   Sat Oct 28 13:21:29 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGISel.hTue Mar  6 00:10:33 2007
@@ -31,6 +31,20 @@
   class FunctionLoweringInfo;
   class HazardRecognizer;
 
+  namespace SDISelParamFlags {
+enum Flags {
+  NoFlagSet = 0,
+  Signed= 10,
+  SignedOffs= 0,
+  InReg = 11,
+  InRegOffs = 1,
+  StructReturn  = 12,
+  StructReturnOffs  = 2,
+  OrigAlignment = 0x1F27,
+  OrigAlignmentOffs = 27
+};
+  }
+  
 /// SelectionDAGISel - This is the common base class used for 
SelectionDAG-based
 /// pattern-matching instruction selectors.
 class SelectionDAGISel : public FunctionPass {



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


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

2007-03-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.380 - 1.381
---
Log message:

Enumerate SDISel formal parameter attributes. Make use of new 
enumeration.


---
Diffs of the changes:  (+24 -22)

 SelectionDAGISel.cpp |   46 --
 1 files changed, 24 insertions(+), 22 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.380 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.381
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.380Sun Mar  4 
18:00:42 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue Mar  6 00:10:33 2007
@@ -3099,22 +3099,21 @@
   for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
I != E; ++I, ++j) {
 MVT::ValueType VT = getValueType(I-getType());
-bool isInReg = FTy-paramHasAttr(j, FunctionType::InRegAttribute);
-bool isSRet  = FTy-paramHasAttr(j, FunctionType::StructRetAttribute);
+unsigned Flags = SDISelParamFlags::NoFlagSet;
 unsigned OriginalAlignment =
   getTargetData()-getABITypeAlignment(I-getType());
-// Flags[31:27] - OriginalAlignment
-// Flags[2] - isSRet
-// Flags[1] - isInReg
-// Flags[0] - isSigned
-unsigned Flags = (isInReg  1) | (isSRet  2) | (OriginalAlignment  
27);
 
 // FIXME: Distinguish between a formal with no [sz]ext attribute from one
 // that is zero extended!
 if (FTy-paramHasAttr(j, FunctionType::ZExtAttribute))
-  Flags |= 0;
+  Flags = ~(SDISelParamFlags::Signed);
 if (FTy-paramHasAttr(j, FunctionType::SExtAttribute))
-  Flags |= 1;
+  Flags |= SDISelParamFlags::Signed;
+if (FTy-paramHasAttr(j, FunctionType::InRegAttribute))
+  Flags |= SDISelParamFlags::InReg;
+if (FTy-paramHasAttr(j, FunctionType::StructRetAttribute))
+  Flags |= SDISelParamFlags::StructReturn;
+Flags |= (OriginalAlignment  SDISelParamFlags::OrigAlignmentOffs);
 
 switch (getTypeAction(VT)) {
 default: assert(0  Unknown type action!);
@@ -3136,7 +3135,9 @@
 for (unsigned i = 0; i != NumVals; ++i) {
   RetVals.push_back(NVT);
   // if it isn't first piece, alignment must be 1
-  if (i == 1) Flags = (Flags  0x07ff) | (1  27);
+  if (i  0)
+Flags = (Flags  (~SDISelParamFlags::OrigAlignment)) |
+  (1  SDISelParamFlags::OrigAlignmentOffs);
   Ops.push_back(DAG.getConstant(Flags, MVT::i32));
 }
   } else {
@@ -3245,7 +3246,8 @@
   if (TLI.getTypeAction(VT) != TargetLowering::Expand) {
 // if it isn't first piece, alignment must be 1
 if (!isFirst)
-  Flags = (Flags  0x07ff) | (1  27);
+  Flags = (Flags  (~SDISelParamFlags::OrigAlignment)) |
+(1  SDISelParamFlags::OrigAlignmentOffs);
 Ops.push_back(Arg);
 Ops.push_back(DAG.getConstant(Flags, MVT::i32));
 return;
@@ -3292,18 +3294,18 @@
   for (unsigned i = 0, e = Args.size(); i != e; ++i) {
 MVT::ValueType VT = getValueType(Args[i].Ty);
 SDOperand Op = Args[i].Node;
-bool isSigned = Args[i].isSigned;
-bool isInReg = Args[i].isInReg;
-bool isSRet  = Args[i].isSRet;
+unsigned Flags = SDISelParamFlags::NoFlagSet;
 unsigned OriginalAlignment =
   getTargetData()-getABITypeAlignment(Args[i].Ty);
-// Flags[31:27] - OriginalAlignment
-// Flags[2] - isSRet
-// Flags[1] - isInReg
-// Flags[0] - isSigned
-unsigned Flags = (isSRet  2) | (isInReg  1) | unsigned(isSigned) |
-  (OriginalAlignment  27);
-
+
+if (Args[i].isSigned)
+  Flags |= SDISelParamFlags::Signed;
+if (Args[i].isInReg)
+  Flags |= SDISelParamFlags::InReg;
+if (Args[i].isSRet)
+  Flags |= SDISelParamFlags::StructReturn;
+Flags |= OriginalAlignment  SDISelParamFlags::OrigAlignmentOffs;
+
 switch (getTypeAction(VT)) {
 default: assert(0  Unknown type action!);
 case Legal:
@@ -3312,7 +3314,7 @@
   break;
 case Promote:
   if (MVT::isInteger(VT)) {
-unsigned ExtOp = isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; 
+unsigned ExtOp = Args[i].isSigned ? ISD::SIGN_EXTEND : 
ISD::ZERO_EXTEND;
 Op = DAG.getNode(ExtOp, getTypeToTransformTo(VT), Op);
   } else {
 assert(MVT::isFloatingPoint(VT)  Not int or FP?);



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


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

2007-03-05 Thread Chris Lattner


Changes in directory llvm/docs:

GettingStarted.html updated: 1.155 - 1.156
---
Log message:

llvm-gcc 3.4 is dead.


---
Diffs of the changes:  (+5 -10)

 GettingStarted.html |   15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)


Index: llvm/docs/GettingStarted.html
diff -u llvm/docs/GettingStarted.html:1.155 llvm/docs/GettingStarted.html:1.156
--- llvm/docs/GettingStarted.html:1.155 Wed Feb 14 01:34:22 2007
+++ llvm/docs/GettingStarted.html   Tue Mar  6 00:27:34 2007
@@ -89,7 +89,7 @@
 
 pThe second piece is the GCC front end.  This component provides a version of
 GCC that compiles C and C++ code into LLVM bytecode.  Currently, the GCC front
-end is a modified version of GCC 3.4 (we track the GCC 3.4 development).  Once
+end uses the GCC parser to convert code to LLVM.  Once
 compiled into LLVM bytecode, a program can be manipulated with the LLVM tools
 from the LLVM suite./p
 
@@ -712,14 +712,9 @@
 configured by the LLVM configure script as well as automatically updated when
 you run ttcvs update/tt./p
 
-pIf you would like to get the GCC 3.4 front end source code, you can also 
get it from the CVS repository:/p
-
-pre
-  cvs -z3 -d :pserver:[EMAIL PROTECTED]:/var/cvs/llvm co llvm-gcc
-/pre
-
-pPlease note that you must follow a href=CFEBuildInstrs.htmlthese 
-instructions/a to successfully build the LLVM GCC front-end./p
+pIf you would like to get the GCC front end source code, you can also get it 
+and build it yourself.  Please follow a href=CFEBuildInstrs.htmlthese 
+instructions/a to successfully get and build the LLVM GCC front-end./p
 
 /div
 
@@ -1616,7 +1611,7 @@
   a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
   a href=http://llvm.x10sys.com/rspencer/;Reid Spencer/abr
   a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/02/14 07:34:22 $
+  Last modified: $Date: 2007/03/06 06:27:34 $
 /address
 /body
 /html



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


[llvm-commits] CVS: llvm/examples/Makefile

2007-03-05 Thread Chris Lattner


Changes in directory llvm/examples:

Makefile updated: 1.8 - 1.9
---
Log message:

temporarily disable this until Reid has a chance to fix it.


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

 Makefile |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/examples/Makefile
diff -u llvm/examples/Makefile:1.8 llvm/examples/Makefile:1.9
--- llvm/examples/Makefile:1.8  Thu Nov 30 18:37:14 2006
+++ llvm/examples/Makefile  Tue Mar  6 01:30:03 2007
@@ -10,10 +10,10 @@
 
 include $(LEVEL)/Makefile.config
 
-PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker BFtoLLVM
+#PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker BFtoLLVM
 
 ifeq ($(HAVE_PTHREAD),1)
-PARALLEL_DIRS += ParallelJIT 
+#PARALLEL_DIRS += ParallelJIT 
 endif
 
 include $(LEVEL)/Makefile.common



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