[llvm-commits] CVS: llvm/lib/Target/README.txt

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Target:

README.txt updated: 1.41 - 1.42
---
Log message:

add a note about a general improvement to the code generator


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

 README.txt |   16 +++-
 1 files changed, 15 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.41 llvm/lib/Target/README.txt:1.42
--- llvm/lib/Target/README.txt:1.41 Mon Sep 25 12:12:14 2006
+++ llvm/lib/Target/README.txt  Thu Sep 28 01:01:17 2006
@@ -1,6 +1,20 @@
 Target Independent Opportunities:
 
-===-===
+//===-===//
+
+We should make the following changes to clean up MachineInstr:
+
+1. Add an Opcode field to TargetInstrDescriptor, so you can tell the opcode of
+   an instruction with just a TargetInstrDescriptor*.
+2. Remove the Opcode field from MachineInstr, replacing it with a
+   TargetInstrDescriptor*.
+3. Getting information about a machine instr then becomes:
+ MI-getInfo()-isTwoAddress()
+   instead of:
+ const TargetInstrInfo TII = ...
+ TII.isTwoAddrInstr(MI-getOpcode())
+
+//===-===//
 
 FreeBench/mason contains code like this:
 



___
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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.280 - 1.281
---
Log message:

refactor critical edge breaking out into the SplitCritEdgesForPHIConstants 
method.
This is a baby step towards fixing PR925: http://llvm.org/PR925 .


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

 SelectionDAGISel.cpp |   29 -
 1 files changed, 20 insertions(+), 9 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.281
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280Tue Sep 26 
15:02:30 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Thu Sep 28 01:17:10 2006
@@ -845,8 +845,6 @@
   CurMBB-addSuccessor(CB.RHSBB);
 }
 
-/// visitSwitchCase - Emits the necessary code to represent a single node in
-/// the binary search tree resulting from lowering a switch instruction.
 void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable JT) {
   // FIXME: Need to emit different code for PIC vs. Non-PIC, specifically,
   // we need to add the address of the jump table to the value loaded, since
@@ -3207,6 +3205,21 @@
   return true;
 }
 
+/// SplitCritEdgesForPHIConstants - If this block has any PHI nodes with
+/// constant operands, and if any of the edges feeding the PHI node are
+/// critical, split them so that the assignments of a constant to a register
+/// will not be executed on a path that isn't relevant.
+void SelectionDAGISel::SplitCritEdgesForPHIConstants(BasicBlock *BB) {
+  PHINode *PN;
+  BasicBlock::iterator BBI = BB-begin();
+  while ((PN = dyn_castPHINode(BBI++))) {
+for (unsigned i = 0, e = PN-getNumIncomingValues(); i != e; ++i)
+  if (isaConstant(PN-getIncomingValue(i)))
+SplitCriticalEdge(PN-getIncomingBlock(i), BB);
+  }
+}
+
+
 bool SelectionDAGISel::runOnFunction(Function Fn) {
   MachineFunction MF = MachineFunction::construct(Fn, 
TLI.getTargetMachine());
   RegMap = MF.getSSARegMap();
@@ -3225,14 +3238,12 @@
   while (MadeChange) {
 MadeChange = false;
   for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
-PHINode *PN;
-BasicBlock::iterator BBI;
-for (BBI = BB-begin(); (PN = dyn_castPHINode(BBI)); ++BBI)
-  for (unsigned i = 0, e = PN-getNumIncomingValues(); i != e; ++i)
-if (isaConstant(PN-getIncomingValue(i)))
-  SplitCriticalEdge(PN-getIncomingBlock(i), BB);
+// If this block has any PHI nodes with constant operands, and if any of 
the
+// edges feeding the PHI node are critical, split them.
+if (isaPHINode(BB-begin()))
+  SplitCritEdgesForPHIConstants(BB);
 
-for (BasicBlock::iterator E = BB-end(); BBI != E; ) {
+for (BasicBlock::iterator BBI = BB-begin(), E = BB-end(); BBI != E; ) {
   Instruction *I = BBI++;
   if (GetElementPtrInst *GEPI = dyn_castGetElementPtrInst(I)) {
 MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData());



___
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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGISel.h updated: 1.24 - 1.25
---
Log message:

refactor critical edge breaking out into the SplitCritEdgesForPHIConstants 
method.
This is a baby step towards fixing PR925: http://llvm.org/PR925 .


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

 SelectionDAGISel.h |1 +
 1 files changed, 1 insertion(+)


Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24 
llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.25
--- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24   Mon Aug  7 17:16:08 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGISel.hThu Sep 28 01:17:10 2006
@@ -124,6 +124,7 @@
  SelectionDAG DAG);
 
 private:
+  void SplitCritEdgesForPHIConstants(BasicBlock *BB);
   SDOperand CopyValueToVirtualRegister(SelectionDAGLowering SDL,
Value *V, unsigned Reg);
   void SelectBasicBlock(BasicBlock *BB, MachineFunction MF,



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


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

2006-09-28 Thread Bill Wendling


Changes in directory llvm/lib/CodeGen:

PHIElimination.cpp updated: 1.50 - 1.51
---
Log message:

Once more into the breach, dear friends, once more, or fill the wall up
with our English dead.

No! Really! Serious this time...It was how the vreg uses were being
adjusted that was causing hte Olden tests to fail. I corrected this and
the Olden and Regression tests all passed.


---
Diffs of the changes:  (+42 -26)

 PHIElimination.cpp |   68 -
 1 files changed, 42 insertions(+), 26 deletions(-)


Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.50 
llvm/lib/CodeGen/PHIElimination.cpp:1.51
--- llvm/lib/CodeGen/PHIElimination.cpp:1.50Wed Sep 27 19:11:54 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Thu Sep 28 02:10:24 2006
@@ -34,12 +34,15 @@
   
   struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
 bool runOnMachineFunction(MachineFunction Fn) {
+  analyzePHINodes(Fn);
+
   bool Changed = false;
 
   // Eliminate PHI instructions by inserting copies into predecessor 
blocks.
   for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
 Changed |= EliminatePHINodes(Fn, *I);
 
+  VRegPHIUseCount.clear();
   return Changed;
 }
 
@@ -54,15 +57,26 @@
 ///
 bool EliminatePHINodes(MachineFunction MF, MachineBasicBlock MBB);
 void LowerAtomicPHINode(MachineBasicBlock MBB,
-MachineBasicBlock::iterator AfterPHIsIt,
-DenseMapunsigned, VirtReg2IndexFunctor VUC);
+MachineBasicBlock::iterator AfterPHIsIt);
+
+/// analyzePHINodes - Gather information about the PHI nodes in
+/// here. In particular, we want to map the number of uses of a virtual
+/// register which is used in a PHI node. We map that to the BB the
+/// vreg is coming from. This is used later to determine when the vreg
+/// is killed in the BB.
+///
+void analyzePHINodes(const MachineFunction Fn);
+
+typedef std::pairconst MachineBasicBlock*, unsigned BBVRegPair;
+typedef std::mapBBVRegPair, unsigned VRegPHIUse;
+
+VRegPHIUse VRegPHIUseCount;
   };
 
   RegisterPassPNE X(phi-node-elimination,
   Eliminate PHI nodes for register allocation);
 }
 
-
 const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
 
 /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -72,20 +86,6 @@
   if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
 return false;   // Quick exit for basic blocks without PHIs.
 
-  // VRegPHIUseCount - Keep track of the number of times each virtual register
-  // is used by PHI nodes in successors of this block.
-  DenseMapunsigned, VirtReg2IndexFunctor VRegPHIUseCount;
-  VRegPHIUseCount.grow(MF.getSSARegMap()-getLastVirtReg());
-
-  for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
- E = MBB.pred_end(); PI != E; ++PI)
-for (MachineBasicBlock::succ_iterator SI = (*PI)-succ_begin(),
-   E = (*PI)-succ_end(); SI != E; ++SI)
-  for (MachineBasicBlock::iterator BBI = (*SI)-begin(), E = (*SI)-end();
-   BBI != E  BBI-getOpcode() == TargetInstrInfo::PHI; ++BBI)
-for (unsigned i = 1, e = BBI-getNumOperands(); i != e; i += 2)
-  VRegPHIUseCount[BBI-getOperand(i).getReg()]++;
-  
   // Get an iterator to the first instruction after the last PHI node (this may
   // also be the end of the basic block).
   MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
  AfterPHIsIt-getOpcode() == TargetInstrInfo::PHI)
 ++AfterPHIsIt;// Skip over all of the PHI nodes...
 
-  while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
-LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
-  }
+  while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
+LowerAtomicPHINode(MBB, AfterPHIsIt);
+
   return true;
 }
 
@@ -115,14 +115,13 @@
 /// atomic execution of PHIs.  This lowering method is always correct all of 
the
 /// time.
 void PNE::LowerAtomicPHINode(MachineBasicBlock MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
-   DenseMapunsigned, VirtReg2IndexFunctor VRegPHIUseCount) {
+ MachineBasicBlock::iterator AfterPHIsIt) {
   // Unlink the PHI node from the basic block, but don't delete the PHI yet.
   MachineInstr *MPhi = MBB.remove(MBB.begin());
 
   unsigned DestReg = MPhi-getOperand(0).getReg();
 
-  // Create a new register for the incoming PHI arguments/
+  // Create a new register for the incoming PHI arguments.
   MachineFunction MF = *MBB.getParent();
   const TargetRegisterClass *RC = MF.getSSARegMap()-getRegClass(DestReg);
   unsigned IncomingReg = MF.getSSARegMap()-createVirtualRegister(RC);
@@ -165,9 +164,10 @@
 
   // Adjust the VRegPHIUseCount map to account for the removal of this PHI
   // node.
-  unsigned 

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

2006-09-28 Thread Reid Spencer


Changes in directory llvm/docs:

WritingAnLLVMPass.html updated: 1.49 - 1.50
---
Log message:

Provide a gdb usage fix provided by Zhongzing Xu.


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

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


Index: llvm/docs/WritingAnLLVMPass.html
diff -u llvm/docs/WritingAnLLVMPass.html:1.49 
llvm/docs/WritingAnLLVMPass.html:1.50
--- llvm/docs/WritingAnLLVMPass.html:1.49   Sun Aug 27 19:45:38 2006
+++ llvm/docs/WritingAnLLVMPass.htmlThu Sep 28 11:53:47 2006
@@ -1593,7 +1593,7 @@
 want:/p
 
 div class=doc_codepre
-(gdb) bbreak PassManager::run/b
+(gdb) bbreak llvm::PassManager::run/b
 Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
 (gdb) brun test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so 
-[passoption]/b
 Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so 
-[passoption]
@@ -1711,7 +1711,7 @@
 
   a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
   a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/08/28 00:45:38 $
+  Last modified: $Date: 2006/09/28 16:53:47 $
 /address
 
 /body



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


[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl

2006-09-28 Thread Jim Laskey


Changes in directory llvm/utils:

NewNightlyTest.pl updated: 1.60 - 1.61
---
Log message:

Add support for -release-asserts.

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

 NewNightlyTest.pl |   10 +-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/utils/NewNightlyTest.pl
diff -u llvm/utils/NewNightlyTest.pl:1.60 llvm/utils/NewNightlyTest.pl:1.61
--- llvm/utils/NewNightlyTest.pl:1.60   Wed Sep 20 04:20:22 2006
+++ llvm/utils/NewNightlyTest.plThu Sep 28 12:49:20 2006
@@ -29,6 +29,7 @@
 #  -nodejagnu   Do not run feature or regression tests
 #  -parallelRun two parallel jobs with GNU Make.
 #  -release Build an LLVM Release version
+#  -release-asserts Build an LLVM ReleaseAsserts version
 #  -enable-llcbeta  Enable testing of beta features in llc.
 #  -disable-llc Disable LLC tests in the nightly tester.
 #  -disable-jit Disable JIT tests in the nightly tester.
@@ -133,6 +134,9 @@
   if (/^-parallel$/)   { $MAKEOPTS = $MAKEOPTS -j2 -l3.0; next; }
   if (/^-release$/){ $MAKEOPTS = $MAKEOPTS ENABLE_OPTIMIZED=1 .
  OPTIMIZE_OPTION=-O2; $BUILDTYPE=release; 
next;}
+  if (/^-release-asserts$/){ $MAKEOPTS = $MAKEOPTS ENABLE_OPTIMIZED=1 .
+ DISABLE-ASSERTIONS=1 .
+ OPTIMIZE_OPTION=-O2; 
$BUILDTYPE=release-asserts; next;}
   if (/^-enable-llcbeta$/) { $PROGTESTOPTS .=  ENABLE_LLCBETA=1; next; }
   if (/^-disable-llc$/){ $PROGTESTOPTS .=  DISABLE_LLC=1;
  $CONFIGUREARGS .=  --disable-llc_diffs; next; } 
@@ -206,7 +210,7 @@
\-nickname nickname\);
 }
 
-if ($BUILDTYPE ne release) {
+if ($BUILDTYPE ne release  $BUILDTYPE ne release-asserts) {
   $BUILDTYPE = debug;
 }
 
@@ -657,6 +661,8 @@
   $afiles.= `find tools/ -iname '*.a' -ls`;
   if($BUILDTYPE eq release){
 $afiles.= `find Release/ -iname '*.a' -ls`;
+  } elsif($BUILDTYPE eq release-asserts) {
+   $afiles.= `find Release-Asserts/ -iname '*.a' -ls`;
   } else {
$afiles.= `find Debug/ -iname '*.a' -ls`;
   }
@@ -666,6 +672,8 @@
   $ofiles.= `find tools/ -iname '*.o' -ls`;
   if($BUILDTYPE eq release){
 $ofiles.= `find Release/ -iname '*.o' -ls`;
+  } elsif($BUILDTYPE eq release-asserts) {
+$ofiles.= `find Release-Asserts/ -iname '*.o' -ls`;
   } else {
 $ofiles.= `find Debug/ -iname '*.o' -ls`;
   }



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


[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl

2006-09-28 Thread Jim Laskey


Changes in directory llvm/utils:

NewNightlyTest.pl updated: 1.61 - 1.62
---
Log message:

Fix search file for -release.

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

 NewNightlyTest.pl |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/utils/NewNightlyTest.pl
diff -u llvm/utils/NewNightlyTest.pl:1.61 llvm/utils/NewNightlyTest.pl:1.62
--- llvm/utils/NewNightlyTest.pl:1.61   Thu Sep 28 12:49:20 2006
+++ llvm/utils/NewNightlyTest.plThu Sep 28 13:45:11 2006
@@ -660,7 +660,7 @@
   $afiles.= `find lib/ -iname '*.a' -ls`;
   $afiles.= `find tools/ -iname '*.a' -ls`;
   if($BUILDTYPE eq release){
-$afiles.= `find Release/ -iname '*.a' -ls`;
+$afiles.= `find Release+Asserts/ -iname '*.a' -ls`;
   } elsif($BUILDTYPE eq release-asserts) {
$afiles.= `find Release-Asserts/ -iname '*.a' -ls`;
   } else {
@@ -671,7 +671,7 @@
   $ofiles.= `find lib/ -iname '*.o' -ls`;
   $ofiles.= `find tools/ -iname '*.o' -ls`;
   if($BUILDTYPE eq release){
-$ofiles.= `find Release/ -iname '*.o' -ls`;
+$ofiles.= `find Release+Asserts/ -iname '*.o' -ls`;
   } elsif($BUILDTYPE eq release-asserts) {
 $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`;
   } else {



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


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

2006-09-28 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

PrologEpilogInserter.cpp updated: 1.60 - 1.61
---
Log message:

TargetRegisterClass specifies the desired spill alignment. However, it cannot 
be honored if stack alignment is smaller.

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

 PrologEpilogInserter.cpp |7 ++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 
llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.61
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60  Wed Sep 27 19:10:27 2006
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp   Thu Sep 28 13:52:32 2006
@@ -190,7 +190,12 @@
 int FrameIdx;
 if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) {
   // Nope, just spill it anywhere convenient.
-  FrameIdx = FFI-CreateStackObject(RC-getSize(), RC-getAlignment());
+  unsigned Align = RC-getAlignment();
+  unsigned StackAlign = TFI-getStackAlignment();
+  // We may not be able to sastify the desired alignment specification of
+  // the TargetRegisterClass if the stack alignment is smaller. Use the 
min.
+  Align = std::min(Align, StackAlign);
+  FrameIdx = FFI-CreateStackObject(RC-getSize(), Align);
   if ((unsigned)FrameIdx  MinCSFrameIndex) MinCSFrameIndex = FrameIdx;
   if ((unsigned)FrameIdx  MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx;
 } else {



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


[llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c

2006-09-28 Thread Chris Lattner


Changes in directory llvm/test/Regression/CFrontend:

2006-09-28-SimpleAsm.c added (r1.1)
---
Log message:

Testcase for PR924: http://llvm.org/PR924 




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

 2006-09-28-SimpleAsm.c |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c
diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1
*** /dev/null   Thu Sep 28 13:58:12 2006
--- llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c   Thu Sep 28 
13:58:02 2006
***
*** 0 
--- 1,11 
+ // RUN: %llvmgcc %s -S -o /dev/null 
+ // RUN: %llvmgcc %s -S -o - | grep 'ext: xorl %eax, eax; movl' 
+ // RUN: %llvmgcc %s -S -o - | grep 'nonext: xorl %eax, %eax; mov'
+ // PR924
+ 
+ void bar() {
+// Extended asm
+asm volatile (ext: xorl %%eax, eax; movl eax, fs; movl eax, gs  %%blah %= 
%%  : : r(1));
+// Non-extended asm.
+asm volatile (nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs  
%%blah %= %% );
+ }



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll

2006-09-28 Thread Chris Lattner


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

2006-09-28-shift_64.ll added (r1.1)
---
Log message:

new testcase


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

 2006-09-28-shift_64.ll |   27 +++
 1 files changed, 27 insertions(+)


Index: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll:1.1
*** /dev/null   Thu Sep 28 15:48:27 2006
--- llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll Thu Sep 28 
15:48:17 2006
***
*** 0 
--- 1,27 
+ ; RUN: llvm-as  %s | llc -march=ppc64
+ target endian = big
+ target pointersize = 64
+ target triple = powerpc64-apple-darwin8
+ 
+ implementation   ; Functions:
+ 
+ void %glArrayElement_CompExec() {
+ entry:
+   %tmp3 = and ulong 0, 18446744073701163007   ; ulong 
[#uses=1]
+   br label %cond_true24
+ 
+ cond_false:   ; preds = %cond_true24
+   ret void
+ 
+ cond_true24:  ; preds = %cond_true24, %entry
+   %indvar.ph = phi uint [ 0, %entry ], [ %indvar.next, %cond_true24 ] 
; uint [#uses=1]
+   %indvar = add uint 0, %indvar.ph; uint [#uses=2]
+   %code.0 = cast uint %indvar to ubyte; ubyte [#uses=1]
+   %tmp5 = add ubyte %code.0, 16   ; ubyte [#uses=1]
+   %tmp7 = shr ulong %tmp3, ubyte %tmp5; ulong [#uses=1]
+   %tmp7 = cast ulong %tmp7 to int ; int [#uses=1]
+   %tmp8 = and int %tmp7, 1; int [#uses=1]
+   %tmp8 = seteq int %tmp8, 0  ; bool [#uses=1]
+   %indvar.next = add uint %indvar, 1  ; uint [#uses=1]
+   br bool %tmp8, label %cond_false, label %cond_true24
+ }



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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCInstr64Bit.td updated: 1.19 - 1.20
---
Log message:

Shift amounts are always 32-bits, even in 64-bit mode.  This fixes
CodeGen/PowerPC/2006-09-28-shift_64.ll


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

 PPCInstr64Bit.td |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td
diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19 
llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.20
--- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19   Tue Jul 18 11:33:26 2006
+++ llvm/lib/Target/PowerPC/PPCInstr64Bit.tdThu Sep 28 15:48:45 2006
@@ -168,15 +168,15 @@
 def CMPLDI : DForm_6_ext10, (ops CRRC:$dst, G8RC:$src1, u16imm:$src2),
  cmpldi $dst, $src1, $src2, IntCompare, isPPC64;
 
-def SLD  : XForm_631,  27, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
+def SLD  : XForm_631,  27, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
sld $rA, $rS, $rB, IntRotateD,
-   [(set G8RC:$rA, (shl G8RC:$rS, G8RC:$rB))], isPPC64;
-def SRD  : XForm_631, 539, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
+   [(set G8RC:$rA, (shl G8RC:$rS, GPRC:$rB))], isPPC64;
+def SRD  : XForm_631, 539, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
srd $rA, $rS, $rB, IntRotateD,
-   [(set G8RC:$rA, (srl G8RC:$rS, G8RC:$rB))], isPPC64;
-def SRAD : XForm_631, 794, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
+   [(set G8RC:$rA, (srl G8RC:$rS, GPRC:$rB))], isPPC64;
+def SRAD : XForm_631, 794, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
srad $rA, $rS, $rB, IntRotateD,
-   [(set G8RC:$rA, (sra G8RC:$rS, G8RC:$rB))], isPPC64;
+   [(set G8RC:$rA, (sra G8RC:$rS, GPRC:$rB))], isPPC64;
 def EXTSW  : XForm_1131, 986, (ops G8RC:$rA, G8RC:$rS),
   extsw $rA, $rS, IntGeneral,
   [(set G8RC:$rA, (sext_inreg G8RC:$rS, i32))], isPPC64;



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


[llvm-commits] CVS: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll

2006-09-28 Thread Reid Spencer


Changes in directory llvm/test/Regression/Assembler:

2006-09-28-CrashOnInvalid.ll added (r1.1)
---
Log message:

Add a test case for PR902: http://llvm.org/PR902 .


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

 2006-09-28-CrashOnInvalid.ll |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll
diff -c /dev/null 
llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll:1.1
*** /dev/null   Thu Sep 28 16:20:16 2006
--- llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll Thu Sep 28 
16:20:05 2006
***
*** 0 
--- 1,7 
+ ; Test for PR902.  This program is erroneous, but should not crash llvm-as.
+ ; This tests that a simple error is caught and processed correctly.
+ ; RUN: (llvm-as  %s) 21 | grep 'FP constant invalid for type'
+ void %test() {
+   add int 1, 2.0
+   ret void
+ }



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


[llvm-commits] CVS: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c

2006-09-28 Thread Reid Spencer


Changes in directory llvm/test/Regression/CFrontend:

2005-12-04-AttributeUsed.c updated: 1.1 - 1.2
---
Log message:

Use the -emit-llvm switch to generate LLVM assembly that can be parsed 
by the test case.


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

 2005-12-04-AttributeUsed.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c
diff -u llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1 
llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.2
--- llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1   Sun Dec 
 4 22:48:12 2005
+++ llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c   Thu Sep 28 
16:36:21 2006
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | 
grep X
+// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | 
grep foo | grep X
 
 int X __attribute__((used));
 int Y;



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.206 - 1.207
---
Log message:

simplify code


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

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


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.206 llvm/lib/VMCore/AsmWriter.cpp:1.207
--- llvm/lib/VMCore/AsmWriter.cpp:1.206 Wed Sep 20 17:03:51 2006
+++ llvm/lib/VMCore/AsmWriter.cpp   Thu Sep 28 17:50:29 2006
@@ -421,7 +421,7 @@
   const int IndentSize = 4;
   static std::string Indent = \n;
   if (const ConstantBool *CB = dyn_castConstantBool(CV)) {
-Out  (CB == ConstantBool::True ? true : false);
+Out  (CB-getValue() ? true : false);
   } else if (const ConstantSInt *CI = dyn_castConstantSInt(CV)) {
 Out  CI-getValue();
   } else if (const ConstantUInt *CI = dyn_castConstantUInt(CV)) {



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

CodeExtractor.cpp updated: 1.39 - 1.40
---
Log message:

simplify code


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

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


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39 
llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.40
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39Sun Jan 22 16:53:01 2006
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Thu Sep 28 17:58:25 2006
@@ -470,7 +470,7 @@
   case 0:
   case 1: break;  // No value needed.
   case 2: // Conditional branch, return a bool
-brVal = SuccNum ? ConstantBool::False : ConstantBool::True;
+brVal = ConstantBool::get(!SuccNum);
 break;
   default:
 brVal = ConstantUInt::get(Type::UShortTy, SuccNum);



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

2006-09-28 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.25 - 1.26
---
Log message:

Another attempt at making ArgPromotion smarter.  This patch no longer breaks 
Burg.


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

 ArgumentPromotion.cpp |   50 +-
 1 files changed, 49 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25 
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.26
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25  Fri Sep 15 12:24:45 2006
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp   Thu Sep 28 18:02:22 2006
@@ -179,6 +179,53 @@
   return true;
 }
 
+/// AccessOccursOnPath - Returns true if and only if a load or GEP instruction
+/// on Pointer occurs in Path, or in every control-flow path that succeeds it.
+bool AccessOccursOnPath(Value* V, BasicBlock* Start) {
+  std::vectorBasicBlock* Worklist;
+  Worklist.push_back(Start);
+  
+  std::setBasicBlock* Visited;
+  
+  while (!Worklist.empty()) {
+BasicBlock* BB = Worklist.back();
+Worklist.pop_back();
+Visited.insert(BB);
+
+bool ContainsAccess = false;
+for (BasicBlock::iterator I = BB-begin(), E = BB-end(); I != E; ++I) {
+  if (isaLoadInst(I)) {
+for (Instruction::op_iterator OI = I-op_begin(), OE = I-op_end(); OI 
!= OE; ++OI)
+  if (*OI == V) {
+ContainsAccess = true;
+break;
+  }
+  } else if (isaGetElementPtrInst(I)) {
+for (Instruction::op_iterator OI = I-op_begin(), OE = I-op_end(); OI 
!= OE; ++OI)
+  if (*OI == V) {
+ContainsAccess = AccessOccursOnPath(I, I-getParent());
+break;
+  }
+  }
+  
+  if (ContainsAccess)
+  break;
+}
+
+if (ContainsAccess) continue;
+
+TerminatorInst* TI = BB-getTerminator();
+if (isaBranchInst(TI) || isaSwitchInst(TI)) {
+  for (unsigned i = 0; i  TI-getNumSuccessors(); ++i)
+if (!Visited.count(TI-getSuccessor(i)))
+  Worklist.push_back(TI-getSuccessor(i));
+} else {
+  return false;
+}
+  }
+  
+  return true;
+}
 
 /// isSafeToPromoteArgument - As you might guess from the name of this method,
 /// it checks to see if it is both safe and useful to promote the argument.
@@ -252,7 +299,8 @@
   // of the pointer in the entry block of the function) or if we can prove that
   // all pointers passed in are always to legal locations (for example, no null
   // pointers are passed in, no pointers to free'd memory, etc).
-  if (!HasLoadInEntryBlock  !AllCalleesPassInValidPointerForArgument(Arg))
+  if (!AccessOccursOnPath(Arg, Arg-getParent()-begin()) 
+  !AllCalleesPassInValidPointerForArgument(Arg))
 return false;   // Cannot prove that this is safe!!
 
   // Okay, now we know that the argument is only used by load instructions and



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.14 - 1.15
---
Log message:

Simplify some code


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

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


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.14 
llvm/lib/Analysis/ConstantRange.cpp:1.15
--- llvm/lib/Analysis/ConstantRange.cpp:1.14Thu Apr 21 18:46:51 2005
+++ llvm/lib/Analysis/ConstantRange.cpp Thu Sep 28 18:14:29 2006
@@ -30,8 +30,8 @@
 using namespace llvm;
 
 static ConstantIntegral *Next(ConstantIntegral *CI) {
-  if (CI-getType() == Type::BoolTy)
-return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True;
+  if (ConstantBool *CB = dyn_castConstantBool(CI))
+return ConstantBool::get(!CB-getValue());
 
   Constant *Result = ConstantExpr::getAdd(CI,
   ConstantInt::get(CI-getType(), 1));



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


[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.271 - 1.272
---
Log message:

Simplify some code, reformat break's


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

 Writer.cpp |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.271 
llvm/lib/Target/CBackend/Writer.cpp:1.272
--- llvm/lib/Target/CBackend/Writer.cpp:1.271   Sun Sep 17 15:25:45 2006
+++ llvm/lib/Target/CBackend/Writer.cpp Thu Sep 28 18:19:29 2006
@@ -638,10 +638,12 @@
 
   switch (CPV-getType()-getTypeID()) {
   case Type::BoolTyID:
-Out  (CPV == ConstantBool::False ? '0' : '1'); break;
+Out  (castConstantBool(CPV)-getValue() ? '1' : '0');
+break;
   case Type::SByteTyID:
   case Type::ShortTyID:
-Out  castConstantSInt(CPV)-getValue(); break;
+Out  castConstantSInt(CPV)-getValue();
+break;
   case Type::IntTyID:
 if ((int)castConstantSInt(CPV)-getValue() == (int)0x8000)
   Out  ((int)0x8000U);   // Handle MININT specially to avoid 
warning
@@ -653,15 +655,19 @@
 if (castConstantSInt(CPV)-isMinValue())
   Out  (/*INT64_MIN*/(-9223372036854775807LL)-1);
 else
-  Out  castConstantSInt(CPV)-getValue()  ll; break;
+  Out  castConstantSInt(CPV)-getValue()  ll;
+break;
 
   case Type::UByteTyID:
   case Type::UShortTyID:
-Out  castConstantUInt(CPV)-getValue(); break;
+Out  castConstantUInt(CPV)-getValue();
+break;
   case Type::UIntTyID:
-Out  castConstantUInt(CPV)-getValue()  'u'; break;
+Out  castConstantUInt(CPV)-getValue()  'u';
+break;
   case Type::ULongTyID:
-Out  castConstantUInt(CPV)-getValue()  ull; break;
+Out  castConstantUInt(CPV)-getValue()  ull;
+break;
 
   case Type::FloatTyID:
   case Type::DoubleTyID: {



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


[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp

2006-09-28 Thread Chris Lattner


Changes in directory llvm/tools/llvm2cpp:

CppWriter.cpp updated: 1.15 - 1.16
---
Log message:

simplify code


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

 CppWriter.cpp |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.15 
llvm/tools/llvm2cpp/CppWriter.cpp:1.16
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.15  Thu Sep 14 13:23:27 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp   Thu Sep 28 18:24:48 2006
@@ -677,8 +677,7 @@
   }
   if (const ConstantBool *CB = dyn_castConstantBool(CV)) {
 Out  ConstantBool*   constName   = ConstantBool::get( 
- (CB == ConstantBool::True ? true : false)
- );;
+ (CB-getValue() ? true : false)  );;
   } else if (const ConstantSInt *CI = dyn_castConstantSInt(CV)) {
 Out  ConstantSInt*   constName   = ConstantSInt::get( 
  typeName  ,   CI-getValue()  );;



___
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/PPCJITInfo.cpp

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCJITInfo.cpp updated: 1.29 - 1.30
---
Log message:

wrap long lines


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

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


Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 
llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.30
--- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 Fri Sep  8 17:42:09 2006
+++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp  Thu Sep 28 18:32:43 2006
@@ -70,7 +70,8 @@
 extern C void PPC32CompilationCallback();
 extern C void PPC64CompilationCallback();
 
-#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER))  
!defined(__ppc64__)
+#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER))  \
+!defined(__ppc64__)
 // CompilationCallback stub - We can't use a C function with inline assembly in
 // it, because we the prolog/epilog inserted by GCC won't work for us.  
Instead,
 // write our own wrapper, which does things our way, so we have complete 
control
@@ -135,7 +136,8 @@
 }
 #endif
 
-#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER))  
defined(__ppc64__)
+#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER))  \
+defined(__ppc64__)
 asm(
 .text\n
 .align 2\n



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.h updated: 1.73 - 1.74
X86InstrInfo.cpp updated: 1.60 - 1.61
---
Log message:

update comments


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

 X86ISelLowering.h |2 +-
 X86InstrInfo.cpp  |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.73 
llvm/lib/Target/X86/X86ISelLowering.h:1.74
--- llvm/lib/Target/X86/X86ISelLowering.h:1.73  Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86ISelLowering.h   Thu Sep 28 18:33:12 2006
@@ -146,7 +146,7 @@
   /// at function entry, used for PIC code.
   GlobalBaseReg,
 
-  /// TCPWrapper - A wrapper node for TargetConstantPool,
+  /// Wrapper - A wrapper node for TargetConstantPool,
   /// TargetExternalSymbol, and TargetGlobalAddress.
   Wrapper,
 


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.60 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.61
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.60   Fri Sep  8 01:48:29 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppThu Sep 28 18:33:12 2006
@@ -213,6 +213,7 @@
 /// commute them.
 ///
 MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const {
+  // FIXME: Can commute cmoves by changing the condition!
   switch (MI-getOpcode()) {
   case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I - A = SHLD16rri8 C, B, 
(16-I)
   case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I - A = SHRD16rri8 C, B, 
(16-I)



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.162 - 1.163
---
Log message:

Eliminate ConstantBool::True and ConstantBool::False.  Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


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

 Constants.cpp |   26 ++
 1 files changed, 18 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.162 llvm/lib/VMCore/Constants.cpp:1.163
--- llvm/lib/VMCore/Constants.cpp:1.162 Wed Sep 27 19:38:19 2006
+++ llvm/lib/VMCore/Constants.cpp   Thu Sep 28 18:34:27 2006
@@ -26,10 +26,6 @@
 #include iostream
 using namespace llvm;
 
-ConstantBool *ConstantBool::True  = new ConstantBool(true);
-ConstantBool *ConstantBool::False = new ConstantBool(false);
-
-
 
//===--===//
 //  Constant Class
 
//===--===//
@@ -128,7 +124,7 @@
 // Static constructor to create the maximum constant of an integral type...
 ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) {
   switch (Ty-getTypeID()) {
-  case Type::BoolTyID:   return ConstantBool::True;
+  case Type::BoolTyID:   return ConstantBool::getTrue();
   case Type::SByteTyID:
   case Type::ShortTyID:
   case Type::IntTyID:
@@ -152,7 +148,7 @@
 // Static constructor to create the minimum constant for an integral type...
 ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) {
   switch (Ty-getTypeID()) {
-  case Type::BoolTyID:   return ConstantBool::False;
+  case Type::BoolTyID:   return ConstantBool::getFalse();
   case Type::SByteTyID:
   case Type::ShortTyID:
   case Type::IntTyID:
@@ -176,7 +172,7 @@
 // Static constructor to create an integral constant with all bits set
 ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {
   switch (Ty-getTypeID()) {
-  case Type::BoolTyID:   return ConstantBool::True;
+  case Type::BoolTyID:   return ConstantBool::getTrue();
   case Type::SByteTyID:
   case Type::ShortTyID:
   case Type::IntTyID:
@@ -877,6 +873,20 @@
   };
 }
 
+
+// ConstantBool::get*() implementation.
+
+ConstantBool *ConstantBool::getTrue() {
+  static ConstantBool *T = 0;
+  if (T) return T;
+  return T = new ConstantBool(true);
+}
+ConstantBool *ConstantBool::getFalse() {
+  static ConstantBool *F = 0;
+  if (F) return F;
+  return F = new ConstantBool(false);
+}
+
 // ConstantUInt::get() and ConstantSInt::get() implementations...
 //
 static ManagedStaticValueMap int64_t, Type, ConstantSInt  SIntConstants;
@@ -1380,7 +1390,7 @@
 C = ConstantExpr::getCast(C, C-getType()-getSignedVersion());
 return ConstantExpr::getCast(C, Ty);
   } else {
-if (C == ConstantBool::True)
+if (C == ConstantBool::getTrue())
   return ConstantIntegral::getAllOnesValue(Ty);
 else
   return ConstantIntegral::getNullValue(Ty);



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.91 - 1.92
---
Log message:

Eliminate ConstantBool::True and ConstantBool::False.  Instead, 
provideConstantBool::getTrue() and ConstantBool::getFalse().


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

 ConstantFolding.cpp |   32 +++-
 1 files changed, 15 insertions(+), 17 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.91 
llvm/lib/VMCore/ConstantFolding.cpp:1.92
--- llvm/lib/VMCore/ConstantFolding.cpp:1.91Sun Sep 17 14:14:47 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Sep 28 18:34:49 2006
@@ -225,7 +225,7 @@
 struct VISIBILITY_HIDDEN EmptyRules
   : public TemplateRulesConstant, EmptyRules {
   static Constant *EqualTo(const Constant *V1, const Constant *V2) {
-if (V1 == V2) return ConstantBool::True;
+if (V1 == V2) return ConstantBool::getTrue();
 return 0;
   }
 };
@@ -296,10 +296,10 @@
 struct VISIBILITY_HIDDEN NullPointerRules
   : public TemplateRulesConstantPointerNull, NullPointerRules {
   static Constant *EqualTo(const Constant *V1, const Constant *V2) {
-return ConstantBool::True;  // Null pointers are always equal
+return ConstantBool::getTrue();  // Null pointers are always equal
   }
   static Constant *CastToBool(const Constant *V) {
-return ConstantBool::False;
+return ConstantBool::getFalse();
   }
   static Constant *CastToSByte (const Constant *V) {
 return ConstantSInt::get(Type::SByteTy, 0);
@@ -729,7 +729,7 @@
   // FIXME: When we support 'external weak' references, we have to prevent
   // this transformation from happening.  This code will need to be updated
   // to ignore external weak symbols when we support it.
-  return ConstantBool::True;
+  return ConstantBool::getTrue();
   } else if (const ConstantExpr *CE = dyn_castConstantExpr(V)) {
 if (CE-getOpcode() == Instruction::Cast) {
   Constant *Op = const_castConstant*(CE-getOperand(0));
@@ -842,10 +842,8 @@
 Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond,
   const Constant *V1,
   const Constant *V2) {
-  if (Cond == ConstantBool::True)
-return const_castConstant*(V1);
-  else if (Cond == ConstantBool::False)
-return const_castConstant*(V2);
+  if (const ConstantBool *CB = dyn_castConstantBool(Cond))
+return const_castConstant*(CB-getValue() ? V1 : V2);
 
   if (isaUndefValue(V1)) return const_castConstant*(V2);
   if (isaUndefValue(V2)) return const_castConstant*(V1);
@@ -1011,11 +1009,11 @@
   // We distilled this down to a simple case, use the standard constant
   // folder.
   ConstantBool *R = dyn_castConstantBool(ConstantExpr::getSetEQ(V1, V2));
-  if (R == ConstantBool::True) return Instruction::SetEQ;
+  if (R  R-getValue()) return Instruction::SetEQ;
   R = dyn_castConstantBool(ConstantExpr::getSetLT(V1, V2));
-  if (R == ConstantBool::True) return Instruction::SetLT;
+  if (R  R-getValue()) return Instruction::SetLT;
   R = dyn_castConstantBool(ConstantExpr::getSetGT(V1, V2));
-  if (R == ConstantBool::True) return Instruction::SetGT;
+  if (R  R-getValue()) return Instruction::SetGT;
   
   // If we couldn't figure it out, bail.
   return Instruction::BinaryOpsEnd;
@@ -1240,20 +1238,20 @@
Opcode == Instruction::SetGE);
 case Instruction::SetLE:
   // If we know that V1 = V2, we can only partially decide this relation.
-  if (Opcode == Instruction::SetGT) return ConstantBool::False;
-  if (Opcode == Instruction::SetLT) return ConstantBool::True;
+  if (Opcode == Instruction::SetGT) return ConstantBool::getFalse();
+  if (Opcode == Instruction::SetLT) return ConstantBool::getTrue();
   break;
 
 case Instruction::SetGE:
   // If we know that V1 = V2, we can only partially decide this relation.
-  if (Opcode == Instruction::SetLT) return ConstantBool::False;
-  if (Opcode == Instruction::SetGT) return ConstantBool::True;
+  if (Opcode == Instruction::SetLT) return ConstantBool::getFalse();
+  if (Opcode == Instruction::SetGT) return ConstantBool::getTrue();
   break;
 
 case Instruction::SetNE:
   // If we know that V1 != V2, we can only partially decide this relation.
-  if (Opcode == Instruction::SetEQ) return ConstantBool::False;
-  if (Opcode == Instruction::SetNE) return ConstantBool::True;
+  if (Opcode == Instruction::SetEQ) return ConstantBool::getFalse();
+  if (Opcode == Instruction::SetNE) return ConstantBool::getTrue();
   break;
 }
   }



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.64 - 1.65
---
Log message:


Eliminate ConstantBool::True and ConstantBool::False.  Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


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

 GlobalOpt.cpp |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.65
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64  Thu Sep 14 13:23:27 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Thu Sep 28 18:35:21 2006
@@ -709,7 +709,7 @@
   // keep track of whether the global was initialized yet or not.
   GlobalVariable *InitBool =
 new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage,
-   ConstantBool::False, GV-getName()+.init);
+   ConstantBool::getFalse(), GV-getName()+.init);
   bool InitBoolUsed = false;
 
   // Loop over all uses of GV, processing them in turn.
@@ -728,7 +728,7 @@
   switch (SCI-getOpcode()) {
   default: assert(0  Unknown opcode!);
   case Instruction::SetLT:
-LV = ConstantBool::False;   // X  null - always false
+LV = ConstantBool::getFalse();   // X  null - always false
 break;
   case Instruction::SetEQ:
   case Instruction::SetLE:
@@ -747,7 +747,7 @@
 } else {
   StoreInst *SI = castStoreInst(GV-use_back());
   // The global is initialized when the store to it occurs.
-  new StoreInst(ConstantBool::True, InitBool, SI);
+  new StoreInst(ConstantBool::getTrue(), InitBool, SI);
   SI-eraseFromParent();
 }
 
@@ -859,7 +859,8 @@
 static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
   // Create the new global, initializing it to false.
   GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false,
- GlobalValue::InternalLinkage, ConstantBool::False, 
GV-getName()+.b);
+ GlobalValue::InternalLinkage, ConstantBool::getFalse(),
+ GV-getName()+.b);
   GV-getParent()-getGlobalList().insert(GV, NewGV);
 
   Constant *InitVal = GV-getInitializer();



___
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/CorrelatedExprs.cpp InstructionCombining.cpp LoopUnswitch.cpp PredicateSimplifier.cpp SCCP.cpp

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

CorrelatedExprs.cpp updated: 1.34 - 1.35
InstructionCombining.cpp updated: 1.515 - 1.516
LoopUnswitch.cpp updated: 1.47 - 1.48
PredicateSimplifier.cpp updated: 1.15 - 1.16
SCCP.cpp updated: 1.131 - 1.132
---
Log message:


Eliminate ConstantBool::True and ConstantBool::False.  Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


---
Diffs of the changes:  (+108 -115)

 CorrelatedExprs.cpp  |7 +--
 InstructionCombining.cpp |  109 ---
 LoopUnswitch.cpp |   19 
 PredicateSimplifier.cpp  |   73 ++-
 SCCP.cpp |   15 ++
 5 files changed, 108 insertions(+), 115 deletions(-)


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 
llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.35
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp  Thu Sep 28 18:35:21 2006
@@ -788,12 +788,12 @@
 
   // Propagate information into the true block...
   //
-  PropagateEquality(BI-getCondition(), ConstantBool::True,
+  PropagateEquality(BI-getCondition(), ConstantBool::getTrue(),
 getRegionInfo(BI-getSuccessor(0)));
 
   // Propagate information into the false block...
   //
-  PropagateEquality(BI-getCondition(), ConstantBool::False,
+  PropagateEquality(BI-getCondition(), ConstantBool::getFalse(),
 getRegionInfo(BI-getSuccessor(1)));
 }
 
@@ -971,8 +971,7 @@
 // See if we can figure out a result for this instruction...
 Relation::KnownResult Result = getSetCCResult(SCI, RI);
 if (Result != Relation::Unknown) {
-  PropagateEquality(SCI, Result ? ConstantBool::True : ConstantBool::False,
-RI);
+  PropagateEquality(SCI, ConstantBool::get(Result != 0), RI);
 }
   }
 }


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.516
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515   Wed Sep 20 
10:37:57 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 28 18:35:21 2006
@@ -1989,7 +1989,7 @@
   if (ST-isNullValue()) {
 Instruction *CondI = dyn_castInstruction(SI-getOperand(0));
 if (CondI  CondI-getParent() == I.getParent())
-  UpdateValueUsesWith(CondI, ConstantBool::False);
+  UpdateValueUsesWith(CondI, ConstantBool::getFalse());
 else if (I.getParent() != SI-getParent() || SI-hasOneUse())
   I.setOperand(1, SI-getOperand(2));
 else
@@ -2001,7 +2001,7 @@
   if (ST-isNullValue()) {
 Instruction *CondI = dyn_castInstruction(SI-getOperand(0));
 if (CondI  CondI-getParent() == I.getParent())
-  UpdateValueUsesWith(CondI, ConstantBool::True);
+  UpdateValueUsesWith(CondI, ConstantBool::getTrue());
 else if (I.getParent() != SI-getParent() || SI-hasOneUse())
   I.setOperand(1, SI-getOperand(1));
 else
@@ -2213,7 +2213,7 @@
 if (ST-isNullValue()) {
   Instruction *CondI = dyn_castInstruction(SI-getOperand(0));
   if (CondI  CondI-getParent() == I.getParent())
-UpdateValueUsesWith(CondI, ConstantBool::False);
+UpdateValueUsesWith(CondI, ConstantBool::getFalse());
   else if (I.getParent() != SI-getParent() || SI-hasOneUse())
 I.setOperand(1, SI-getOperand(2));
   else
@@ -2225,7 +2225,7 @@
 if (ST-isNullValue()) {
   Instruction *CondI = dyn_castInstruction(SI-getOperand(0));
   if (CondI  CondI-getParent() == I.getParent())
-UpdateValueUsesWith(CondI, ConstantBool::True);
+UpdateValueUsesWith(CondI, ConstantBool::getTrue());
   else if (I.getParent() != SI-getParent() || SI-hasOneUse())
 I.setOperand(1, SI-getOperand(1));
   else
@@ -2344,14 +2344,14 @@
 /// SetCC instruction.
 static Value *getSetCCValue(unsigned Opcode, Value *LHS, Value *RHS) {
   switch (Opcode) {
-  case 0: return ConstantBool::False;
+  case 0: return ConstantBool::getFalse();
   case 1: return new SetCondInst(Instruction::SetGT, LHS, RHS);
   case 2: return new SetCondInst(Instruction::SetEQ, LHS, RHS);
   case 3: return new SetCondInst(Instruction::SetGE, LHS, RHS);
   case 4: return new SetCondInst(Instruction::SetLT, LHS, RHS);
   case 5: return new SetCondInst(Instruction::SetNE, LHS, RHS);
   case 6: return new SetCondInst(Instruction::SetLE, LHS, RHS);
-  case 7: return ConstantBool::True;
+  case 7: return ConstantBool::getTrue();
   default: assert(0  Illegal SetCCCode!); return 0;
   }
 }
@@ -2851,7 +2851,7 @@
 default: assert(0  Unknown integer condition code!);
 case Instruction::SetEQ:  // (X == 13  X == 

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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.51 - 1.52
---
Log message:

Eliminate ConstantBool::True and ConstantBool::False.  Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


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

 ScalarEvolution.cpp |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.51 
llvm/lib/Analysis/ScalarEvolution.cpp:1.52
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.51  Sun Aug 27 17:30:17 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Thu Sep 28 18:35:49 2006
@@ -1689,7 +1689,7 @@
 // Evaluate the condition for this iteration.
 Result = ConstantExpr::get(SetCCOpcode, Result, RHS);
 if (!isaConstantBool(Result)) break;  // Couldn't decide for sure
-if (Result == ConstantBool::False) {
+if (castConstantBool(Result)-getValue() == false) {
 #if 0
   std::cerr  \n***\n*** Computed loop count   *ItCst
  \n*** From global   *GV  *** BB:   *L-getHeader()
@@ -2168,7 +2168,7 @@
   if (ConstantBool *CB =
   dyn_castConstantBool(ConstantExpr::getSetLT(R1-getValue(),
 R2-getValue( {
-if (CB != ConstantBool::True)
+if (CB-getValue() == false)
   std::swap(R1, R2);   // R1 is the minimum root now.
 
 // We can only use this value if the chrec ends up with an exact zero
@@ -2198,7 +2198,7 @@
   if (SCEVConstant *C = dyn_castSCEVConstant(V)) {
 Constant *Zero = Constant::getNullValue(C-getValue()-getType());
 Constant *NonZero = ConstantExpr::getSetNE(C-getValue(), Zero);
-if (NonZero == ConstantBool::True)
+if (NonZero == ConstantBool::getTrue())
   return getSCEV(Zero);
 return UnknownValue;  // Otherwise it will loop infinitely.
   }
@@ -2386,7 +2386,7 @@
   if (ConstantBool *CB =
   dyn_castConstantBool(ConstantExpr::getSetLT(R1-getValue(),
 R2-getValue( {
-if (CB != ConstantBool::True)
+if (CB-getValue() == false)
   std::swap(R1, R2);   // R1 is the minimum root now.
 
 // Make sure the root is not off by one.  The returned iteration should



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Constants.h updated: 1.87 - 1.88
---
Log message:

Eliminate ConstantBool::True and ConstantBool::False.  Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


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

 Constants.h |   18 +++---
 1 files changed, 11 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.87 llvm/include/llvm/Constants.h:1.88
--- llvm/include/llvm/Constants.h:1.87  Sun Sep 17 23:58:06 2006
+++ llvm/include/llvm/Constants.h   Thu Sep 28 18:36:21 2006
@@ -125,12 +125,14 @@
 class ConstantBool : public ConstantIntegral {
   ConstantBool(bool V);
 public:
-  static ConstantBool *True, *False;  /// The True  False values
+  /// getTrue/getFalse - Return the singleton true/false values.
+  static ConstantBool *getTrue();
+  static ConstantBool *getFalse();
 
   /// This method is provided mostly for compatibility with the other 
   /// ConstantIntegral subclasses.
   /// @brief Static factory method for getting a ConstantBool instance.
-  static ConstantBool *get(bool Value) { return Value ? True : False; }
+  static ConstantBool *get(bool Value) { return Value ? getTrue() : 
getFalse();}
 
   /// This method is provided mostly for compatibility with the other 
   /// ConstantIntegral subclasses.
@@ -139,7 +141,9 @@
 
   /// Returns the opposite value of this ConstantBool value.
   /// @brief Get inverse value.
-  inline ConstantBool *inverted() const { return (this==True) ? False : True; }
+  inline ConstantBool *inverted() const {
+return getValue() ? getFalse() : getTrue();
+  }
 
   /// @returns the value of this ConstantBool
   /// @brief return the boolean value of this constant.
@@ -147,10 +151,10 @@
 
   /// @see ConstantIntegral for details
   /// @brief Implement overrides
-  virtual bool isNullValue() const { return this == False; }
-  virtual bool isMaxValue() const { return this == True; }
-  virtual bool isMinValue() const { return this == False; }
-  virtual bool isAllOnesValue() const { return this == True; }
+  virtual bool isNullValue() const { return getValue() == false; }
+  virtual bool isMaxValue() const { return getValue() == true; }
+  virtual bool isMinValue() const { return getValue() == false; }
+  virtual bool isAllOnesValue() const { return getValue() == true; }
 
   /// @brief Methods to support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantBool *) { return true; }



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Type.h updated: 1.89 - 1.90
---
Log message:

Now that ConstantBool::True/False are gone, we can modify Type.cpp to
eliminate its static dtors, without having code that depends on order of 
initialization.  Eliminate static ctors/dtors from Type.cpp.


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

 Type.h |5 -
 1 files changed, 5 deletions(-)


Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.89 llvm/include/llvm/Type.h:1.90
--- llvm/include/llvm/Type.h:1.89   Sat Sep 23 01:09:45 2006
+++ llvm/include/llvm/Type.hThu Sep 28 18:38:07 2006
@@ -347,11 +347,6 @@
   ///
   void removeAbstractTypeUser(AbstractTypeUser *U) const;
 
-  /// clearAllTypeMaps - This method frees all internal memory used by the
-  /// type subsystem, which can be used in environments where this memory is
-  /// otherwise reported as a leak.
-  static void clearAllTypeMaps();
-
 private:
   /// isSizedDerivedType - Derived types like structures and arrays are sized
   /// iff all of the members of the type are sized as well.  Since asking for



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


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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.144 - 1.145
---
Log message:

Now that ConstantBool::True/False are gone, we can modify Type.cpp to
eliminate its static dtors, without having code that depends on order of 
initialization.  Eliminate static ctors/dtors from Type.cpp.


---
Diffs of the changes:  (+73 -91)

 Type.cpp |  164 ---
 1 files changed, 73 insertions(+), 91 deletions(-)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.144 llvm/lib/VMCore/Type.cpp:1.145
--- llvm/lib/VMCore/Type.cpp:1.144  Sun Aug 27 07:54:02 2006
+++ llvm/lib/VMCore/Type.cppThu Sep 28 18:38:07 2006
@@ -21,6 +21,7 @@
 #include llvm/ADT/STLExtras.h
 #include llvm/Support/MathExtras.h
 #include llvm/Support/Compiler.h
+#include llvm/Support/ManagedStatic.h
 #include algorithm
 #include iostream
 using namespace llvm;
@@ -57,13 +58,15 @@
 // for types as they are needed.  Because resolution of types must invalidate
 // all of the abstract type descriptions, we keep them in a seperate map to 
make
 // this easy.
-static std::mapconst Type*, std::string ConcreteTypeDescriptions;
-static std::mapconst Type*, std::string AbstractTypeDescriptions;
+static ManagedStaticstd::mapconst Type*, 
+  std::string  ConcreteTypeDescriptions;
+static ManagedStaticstd::mapconst Type*,
+  std::string  AbstractTypeDescriptions;
 
 Type::Type(const char *Name, TypeID id)
   : ID(id), Abstract(false),  RefCount(0), ForwardType(0) {
   assert(Name  Name[0]  Should use other ctor if no name!);
-  ConcreteTypeDescriptions[this] = Name;
+  (*ConcreteTypeDescriptions)[this] = Name;
 }
 
 
@@ -250,18 +253,18 @@
   std::vectorconst Type * TypeStack) {
   if (isaOpaqueType(Ty)) { // Base case for the recursion
 std::mapconst Type*, std::string::iterator I =
-  AbstractTypeDescriptions.lower_bound(Ty);
-if (I != AbstractTypeDescriptions.end()  I-first == Ty)
+  AbstractTypeDescriptions-lower_bound(Ty);
+if (I != AbstractTypeDescriptions-end()  I-first == Ty)
   return I-second;
 std::string Desc = opaque;
-AbstractTypeDescriptions.insert(std::make_pair(Ty, Desc));
+AbstractTypeDescriptions-insert(std::make_pair(Ty, Desc));
 return Desc;
   }
 
   if (!Ty-isAbstract()) {   // Base case for the recursion
 std::mapconst Type*, std::string::iterator I =
-  ConcreteTypeDescriptions.find(Ty);
-if (I != ConcreteTypeDescriptions.end()) return I-second;
+  ConcreteTypeDescriptions-find(Ty);
+if (I != ConcreteTypeDescriptions-end()) return I-second;
   }
 
   // Check to see if the Type is already on the stack...
@@ -354,9 +357,9 @@
 
 const std::string Type::getDescription() const {
   if (isAbstract())
-return getOrCreateDesc(AbstractTypeDescriptions, this);
+return getOrCreateDesc(*AbstractTypeDescriptions, this);
   else
-return getOrCreateDesc(ConcreteTypeDescriptions, this);
+return getOrCreateDesc(*ConcreteTypeDescriptions, this);
 }
 
 
@@ -382,39 +385,41 @@
 //   Static 'Type' data
 
//===--===//
 
-namespace {
-  struct VISIBILITY_HIDDEN PrimType : public Type {
-PrimType(const char *S, TypeID ID) : Type(S, ID) {}
-  };
-}
+#define DeclarePrimType(TY, Str) \
+  struct VISIBILITY_HIDDEN TY##Type : public Type {  \
+TY##Type() : Type(Str, Type::TY##TyID) {}\
+  }; \
+  static ManagedStaticTY##Type The##TY##Ty
 
-static PrimType TheVoidTy  (void  , Type::VoidTyID);
-static PrimType TheBoolTy  (bool  , Type::BoolTyID);
-static PrimType TheSByteTy (sbyte , Type::SByteTyID);
-static PrimType TheUByteTy (ubyte , Type::UByteTyID);
-static PrimType TheShortTy (short , Type::ShortTyID);
-static PrimType TheUShortTy(ushort, Type::UShortTyID);
-static PrimType TheIntTy   (int   , Type::IntTyID);
-static PrimType TheUIntTy  (uint  , Type::UIntTyID);
-static PrimType TheLongTy  (long  , Type::LongTyID);
-static PrimType TheULongTy (ulong , Type::ULongTyID);
-static PrimType TheFloatTy (float , Type::FloatTyID);
-static PrimType TheDoubleTy(double, Type::DoubleTyID);
-static PrimType TheLabelTy (label , Type::LabelTyID);
-
-Type *Type::VoidTy   = TheVoidTy;
-Type *Type::BoolTy   = TheBoolTy;
-Type *Type::SByteTy  = TheSByteTy;
-Type *Type::UByteTy  = TheUByteTy;
-Type *Type::ShortTy  = TheShortTy;
-Type *Type::UShortTy = TheUShortTy;
-Type *Type::IntTy= TheIntTy;
-Type *Type::UIntTy   = TheUIntTy;
-Type *Type::LongTy   = TheLongTy;
-Type *Type::ULongTy  = TheULongTy;
-Type *Type::FloatTy  = TheFloatTy;
-Type *Type::DoubleTy = TheDoubleTy;
-Type *Type::LabelTy  = TheLabelTy;
+namespace {
+  DeclarePrimType(Void,   void);
+  DeclarePrimType(Bool,   bool);
+  DeclarePrimType(SByte,  

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

2006-09-28 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.145 - 1.146
---
Log message:

Minor cleanups


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

 Type.cpp |   60 
 1 files changed, 24 insertions(+), 36 deletions(-)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.145 llvm/lib/VMCore/Type.cpp:1.146
--- llvm/lib/VMCore/Type.cpp:1.145  Thu Sep 28 18:38:07 2006
+++ llvm/lib/VMCore/Type.cppThu Sep 28 18:45:00 2006
@@ -382,44 +382,32 @@
 
 
 
//===--===//
-//   Static 'Type' data
+//  Primitive 'Type' data
 
//===--===//
 
-#define DeclarePrimType(TY, Str) \
-  struct VISIBILITY_HIDDEN TY##Type : public Type {  \
-TY##Type() : Type(Str, Type::TY##TyID) {}\
-  }; \
-  static ManagedStaticTY##Type The##TY##Ty
-
-namespace {
-  DeclarePrimType(Void,   void);
-  DeclarePrimType(Bool,   bool);
-  DeclarePrimType(SByte,  sbyte);
-  DeclarePrimType(UByte,  ubyte);
-  DeclarePrimType(Short,  short);
-  DeclarePrimType(UShort, ushort);
-  DeclarePrimType(Int,int);
-  DeclarePrimType(UInt,   uint);
-  DeclarePrimType(Long,   long);
-  DeclarePrimType(ULong,  ulong);
-  DeclarePrimType(Float,  float);
-  DeclarePrimType(Double, double);
-  DeclarePrimType(Label,  label);
-}
-
-Type *Type::VoidTy   = *TheVoidTy;
-Type *Type::BoolTy   = *TheBoolTy;
-Type *Type::SByteTy  = *TheSByteTy;
-Type *Type::UByteTy  = *TheUByteTy;
-Type *Type::ShortTy  = *TheShortTy;
-Type *Type::UShortTy = *TheUShortTy;
-Type *Type::IntTy= *TheIntTy;
-Type *Type::UIntTy   = *TheUIntTy;
-Type *Type::LongTy   = *TheLongTy;
-Type *Type::ULongTy  = *TheULongTy;
-Type *Type::FloatTy  = *TheFloatTy;
-Type *Type::DoubleTy = *TheDoubleTy;
-Type *Type::LabelTy  = *TheLabelTy;
+#define DeclarePrimType(TY, Str)   \
+  namespace {  \
+struct VISIBILITY_HIDDEN TY##Type : public Type {  \
+  TY##Type() : Type(Str, Type::TY##TyID) {}\
+}; \
+  }\
+  static ManagedStaticTY##Type The##TY##Ty;  \
+  Type *Type::TY##Ty = *The##TY##Ty
+
+DeclarePrimType(Void,   void);
+DeclarePrimType(Bool,   bool);
+DeclarePrimType(SByte,  sbyte);
+DeclarePrimType(UByte,  ubyte);
+DeclarePrimType(Short,  short);
+DeclarePrimType(UShort, ushort);
+DeclarePrimType(Int,int);
+DeclarePrimType(UInt,   uint);
+DeclarePrimType(Long,   long);
+DeclarePrimType(ULong,  ulong);
+DeclarePrimType(Float,  float);
+DeclarePrimType(Double, double);
+DeclarePrimType(Label,  label);
+#undef DeclarePrimType
 
 
 
//===--===//



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


[llvm-commits] llvm-gcc patch

2006-09-28 Thread Chris Lattner
FYI, this updates llvm-gcc to work with recent llvm cvs changes.

-Chris

Index: llvm-backend.cpp
===
--- llvm-backend.cpp(revision 118395)
+++ llvm-backend.cpp(working copy)
@@ -575,10 +575,10 @@ bool ValidateRegisterVariable(tree decl)
  if (TREE_THIS_VOLATILE(decl))
warning(volatile register variables don%'t work as you might  
wish);

-SET_DECL_LLVM(decl, ConstantBool::False);
+SET_DECL_LLVM(decl, ConstantBool::getFalse());
  return false;  // Everything ok.
}
-  SET_DECL_LLVM(decl, ConstantBool::True);
+  SET_DECL_LLVM(decl, ConstantBool::getTrue());
return true;
}

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