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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.53 -> 1.54
---
Log message:

Ugh. Only meant to do this in thumb mode.

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

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


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.53 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.54
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.53Wed Jan 31 20:18:36 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Fri Feb  2 02:58:48 2007
@@ -1159,12 +1159,17 @@
   }
 
   if (VARegSaveSize) {
-// Epilogue for vararg functions: pop LR to R3 and branch off it.
-// FIXME: Verify this is still ok when R3 is no longer being reserved.
-BuildMI(MBB, MBBI, TII.get(ARM::tPOP)).addReg(ARM::R3);
+if (isThumb)
+  // Epilogue for vararg functions: pop LR to R3 and branch off it.
+  // FIXME: Verify this is still ok when R3 is no longer being reserved.
+  BuildMI(MBB, MBBI, TII.get(ARM::tPOP)).addReg(ARM::R3);
+
 emitSPUpdate(MBB, MBBI, VARegSaveSize, isThumb, TII);
-BuildMI(MBB, MBBI, TII.get(ARM::tBX_RET_vararg)).addReg(ARM::R3);
-MBB.erase(MBBI);
+
+if (isThumb) {
+  BuildMI(MBB, MBBI, TII.get(ARM::tBX_RET_vararg)).addReg(ARM::R3);
+  MBB.erase(MBBI);
+}
   }
 }
 



___
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

2007-02-02 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.258 -> 1.259
---
Log message:

Fix a comment that needed to change after SHIFT patch landed.


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

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


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.258 llvm/lib/VMCore/AsmWriter.cpp:1.259
--- llvm/lib/VMCore/AsmWriter.cpp:1.258 Thu Feb  1 20:16:22 2007
+++ llvm/lib/VMCore/AsmWriter.cpp   Fri Feb  2 07:54:55 2007
@@ -1270,8 +1270,7 @@
 bool PrintAllTypes = false;
 const Type *TheType = Operand->getType();
 
-// Shift Left & Right print both types even for Ubyte LHS, and select 
prints
-// types even if all operands are bools.
+// Select, Store and ShuffleVector always print all types.
 if (isa(I) || isa(I) || isa(I)) {
   PrintAllTypes = true;
 } else {



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


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

2007-02-02 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.206 -> 1.207
---
Log message:

Put the Shift instructions in the right section.


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

 LangRef.html |   33 +
 1 files changed, 17 insertions(+), 16 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.206 llvm/docs/LangRef.html:1.207
--- llvm/docs/LangRef.html:1.206Wed Jan 31 15:39:12 2007
+++ llvm/docs/LangRef.html  Fri Feb  2 07:57:07 2007
@@ -85,13 +85,13 @@
   'urem' Instruction
   'srem' Instruction
   'frem' Instruction
-  'shl' Instruction
-  'lshr' Instruction
-  'ashr' Instruction
 
   
   Bitwise Binary Operations
 
+  'shl' Instruction
+  'lshr' Instruction
+  'ashr' Instruction
   'and' Instruction
   'or'  Instruction
   'xor' Instruction
@@ -1952,6 +1952,18 @@
 
 
 
+
+ Bitwise Binary
+Operations 
+
+Bitwise binary operators are used to do various forms of
+bit-twiddling in a program.  They are generally very efficient
+instructions and can commonly be strength reduced from other
+instructions.  They require two operands, execute an operation on them,
+and produce a single value.  The resulting value of the bitwise binary
+operators is always the same type as its first operand.
+
+
 
  'shl'
 Instruction 
@@ -2003,7 +2015,7 @@
 
 
 
-
+
  'ashr'
 Instruction 
 
@@ -2034,17 +2046,6 @@
 
 
 
-
- Bitwise Binary
-Operations 
-
-Bitwise binary operators are used to do various forms of
-bit-twiddling in a program.  They are generally very efficient
-instructions and can commonly be strength reduced from other
-instructions.  They require two operands, execute an operation on them,
-and produce a single value.  The resulting value of the bitwise binary
-operators is always the same type as its first operand.
-
 
  'and'
 Instruction 
@@ -4507,7 +4508,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/01/31 21:39:12 $
+  Last modified: $Date: 2007/02/02 13:57:07 $
 
 
 



___
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 ScalarReplAggregates.cpp

2007-02-02 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.621 -> 1.622
ScalarReplAggregates.cpp updated: 1.69 -> 1.70
---
Log message:

Use short form of binary operator create functions.


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

 InstructionCombining.cpp |   46 +++---
 ScalarReplAggregates.cpp |4 ++--
 2 files changed, 25 insertions(+), 25 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.621 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.622
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.621   Thu Feb  1 
23:29:55 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb  2 08:08:20 2007
@@ -1200,7 +1200,7 @@
 // the shift amount is >= the size of the datatype, which is undefined.
 if (DemandedMask == 1) {
   // Perform the logical shift right.
-  Value *NewVal = BinaryOperator::create(Instruction::LShr, 
+  Value *NewVal = BinaryOperator::createLShr(
 I->getOperand(0), I->getOperand(1), I->getName());
   InsertNewInstBefore(cast(NewVal), *I);
   return UpdateValueUsesWith(I, NewVal);
@@ -1232,7 +1232,7 @@
   // are demanded, turn this into an unsigned shift right.
   if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) {
 // Perform the logical shift right.
-Value *NewVal = BinaryOperator::create(Instruction::LShr, 
+Value *NewVal = BinaryOperator::createLShr(
   I->getOperand(0), SA, I->getName());
 InsertNewInstBefore(cast(NewVal), *I);
 return UpdateValueUsesWith(I, NewVal);
@@ -1549,7 +1549,7 @@
   AddRHS(Value *rhs) : RHS(rhs) {}
   bool shouldApply(Value *LHS) const { return LHS == RHS; }
   Instruction *apply(BinaryOperator &Add) const {
-return BinaryOperator::create(Instruction::Shl, Add.getOperand(0),
+return BinaryOperator::createShl(Add.getOperand(0),
   ConstantInt::get(Add.getType(), 1));
   }
 };
@@ -1973,7 +1973,7 @@
 if (CU->getZExtValue() == 
 SI->getType()->getPrimitiveSizeInBits()-1) {
   // Ok, the transformation is safe.  Insert LShr. 
-  return BinaryOperator::create(Instruction::LShr, 
+  return BinaryOperator::createLShr(
   SI->getOperand(0), CU, 
SI->getName());
 }
   }
@@ -2126,7 +2126,7 @@
   int64_t Val = (int64_t)cast(CI)->getZExtValue();
   if (isPowerOf2_64(Val)) {  // Replace X*(2^C) with X << C
 uint64_t C = Log2_64(Val);
-return BinaryOperator::create(Instruction::Shl, Op0,
+return BinaryOperator::createShl(Op0,
   ConstantInt::get(Op0->getType(), C));
   }
 } else if (ConstantFP *Op1F = dyn_cast(Op1)) {
@@ -2322,7 +2322,7 @@
 if (uint64_t Val = C->getZExtValue())// Don't break X / 0
   if (isPowerOf2_64(Val)) {
 uint64_t ShiftAmt = Log2_64(Val);
-return BinaryOperator::create(Instruction::LShr, Op0, 
+return BinaryOperator::createLShr(Op0, 
 ConstantInt::get(Op0->getType(), 
ShiftAmt));
   }
   }
@@ -2339,7 +2339,7 @@
   Constant *C2V = ConstantInt::get(NTy, C2);
   N = InsertNewInstBefore(BinaryOperator::createAdd(N, C2V, "tmp"), I);
 }
-return BinaryOperator::create(Instruction::LShr, Op0, N);
+return BinaryOperator::createLShr(Op0, N);
   }
 }
   }
@@ -2356,13 +2356,13 @@
 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::create(Instruction::LShr, 
+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::create(Instruction::LShr,
+Instruction *FSI = BinaryOperator::createLShr(
Op0, FC, 
SI->getName()+".f");
 FSI = InsertNewInstBefore(FSI, I);
 
@@ -2916,7 +2916,7 @@
 // Make the argument unsigned.
 Value *ShVal = Op->getOperand(0);
 ShVal = InsertNewInstBefore(
-BinaryOperator::create(Instruction::LShr, ShVal, OpRHS, 
+BinaryOperator::createLShr(ShVal, OpRHS, 
Op->getName()), TheAnd);
 return BinaryOperator::createAnd(ShVal, AndRHS, TheAnd.getName());
   }
@@ -4681,11 +4681,11 @@
 // Compute C << Y.
  

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

2007-02-02 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.63 -> 1.64
---
Log message:

Use short form of BinaryOperator create function.


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

 IntrinsicLowering.cpp |   32 
 1 files changed, 16 insertions(+), 16 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.63 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.64
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.63 Thu Feb  1 20:16:22 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Fri Feb  2 08:09:34 2007
@@ -118,21 +118,21 @@
   switch(BitSize) {
   default: assert(0 && "Unhandled type size of value to byteswap!");
   case 16: {
-Value *Tmp1 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp1 = BinaryOperator::createShl(V,
 ConstantInt::get(V->getType(),8),"bswap.2",IP);
-Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V,
+Value *Tmp2 = BinaryOperator::createLShr(V,
 ConstantInt::get(V->getType(),8),"bswap.1",IP);
 V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP);
 break;
   }
   case 32: {
-Value *Tmp4 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp4 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),24),"bswap.4", IP);
-Value *Tmp3 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp3 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),8),"bswap.3",IP);
-Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V,
+Value *Tmp2 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),8),"bswap.2",IP);
-Value *Tmp1 = BinaryOperator::create(Instruction::LShr, V,
+Value *Tmp1 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),24),"bswap.1", IP);
 Tmp3 = BinaryOperator::createAnd(Tmp3, 
  ConstantInt::get(Type::Int32Ty, 0xFF),
@@ -146,21 +146,21 @@
 break;
   }
   case 64: {
-Value *Tmp8 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp8 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),56),"bswap.8", IP);
-Value *Tmp7 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp7 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),40),"bswap.7", IP);
-Value *Tmp6 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp6 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),24),"bswap.6", IP);
-Value *Tmp5 = BinaryOperator::create(Instruction::Shl, V,
+Value *Tmp5 = BinaryOperator::createShl(V,
   ConstantInt::get(V->getType(),8),"bswap.5", IP);
-Value* Tmp4 = BinaryOperator::create(Instruction::LShr, V,
+Value* Tmp4 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),8),"bswap.4", IP);
-Value* Tmp3 = BinaryOperator::create(Instruction::LShr, V,
+Value* Tmp3 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),24),"bswap.3", IP);
-Value* Tmp2 = BinaryOperator::create(Instruction::LShr, V,
+Value* Tmp2 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),40),"bswap.2", IP);
-Value* Tmp1 = BinaryOperator::create(Instruction::LShr, V,
+Value* Tmp1 = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(),56),"bswap.1", IP);
 Tmp7 = BinaryOperator::createAnd(Tmp7,
  ConstantInt::get(Type::Int64Ty, 
@@ -210,7 +210,7 @@
   for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
 Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]);
 Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
-Value *VShift = BinaryOperator::create(Instruction::LShr, V,
+Value *VShift = BinaryOperator::createLShr(V,
   ConstantInt::get(V->getType(), i), "ctpop.sh", IP);
 Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP);
 V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
@@ -226,7 +226,7 @@
   unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
   for (unsigned i = 1; i != BitSize; i <<= 1) {
 Value *ShVal = ConstantInt::get(V->getType(), i);
-ShVal = BinaryOperator::create(Instruction::LShr, V, ShVal, "ctlz.sh", IP);
+ShVal = BinaryOperator::createLShr(V, ShVal, "ctlz.sh", IP);
 V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP);
   }
 



___
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-02-02 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.622 -> 1.623
---
Log message:

Remove dead code and fix indentation per Chris' review comments.


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

 InstructionCombining.cpp |   43 ---
 1 files changed, 12 insertions(+), 31 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.622 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.623
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.622   Fri Feb  2 
08:08:20 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb  2 08:41:37 2007
@@ -4605,16 +4605,6 @@
   if (Shift && !Shift->isShift())
 Shift = 0;
 
-  // Check to see if there is a noop-cast between the shift and the 
and.
-  if (!Shift) {
-if (CastInst *CI = dyn_cast(LHSI->getOperand(0)))
-  if (CI->getOpcode() == Instruction::BitCast) {
-Shift = dyn_cast(CI->getOperand(0));
-if (Shift && !Shift->isShift())
-  Shift = 0;
-  }
-  }
-
   ConstantInt *ShAmt;
   ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0;
   const Type *Ty = Shift ? Shift->getType() : 0;  // Type of the shift.
@@ -5487,7 +5477,7 @@
 case Instruction::Add:
 case Instruction::And:
 case Instruction::Or:
-case Instruction::Xor:
+case Instruction::Xor: {
   // These operators commute.
   // Turn (Y + (X >> C)) << C  ->  (X + (Y << C)) & (~0 << C)
   if (isLeftShift && Op0BO->getOperand(1)->hasOneUse() &&
@@ -5507,10 +5497,11 @@
   }
   
   // Turn (Y + ((X >> C) & CC)) << C  ->  ((X & (CC << C)) + (Y << C))
-  if (isLeftShift && Op0BO->getOperand(1)->hasOneUse() &&
-  match(Op0BO->getOperand(1), m_And(m_Shr(m_Value(V1), 
m_Value(V2)),
-m_ConstantInt(CC))) && V2 == Op1 &&
-  cast(Op0BO->getOperand(1))->getOperand(0)->hasOneUse()) {
+  Value *Op0BOOp1 = Op0BO->getOperand(1);
+  if (isLeftShift && Op0BOOp1->hasOneUse() && V2 == Op1 &&
+  match(Op0BOOp1, 
+m_And(m_Shr(m_Value(V1), m_Value(V2)),m_ConstantInt(CC))) 
&&
+  cast(Op0BOOp1)->getOperand(0)-> hasOneUse()) {
 Instruction *YS = BinaryOperator::createShl(
  Op0BO->getOperand(0), Op1,
  Op0BO->getName());
@@ -5522,9 +5513,10 @@
 
 return BinaryOperator::create(Op0BO->getOpcode(), YS, XM);
   }
+}
   
-  // FALL THROUGH.
-case Instruction::Sub:
+// FALL THROUGH.
+case Instruction::Sub: {
   // Turn ((X >> C) + Y) << C  ->  (X + (Y << C)) & (~0 << C)
   if (isLeftShift && Op0BO->getOperand(0)->hasOneUse() &&
   match(Op0BO->getOperand(0),
@@ -5562,6 +5554,7 @@
   }
   
   break;
+}
   }
   
   
@@ -5616,12 +5609,6 @@
   BinaryOperator *ShiftOp = dyn_cast(Op0);
   if (ShiftOp && !ShiftOp->isShift())
 ShiftOp = 0;
-  if (!ShiftOp)
-if (BitCastInst *CI = dyn_cast(Op0))
-  // If this is a noop-integer cast of a shift instruction, use the shift.
-  if (BinaryOperator *SI = dyn_cast(CI->getOperand(0)))
-if (SI->isShift())
-  ShiftOp = SI;
   
   if (ShiftOp && isa(ShiftOp->getOperand(1))) {
 // Find the operands and properties of the input shift.  Note that the
@@ -6594,14 +6581,8 @@
 else
   return BinaryOperator::create(BO->getOpcode(), NewSI, MatchOp);
   }
-
-  assert(TI->isShift() && "Should only have Shift here");
-  if (MatchIsOpZero)
-return BinaryOperator::create(Instruction::BinaryOps(TI->getOpcode()), 
-  MatchOp, NewSI);
-  else
-return BinaryOperator::create(Instruction::BinaryOps(TI->getOpcode()), 
-  NewSI, MatchOp);
+  assert(0 && "Shouldn't get here");
+  return 0;
 }
 
 Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {



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


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

2007-02-02 Thread Reid Spencer


Changes in directory llvm/tools/opt:

opt.cpp updated: 1.127 -> 1.128
---
Log message:

For PR1152: http://llvm.org/PR1152 :
Step 1: Copy gccas functionality to opt. This endows opt with a new
-std-compile-opts option to get the set of optimization passes that
gccas used. It also adds -disable-inlining and -disable-opt which
both apply only if -std-compile-opts is given. The -strip-debug option
was also removed. It just makes sure that "-strip" gets done early and
is mostly there for compatibility with gccas. Finally, a new 
-verify-each option will cause the verify pass to be run after each pass.


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

 opt.cpp |  102 ++--
 1 files changed, 100 insertions(+), 2 deletions(-)


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.127 llvm/tools/opt/opt.cpp:1.128
--- llvm/tools/opt/opt.cpp:1.127Tue Jan 30 22:45:28 2007
+++ llvm/tools/opt/opt.cpp  Fri Feb  2 08:46:29 2007
@@ -68,6 +68,24 @@
 NoVerify("disable-verify", cl::desc("Do not verify result module"), 
cl::Hidden);
 
 static cl::opt
+VerifyEach("verify-each", cl::desc("Verify after each transform"));
+
+static cl::opt
+StripDebug("strip-debug",
+   cl::desc("Strip debugger symbol info from translation unit"));
+
+static cl::opt
+DisableInline("disable-inlining", cl::desc("Do not run the inliner pass"));
+
+static cl::opt 
+DisableOptimizations("disable-opt", 
+ cl::desc("Do not run any optimization passes"));
+
+static cl::opt
+StandardCompileOpts("std-compile-opts", 
+   cl::desc("Include the standard compile time 
optimizations"));
+
+static cl::opt
 Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
 
 static cl::alias
@@ -148,6 +166,76 @@
   }
 };
 
+inline void addPass(PassManager &PM, Pass *P) {
+  // Add the pass to the pass manager...
+  PM.add(P);
+
+  // If we are verifying all of the intermediate steps, add the verifier...
+  if (VerifyEach) PM.add(createVerifierPass());
+}
+
+void AddStandardCompilePasses(PassManager &PM) {
+  PM.add(createVerifierPass());  // Verify that input is 
correct
+
+  addPass(PM, createLowerSetJmpPass());  // Lower llvm.setjmp/.longjmp
+  addPass(PM, createFunctionResolvingPass());// Resolve (...) functions
+
+  // If the -strip-debug command line option was specified, do it.
+  if (StripDebug)
+addPass(PM, createStripSymbolsPass(true));
+
+  if (DisableOptimizations) return;
+
+  addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst
+  addPass(PM, createCFGSimplificationPass());// Clean up disgusting code
+  addPass(PM, createPromoteMemoryToRegisterPass());// Kill useless allocas
+  addPass(PM, createGlobalOptimizerPass());  // Optimize out global vars
+  addPass(PM, createGlobalDCEPass());// Remove unused fns and globs
+  addPass(PM, createIPConstantPropagationPass());// IP Constant Propagation
+  addPass(PM, createDeadArgEliminationPass());   // Dead argument elimination
+  addPass(PM, createInstructionCombiningPass()); // Clean up after IPCP & DAE
+  addPass(PM, createCFGSimplificationPass());// Clean up after IPCP & DAE
+
+  addPass(PM, createPruneEHPass());  // Remove dead EH info
+
+  if (!DisableInline)
+addPass(PM, createFunctionInliningPass());   // Inline small functions
+  addPass(PM, createArgumentPromotionPass());// Scalarize uninlined fn args
+
+  addPass(PM, createRaisePointerReferencesPass());// Recover type information
+  addPass(PM, createTailDuplicationPass());  // Simplify cfg by copying 
code
+  addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
+  addPass(PM, createCFGSimplificationPass());// Merge & remove BBs
+  addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas
+  addPass(PM, createInstructionCombiningPass()); // Combine silly seq's
+  addPass(PM, createCondPropagationPass());  // Propagate conditionals
+
+  addPass(PM, createTailCallEliminationPass());  // Eliminate tail calls
+  addPass(PM, createCFGSimplificationPass());// Merge & remove BBs
+  addPass(PM, createReassociatePass());  // Reassociate expressions
+  addPass(PM, createLICMPass()); // Hoist loop invariants
+  addPass(PM, createLoopUnswitchPass()); // Unswitch loops.
+  addPass(PM, createInstructionCombiningPass()); // Clean up after LICM/reassoc
+  addPass(PM, createIndVarSimplifyPass());   // Canonicalize indvars
+  addPass(PM, createLoopUnrollPass());   // Unroll small loops
+  addPass(PM, createInstructionCombiningPass()); // Clean up after the unroller
+  addPass(PM, createLoadValueNumberingPass());   // GVN for load instructions
+  addPass(PM, createGCSEPass()); // Remove common subexprs
+  addPass(PM, createSCCPPass()); // Constant prop with SCCP
+
+  // Run instcombine after redundancy elimination to exploit opportunitie

[llvm-commits] CVS: llvm/tools/gccas/gccas.sh Makefile gccas.cpp

2007-02-02 Thread Reid Spencer


Changes in directory llvm/tools/gccas:

gccas.sh added (r1.1)
Makefile updated: 1.27 -> 1.28
gccas.cpp (r1.126) removed
---
Log message:

For PR1152: http://llvm.org/PR1152 :
Step 2: Make plug compatible shell script to replace gccas binary.


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

 Makefile |   19 +--
 gccas.sh |   63 +++
 2 files changed, 76 insertions(+), 6 deletions(-)


Index: llvm/tools/gccas/gccas.sh
diff -c /dev/null llvm/tools/gccas/gccas.sh:1.1
*** /dev/null   Fri Feb  2 09:51:08 2007
--- llvm/tools/gccas/gccas.sh   Fri Feb  2 09:50:58 2007
***
*** 0 
--- 1,63 
+ #!/bin/sh
+ ##===- tools/gccas.sh --*- bash 
-*-===##
+ # 
+ # The LLVM Compiler Infrastructure
+ #
+ # This file was developed by Reid Spencer and is distributed under the
+ # University of Illinois Open Source License. See LICENSE.TXT for details.
+ # 
+ 
##===--===##
+ #
+ # Synopsis: This shell script is a replacement for the old "gccas" tool that
+ #   existed in LLVM versions before 2.0. The functionality of gccas 
has
+ #   now been moved to opt and llvm-as. This shell script provides 
+ #   backwards compatibility so build environments invoking gccas can
+ #   still get the net effect of llvm-as/opt by running gccas.
+ #
+ # Syntax:   gccas OPTIONS... [asm file]
+ # 
+ 
##===--===##
+ #
+ [EMAIL PROTECTED]@
+ OPTOPTS="-std-compile-opts -f"
+ ASOPTS=""
+ lastwasdasho=0
+ for option in "$@" ; do
+   case "$option" in
+ -disable-opt)
+OPTOPTS="$OPTOPTS $option"
+;;
+ -disable-inlining)
+OPTOPTS="$OPTOPTS $option"
+;;
+ -verify)
+OPTOPTS="$OPTOPTS -verify-each"
+;;
+ -strip-debug)
+OPTOPTS="$OPTOPTS $option"
+;;
+ -o)
+OPTOPTS="$OPTOPTS -o"
+lastwasdasho=1
+;;
+ -disable-compression)
+# ignore
+;;
+ -traditional-format)
+# ignore
+;;
+ -*)
+echo "gccas: Unrecognized option '$option'"
+exit 1
+;;
+ *)
+if test $lastwasdasho -eq 1 ; then
+  OPTOPTS="$OPTOPTS $option"
+  lastwasdasho=0
+else
+  ASOPTS="$ASOPTS $option"
+fi
+;;
+   esac
+ done
+ ${TOOLDIR}/llvm-as $ASOPTS -o - | ${TOOLDIR}/opt $OPTOPTS


Index: llvm/tools/gccas/Makefile
diff -u llvm/tools/gccas/Makefile:1.27 llvm/tools/gccas/Makefile:1.28
--- llvm/tools/gccas/Makefile:1.27  Mon Sep  4 00:59:09 2006
+++ llvm/tools/gccas/Makefile   Fri Feb  2 09:50:58 2007
@@ -2,14 +2,21 @@
 # 
 # The LLVM Compiler Infrastructure
 #
-# This file was developed by the LLVM research group and is distributed under
-# the University of Illinois Open Source License. See LICENSE.TXT for details.
+# This file was developed by Reid Spencer and is distributed under the
+# University of Illinois Open Source License. See LICENSE.TXT for details.
 # 
 
##===--===##
 LEVEL = ../..
 
-TOOLNAME = gccas
-LINK_COMPONENTS = asmparser bcwriter scalaropts ipo ipa transforms
-REQUIRES_EH := 1
-
 include $(LEVEL)/Makefile.common
+
+install-local:: $(PROJ_bindir)/gccas
+   
+$(PROJ_bindir)/gccas : gccas.sh
+   sed "[EMAIL PROTECTED]@#$(PROJ_bindir)#" $< > $@
+
+all-local:: $(ToolDir)/gccas
+   
+$(ToolDir)/gccas : gccas.sh
+   sed "[EMAIL PROTECTED]@#$(ToolDir)#" $< > $@
+



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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMConstantIslandPass.cpp updated: 1.21 -> 1.22
---
Log message:

Watch out for empty BB.

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

 ARMConstantIslandPass.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.21 
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.22
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.21  Thu Feb  1 14:44:52 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp   Fri Feb  2 12:49:02 2007
@@ -352,6 +352,7 @@
 // In thumb mode, if this block is a constpool island, pessmisticly assume
 // it needs to be padded by two byte so it's aligned on 4 byte boundary.
 if (AFI->isThumbFunction() &&
+MBB.size() &&
 MBB.begin()->getOpcode() == ARM::CONSTPOOL_ENTRY)
   MBBSize += 2;
 



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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMConstantIslandPass.cpp updated: 1.22 -> 1.23
---
Log message:

Use MBB.empty() instead of MBB.size() for speed.

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

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


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.22 
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.23
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.22  Fri Feb  2 12:49:02 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp   Fri Feb  2 13:09:19 2007
@@ -352,7 +352,7 @@
 // In thumb mode, if this block is a constpool island, pessmisticly assume
 // it needs to be padded by two byte so it's aligned on 4 byte boundary.
 if (AFI->isThumbFunction() &&
-MBB.size() &&
+!MBB.empty() &&
 MBB.begin()->getOpcode() == ARM::CONSTPOOL_ENTRY)
   MBBSize += 2;
 



___
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/DenseMap.h

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

DenseMap.h updated: 1.11 -> 1.12
---
Log message:

add iterators


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

 DenseMap.h |  104 -
 1 files changed, 82 insertions(+), 22 deletions(-)


Index: llvm/include/llvm/ADT/DenseMap.h
diff -u llvm/include/llvm/ADT/DenseMap.h:1.11 
llvm/include/llvm/ADT/DenseMap.h:1.12
--- llvm/include/llvm/ADT/DenseMap.h:1.11   Thu Feb  1 01:49:59 2007
+++ llvm/include/llvm/ADT/DenseMap.hFri Feb  2 13:27:13 2007
@@ -16,6 +16,7 @@
 
 #include "llvm/Support/DataTypes.h"
 #include 
+#include 
 
 namespace llvm {
   
@@ -38,10 +39,12 @@
   static bool isPod() { return true; }
 };
 
+template
+class DenseMapIterator;
 
 template
 class DenseMap {
-  struct BucketT { KeyT Key; ValueT Value; };
+  typedef std::pair BucketT;
   unsigned NumBuckets;
   BucketT *Buckets;
   
@@ -54,21 +57,26 @@
   ~DenseMap() {
 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
 for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
-  if (P->Key != EmptyKey && P->Key != TombstoneKey)
-P->Value.~ValueT();
-  P->Key.~KeyT();
+  if (P->first != EmptyKey && P->first != TombstoneKey)
+P->second.~ValueT();
+  P->first.~KeyT();
 }
 delete[] (char*)Buckets;
   }
   
+  typedef DenseMapIterator iterator;
+  typedef DenseMapIterator const_iterator;
+  inline iterator begin() const;
+  inline iterator end() const;
+  
   unsigned size() const { return NumEntries; }
   
   void clear() {
 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
 for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
-  if (P->Key != EmptyKey && P->Key != TombstoneKey) {
-P->Key = EmptyKey;
-P->Value.~ValueT();
+  if (P->first != EmptyKey && P->first != TombstoneKey) {
+P->first = EmptyKey;
+P->second.~ValueT();
 --NumEntries;
   }
 }
@@ -84,7 +92,7 @@
   ValueT &operator[](const KeyT &Val) {
 BucketT *TheBucket;
 if (LookupBucketFor(Val, TheBucket))
-  return TheBucket->Value;
+  return TheBucket->second;
 
 // If the load of the hash table is more than 3/4, grow it.
 if (NumEntries*4 >= NumBuckets*3) {
@@ -92,9 +100,9 @@
   LookupBucketFor(Val, TheBucket);
 }
 ++NumEntries;
-TheBucket->Key = Val;
-new (&TheBucket->Value) ValueT();
-return TheBucket->Value;
+TheBucket->first = Val;
+new (&TheBucket->second) ValueT();
+return TheBucket->second;
   }
   
 private:
@@ -125,14 +133,14 @@
 while (1) {
   BucketT *ThisBucket = BucketsPtr + (BucketNo & (NumBuckets-1));
   // Found Val's bucket?  If so, return it.
-  if (ThisBucket->Key == Val) {
+  if (ThisBucket->first == Val) {
 FoundBucket = ThisBucket;
 return true;
   }
   
   // If we found an empty bucket, the key doesn't exist in the set.
   // Insert it and return the default value.
-  if (ThisBucket->Key == EmptyKey) {
+  if (ThisBucket->first == EmptyKey) {
 // If we've already seen a tombstone while probing, fill it in instead
 // of the empty bucket we eventually probed to.
 if (FoundTombstone) ThisBucket = FoundTombstone;
@@ -142,7 +150,7 @@
   
   // If this is a tombstone, remember it.  If Val ends up not in the map, 
we
   // prefer to return it than something that would require more probing.
-  if (ThisBucket->Key == TombstoneKey && !FoundTombstone)
+  if (ThisBucket->first == TombstoneKey && !FoundTombstone)
 FoundTombstone = ThisBucket;  // Remember the first tombstone found.
   
   // Otherwise, it's a hash collision or a tombstone, continue quadratic
@@ -160,7 +168,7 @@
 // Initialize all the keys to EmptyKey.
 const KeyT EmptyKey = getEmptyKey();
 for (unsigned i = 0; i != InitBuckets; ++i)
-  new (&Buckets[i].Key) KeyT(EmptyKey);
+  new (&Buckets[i].first) KeyT(EmptyKey);
   }
   
   void grow() {
@@ -174,23 +182,23 @@
 // Initialize all the keys to EmptyKey.
 const KeyT EmptyKey = getEmptyKey();
 for (unsigned i = 0, e = NumBuckets; i != e; ++i)
-  new (&Buckets[i].Key) KeyT(EmptyKey);
+  new (&Buckets[i].first) KeyT(EmptyKey);
 
 // Insert all the old elements.
 const KeyT TombstoneKey = getTombstoneKey();
 for (BucketT *B = OldBuckets, *E = OldBuckets+OldNumBuckets; B != E; ++B) {
-  if (B->Key != EmptyKey && B->Key != TombstoneKey) {
+  if (B->first != EmptyKey && B->first != TombstoneKey) {
 // Insert the key/value into the new table.
 BucketT *DestBucket;
-bool FoundVal = LookupBucketFor(B->Key, DestBucket);
+bool FoundVal = LookupBucketFor(B->first, DestBucket);
 assert(!FoundVal && "Key already in new map?");
-DestBucket->Key = B->Key;
-new (&DestBucket->Value) ValueT(B->Value);
+DestBuck

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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

DenseMap.h updated: 1.12 -> 1.13
---
Log message:

add find/erase, add const iterators, fix bugs in iterators.


---
Diffs of the changes:  (+67 -19)

 DenseMap.h |   86 +++--
 1 files changed, 67 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/ADT/DenseMap.h
diff -u llvm/include/llvm/ADT/DenseMap.h:1.12 
llvm/include/llvm/ADT/DenseMap.h:1.13
--- llvm/include/llvm/ADT/DenseMap.h:1.12   Fri Feb  2 13:27:13 2007
+++ llvm/include/llvm/ADT/DenseMap.hFri Feb  2 14:34:32 2007
@@ -41,6 +41,8 @@
 
 template
 class DenseMapIterator;
+template
+class DenseMapConstIterator;
 
 template
 class DenseMap {
@@ -65,10 +67,23 @@
   }
   
   typedef DenseMapIterator iterator;
-  typedef DenseMapIterator const_iterator;
-  inline iterator begin() const;
-  inline iterator end() const;
+  typedef DenseMapConstIterator const_iterator;
+  inline iterator begin() {
+ return DenseMapIterator(Buckets, Buckets+NumBuckets);
+  }
+  inline iterator end() {
+return DenseMapIterator(Buckets+NumBuckets, 
+  Buckets+NumBuckets);
+  }
+  inline const_iterator begin() const {
+return DenseMapConstIterator(Buckets, Buckets+NumBuckets);
+  }
+  inline const_iterator end() const {
+return DenseMapConstIterator(Buckets+NumBuckets, 
+   Buckets+NumBuckets);
+  }
   
+  bool empty() const { return NumEntries == 0; }
   unsigned size() const { return NumEntries; }
   
   void clear() {
@@ -89,6 +104,31 @@
 return LookupBucketFor(Val, TheBucket);
   }
   
+  iterator find(const KeyT &Val) const {
+BucketT *TheBucket;
+if (LookupBucketFor(Val, TheBucket))
+  return iterator(TheBucket, Buckets+NumBuckets);
+return end();
+  }
+  
+  bool erase(const KeyT &Val) {
+BucketT *TheBucket;
+if (!LookupBucketFor(Val, TheBucket))
+  return false; // not in map.
+
+TheBucket->second.~ValueT();
+TheBucket->first = getTombstoneKey();
+--NumEntries;
+return true;
+  }
+  bool erase(iterator I) {
+BucketT *TheBucket = &*I;
+TheBucket->second.~ValueT();
+TheBucket->first = getTombstoneKey();
+--NumEntries;
+return true;
+  }
+  
   ValueT &operator[](const KeyT &Val) {
 BucketT *TheBucket;
 if (LookupBucketFor(Val, TheBucket))
@@ -106,11 +146,13 @@
   }
   
 private:
-  unsigned getHashValue(const KeyT &Val) const {
+  static unsigned getHashValue(const KeyT &Val) {
 return DenseMapKeyInfo::getHashValue(Val);
   }
-  const KeyT getEmptyKey() const { return 
DenseMapKeyInfo::getEmptyKey();}
-  const KeyT getTombstoneKey() const {
+  static const KeyT getEmptyKey() {
+return DenseMapKeyInfo::getEmptyKey();
+  }
+  static const KeyT getTombstoneKey() {
 return DenseMapKeyInfo::getTombstoneKey();
   }
   
@@ -209,17 +251,18 @@
 template
 class DenseMapIterator {
   typedef std::pair BucketT;
+protected:
   const BucketT *Ptr, *End;
 public:
   DenseMapIterator(const BucketT *Pos, const BucketT *E) : Ptr(Pos), End(E) {
 AdvancePastEmptyBuckets();
   }
   
-  const std::pair &operator*() const {
-return *Ptr;
+  std::pair &operator*() const {
+return *const_cast(Ptr);
   }
-  const std::pair *operator->() const {
-return Ptr;
+  std::pair *operator->() const {
+return const_cast(Ptr);
   }
   
   bool operator==(const DenseMapIterator &RHS) const {
@@ -243,20 +286,25 @@
 const KeyT Empty = DenseMapKeyInfo::getEmptyKey();
 const KeyT Tombstone = DenseMapKeyInfo::getTombstoneKey();
 
-while (Ptr != End && Ptr->first != Empty && Ptr->first != Tombstone)
+while (Ptr != End && (Ptr->first == Empty || Ptr->first == Tombstone))
   ++Ptr;
   }
 };
 
-
-template
-inline DenseMapIterator DenseMap::begin() const {
-  return DenseMapIterator(Buckets, Buckets+NumBuckets);
-}
 template
-inline DenseMapIterator DenseMap::end() const {
-  return DenseMapIterator(Buckets+NumBuckets, 
Buckets+NumBuckets);
-}
+class DenseMapConstIterator : public DenseMapIterator {
+public:
+  DenseMapConstIterator(const std::pair *Pos,
+const std::pair *E)
+: DenseMapIterator(Pos, E) {
+  }
+  const std::pair &operator*() const {
+return *this->Ptr;
+  }
+  const std::pair *operator->() const {
+return this->Ptr;
+  }
+};
 
 } // end namespace llvm
 



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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.156 -> 1.157
---
Log message:

switch hash_map's over to DenseMap in SCCP.  This speeds up SCCP by 30% in
a release-assert build on kimwitu++.


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

 SCCP.cpp |   40 +---
 1 files changed, 21 insertions(+), 19 deletions(-)


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.156 
llvm/lib/Transforms/Scalar/SCCP.cpp:1.157
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.156   Thu Feb  1 20:16:22 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Feb  2 14:38:30 2007
@@ -33,7 +33,7 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/InstVisitor.h"
-#include "llvm/ADT/hash_map"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
@@ -138,18 +138,18 @@
 ///
 class SCCPSolver : public InstVisitor {
   std::set BBExecutable;// The basic blocks that are 
executable
-  hash_map ValueState;  // The state each value is in...
+  DenseMap ValueState;  // The state each value is in.
 
   /// GlobalValue - If we are tracking any values for the contents of a global
   /// variable, we keep a mapping from the constant accessor to the element of
   /// the global, to the currently known value.  If the value becomes
   /// overdefined, it's entry is simply removed from this map.
-  hash_map TrackedGlobals;
+  DenseMap TrackedGlobals;
 
   /// TrackedFunctionRetVals - If we are tracking arguments into and the return
   /// value out of a function, it will have an entry in this map, indicating
   /// what the known return value for the function is.
-  hash_map TrackedFunctionRetVals;
+  DenseMap TrackedFunctionRetVals;
 
   // The reason for two worklists is that overdefined is the lowest state
   // on the lattice, and moving things to overdefined as fast as possible
@@ -222,19 +222,19 @@
 
   /// getValueMapping - Once we have solved for constants, return the mapping 
of
   /// LLVM values to LatticeVals.
-  hash_map &getValueMapping() {
+  DenseMap &getValueMapping() {
 return ValueState;
   }
 
   /// getTrackedFunctionRetVals - Get the inferred return value map.
   ///
-  const hash_map &getTrackedFunctionRetVals() {
+  const DenseMap &getTrackedFunctionRetVals() {
 return TrackedFunctionRetVals;
   }
 
   /// getTrackedGlobals - Get and return the set of inferred initializers for
   /// global variables.
-  const hash_map &getTrackedGlobals() {
+  const DenseMap &getTrackedGlobals() {
 return TrackedGlobals;
   }
 
@@ -303,14 +303,16 @@
   // Instruction object, then use this accessor to get its value from the map.
   //
   inline LatticeVal &getValueState(Value *V) {
-hash_map::iterator I = ValueState.find(V);
+DenseMap::iterator I = ValueState.find(V);
 if (I != ValueState.end()) return I->second;  // Common case, in the map
 
 if (Constant *C = dyn_cast(V)) {
   if (isa(V)) {
 // Nothing to do, remain undefined.
   } else {
-ValueState[C].markConstant(C);  // Constants are constant
+LatticeVal &LV = ValueState[C];
+LV.markConstant(C);  // Constants are constant
+return LV;
   }
 }
 // All others are underdefined by default...
@@ -610,7 +612,7 @@
   // If we are tracking the return value of this function, merge it in.
   Function *F = I.getParent()->getParent();
   if (F->hasInternalLinkage() && !TrackedFunctionRetVals.empty()) {
-hash_map::iterator TFRVI =
+DenseMap::iterator TFRVI =
   TrackedFunctionRetVals.find(F);
 if (TFRVI != TrackedFunctionRetVals.end() &&
 !TFRVI->second.isOverdefined()) {
@@ -991,7 +993,7 @@
   if (TrackedGlobals.empty() || !isa(SI.getOperand(1)))
 return;
   GlobalVariable *GV = cast(SI.getOperand(1));
-  hash_map::iterator I = TrackedGlobals.find(GV);
+  DenseMap::iterator I = TrackedGlobals.find(GV);
   if (I == TrackedGlobals.end() || I->second.isOverdefined()) return;
 
   // Get the value we are storing into the global.
@@ -1028,7 +1030,7 @@
 }
   } else if (!TrackedGlobals.empty()) {
 // If we are tracking this global, merge in the known value for it.
-hash_map::iterator It =
+DenseMap::iterator It =
   TrackedGlobals.find(GV);
 if (It != TrackedGlobals.end()) {
   mergeInValue(IV, &I, It->second);
@@ -1059,7 +1061,7 @@
 
   // If we are tracking this function, we must make sure to bind arguments as
   // appropriate.
-  hash_map::iterator TFRVI 
=TrackedFunctionRetVals.end();
+  DenseMap::iterator TFRVI 
=TrackedFunctionRetVals.end();
   if (F && F->hasInternalLinkage())
 TFRVI = TrackedFunctionRetVals.find(F);
 
@@ -1363,7 +1365,7 @@
   Solver.MarkBlockExecutable(F.begin());
 
   // Mark all arguments to the function as being overdefined.
-  hash_map &Values = Solver.getValueMapping();
+  DenseMap

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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.157 -> 1.158
---
Log message:

eliminate a malloc/free for (almost) every GEP processed.  This speeds up 
IPSCCP 3.3% on kimwitu.


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

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


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.157 
llvm/lib/Transforms/Scalar/SCCP.cpp:1.158
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.157   Fri Feb  2 14:38:30 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Feb  2 14:51:48 2007
@@ -968,7 +968,7 @@
   LatticeVal &IV = ValueState[&I];
   if (IV.isOverdefined()) return;
 
-  std::vector Operands;
+  SmallVector Operands;
   Operands.reserve(I.getNumOperands());
 
   for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
@@ -986,7 +986,8 @@
   Constant *Ptr = Operands[0];
   Operands.erase(Operands.begin());  // Erase the pointer from idx list...
 
-  markConstant(IV, &I, ConstantExpr::getGetElementPtr(Ptr, Operands));
+  markConstant(IV, &I, ConstantExpr::getGetElementPtr(Ptr, &Operands[0],
+  Operands.size()));
 }
 
 void SCCPSolver::visitStoreInst(Instruction &SI) {



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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.158 -> 1.159
---
Log message:

Convert an std::set to SmallSet, this speeds up IPSCCP 17% on kimwitu.



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

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


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.158 
llvm/lib/Transforms/Scalar/SCCP.cpp:1.159
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.158   Fri Feb  2 14:51:48 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Feb  2 14:57:39 2007
@@ -34,11 +34,11 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include 
-#include 
 using namespace llvm;
 
 STATISTIC(NumInstRemoved, "Number of instructions removed");
@@ -137,7 +137,7 @@
 /// Constant Propagation.
 ///
 class SCCPSolver : public InstVisitor {
-  std::set BBExecutable;// The basic blocks that are 
executable
+  SmallSet BBExecutable;// The basic blocks that are 
executable
   DenseMap ValueState;  // The state each value is in.
 
   /// GlobalValue - If we are tracking any values for the contents of a global
@@ -216,7 +216,7 @@
 
   /// getExecutableBlocks - Once we have solved for constants, return the set 
of
   /// blocks that is known to be executable.
-  std::set &getExecutableBlocks() {
+  SmallSet &getExecutableBlocks() {
 return BBExecutable;
   }
 
@@ -1384,7 +1384,7 @@
   // delete their contents now.  Note that we cannot actually delete the 
blocks,
   // as we cannot modify the CFG of the function.
   //
-  std::set &ExecutableBBs = Solver.getExecutableBlocks();
+  SmallSet &ExecutableBBs = Solver.getExecutableBlocks();
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
 if (!ExecutableBBs.count(BB)) {
   DOUT << "  BasicBlock Dead:" << *BB;
@@ -1523,7 +1523,7 @@
   // Iterate over all of the instructions in the module, replacing them with
   // constants if we have found them to be of constant values.
   //
-  std::set &ExecutableBBs = Solver.getExecutableBlocks();
+  SmallSet &ExecutableBBs = Solver.getExecutableBlocks();
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
  AI != E; ++AI)



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


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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.54 -> 1.55
---
Log message:

Another thumb large stack offset codegen bug.

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

 ARMRegisterInfo.cpp |   18 +-
 1 files changed, 13 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.54 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.55
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.54Fri Feb  2 02:58:48 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Fri Feb  2 15:08:39 2007
@@ -625,7 +625,6 @@
 Offset += MI.getOperand(i+1).getImm();
 assert((Offset & 3) == 0 &&
"Thumb add/sub sp, #imm immediate must be multiple of 4!");
-Offset >>= 2;
 if (Offset == 0) {
   // Turn it into a move.
   MI.setInstrDescriptor(TII.get(ARM::tMOVrr));
@@ -635,28 +634,37 @@
 }
 
 // Common case: small offset, fits into instruction.
-if ((Offset & ~255U) == 0) {
+if (((Offset >> 2) & ~255U) == 0) {
   // Replace the FrameIndex with sp / fp
   MI.getOperand(i).ChangeToRegister(FrameReg, false);
-  MI.getOperand(i+1).ChangeToImmediate(Offset);
+  MI.getOperand(i+1).ChangeToImmediate(Offset >> 2);
   return;
 }
 
 unsigned DestReg = MI.getOperand(0).getReg();
+unsigned Bytes = (Offset > 0) ? Offset : -Offset;
+unsigned NumMIs = calcNumMI(Opcode, 0, Bytes, 8, 1);
+// MI would expand into a large number of instructions. Don't try to
+// simplify the immediate.
+if (NumMIs > 2) {
+  emitThumbRegPlusImmediate(MBB, II, DestReg, ARM::SP, Offset, TII);
+  MBB.erase(II);
+  return;
+}
+
 if (Offset > 0) {
   // Translate r0 = add sp, imm to
   // r0 = add sp, 255*4
   // r0 = add r0, (imm - 255*4)
   MI.getOperand(i).ChangeToRegister(FrameReg, false);
   MI.getOperand(i+1).ChangeToImmediate(255);
-  Offset = (Offset - 255) << 2;
+  Offset = (Offset - 255 * 4);
   MachineBasicBlock::iterator NII = next(II);
   emitThumbRegPlusImmediate(MBB, NII, DestReg, DestReg, Offset, TII);
 } else {
   // Translate r0 = add sp, -imm to
   // r0 = -imm (this is then translated into a series of instructons)
   // r0 = add r0, sp
-  Offset <<= 2;
   emitThumbConstant(MBB, II, DestReg, Offset, TII);
   MI.setInstrDescriptor(TII.get(ARM::tADDhirr));
   MI.getOperand(i).ChangeToRegister(DestReg, false);



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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.159 -> 1.160
---
Log message:

Remove more malloc thrashing, this speeds up IPSCCP on kimwitu another 6.7%.


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

 SCCP.cpp |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.159 
llvm/lib/Transforms/Scalar/SCCP.cpp:1.160
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.159   Fri Feb  2 14:57:39 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Feb  2 15:15:06 2007
@@ -344,7 +344,7 @@
   // getFeasibleSuccessors - Return a vector of booleans to indicate which
   // successors are reachable from a given terminator instruction.
   //
-  void getFeasibleSuccessors(TerminatorInst &TI, std::vector &Succs);
+  void getFeasibleSuccessors(TerminatorInst &TI, SmallVector &Succs);
 
   // isEdgeFeasible - Return true if the control flow edge from the 'From' 
basic
   // block to the 'To' basic block is currently feasible...
@@ -411,7 +411,7 @@
 // successors are reachable from a given terminator instruction.
 //
 void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
-   std::vector &Succs) {
+   SmallVector &Succs) {
   Succs.resize(TI.getNumSuccessors());
   if (BranchInst *BI = dyn_cast(&TI)) {
 if (BI->isUnconditional()) {
@@ -452,8 +452,7 @@
   Succs[0] = true;
 }
   } else {
-cerr << "SCCP: Don't know how to handle: " << TI;
-Succs.assign(TI.getNumSuccessors(), true);
+assert(0 && "SCCP: Don't know how to handle this terminator!");
   }
 }
 
@@ -543,8 +542,7 @@
 std::multimap::iterator I, E;
 tie(I, E) = UsersOfOverdefinedPHIs.equal_range(&PN);
 if (I != E) {
-  std::vector Users;
-  Users.reserve(std::distance(I, E));
+  SmallVector Users;
   for (; I != E; ++I) Users.push_back(I->second);
   while (!Users.empty()) {
 visit(Users.back());
@@ -624,7 +622,7 @@
 
 
 void SCCPSolver::visitTerminatorInst(TerminatorInst &TI) {
-  std::vector SuccFeasible;
+  SmallVector SuccFeasible;
   getFeasibleSuccessors(TI, SuccFeasible);
 
   BasicBlock *BB = TI.getParent();
@@ -1385,6 +1383,7 @@
   // as we cannot modify the CFG of the function.
   //
   SmallSet &ExecutableBBs = Solver.getExecutableBlocks();
+  SmallVector Insts;
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
 if (!ExecutableBBs.count(BB)) {
   DOUT << "  BasicBlock Dead:" << *BB;
@@ -1392,7 +1391,6 @@
 
   // Delete the instructions backwards, as it has a reduced likelihood of
   // having to update as many def-use and use-def chains.
-  std::vector Insts;
   for (BasicBlock::iterator I = BB->begin(), E = BB->getTerminator();
I != E; ++I)
 Insts.push_back(I);
@@ -1524,6 +1522,9 @@
   // constants if we have found them to be of constant values.
   //
   SmallSet &ExecutableBBs = Solver.getExecutableBlocks();
+  SmallVector Insts;
+  SmallVector BlocksToErase;
+
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
  AI != E; ++AI)
@@ -1541,7 +1542,6 @@
 }
   }
 
-std::vector BlocksToErase;
 for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
   if (!ExecutableBBs.count(BB)) {
 DOUT << "  BasicBlock Dead:" << *BB;
@@ -1549,7 +1549,6 @@
 
 // Delete the instructions backwards, as it has a reduced likelihood of
 // having to update as many def-use and use-def chains.
-std::vector Insts;
 TerminatorInst *TI = BB->getTerminator();
 for (BasicBlock::iterator I = BB->begin(), E = TI; I != E; ++I)
   Insts.push_back(I);
@@ -1643,6 +1642,7 @@
   // Finally, delete the basic block.
   F->getBasicBlockList().erase(DeadBB);
 }
+BlocksToErase.clear();
   }
 
   // If we inferred constant or undef return values for a function, we replaced



___
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/DenseMap.h

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

DenseMap.h updated: 1.13 -> 1.14
---
Log message:

silence annoying warning in release-asserts build


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

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


Index: llvm/include/llvm/ADT/DenseMap.h
diff -u llvm/include/llvm/ADT/DenseMap.h:1.13 
llvm/include/llvm/ADT/DenseMap.h:1.14
--- llvm/include/llvm/ADT/DenseMap.h:1.13   Fri Feb  2 14:34:32 2007
+++ llvm/include/llvm/ADT/DenseMap.hFri Feb  2 15:19:18 2007
@@ -233,6 +233,7 @@
 // Insert the key/value into the new table.
 BucketT *DestBucket;
 bool FoundVal = LookupBucketFor(B->first, DestBucket);
+FoundVal = FoundVal; // silence warning.
 assert(!FoundVal && "Key already in new map?");
 DestBucket->first = B->first;
 new (&DestBucket->second) ValueT(B->second);



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


[llvm-commits] CVS: llvm/tools/gccas/gccas.sh

2007-02-02 Thread Reid Spencer


Changes in directory llvm/tools/gccas:

gccas.sh updated: 1.1 -> 1.2
---
Log message:

Two improvements:
1. Allow -- as well as - options (Bill Wendling)
2. Pass unrecognized options to opt and let it handle the errors, if any
   (Chris Lattner).


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

 gccas.sh |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/tools/gccas/gccas.sh
diff -u llvm/tools/gccas/gccas.sh:1.1 llvm/tools/gccas/gccas.sh:1.2
--- llvm/tools/gccas/gccas.sh:1.1   Fri Feb  2 09:50:58 2007
+++ llvm/tools/gccas/gccas.sh   Fri Feb  2 15:49:27 2007
@@ -23,6 +23,7 @@
 ASOPTS=""
 lastwasdasho=0
 for option in "$@" ; do
+  option=`echo "$option" | sed 's/^--/-/'`
   case "$option" in
 -disable-opt)
OPTOPTS="$OPTOPTS $option"
@@ -47,8 +48,7 @@
# ignore
;;
 -*)
-   echo "gccas: Unrecognized option '$option'"
-   exit 1
+   OPTOPTS="$OPTOPTS $option"
;;
 *)
if test $lastwasdasho -eq 1 ; then



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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.160 -> 1.161
---
Log message:

Switch this back to using an std::map.  DenseMap entries are getting invalidated


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

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


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.160 
llvm/lib/Transforms/Scalar/SCCP.cpp:1.161
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.160   Fri Feb  2 15:15:06 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Feb  2 16:36:16 2007
@@ -138,7 +138,7 @@
 ///
 class SCCPSolver : public InstVisitor {
   SmallSet BBExecutable;// The basic blocks that are 
executable
-  DenseMap ValueState;  // The state each value is in.
+  std::map ValueState;  // The state each value is in.
 
   /// GlobalValue - If we are tracking any values for the contents of a global
   /// variable, we keep a mapping from the constant accessor to the element of
@@ -222,7 +222,7 @@
 
   /// getValueMapping - Once we have solved for constants, return the mapping 
of
   /// LLVM values to LatticeVals.
-  DenseMap &getValueMapping() {
+  std::map &getValueMapping() {
 return ValueState;
   }
 
@@ -303,7 +303,7 @@
   // Instruction object, then use this accessor to get its value from the map.
   //
   inline LatticeVal &getValueState(Value *V) {
-DenseMap::iterator I = ValueState.find(V);
+std::map::iterator I = ValueState.find(V);
 if (I != ValueState.end()) return I->second;  // Common case, in the map
 
 if (Constant *C = dyn_cast(V)) {
@@ -1364,7 +1364,7 @@
   Solver.MarkBlockExecutable(F.begin());
 
   // Mark all arguments to the function as being overdefined.
-  DenseMap &Values = Solver.getValueMapping();
+  std::map &Values = Solver.getValueMapping();
   for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; 
++AI)
 Values[AI].markOverdefined();
 
@@ -1485,7 +1485,7 @@
   // Loop over all functions, marking arguments to those with their addresses
   // taken or that are external as overdefined.
   //
-  DenseMap &Values = Solver.getValueMapping();
+  std::map &Values = Solver.getValueMapping();
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
 if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
   if (!F->isDeclaration())



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


[llvm-commits] CVS: llvm-www/pubs/2005-07-IDEAS-PerfEstimation.html 2005-07-IDEAS-PerfEstimation.pdf index.html

2007-02-02 Thread Chris Lattner


Changes in directory llvm-www/pubs:

2005-07-IDEAS-PerfEstimation.html added (r1.1)
2005-07-IDEAS-PerfEstimation.pdf added (r1.1)
index.html updated: 1.42 -> 1.43
---
Log message:

add a new paper



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

 2005-07-IDEAS-PerfEstimation.html |   41 ++
 2005-07-IDEAS-PerfEstimation.pdf  |0 
 index.html|6 +
 3 files changed, 47 insertions(+)


Index: llvm-www/pubs/2005-07-IDEAS-PerfEstimation.html
diff -c /dev/null llvm-www/pubs/2005-07-IDEAS-PerfEstimation.html:1.1
*** /dev/null   Fri Feb  2 16:59:52 2007
--- llvm-www/pubs/2005-07-IDEAS-PerfEstimation.html Fri Feb  2 16:59:42 2007
***
*** 0 
--- 1,41 
+ 
+ 
+ 
+   
+   
+   Practical Techniques for Performance Estimation of Processors
+ 
+ 
+ 
+ 
+   Practical Techniques for Performance Estimation of Processors
+ 
+ 
+   Abhijit Ray, Thambipillai Srikanthan and Wu Jigang 
+ 
+ 
+ Abstract:
+ 
+ Performance estimation of processor is important to select the right 
processor for an application. Poorly chosen processors can either under perform 
very badly or over 
+ perform but with high cost. Most previous work on performance estimation are 
based on generating the development tools, i.e., compilers, assemblers etc from 
a processor 
+ description file and then additionally generating an instruction set 
simulator to get the performance. In this work we 
+ present a simpler strategy for performance estimation. We 
+ propose an estimation technique based on the intermediate format of an 
application. The estimation process does 
+ not require the generation of all the development tools as in 
+ the prevalent methods. As a result our method is not only 
+ cheaper but also faster.
+ 
+ 
+ Published:
+ 
+   "Practical Techniques for Performance Estimation of Processors", Abhijit 
Ray, Thambipillai Srikanthan and Wu Jigang.
+   Proceedings of the 9th International Database Engineering & Application 
Symposium (IDEAS'05), July 2005. 
+ 
+ 
+ Download:
+ 
+   Practical Techniques for 
Performance Estimation of Processors (PDF)
+ 
+ 
+ 
+ 


Index: llvm-www/pubs/2005-07-IDEAS-PerfEstimation.pdf


Index: llvm-www/pubs/index.html
diff -u llvm-www/pubs/index.html:1.42 llvm-www/pubs/index.html:1.43
--- llvm-www/pubs/index.html:1.42   Tue Jun 20 13:22:01 2006
+++ llvm-www/pubs/index.htmlFri Feb  2 16:59:42 2007
@@ -46,6 +46,12 @@
 Performance Libraries"
   By C. Alias and D. Barthou
   Proc. of the International IEEE Euro-Par Conference, August, 2005
+
+"Practical Techniques for 
Performance Estimation of Processors"
+ Abhijit Ray, Thambipillai Srikanthan and Wu Jigang.
+  Proceedings of the 9th International Database Engineering & Application 
Sy
+mposium (IDEAS'05), July 2005. 
+
   
 "An Implementation of Swing 
Modulo Scheduling with Extensions for Superblocks"
 Tanya M. Lattner. M.S. Thesis, Computer Science Dept., University 
of Illinois at



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


[llvm-commits] CVS: llvm-www/pubs/index.html

2007-02-02 Thread Chris Lattner


Changes in directory llvm-www/pubs:

index.html updated: 1.43 -> 1.44
---
Log message:

fix link



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

 index.html |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-www/pubs/index.html
diff -u llvm-www/pubs/index.html:1.43 llvm-www/pubs/index.html:1.44
--- llvm-www/pubs/index.html:1.43   Fri Feb  2 16:59:42 2007
+++ llvm-www/pubs/index.htmlFri Feb  2 17:00:07 2007
@@ -47,7 +47,7 @@
   By C. Alias and D. Barthou
   Proc. of the International IEEE Euro-Par Conference, August, 2005
 
-"Practical Techniques for 
Performance Estimation of Processors"
+"Practical Techniques for 
Performance Estimation of Processors"
  Abhijit Ray, Thambipillai Srikanthan and Wu Jigang.
   Proceedings of the 9th International Database Engineering & Application 
Sy
 mposium (IDEAS'05), July 2005. 



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


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

2007-02-02 Thread Lauro Ramos Venancio


Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.55 -> 1.56
---
Log message:

bugfix: SP isn't resetted when function has FP and there is no spills.


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

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


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.55 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.56
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.55Fri Feb  2 15:08:39 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Fri Feb  2 17:08:40 2007
@@ -1140,10 +1140,11 @@
 if (STI.isTargetDarwin() || hasFP(MF)) {
   NumBytes = AFI->getFramePtrSpillOffset() - NumBytes;
   // Reset SP based on frame pointer only if the stack frame extends beyond
-  // frame pointer stack slot.
+  // frame pointer stack slot or target is ELF and the function has FP.
   if (AFI->getGPRCalleeSavedArea2Size() ||
   AFI->getDPRCalleeSavedAreaSize()  ||
-  AFI->getDPRCalleeSavedAreaOffset())
+  AFI->getDPRCalleeSavedAreaOffset()||
+  hasFP(MF))
 if (NumBytes)
   BuildMI(MBB, MBBI, TII.get(ARM::SUBri), ARM::SP).addReg(FramePtr)
 .addImm(NumBytes);



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


[llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/Cloning.h

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/Transforms/Utils:

Cloning.h updated: 1.21 -> 1.22
---
Log message:

Switch inliner over to use DenseMap instead of std::map for ValueMap.  This
speeds up the inliner 16%.


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

 Cloning.h |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/include/llvm/Transforms/Utils/Cloning.h
diff -u llvm/include/llvm/Transforms/Utils/Cloning.h:1.21 
llvm/include/llvm/Transforms/Utils/Cloning.h:1.22
--- llvm/include/llvm/Transforms/Utils/Cloning.h:1.21   Tue Jan 30 17:22:39 2007
+++ llvm/include/llvm/Transforms/Utils/Cloning.hFri Feb  2 18:07:40 2007
@@ -19,7 +19,7 @@
 #define LLVM_TRANSFORMS_UTILS_CLONING_H
 
 #include 
-#include 
+#include "llvm/ADT/DenseMap.h"
 
 namespace llvm {
 
@@ -38,7 +38,7 @@
 /// CloneModule - Return an exact copy of the specified module
 ///
 Module *CloneModule(const Module *M);
-Module *CloneModule(const Module *M, std::map &ValueMap);
+Module *CloneModule(const Module *M, DenseMap &ValueMap);
 
 /// ClonedCodeInfo - This struct can be used to capture information about code
 /// being cloned, while it is being cloned.
@@ -94,7 +94,7 @@
 /// parameter.
 ///
 BasicBlock *CloneBasicBlock(const BasicBlock *BB,
-std::map &ValueMap,
+DenseMap &ValueMap,
 const char *NameSuffix = "", Function *F = 0,
 ClonedCodeInfo *CodeInfo = 0);
 
@@ -109,13 +109,13 @@
 /// information about the cloned code if non-null.
 ///
 Function *CloneFunction(const Function *F,
-std::map &ValueMap,
+DenseMap &ValueMap,
 ClonedCodeInfo *CodeInfo = 0);
 
 /// CloneFunction - Version of the function that doesn't need the ValueMap.
 ///
 inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 
0){
-  std::map ValueMap;
+  DenseMap ValueMap;
   return CloneFunction(F, ValueMap, CodeInfo);
 }
 
@@ -126,7 +126,7 @@
 /// specified suffix to all values cloned.
 ///
 void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
-   std::map &ValueMap,
+   DenseMap &ValueMap,
std::vector &Returns,
const char *NameSuffix = "", 
ClonedCodeInfo *CodeInfo = 0);
@@ -139,7 +139,7 @@
 /// dead.  Since this doesn't produce an exactly copy of the input, it can't be
 /// used for things like CloneFunction or CloneModule.
 void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
-   std::map &ValueMap,
+   DenseMap &ValueMap,
std::vector &Returns,
const char *NameSuffix = "", 
ClonedCodeInfo *CodeInfo = 0,
@@ -150,7 +150,7 @@
 /// saved in ValueMap.
 ///
 void CloneTraceInto(Function *NewFunc, Trace &T,
-std::map &ValueMap,
+DenseMap &ValueMap,
 const char *NameSuffix);
 
 /// CloneTrace - Returns a copy of the specified trace.



___
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/CloneFunction.cpp CloneModule.cpp CloneTrace.cpp InlineFunction.cpp ValueMapper.cpp ValueMapper.h

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

CloneFunction.cpp updated: 1.40 -> 1.41
CloneModule.cpp updated: 1.21 -> 1.22
CloneTrace.cpp updated: 1.11 -> 1.12
InlineFunction.cpp updated: 1.51 -> 1.52
ValueMapper.cpp updated: 1.28 -> 1.29
ValueMapper.h updated: 1.6 -> 1.7
---
Log message:

Switch inliner over to use DenseMap instead of std::map for ValueMap.  This
speeds up the inliner 16%.



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

 CloneFunction.cpp  |   13 +++--
 CloneModule.cpp|6 +++---
 CloneTrace.cpp |4 ++--
 InlineFunction.cpp |6 +++---
 ValueMapper.cpp|   20 +++-
 ValueMapper.h  |4 ++--
 6 files changed, 28 insertions(+), 25 deletions(-)


Index: llvm/lib/Transforms/Utils/CloneFunction.cpp
diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.40 
llvm/lib/Transforms/Utils/CloneFunction.cpp:1.41
--- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.40Thu Feb  1 12:48:38 2007
+++ llvm/lib/Transforms/Utils/CloneFunction.cpp Fri Feb  2 18:08:31 2007
@@ -22,11 +22,12 @@
 #include "ValueMapper.h"
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/ADT/SmallVector.h"
+#include 
 using namespace llvm;
 
 // CloneBasicBlock - See comments in Cloning.h
 BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB,
-  std::map &ValueMap,
+  DenseMap &ValueMap,
   const char *NameSuffix, Function *F,
   ClonedCodeInfo *CodeInfo) {
   BasicBlock *NewBB = new BasicBlock("", F);
@@ -66,7 +67,7 @@
 // ArgMap values.
 //
 void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
- std::map &ValueMap,
+ DenseMap &ValueMap,
  std::vector &Returns,
  const char *NameSuffix, ClonedCodeInfo *CodeInfo) 
{
   assert(NameSuffix && "NameSuffix cannot be null!");
@@ -113,7 +114,7 @@
 /// the function from their old to new values.
 ///
 Function *llvm::CloneFunction(const Function *F,
-  std::map &ValueMap,
+  DenseMap &ValueMap,
   ClonedCodeInfo *CodeInfo) {
   std::vector ArgTypes;
 
@@ -154,7 +155,7 @@
   struct PruningFunctionCloner {
 Function *NewFunc;
 const Function *OldFunc;
-std::map &ValueMap;
+DenseMap &ValueMap;
 std::vector &Returns;
 const char *NameSuffix;
 ClonedCodeInfo *CodeInfo;
@@ -162,7 +163,7 @@
 
   public:
 PruningFunctionCloner(Function *newFunc, const Function *oldFunc,
-  std::map &valueMap,
+  DenseMap &valueMap,
   std::vector &returns,
   const char *nameSuffix, 
   ClonedCodeInfo *codeInfo,
@@ -303,7 +304,7 @@
 /// dead.  Since this doesn't produce an exactly copy of the input, it can't be
 /// used for things like CloneFunction or CloneModule.
 void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function 
*OldFunc,
- std::map &ValueMap,
+ DenseMap &ValueMap,
  std::vector &Returns,
  const char *NameSuffix, 
  ClonedCodeInfo *CodeInfo,


Index: llvm/lib/Transforms/Utils/CloneModule.cpp
diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.21 
llvm/lib/Transforms/Utils/CloneModule.cpp:1.22
--- llvm/lib/Transforms/Utils/CloneModule.cpp:1.21  Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/Utils/CloneModule.cpp   Fri Feb  2 18:08:31 2007
@@ -29,12 +29,12 @@
 Module *llvm::CloneModule(const Module *M) {
   // Create the value map that maps things from the old module over to the new
   // module.
-  std::map ValueMap;
-
+  DenseMap ValueMap;
   return CloneModule(M, ValueMap);
 }
 
-Module *llvm::CloneModule(const Module *M, std::map 
&ValueMap) {
+Module *llvm::CloneModule(const Module *M,
+  DenseMap &ValueMap) {
   // First off, we need to create the new module...
   Module *New = new Module(M->getModuleIdentifier());
   New->setDataLayout(M->getDataLayout());


Index: llvm/lib/Transforms/Utils/CloneTrace.cpp
diff -u llvm/lib/Transforms/Utils/CloneTrace.cpp:1.11 
llvm/lib/Transforms/Utils/CloneTrace.cpp:1.12
--- llvm/lib/Transforms/Utils/CloneTrace.cpp:1.11   Sat Apr 23 16:38:35 2005
+++ llvm/lib/Transforms/Utils/CloneTrace.cppFri Feb  2 18:08:31 2007
@@ -26,7 +26,7 @@
 std::vector
 llvm::CloneTrace(const std::vector &origTrace) {
   std::vector clonedTrace;
-  std::map ValueMap;
+  DenseMap ValueMap;
 
   //First, loop over all the Basic Blocks in the trace and copy
   //them using CloneBasicBlock. Also fix the phi nodes during
@@ -92,7 +92,7 @@
 /// saved in ValueMap.
 ///
 void llvm::CloneTraceInto(Function *NewFunc, Trace &T,
-

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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnroll.cpp updated: 1.34 -> 1.35
LoopUnswitch.cpp updated: 1.59 -> 1.60
---
Log message:

Switch inliner over to use DenseMap instead of std::map for ValueMap.  This
speeds up the inliner 16%.



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

 LoopUnroll.cpp   |   16 
 LoopUnswitch.cpp |   10 +-
 2 files changed, 13 insertions(+), 13 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.34 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.35
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.34  Tue Jan 30 17:46:24 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Fri Feb  2 18:08:31 2007
@@ -31,9 +31,9 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IntrinsicInst.h"
 #include 
-#include 
 #include 
 using namespace llvm;
 
@@ -111,10 +111,10 @@
 // current values into those specified by ValueMap.
 //
 static inline void RemapInstruction(Instruction *I,
-std::map &ValueMap) 
{
+DenseMap &ValueMap) 
{
   for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
 Value *Op = I->getOperand(op);
-std::map::iterator It = ValueMap.find(Op);
+DenseMap::iterator It = ValueMap.find(Op);
 if (It != ValueMap.end()) Op = It->second;
 I->setOperand(op, Op);
   }
@@ -212,7 +212,7 @@
 
   // For the first iteration of the loop, we should use the precloned values 
for
   // PHI nodes.  Insert associations now.
-  std::map LastValueMap;
+  DenseMap LastValueMap;
   std::vector OrigPHINode;
   for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) {
 PHINode *PN = cast(I);
@@ -240,7 +240,7 @@
 
 for (std::vector::iterator BB = LoopBlocks.begin(),
  E = LoopBlocks.end(); BB != E; ++BB) {
-  std::map ValueMap;
+  DenseMap ValueMap;
   BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer);
   Header->getParent()->getBasicBlockList().push_back(New);
 
@@ -259,7 +259,7 @@
 
   // Update our running map of newest clones
   LastValueMap[*BB] = New;
-  for (std::map::iterator VI = ValueMap.begin(),
+  for (DenseMap::iterator VI = ValueMap.begin(),
VE = ValueMap.end(); VI != VE; ++VI)
 LastValueMap[VI->first] = VI->second;
 
@@ -303,13 +303,13 @@
  
   // Update PHI nodes that reference the final latch block
   if (TripCount > 1) {
-std::set Users;
+SmallPtrSet Users;
 for (Value::use_iterator UI = LatchBlock->use_begin(),
  UE = LatchBlock->use_end(); UI != UE; ++UI)
   if (PHINode* phi = dyn_cast(*UI))
 Users.insert(phi);
 
-for (std::set::iterator SI = Users.begin(), SE = Users.end();
+for (SmallPtrSet::iterator SI = Users.begin(), SE = 
Users.end();
  SI != SE; ++SI) {
   Value* InVal = (*SI)->getIncomingValueForBlock(LatchBlock);
   if (isa(InVal))


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.59 
llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.60
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.59Tue Jan 30 17:46:24 2007
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb  2 18:08:31 2007
@@ -445,10 +445,10 @@
 // current values into those specified by ValueMap.
 //
 static inline void RemapInstruction(Instruction *I,
-std::map &ValueMap) 
{
+DenseMap &ValueMap) 
{
   for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
 Value *Op = I->getOperand(op);
-std::map::iterator It = ValueMap.find(Op);
+DenseMap::iterator It = ValueMap.find(Op);
 if (It != ValueMap.end()) Op = It->second;
 I->setOperand(op, Op);
   }
@@ -456,7 +456,7 @@
 
 /// CloneLoop - Recursively clone the specified loop and all of its children,
 /// mapping the blocks with the specified map.
-static Loop *CloneLoop(Loop *L, Loop *PL, std::map &VM,
+static Loop *CloneLoop(Loop *L, Loop *PL, DenseMap &VM,
LoopInfo *LI) {
   Loop *New = new Loop();
 
@@ -632,7 +632,7 @@
   // the instructions and blocks.
   std::vector NewBlocks;
   NewBlocks.reserve(LoopBlocks.size());
-  std::map ValueMap;
+  DenseMap ValueMap;
   for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
 BasicBlock *New = CloneBasicBlock(LoopBlocks[i], ValueMap, ".us", F);
 NewBlocks.push_back(New);
@@ -669,7 +669,7 @@
 for (BasicBlock::iterator I = ExitSucc->begin();
  (PN = dyn_cast(I)); ++I) {
   Value *V = PN->getIncomingValueForBlock(ExitBlocks[i]);
-  std::map::iterator It = ValueMap.find(V);
+  DenseMap::iterator It = ValueMap.find(V);
   if (It != ValueMap.end()) V = It->second;
   PN->addIncoming(V, NewExit);
 }



___
llvm-commits m

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

2007-02-02 Thread Lauro Ramos Venancio


Changes in directory llvm/test/CodeGen/ARM:

alloca.ll updated: 1.4 -> 1.5
---
Log message:

Improves alloca test. Verifies SP restoration.


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

 alloca.ll |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/test/CodeGen/ARM/alloca.ll
diff -u llvm/test/CodeGen/ARM/alloca.ll:1.4 llvm/test/CodeGen/ARM/alloca.ll:1.5
--- llvm/test/CodeGen/ARM/alloca.ll:1.4 Fri Dec  1 22:23:08 2006
+++ llvm/test/CodeGen/ARM/alloca.ll Fri Feb  2 18:16:21 2007
@@ -1,4 +1,7 @@
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mtriple=arm-linux-gnu | 
grep "mov r11, sp" &&
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mtriple=arm-linux-gnu | 
grep "mov sp, r11"
+
 void %f(uint %a) {
 entry:
%tmp = alloca sbyte, uint %a



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


[llvm-commits] CVS: llvm/docs/CommandGuide/opt.pod

2007-02-02 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

opt.pod updated: 1.4 -> 1.5
---
Log message:

For PR1152: http://llvm.org/PR1152 :
Update documentation to reflect addition of gccas functionality into opt.


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

 opt.pod |   47 ++-
 1 files changed, 46 insertions(+), 1 deletion(-)


Index: llvm/docs/CommandGuide/opt.pod
diff -u llvm/docs/CommandGuide/opt.pod:1.4 llvm/docs/CommandGuide/opt.pod:1.5
--- llvm/docs/CommandGuide/opt.pod:1.4  Sun Aug 27 19:34:19 2006
+++ llvm/docs/CommandGuide/opt.pod  Fri Feb  2 18:21:56 2007
@@ -45,12 +45,57 @@
 
 =item B<-help>
 
-Print a summary of command line options.
+Print a summary of command line options. 
 
 =item B<-o> I
 
 Specify the output filename.
 
+=item B<-{passname}>
+
+B provides the ability to run any of LLVM's optimization or analysis 
passes
+in any order. The B<-help> option lists all the passes available. The order in
+which the options occur on the command line are the order in which they are
+executed (within pass constraints). 
+
+=item B<-std-compile-opts>
+
+This is short hand for a standard list of I passes.
+This is typically used to optimize the output from the llvm-gcc front end. It
+might be useful for other front end compilers as well. To discover the full set
+of options available, use the following command:
+
+=over
+
+B
+
+=back
+
+=item B<-disable-inlining>
+
+This option is only meaningful when B<-std-compile-opts> is given. It simply
+removes the inlining pass from the standard list.
+
+=item B<-disable-opt>
+
+This option is only meaningful when B<-std-compile-opts> is given. It disables
+most, but not all, of the B<-std-compile-opts>. The ones that remain are
+B<-verify>, B<-lower-setjmp>, and B<-funcresolve>.
+
+=item B<-strip-debug>
+
+This option causes opt to strip debug information from the module before 
+applying other optimizations. It is essentially the same as B<-strip> but it
+ensures that stripping of debug information is done first.
+
+=item B<-verify-each>
+
+This option causes opt to add a verify pass after every pass otherwise 
specified
+on the command line (including B<-verify>).  This is useful for cases where it 
+is suspected that a pass is creating an invalid module but it is not clear 
which
+pass is doing it. The combination of B<-std-compile-opts> and B<-verify-each>
+can quickly track down this kind of problem.
+
 =item B<-profile-info-file> I
 
 Specify the name of the file loaded by the -profile-loader option.



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


[llvm-commits] [PATCH] Write llvm byte code into PCH while creating PCH

2007-02-02 Thread Devang Patel
I checked in following patch today. First step as part of GCC PCH  
integration work.

-
Devang

Index: gcc/toplev.c
===
--- gcc/toplev.c(revision 123268)
+++ gcc/toplev.c(working copy)
@@ -1163,7 +1163,8 @@ compile_file (void)
#ifndef ENABLE_LLVM
targetm.asm_out.file_end ();
#else
-  llvm_asm_file_end();
+  if (!flag_pch_file)
+llvm_asm_file_end();
#endif
/* APPLE LOCAL end LLVM */
}
@@ -1563,7 +1564,10 @@ init_asm_output (const char *name)
#ifndef ENABLE_LLVM
targetm.asm_out.file_start ();
#else
-  llvm_asm_file_start();
+  if (flag_pch_file)
+llvm_pch_write_init();
+  else
+llvm_asm_file_start();
#endif
/* APPLE LOCAL end LLVM */
Index: gcc/llvm.h
===
--- gcc/llvm.h  (revision 123268)
+++ gcc/llvm.h  (working copy)
@@ -80,6 +80,9 @@ void llvm_emit_typedef(union tree_node*)
   */
void print_llvm(FILE *file, void *LLVM);
+/* Init pch writing. */
+void llvm_pch_write_init(void);
+
/* llvm_asm_file_start - Start the .s file. */
void llvm_asm_file_start(void);
Index: gcc/cp/decl2.c
===
--- gcc/cp/decl2.c  (revision 123268)
+++ gcc/cp/decl2.c  (working copy)
@@ -2846,8 +2846,12 @@ cp_finish_file (void)
if (! global_bindings_p () || current_class_type ||  
decl_namespace_list)
  return;
-  if (pch_file)
+  /* APPLE LOCAL begin LLVM */
+  if (pch_file) {
  c_common_write_pch ();
+return;
+  }
+  /* APPLE LOCAL end LLVM */
#ifdef USE_MAPPED_LOCATION
/* FIXME - huh? */
Index: gcc/llvm-backend.cpp
===
--- gcc/llvm-backend.cpp(revision 123268)
+++ gcc/llvm-backend.cpp(working copy)
@@ -183,6 +183,26 @@ void llvm_lang_dependent_init(const char
oFILEstream *AsmOutStream = 0;
+// Initialize PCH writing.
+void llvm_pch_write_init(void) {
+  timevar_push(TV_LLVM_INIT);
+  AsmOutStream = new oFILEstream(asm_out_file);
+  AsmOutFile = new OStream(*AsmOutStream);
+
+  PerModulePasses = new PassManager();
+  PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
+
+  // Emit an LLVM .bc file to the output.  This is used when passed
+  // -emit-llvm -c to the GCC driver.
+  PerModulePasses->add(new WriteBytecodePass(AsmOutFile));
+
+  // Disable emission of .ident into the output file... which is  
completely
+  // wrong for llvm/.bc emission cases.
+  flag_no_ident = 1;
+
+  timevar_pop(TV_LLVM_INIT);
+}
+
// llvm_asm_file_start - Start the .s file.
void llvm_asm_file_start(void) {
timevar_push(TV_LLVM_INIT);
Index: gcc/c-pch.c
===
--- gcc/c-pch.c (revision 123268)
+++ gcc/c-pch.c (working copy)
@@ -193,6 +193,11 @@ c_common_write_pch (void)
long written;
struct c_pch_header h;
+  /* APPLE LOCAL begin LLVM */
+#ifdef ENABLE_LLVM
+  llvm_asm_file_end();
+#endif
+  /* APPLE LOCAL end LLVM */
(*debug_hooks->handle_pch) (1);
cpp_write_pch_deps (parse_in, pch_outfile);

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


[llvm-commits] CVS: llvm/docs/CommandGuide/opt.pod

2007-02-02 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

opt.pod updated: 1.5 -> 1.6
---
Log message:

Format the examples correctly.


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

 opt.pod |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/docs/CommandGuide/opt.pod
diff -u llvm/docs/CommandGuide/opt.pod:1.5 llvm/docs/CommandGuide/opt.pod:1.6
--- llvm/docs/CommandGuide/opt.pod:1.5  Fri Feb  2 18:21:56 2007
+++ llvm/docs/CommandGuide/opt.pod  Fri Feb  2 18:32:23 2007
@@ -67,7 +67,7 @@
 
 =over
 
-B
+   llvm-as < /dev/null | opt -std-compile-opts -disable-output 
-debug-pass=Arguments
 
 =back
 
@@ -122,11 +122,7 @@
 enable various optimizations or analyses.  To see the new complete list of 
 optimizations, use the B<-help> and B<-load> options together. For example:
 
-=over
-
-B=I B<-help>
-
-=back
+   opt -load=plugin.so -help
 
 =item B<-p>
 



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


[llvm-commits] CVS: llvm/docs/CommandGuide/opt.pod

2007-02-02 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

opt.pod updated: 1.6 -> 1.7
---
Log message:

And even more correctly.


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

 opt.pod |4 
 1 files changed, 4 deletions(-)


Index: llvm/docs/CommandGuide/opt.pod
diff -u llvm/docs/CommandGuide/opt.pod:1.6 llvm/docs/CommandGuide/opt.pod:1.7
--- llvm/docs/CommandGuide/opt.pod:1.6  Fri Feb  2 18:32:23 2007
+++ llvm/docs/CommandGuide/opt.pod  Fri Feb  2 18:33:26 2007
@@ -65,12 +65,8 @@
 might be useful for other front end compilers as well. To discover the full set
 of options available, use the following command:
 
-=over
-
llvm-as < /dev/null | opt -std-compile-opts -disable-output 
-debug-pass=Arguments
 
-=back
-
 =item B<-disable-inlining>
 
 This option is only meaningful when B<-std-compile-opts> is given. It simply



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


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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.465 -> 1.466
---
Log message:

Pasto

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

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


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.465 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.466
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.465 Thu Feb  1 02:39:52 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri Feb  2 18:43:46 2007
@@ -3634,7 +3634,7 @@
 LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 : RTLIB::UO_F64;
 break;
   case ISD::SETO:
-LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 : RTLIB::UO_F64;
+LC1 = (VT == MVT::f32) ? RTLIB::O_F32 : RTLIB::O_F64;
 break;
   default:
 LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 : RTLIB::UO_F64;



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


[llvm-commits] CVS: llvm/docs/CommandGuide/gccas.pod

2007-02-02 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

gccas.pod updated: 1.6 -> 1.7
---
Log message:

For PR1152: http://llvm.org/PR1152 :
Update documentation to reflect that this isn't a full-blown executable
any more.


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

 gccas.pod |   30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)


Index: llvm/docs/CommandGuide/gccas.pod
diff -u llvm/docs/CommandGuide/gccas.pod:1.6 
llvm/docs/CommandGuide/gccas.pod:1.7
--- llvm/docs/CommandGuide/gccas.pod:1.6Tue Nov 21 16:53:12 2006
+++ llvm/docs/CommandGuide/gccas.podFri Feb  2 18:44:47 2007
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-gccas - optimizing LLVM assembler
+gccas - convenience script to run B and B
 
 =head1 SYNOPSIS
 
@@ -10,19 +10,19 @@
 
 =head1 DESCRIPTION
 
-The B utility takes an LLVM assembly file generated by the
-L or L front-ends and converts
-it into an LLVM bytecode file.  It is primarily used by the GCC
-front end, and as such, attempts to mimic the interface provided
-by the default system assembler so that it can act as a "drop-in"
-replacement.
-
-B performs a number of optimizations on the input program,
-including but not limited to: promotion of stack values to SSA
-registers; elimination of dead globals, function arguments, code,
-and types; tail-call elimination; loop-invariant code motion; global
-common-subexpression elimination; and sparse conditional constant
-propagation.
+The B shell script passes an LLVM assembly file through the B 
+and B programs to generate an optimized bytecode file. Its name is an
+historical artifact from when it was a full executable used to process LLVM 
+assembly generated by the L or L front-ends. 
 
+Currently this is a shell script that simulates what the old B 
executable
+once did. 
+
+B performs a number of optimizations on the input program, including but
+not limited to: promotion of stack values to SSA registers; elimination of dead
+globals, function arguments, code, and types; tail-call elimination; 
+loop-invariant code motion; global common-subexpression elimination; and 
+sparse conditional constant propagation. It accomplishes this by using the
+B<-std-compile-opts> option to the B tool.
 
 =head1 OPTIONS
 
@@ -71,7 +71,7 @@
 
 =head1 SEE ALSO
 
-L, L
+L, L, L
 
 =head1 AUTHORS
 



___
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/unord.ll

2007-02-02 Thread Evan Cheng


Changes in directory llvm/test/CodeGen/ARM:

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

__builtin_isunordered test case.

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

 unord.ll |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/test/CodeGen/ARM/unord.ll
diff -c /dev/null llvm/test/CodeGen/ARM/unord.ll:1.1
*** /dev/null   Fri Feb  2 18:50:55 2007
--- llvm/test/CodeGen/ARM/unord.ll  Fri Feb  2 18:50:45 2007
***
*** 0 
--- 1,18 
+ ; RUN: llvm-as < %s | llc -march=arm &&
+ ; RUN: llvm-as < %s | llc -march=arm | grep bne | wc -l | grep 1 &&
+ ; RUN: llvm-as < %s | llc -march=arm | grep beq | wc -l | grep 1 &&
+ ; RUN: llvm-as < %s | llc -march=arm -enable-thumb &&
+ ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bne | wc -l | grep 
1 &&
+ ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep beq | wc -l | grep 1
+ 
+ define i32 @f1(float %X, float %Y) {
+   %tmp = fcmp uno float %X, %Y
+   %retval = select i1 %tmp, i32 1, i32 -1
+   ret i32 %retval
+ }
+ 
+ define i32 @f2(float %X, float %Y) {
+   %tmp = fcmp ord float %X, %Y
+   %retval = select i1 %tmp, i32 1, i32 -1
+   ret i32 %retval
+ }



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


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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.466 -> 1.467
---
Log message:

Switch ComputeTopDownOrdering over to using a densemap.  This speeds up
isel as a whole by 3.3%.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.466 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.467
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.466 Fri Feb  2 18:43:46 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri Feb  2 19:12:36 2007
@@ -25,6 +25,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 using namespace llvm;
@@ -290,7 +291,7 @@
 /// ComputeTopDownOrdering - Add the specified node to the Order list if it has
 /// not been visited yet and if all of its operands have already been visited.
 static void ComputeTopDownOrdering(SDNode *N, std::vector &Order,
-   std::map &Visited) {
+   DenseMap &Visited) {
   if (++Visited[N] != N->getNumOperands())
 return;  // Haven't visited all operands yet
   
@@ -318,7 +319,7 @@
   // practice however, this causes us to run out of stack space on large basic
   // blocks.  To avoid this problem, compute an ordering of the nodes where 
each
   // node is only legalized after all of its operands are legalized.
-  std::map Visited;
+  DenseMap Visited;
   std::vector Order;
   
   // Compute ordering from all of the leaves in the graphs, those (like the



___
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/MachinePassRegistry.h ScheduleDAG.h

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

MachinePassRegistry.h updated: 1.3 -> 1.4
ScheduleDAG.h updated: 1.35 -> 1.36
---
Log message:

switch the sched unit map over to use a DenseMap instead of std::map.  This
speeds up isel as a whole time by 2.6%.


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

 MachinePassRegistry.h |1 -
 ScheduleDAG.h |5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/CodeGen/MachinePassRegistry.h
diff -u llvm/include/llvm/CodeGen/MachinePassRegistry.h:1.3 
llvm/include/llvm/CodeGen/MachinePassRegistry.h:1.4
--- llvm/include/llvm/CodeGen/MachinePassRegistry.h:1.3 Wed Aug  2 07:30:23 2006
+++ llvm/include/llvm/CodeGen/MachinePassRegistry.h Fri Feb  2 19:34:13 2007
@@ -19,7 +19,6 @@
 #define LLVM_CODEGEN_MACHINEPASSREGISTRY_H
 
 #include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/Support/CommandLine.h"
 
 namespace llvm {


Index: llvm/include/llvm/CodeGen/ScheduleDAG.h
diff -u llvm/include/llvm/CodeGen/ScheduleDAG.h:1.35 
llvm/include/llvm/CodeGen/ScheduleDAG.h:1.36
--- llvm/include/llvm/CodeGen/ScheduleDAG.h:1.35Wed Jan 31 23:32:05 2007
+++ llvm/include/llvm/CodeGen/ScheduleDAG.h Fri Feb  2 19:34:13 2007
@@ -16,6 +16,7 @@
 #define LLVM_CODEGEN_SCHEDULEDAG_H
 
 #include "llvm/CodeGen/SelectionDAG.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
 
 namespace llvm {
@@ -153,7 +154,7 @@
   public:
 virtual ~SchedulingPriorityQueue() {}
   
-virtual void initNodes(std::map &SUMap,
+virtual void initNodes(DenseMap &SUMap,
std::vector &SUnits) = 0;
 virtual void releaseState() = 0;
   
@@ -180,7 +181,7 @@
 MachineConstantPool *ConstPool;   // Target constant pool
 std::vector Sequence; // The schedule. Null SUnit*'s
   // represent noop instructions.
-std::map SUnitMap;   // SDNode to SUnit mapping (n -> 1).
+DenseMap SUnitMap;   // SDNode to SUnit mapping (n -> 1).
 std::vector SUnits;// The scheduling units.
 SmallSet CommuteSet; // Nodes the should be commuted.
 



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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAGList.cpp updated: 1.71 -> 1.72
ScheduleDAGRRList.cpp updated: 1.26 -> 1.27
---
Log message:

switch the sched unit map over to use a DenseMap instead of std::map.  This
speeds up isel as a whole time by 2.6%.


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

 ScheduleDAGList.cpp   |2 +-
 ScheduleDAGRRList.cpp |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.71 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.72
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.71  Tue Dec 19 
16:41:21 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp   Fri Feb  2 19:34:13 2007
@@ -328,7 +328,7 @@
 LatencyPriorityQueue() : Queue(latency_sort(this)) {
 }
 
-void initNodes(std::map &sumap,
+void initNodes(DenseMap &sumap,
std::vector &sunits) {
   SUnits = &sunits;
   // Calculate node priorities.


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.26 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.27
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.26Wed Jan 31 
22:55:59 2007
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Feb  2 19:34:13 2007
@@ -430,7 +430,7 @@
 RegReductionPriorityQueue() :
 Queue(SF(this)) {}
 
-virtual void initNodes(std::map &sumap,
+virtual void initNodes(DenseMap &sumap,
std::vector &sunits) {}
 virtual void releaseState() {}
 
@@ -464,7 +464,7 @@
   class VISIBILITY_HIDDEN BURegReductionPriorityQueue
: public RegReductionPriorityQueue {
 // SUnitMap SDNode to SUnit mapping (n -> 1).
-std::map *SUnitMap;
+DenseMap *SUnitMap;
 
 // SUnits - The SUnits for the current graph.
 const std::vector *SUnits;
@@ -477,7 +477,7 @@
 BURegReductionPriorityQueue(const TargetInstrInfo *tii)
   : TII(tii) {}
 
-void initNodes(std::map &sumap,
+void initNodes(DenseMap &sumap,
std::vector &sunits) {
   SUnitMap = &sumap;
   SUnits = &sunits;
@@ -541,7 +541,7 @@
   template
   class TDRegReductionPriorityQueue : public RegReductionPriorityQueue {
 // SUnitMap SDNode to SUnit mapping (n -> 1).
-std::map *SUnitMap;
+DenseMap *SUnitMap;
 
 // SUnits - The SUnits for the current graph.
 const std::vector *SUnits;
@@ -552,7 +552,7 @@
   public:
 TDRegReductionPriorityQueue() {}
 
-void initNodes(std::map &sumap,
+void initNodes(DenseMap &sumap,
std::vector &sunits) {
   SUnitMap = &sumap;
   SUnits = &sunits;



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


[llvm-commits] [123343] Add #include that is no longer included by SchedulerRegistry.h

2007-02-02 Thread clattner
Revision: 123343
Author:   clattner
Date: 2007-02-02 17:44:37 -0800 (Fri, 02 Feb 2007)

Log Message:
---
Add #include that is no longer included by SchedulerRegistry.h

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-02-03 01:32:17 UTC 
(rev 123342)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-02-03 01:44:37 UTC 
(rev 123343)
@@ -34,6 +34,7 @@
 #include "llvm/Bytecode/WriteBytecodePass.h"
 #include "llvm/CodeGen/RegAllocRegistry.h"
 #include "llvm/CodeGen/SchedulerRegistry.h"
+#include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Target/SubtargetFeature.h"
 #include "llvm/Target/TargetData.h"


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

2007-02-02 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMConstantIslandPass.cpp updated: 1.23 -> 1.24
---
Log message:

- Branch max. displacement calculation bug.
- Add debugging info.


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

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


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.23 
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.24
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.23  Fri Feb  2 13:09:19 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp   Fri Feb  2 20:08:34 2007
@@ -283,7 +283,7 @@
 }
 
 // Record this immediate branch.
-unsigned MaxOffs = (1 << (Bits-1)) * Scale;
+unsigned MaxOffs = ((1 << (Bits-1))-1) * Scale;
 ImmBranches.push_back(ImmBranch(I, MaxOffs, isCond, UOpc));
   }
 
@@ -489,7 +489,7 @@
 
   DEBUG(std::cerr << "User of CPE#" << CPEMI->getOperand(0).getImm()
   << " max delta=" << MaxDisp
-  << " at offset " << int(UserOffset-CPEOffset) << "\t"
+  << " at offset " << int(CPEOffset-UserOffset) << "\t"
   << *MI);
 
   if (UserOffset <= CPEOffset) {
@@ -581,8 +581,9 @@
   unsigned DestOffset = GetOffsetOf(DestBB);
 
   DEBUG(std::cerr << "Branch of destination BB#" << DestBB->getNumber()
+  << " from BB#" << MI->getParent()->getNumber()
   << " max delta=" << MaxDisp
-  << " at offset " << int(BrOffset-DestOffset) << "\t"
+  << " at offset " << int(DestOffset-BrOffset) << "\t"
   << *MI);
 
   if (BrOffset <= DestOffset) {
@@ -626,6 +627,9 @@
   BBSizes[MBB->getNumber()] += 2;
   HasFarJump = true;
   NumUBrFixed++;
+
+  DEBUG(std::cerr << "  Changed B to long jump " << *MI);
+
   return true;
 }
 
@@ -657,13 +661,13 @@
   // direct the updated conditional branch to the fall-through block. 
Otherwise,
   // split the MBB before the next instruction.
   MachineBasicBlock *MBB = MI->getParent();
-  MachineInstr *BackMI = &MBB->back();
-  bool NeedSplit = (BackMI != MI) || !BBHasFallthrough(MBB);
+  MachineInstr *BMI = &MBB->back();
+  bool NeedSplit = (BMI != MI) || !BBHasFallthrough(MBB);
 
   NumCBrFixed++;
-  if (BackMI != MI) {
+  if (BMI != MI) {
 if (next(MachineBasicBlock::iterator(MI)) == MBB->back() &&
-BackMI->getOpcode() == Br.UncondBr) {
+BMI->getOpcode() == Br.UncondBr) {
   // Last MI in the BB is a unconditional branch. Can we simply invert the
   // condition and swap destinations:
   // beq L1
@@ -671,9 +675,12 @@
   // =>
   // bne L2
   // b   L1
-  MachineBasicBlock *NewDest = 
BackMI->getOperand(0).getMachineBasicBlock();
+  MachineBasicBlock *NewDest = BMI->getOperand(0).getMachineBasicBlock();
   if (BBIsInRange(MI, NewDest, Br.MaxDisp)) {
-BackMI->getOperand(0).setMachineBasicBlock(DestBB);
+DEBUG(std::cerr << "  Invert Bcc condition and swap its destination"
+<< " with " << *BMI);
+
+BMI->getOperand(0).setMachineBasicBlock(DestBB);
 MI->getOperand(0).setMachineBasicBlock(NewDest);
 MI->getOperand(1).setImm(CC);
 return true;
@@ -688,6 +695,10 @@
 MBB->back().eraseFromParent();
   }
   MachineBasicBlock *NextBB = next(MachineFunction::iterator(MBB));
+ 
+  DEBUG(std::cerr << "  Insert B to BB#" << DestBB->getNumber()
+  << " also invert condition and change dest. to BB#"
+  << NextBB->getNumber() << "\n");
 
   // Insert a unconditional branch and replace the conditional branch.
   // Also update the ImmBranch as well as adding a new entry for the new 
branch.



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


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

2007-02-02 Thread Bill Wendling
Hi Evan,

>DEBUG(std::cerr << "User of CPE#" << CPEMI->getOperand(0).getImm()
><< " max delta=" << MaxDisp
> -  << " at offset " << int(UserOffset-CPEOffset) << "\t"
> +  << " at offset " << int(CPEOffset-UserOffset) << "\t"
><< *MI);
>

Could you remove the std::cerr and #include  and use DOUT instead?

Thanks!
-bw
___
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/MachORelocation.h

2007-02-02 Thread Bill Wendling


Changes in directory llvm/include/llvm/CodeGen:

MachORelocation.h added (r1.1)
---
Log message:

New file for the MachORelocation structure. It doesn't have to be tied to the
MachOWriter.h file.


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

 MachORelocation.h |   54 ++
 1 files changed, 54 insertions(+)


Index: llvm/include/llvm/CodeGen/MachORelocation.h
diff -c /dev/null llvm/include/llvm/CodeGen/MachORelocation.h:1.1
*** /dev/null   Fri Feb  2 20:36:27 2007
--- llvm/include/llvm/CodeGen/MachORelocation.h Fri Feb  2 20:36:17 2007
***
*** 0 
--- 1,54 
+ //=== MachORelocation.h - Mach-O Relocation Info *- C++ 
-*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Bill Wendling and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ 
//===--===//
+ //
+ // This file defines the MachORelocation class.
+ //
+ 
//===--===//
+ 
+ 
+ #ifndef LLVM_CODEGEN_MACHO_RELOCATION_H
+ #define LLVM_CODEGEN_MACHO_RELOCATION_H
+ 
+ namespace llvm {
+ 
+   /// MachORelocation - This struct contains information about each relocation
+   /// that needs to be emitted to the file.
+   /// see 
+   class MachORelocation {
+ uint32_t r_address;   // offset in the section to what is being  relocated
+ uint32_t r_symbolnum; // symbol index if r_extern == 1 else section index
+ bool r_pcrel; // was relocated pc-relative already
+ uint8_t  r_length;// length = 2 ^ r_length
+ bool r_extern;// 
+ uint8_t  r_type;  // if not 0, machine-specific relocation type.
+ bool r_scattered; // 1 = scattered, 0 = non-scattered
+ int32_t  r_value; // the value the item to be relocated is referring
+   // to.
+   public:  
+ uint32_t getPackedFields() const {
+   if (r_scattered)
+ return (1 << 31) | (r_pcrel << 30) | ((r_length & 3) << 28) | 
+   ((r_type & 15) << 24) | (r_address & 0x00FF);
+   else
+ return (r_symbolnum << 8) | (r_pcrel << 7) | ((r_length & 3) << 5) |
+   (r_extern << 4) | (r_type & 15);
+ }
+ uint32_t getAddress() const { return r_scattered ? r_value : r_address; }
+ uint32_t getRawAddress() const { return r_address; }
+ 
+ MachORelocation(uint32_t addr, uint32_t index, bool pcrel, uint8_t len,
+ bool ext, uint8_t type, bool scattered = false, 
+ int32_t value = 0) : 
+   r_address(addr), r_symbolnum(index), r_pcrel(pcrel), r_length(len),
+   r_extern(ext), r_type(type), r_scattered(scattered), r_value(value) {}
+   };
+ 
+ } // end llvm namespace
+ 
+ #endif // LLVM_CODEGEN_MACHO_RELOCATION_H



___
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/MachOWriter.h

2007-02-02 Thread Bill Wendling


Changes in directory llvm/include/llvm/CodeGen:

MachOWriter.h updated: 1.18 -> 1.19
---
Log message:

Moved MachORelocation to its own header file. Have a call through the
TargetMachOInfo object to the GetTargetRelocation method. Pass into it
non-Mach-O-specific parameters.


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

 MachOWriter.h |   47 ++-
 1 files changed, 14 insertions(+), 33 deletions(-)


Index: llvm/include/llvm/CodeGen/MachOWriter.h
diff -u llvm/include/llvm/CodeGen/MachOWriter.h:1.18 
llvm/include/llvm/CodeGen/MachOWriter.h:1.19
--- llvm/include/llvm/CodeGen/MachOWriter.h:1.18Mon Jan 29 15:20:42 2007
+++ llvm/include/llvm/CodeGen/MachOWriter.h Fri Feb  2 20:37:51 2007
@@ -27,6 +27,7 @@
   class Mangler;
   class MachineCodeEmitter;
   class MachOCodeEmitter;
+  class OutputBuffer;
 
   /// MachOSym - This struct contains information about each symbol that is
   /// added to logical symbol table for the module.  This is eventually
@@ -298,37 +299,6 @@
   initprot(VM_PROT_ALL), nsects(0), flags(0) { }
 };
 
-/// MachORelocation - This struct contains information about each 
relocation
-/// that needs to be emitted to the file.
-/// see 
-struct MachORelocation {
-  uint32_t r_address;   // offset in the section to what is being  
relocated
-  uint32_t r_symbolnum; // symbol index if r_extern == 1 else section index
-  bool r_pcrel; // was relocated pc-relative already
-  uint8_t  r_length;// length = 2 ^ r_length
-  bool r_extern;// 
-  uint8_t  r_type;  // if not 0, machine-specific relocation type.
-  bool r_scattered; // 1 = scattered, 0 = non-scattered
-  int32_t  r_value; // the value the item to be relocated is referring
-// to.
-  
-  uint32_t getPackedFields() {
-if (r_scattered)
-  return (1 << 31) | (r_pcrel << 30) | ((r_length & 3) << 28) | 
- ((r_type & 15) << 24) | (r_address & 0x00FF);
-else
-  return (r_symbolnum << 8) | (r_pcrel << 7) | ((r_length & 3) << 5) |
- (r_extern << 4) | (r_type & 15);
-  }
-  uint32_t getAddress() { return r_scattered ? r_value : r_address; }
-  
-  MachORelocation(uint32_t addr, uint32_t index, bool pcrel, uint8_t len,
-  bool ext, uint8_t type, bool scattered = false, 
-  int32_t value = 0) : 
-r_address(addr), r_symbolnum(index), r_pcrel(pcrel), r_length(len),
-r_extern(ext), r_type(type), r_scattered(scattered), r_value(value) {}
-};
-
 /// MachOSection - This struct contains information about each section in 
a 
 /// particular segment that is emitted to the file.  This is eventually
 /// turned into the SectionCommand in the load command for a particlar
@@ -635,8 +605,19 @@
   MachineBasicBlock *MBB) const {
   return TM.getMachOWriterInfo()->GetJTRelocation(Offset, MBB);
 }
-virtual void GetTargetRelocation(MachineRelocation &MR, MachOSection &From,
- MachOSection &To, bool Scattered) = 0;
+
+/// GetTargetRelocation - Returns the number of relocations.
+unsigned GetTargetRelocation(MachineRelocation &MR,
+ unsigned FromIdx,
+ unsigned ToAddr,
+ unsigned ToIndex,
+ OutputBuffer &RelocOut,
+ OutputBuffer &SecOut,
+ bool Scattered) {
+  return TM.getMachOWriterInfo()->GetTargetRelocation(MR, FromIdx, ToAddr,
+  ToIndex, RelocOut,
+  SecOut, Scattered);
+}
   };
 }
 



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


[llvm-commits] CVS: llvm/include/llvm/Support/OutputBuffer.h

2007-02-02 Thread Bill Wendling


Changes in directory llvm/include/llvm/Support:

OutputBuffer.h updated: 1.2 -> 1.3
---
Log message:

Added some accessor methods.


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

 OutputBuffer.h |9 +
 1 files changed, 9 insertions(+)


Index: llvm/include/llvm/Support/OutputBuffer.h
diff -u llvm/include/llvm/Support/OutputBuffer.h:1.2 
llvm/include/llvm/Support/OutputBuffer.h:1.3
--- llvm/include/llvm/Support/OutputBuffer.h:1.2Wed Jan 17 19:23:11 2007
+++ llvm/include/llvm/Support/OutputBuffer.hFri Feb  2 20:38:15 2007
@@ -138,6 +138,15 @@
   else
 assert(0 && "Emission of 64-bit data not implemented yet!");
 }
+
+std::vector::reference
+operator [] (unsigned Index) {
+  return Output[Index];
+}
+std::vector::const_reference
+operator [] (unsigned Index) const {
+  return Output[Index];
+}
   };
   
 } // end llvm namespace



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


[llvm-commits] CVS: llvm/include/llvm/Target/TargetMachOWriterInfo.h

2007-02-02 Thread Bill Wendling


Changes in directory llvm/include/llvm/Target:

TargetMachOWriterInfo.h updated: 1.2 -> 1.3
---
Log message:

Added GetTargetRelocation method.


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

 TargetMachOWriterInfo.h |   11 ++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Target/TargetMachOWriterInfo.h
diff -u llvm/include/llvm/Target/TargetMachOWriterInfo.h:1.2 
llvm/include/llvm/Target/TargetMachOWriterInfo.h:1.3
--- llvm/include/llvm/Target/TargetMachOWriterInfo.h:1.2Wed Jan 24 
01:13:55 2007
+++ llvm/include/llvm/Target/TargetMachOWriterInfo.hFri Feb  2 20:38:57 2007
@@ -19,6 +19,7 @@
 namespace llvm {
 
   class MachineBasicBlock;
+  class OutputBuffer;
 
   
//======//
   //TargetMachOWriterInfo
@@ -88,11 +89,19 @@
 
 TargetMachOWriterInfo(uint32_t cputype, uint32_t cpusubtype)
   : CPUType(cputype), CPUSubType(cpusubtype) {}
-virtual ~TargetMachOWriterInfo() {}
+virtual ~TargetMachOWriterInfo();
 
 virtual MachineRelocation GetJTRelocation(unsigned Offset,
   MachineBasicBlock *MBB) const;
 
+virtual unsigned GetTargetRelocation(MachineRelocation &MR,
+ unsigned FromIdx,
+ unsigned ToAddr,
+ unsigned ToIdx,
+ OutputBuffer &RelocOut,
+ OutputBuffer &SecOut,
+ bool Scattered) const { return 0; }
+
 uint32_t getCPUType() const { return CPUType; }
 uint32_t getCPUSubType() const { return CPUSubType; }
   };



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


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

2007-02-02 Thread Bill Wendling


Changes in directory llvm/lib/CodeGen:

MachOWriter.cpp updated: 1.21 -> 1.22
---
Log message:

Pass in non-Mach-O-specific parameters to the GetTargetRelocation method.


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

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


Index: llvm/lib/CodeGen/MachOWriter.cpp
diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.21 
llvm/lib/CodeGen/MachOWriter.cpp:1.22
--- llvm/lib/CodeGen/MachOWriter.cpp:1.21   Mon Jan 29 15:20:42 2007
+++ llvm/lib/CodeGen/MachOWriter.cppFri Feb  2 20:39:40 2007
@@ -726,8 +726,13 @@
   TargetSection = MOSPtr->Index;
   MR.setResultPointer((void*)Offset);
 }
-
-GetTargetRelocation(MR, MOS, *SectionList[TargetSection-1], Scattered);
+
+OutputBuffer RelocOut(MOS.RelocBuffer, is64Bit, isLittleEndian);
+OutputBuffer SecOut(MOS.SectionData, is64Bit, isLittleEndian);
+MachOSection &To = *SectionList[TargetSection - 1];
+
+MOS.nreloc += GetTargetRelocation(MR, MOS.Index, To.addr, To.Index,
+  RelocOut, SecOut, Scattered);
   }
 }
 



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


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

2007-02-02 Thread Bill Wendling


Changes in directory llvm/lib/Target:

TargetMachOWriterInfo.cpp updated: 1.1 -> 1.2
---
Log message:

Put destructor out-of-line.


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

 TargetMachOWriterInfo.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Target/TargetMachOWriterInfo.cpp
diff -u llvm/lib/Target/TargetMachOWriterInfo.cpp:1.1 
llvm/lib/Target/TargetMachOWriterInfo.cpp:1.2
--- llvm/lib/Target/TargetMachOWriterInfo.cpp:1.1   Tue Jan 23 21:36:05 2007
+++ llvm/lib/Target/TargetMachOWriterInfo.cpp   Fri Feb  2 20:40:10 2007
@@ -15,6 +15,8 @@
 #include "llvm/CodeGen/MachineRelocation.h"
 using namespace llvm;
 
+TargetMachOWriterInfo::~TargetMachOWriterInfo() {}
+
 MachineRelocation
 TargetMachOWriterInfo::GetJTRelocation(unsigned Offset,
MachineBasicBlock *MBB) const {



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

2007-02-02 Thread Bill Wendling


Changes in directory llvm/lib/Target/PowerPC:

PPCMachOWriter.cpp updated: 1.15 -> 1.16
---
Log message:

Moved the GetTargetRelocation method to the PPCMachOWriterInfo object. The
PPCMachOWriter is now trivial.


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

 PPCMachOWriter.cpp |  132 -
 1 files changed, 1 insertion(+), 131 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.15 
llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.16
--- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.15 Fri Jan 26 16:39:48 2007
+++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp  Fri Feb  2 20:40:57 2007
@@ -12,35 +12,17 @@
 //
 
//===--===//
 
-#include "PPCRelocations.h"
 #include "PPCTargetMachine.h"
 #include "llvm/PassManager.h"
 #include "llvm/CodeGen/MachOWriter.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/OutputBuffer.h"
 using namespace llvm;
 
 namespace {
-  class VISIBILITY_HIDDEN PPCMachOWriter : public MachOWriter {
-  public:
+  struct VISIBILITY_HIDDEN PPCMachOWriter : public MachOWriter {
 PPCMachOWriter(std::ostream &O, PPCTargetMachine &TM)
   : MachOWriter(O, TM) {}
-
-virtual void GetTargetRelocation(MachineRelocation &MR, MachOSection &From,
- MachOSection &To, bool Scattered);
-
-// Constants for the relocation r_type field.
-// see 
-enum { PPC_RELOC_VANILLA, // generic relocation
-   PPC_RELOC_PAIR,// the second relocation entry of a pair
-   PPC_RELOC_BR14,// 14 bit branch displacement to word address
-   PPC_RELOC_BR24,// 24 bit branch displacement to word address
-   PPC_RELOC_HI16,// a PAIR follows with the low 16 bits
-   PPC_RELOC_LO16,// a PAIR follows with the high 16 bits
-   PPC_RELOC_HA16,// a PAIR follows, which is sign extended to 32b
-   PPC_RELOC_LO14 // LO16 with low 2 bits implicitly zero
 };
-  };
 }
 
 /// addPPCMachOObjectWriterPass - Returns a pass that outputs the generated 
code
@@ -52,115 +34,3 @@
   FPM.add(MOW);
   FPM.add(createPPCCodeEmitterPass(TM, MOW->getMachineCodeEmitter()));
 }
-
-/// GetTargetRelocation - For the MachineRelocation MR, convert it to one or
-/// more PowerPC MachORelocation(s), add the new relocations to the
-/// MachOSection, and rewrite the instruction at the section offset if required
-/// by that relocation type.
-void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
- MachOSection &From,
- MachOSection &To,
- bool Scattered) {
-  uint64_t Addr = 0;
-
-  // Keep track of whether or not this is an externally defined relocation.
-  bool isExtern = false;
-
-  // Get the address of whatever it is we're relocating, if possible.
-  if (!isExtern)
-Addr = (uintptr_t)MR.getResultPointer() + To.addr;
-
-  switch ((PPC::RelocationType)MR.getRelocationType()) {
-  default: assert(0 && "Unknown PPC relocation type!");
-  case PPC::reloc_absolute_low_ix:
-assert(0 && "Unhandled PPC relocation type!");
-break;
-  case PPC::reloc_vanilla:
-{
-  // FIXME: need to handle 64 bit vanilla relocs
-  MachORelocation VANILLA(MR.getMachineCodeOffset(), To.Index, false, 2, 
-  isExtern, PPC_RELOC_VANILLA, Scattered,
-  (intptr_t)MR.getResultPointer());
-  ++From.nreloc;
-  OutputBuffer RelocOut(From.RelocBuffer, is64Bit, isLittleEndian);
-  OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian);
-
-  if (Scattered) {
-RelocOut.outword(VANILLA.getPackedFields());
-RelocOut.outword(VANILLA.getAddress());
-  } else {
-RelocOut.outword(VANILLA.getAddress());
-RelocOut.outword(VANILLA.getPackedFields());
-  }
-  
-  intptr_t SymbolOffset;
-  if (Scattered)
-SymbolOffset = Addr + MR.getConstantVal();
-  else
-SymbolOffset = Addr;
-  printf("vanilla fixup: sec_%x[%x] = %x\n", From.Index, 
unsigned(MR.getMachineCodeOffset()), (unsigned)SymbolOffset);
-  SecOut.fixword(SymbolOffset, MR.getMachineCodeOffset());
-}
-break;
-  case PPC::reloc_pcrel_bx:
-{
-  Addr -= MR.getMachineCodeOffset();
-  Addr >>= 2;
-  Addr &= 0xFF;
-  Addr <<= 2;
-  Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24);
-
-  OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian);
-  SecOut.fixword(Addr, MR.getMachineCodeOffset());
-  break;
-}
-  case PPC::reloc_pcrel_bcx:
-{
-  Addr -= MR.getMachineCodeOffset();
-  Addr &= 0xFFFC;
-
-  OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian);
-  SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
-  break;
-}
-  c

[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp PPCMachOWriterInfo.h

2007-02-02 Thread Bill Wendling


Changes in directory llvm/lib/Target/PowerPC:

PPCMachOWriterInfo.cpp updated: 1.1 -> 1.2
PPCMachOWriterInfo.h updated: 1.2 -> 1.3
---
Log message:

Moved the GetTargetRelocation method from PPCMachOWriter to here. It uses
non-Mach-O-specific information.


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

 PPCMachOWriterInfo.cpp |  119 +
 PPCMachOWriterInfo.h   |   25 +-
 2 files changed, 143 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.1 
llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.2
--- llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.1  Tue Jan 23 21:36:05 2007
+++ llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp  Fri Feb  2 20:41:58 2007
@@ -12,7 +12,10 @@
 
//===--===//
 
 #include "PPCMachOWriterInfo.h"
+#include "PPCRelocations.h"
 #include "PPCTargetMachine.h"
+#include "llvm/CodeGen/MachORelocation.h"
+#include "llvm/Support/OutputBuffer.h"
 using namespace llvm;
 
 PPCMachOWriterInfo::PPCMachOWriterInfo(const PPCTargetMachine &TM)
@@ -20,3 +23,119 @@
   HDR_CPU_TYPE_POWERPC64 :
   HDR_CPU_TYPE_POWERPC,
   HDR_CPU_SUBTYPE_POWERPC_ALL) {}
+PPCMachOWriterInfo::~PPCMachOWriterInfo() {}
+
+
+/// GetTargetRelocation - For the MachineRelocation MR, convert it to one or
+/// more PowerPC MachORelocation(s), add the new relocations to the
+/// MachOSection, and rewrite the instruction at the section offset if required
+/// by that relocation type.
+unsigned PPCMachOWriterInfo::GetTargetRelocation(MachineRelocation &MR,
+ unsigned FromIdx,
+ unsigned ToAddr,
+ unsigned ToIdx,
+ OutputBuffer &RelocOut,
+ OutputBuffer &SecOut,
+ bool Scattered) const {
+  unsigned NumRelocs = 0;
+  uint64_t Addr = 0;
+
+  // Keep track of whether or not this is an externally defined relocation.
+  bool isExtern = false;
+
+  // Get the address of whatever it is we're relocating, if possible.
+  if (!isExtern)
+Addr = (uintptr_t)MR.getResultPointer() + ToAddr;
+
+  switch ((PPC::RelocationType)MR.getRelocationType()) {
+  default: assert(0 && "Unknown PPC relocation type!");
+  case PPC::reloc_absolute_low_ix:
+assert(0 && "Unhandled PPC relocation type!");
+break;
+  case PPC::reloc_vanilla:
+{
+  // FIXME: need to handle 64 bit vanilla relocs
+  MachORelocation VANILLA(MR.getMachineCodeOffset(), ToIdx,
+  false, 2, isExtern,
+  PPC_RELOC_VANILLA,
+  Scattered, (intptr_t)MR.getResultPointer());
+  ++NumRelocs;
+
+  if (Scattered) {
+RelocOut.outword(VANILLA.getPackedFields());
+RelocOut.outword(VANILLA.getAddress());
+  } else {
+RelocOut.outword(VANILLA.getAddress());
+RelocOut.outword(VANILLA.getPackedFields());
+  }
+  
+  intptr_t SymbolOffset;
+
+  if (Scattered)
+SymbolOffset = Addr + MR.getConstantVal();
+  else
+SymbolOffset = Addr;
+
+  printf("vanilla fixup: sec_%x[%x] = %x\n", FromIdx,
+ unsigned(MR.getMachineCodeOffset()),
+ unsigned(SymbolOffset));
+  SecOut.fixword(SymbolOffset, MR.getMachineCodeOffset());
+}
+break;
+  case PPC::reloc_pcrel_bx:
+{
+  Addr -= MR.getMachineCodeOffset();
+  Addr >>= 2;
+  Addr &= 0xFF;
+  Addr <<= 2;
+  Addr |= (SecOut[MR.getMachineCodeOffset()] << 24);
+
+  SecOut.fixword(Addr, MR.getMachineCodeOffset());
+  break;
+}
+  case PPC::reloc_pcrel_bcx:
+{
+  Addr -= MR.getMachineCodeOffset();
+  Addr &= 0xFFFC;
+
+  SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2);
+  break;
+}
+  case PPC::reloc_absolute_high:
+{
+  MachORelocation HA16(MR.getMachineCodeOffset(), ToIdx, false, 2,
+   isExtern, PPC_RELOC_HA16);
+  MachORelocation PAIR(Addr & 0x, 0xFF, false, 2, isExtern,
+   PPC_RELOC_PAIR);
+  NumRelocs = 2;
+
+  RelocOut.outword(HA16.getRawAddress());
+  RelocOut.outword(HA16.getPackedFields());
+  RelocOut.outword(PAIR.getRawAddress());
+  RelocOut.outword(PAIR.getPackedFields());
+
+  Addr += 0x8000;
+
+  SecOut.fixhalf(Addr >> 16, MR.getMachineCodeOffset() + 2);
+  break;
+}
+  case PPC::reloc_absolute_low:
+{
+  MachORelocation LO16(MR.getMachineCodeOffset(), ToIdx, false, 2,
+   isExtern, PPC_RELOC_LO16);
+  MachORelocation PAIR(Addr >> 16, 0xFF, false, 2, isExtern,
+   

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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

BitSetVector.h (r1.20) removed
---
Log message:

remove a dead header


---
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/docs/ProgrammersManual.html

2007-02-02 Thread Chris Lattner


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.106 -> 1.107
---
Log message:

Add some notes about choice of container.


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

 ProgrammersManual.html |  241 -
 1 files changed, 240 insertions(+), 1 deletion(-)


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.106 
llvm/docs/ProgrammersManual.html:1.107
--- llvm/docs/ProgrammersManual.html:1.106  Sun Jan 14 19:55:32 2007
+++ llvm/docs/ProgrammersManual.htmlFri Feb  2 21:04:03 2007
@@ -44,6 +44,20 @@
   Viewing graphs while debugging code
 
   
+  Picking the Right Data Structure for a Task
+
+Sequential Containers (std::vector, 
std::list, etc)
+Fixed Size Arrays
+Heap Allocated Arrays
+"llvm/ADT/SmallVector.h"
+
+llvm/ADT/ilist
+
+
+Set-Like Containers (std::set, SmallSet, SetVector, 
etc)
+Map-Like Containers (std::map, DenseMap, 
etc)
+
+  
   Helpful Hints for Common Operations
 
   Basic Inspection and Traversal Routines
@@ -632,6 +646,231 @@
 
 
 
+
+
+  Picking the Right Data Structure for a Task
+
+
+
+
+
+LLVM has a plethora of datastructures in the llvm/ADT/ directory,
+ and we commonly use STL datastructures.  This section describes the tradeoffs
+ you should consider when you pick one.
+
+
+The first step is a choose your own adventure: do you want a sequential
+container, a set-like container, or a map-like container?  The most important
+thing when choosing a container is the algorithmic properties of how you plan 
to
+access the container.  Based on that, you should use:
+
+
+a map-like container if you need efficient lookup
+of an value based on another value.  Map-like containers also support
+efficient queries for containment (whether a key is in the map).  Map-like
+containers generally do not support efficient reverse mapping (values to
+keys).  If you need that, use two maps.  Some map-like containers also
+support efficient iteration through the keys in sorted order.  Map-like
+containers are the most expensive sort, only use them if you need one of
+these capabilities.
+
+a set-like container if you need to put a bunch of
+stuff into a container that automatically eliminates duplicates.  Some
+set-like containers support efficient iteration through the elements in
+sorted order.  Set-like containers are more expensive than sequential
+containers.
+
+
+a sequential container provides
+the most efficient way to add elements and keeps track of the order they 
are
+added to the collection.  They permit duplicates and support efficient
+iteration, but do not support efficient lookup based on a key.
+
+
+
+
+
+Once the proper catagory of container is determined, you can fine tune the
+memory use, constant factors, and cache behaviors of access by intelligently
+picking a member of the catagory.  Note that constant factors and cache 
behavior
+can be a big deal.  If you have a vector that usually only contains a few
+elements (but could contain many), for example, it's much better to use
+SmallVector than vector
+.  Doing so avoids (relatively) expensive malloc/free calls, which dwarf the
+cost of adding the elements to the container. 
+
+
+
+
+
+  Sequential Containers (std::vector, std::list, 
etc)
+
+
+
+There are a variety of sequential containers available for you, based on your
+needs.  Pick the first in this section that will do what you want.
+
+
+
+
+  Fixed Size Arrays
+
+
+
+Fixed size arrays are very simple and very fast.  They are good if you know
+exactly how many elements you have, or you have a (low) upper bound on how many
+you have.
+
+
+
+
+  Heap Allocated Arrays
+
+
+
+Heap allocated arrays (new[] + delete[]) are also simple.  They are good if
+the number of elements is variable, if you know how many elements you will need
+before the array is allocated, and if the array is usually large (if not,
+consider a SmallVector).  The cost of a heap
+allocated array is the cost of the new/delete (aka malloc/free).  Also note 
that
+if you are allocating an array of a type with a constructor, the constructor 
and
+destructors will be run for every element in the array (resizable vectors only
+construct those elements actually used).
+
+
+
+
+  "llvm/ADT/SmallVector.h"
+
+
+
+SmallVector is a simple class that looks and smells
+just like vector:
+it supports efficient iteration, lays out elements in memory order (so you can
+do pointer arithmetic between elements), supports efficient push_back/pop_back
+operations, supports efficient random access to its elements, etc.
+
+The advantage of SmallVector is that it allocates space for
+some number of elements (N) in the object itself.  Because of this, if
+the SmallVector is dynamically smaller than N, no malloc is performed.  This 
can
+be a big win in cases where the malloc/free call is far m

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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.107 -> 1.108
---
Log message:

fix validation problems


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

 ProgrammersManual.html |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.107 
llvm/docs/ProgrammersManual.html:1.108
--- llvm/docs/ProgrammersManual.html:1.107  Fri Feb  2 21:04:03 2007
+++ llvm/docs/ProgrammersManual.htmlFri Feb  2 21:05:57 2007
@@ -637,7 +637,7 @@
 call DAG.setGraphColor(node, "color"), then the
 next call DAG.viewGraph() would hilight the node in the
 specified color (choices of colors can be found at http://www.graphviz.org/doc/info/colors.html";>Colors.) More
+href="http://www.graphviz.org/doc/info/colors.html";>colors.) More
 complex node attributes can be provided with call
 DAG.setGraphAttrs(node, "attributes") (choices can be
 found at http://www.graphviz.org/doc/info/attrs.html";>Graph
@@ -1928,7 +1928,7 @@
 
   
   PointerType
-  Subclass of SequentialType for pointer types.
+  Subclass of SequentialType for pointer types.
   PackedType
   Subclass of SequentialType for packed (vector) types. A 
   packed type is similar to an ArrayType but is distinguished because it is 
@@ -2796,7 +2796,7 @@
   mailto:[EMAIL PROTECTED]">Dinakar Dhurjati and
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/02/03 03:04:03 $
+  Last modified: $Date: 2007/02/03 03:05:57 $
 
 
 



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


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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.108 -> 1.109
---
Log message:

fix validation issues


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

 ProgrammersManual.html |9 ++---
 1 files changed, 2 insertions(+), 7 deletions(-)


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.108 
llvm/docs/ProgrammersManual.html:1.109
--- llvm/docs/ProgrammersManual.html:1.108  Fri Feb  2 21:05:57 2007
+++ llvm/docs/ProgrammersManual.htmlFri Feb  2 21:06:52 2007
@@ -1573,7 +1573,7 @@
 This code shows the basic approach used to build recursive types: build a
 non-recursive type using 'opaque', then use type unification to close the 
cycle.
 The type unification step is performed by the refineAbstractTypeTo method, which is
+href="#refineAbstractTypeTo">refineAbstractTypeTo method, which is
 described next.  After that, we describe the PATypeHolder class.
 
@@ -2750,11 +2750,6 @@
   this constant. 
 
   
-
-  bool getValue() const: Returns the underlying value of this 
-  constant. 
-
-  
   ConstantArray : This represents a constant array.
 
   const std::vector &getValues() const: 
Returns 
@@ -2796,7 +2791,7 @@
   mailto:[EMAIL PROTECTED]">Dinakar Dhurjati and
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/02/03 03:05:57 $
+  Last modified: $Date: 2007/02/03 03:06:52 $
 
 
 



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


[llvm-commits] More TargetData mods...

2007-02-02 Thread Scott Michel
Revamped the TargetData spec string so that alignments for differently
sized types can be more flexibly specified. Also added support for
vector alignments (32 and 64 bits). The default spec string now looks
like:

  "E-p:64:64:64-a0:0:0-f32:32:32-f64:0:64"
  "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:0:64"
  "-v64:64:64-v128:128:128"

Although, it should be noted, that this isn't actually parsed (it's the
result of calling TargetData::getRepresentation()).  Internally, a
SmallVector is created with these various and sundry types, sizes and
alignments.

Gratuitously changed "getTypeAlignmentABI" to "getABITypeAlignment"
and "getTypeAlignmentPref" to "getPrefTypeAlignment".

Slimmed down the TargetData code so that there are fewer moving
parts -- if changes have to be made, it's should be more maintainable.


-scooter
-- 
Scott Michel  [EMAIL PROTECTED]
High Performance Hardware Section Manager 310/336-5034
Computer Systems Research Department
The Aerospace Corporation
Index: include/llvm/Target/TargetData.h
===
--- include/llvm/Target/TargetData.h	(.../trunk)	(revision 423)
+++ include/llvm/Target/TargetData.h	(.../branches/llvm-spu)	(revision 423)
@@ -23,6 +23,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Support/DataTypes.h"
 #include 
+#include "llvm/ADT/SmallVector.h"
 #include 
 
 namespace llvm {
@@ -33,45 +34,120 @@
 class StructLayout;
 class GlobalVariable;
 
+/// Enum used to categorize the alignment types stored by TargetAlignElem
+enum AlignTypeEnum {
+  INTEGER_ALIGN = 'i',   ///< Integer type alignment
+  PACKED_ALIGN = 'v',///< Vector type alignment
+  FLOAT_ALIGN = 'f', ///< Floating point type alignment
+  AGGREGATE_ALIGN = 'a'  ///< Aggregate alignment
+};
+/// Target alignment element.
+///
+/// Stores the alignment data associated with a given alignment type (pointer,
+/// integer, packed/vector, float) and type bit width.
+///
+/// @note The unusual order of elements in the structure attempts to reduce
+/// padding and make the structure slightly more cache friendly.
+struct TargetAlignElem {
+  unsigned char   AlignType;  //< Alignment type (AlignTypeEnum)
+  unsigned char   ABIAlign;   //< ABI alignment for this type/bitw
+  unsigned char   PrefAlign;  //< Preferred alignment for this type/bitw
+  short   TypeBitWidth;   //< Type bit width
+
+  /// Default constructor
+  TargetAlignElem();
+  /// Full constructor
+  TargetAlignElem(AlignTypeEnum align_type, unsigned char abi_align,
+  unsigned char pref_align, short bit_width);
+  /// Copy constructor
+  TargetAlignElem(const TargetAlignElem &src);
+  /// Destructor
+  ~TargetAlignElem() { }
+  /// Assignment operator
+  TargetAlignElem &operator=(const TargetAlignElem &rhs);
+  /// Less-than predicate
+  bool operator<(const TargetAlignElem &rhs) const;
+  /// Equality predicate
+  bool operator==(const TargetAlignElem &rhs) const;
+  /// output stream operator
+  std::ostream &dump(std::ostream &os) const;
+};
+
+/// Output stream inserter
+/// @sa TargetAlignElem::dump()
+std::ostream &operator<<(std::ostream &os, const TargetAlignElem &elem);
+
+/// Target alignment container
+///
+/// This is the container for most primitive types' alignment, i.e., integer,
+/// floating point, vectors and aggregates.
+class TargetAlign : public SmallVector {
+private:
+  /// Invalid alignment
+  /// This member is a signal that a requested alignment type and
+  /// bit width were not found in the SmallVector.
+  static const TargetAlignElem InvalidAlignmentElem;
+public:
+  /// Default constructor
+  TargetAlign();
+  /// Destructor
+  ~TargetAlign() { }
+  /// Copy constructor
+  TargetAlign(const TargetAlign &src);
+  /// Assignment operator
+  TargetAlign &operator=(const TargetAlign &rhs);
+  /// Add elements to the container.
+  ///
+  /// Adds elements to the container, keeping the container sorted. If the
+  /// requested alignment type (@a align_type) and bit width (@a bit_width)
+  /// exist in the container, then the matching element's ABI and preferred
+  /// alignments are overwritten with @a abi_align and @a pref_align.
+  void set(AlignTypeEnum align_type, short bit_width, unsigned char abi_align,
+   unsigned char pref_align);
+  /// Get the data associated with a given alignment type and bit width.
+  ///
+  /// @return InvalidAlignmentElem if not found, otherwise, the matching
+  /// TargetAlignElem.
+  const TargetAlignElem &get(AlignTypeEnum align_type, short bit_width) const;
+  /// Valid alignment predicate.
+  ///
+  /// Predicate that tests a TargetAlignElem reference returned by get() against
+  /// InvalidAlignmentElem.
+  inline bool valid(const TargetAlignElem &align) const {
+return (&align != &InvalidAlignmentElem);
+  }
+};
+
 class TargetData : public ImmutablePass {
-  bool  LittleEndi

[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset:

z49.c updated: 1.2 -> 1.3
---
Log message:

Terminate line to pretty up the output.


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

 z49.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c
diff -u llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c:1.2 
llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c:1.3
--- llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c:1.2 Thu Jan 
11 21:48:22 2007
+++ llvm-test/MultiSource/Benchmarks/MiBench/consumer-typeset/z49.c Fri Feb 
 2 22:24:17 2007
@@ -417,7 +417,7 @@
   else
 p0("%!PS-Adobe-3.0\n");
   p1("Creator: %s\n", LOUT_VERSION);
-  p0("CreationDate: Sometime Today");
+  p0("CreationDate: Sometime Today\n");
   p0("%%DocumentData: Binary\n");
   p0("%%DocumentNeededResources: (atend)\n");
   p0("%%DocumentSuppliedResources: (atend)\n");



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/oggenc/Makefile

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/MultiSource/Applications/oggenc:

Makefile updated: 1.1 -> 1.2
---
Log message:

For PR1159: http://llvm.org/PR1159 :
Avoid going to LLVM assembly files at all to improve performance of the
nightly test. Bytecode is now processed like this:

llvm-gcc -c -emit-llvm %.c -o %.bc
gccld -disable-opt -link-as-library *.bc -o %.linked.rbc
opt -std-compile-opts %.linked.rbc -o %.linked.bc
gccld %.linked.bc -o %.llvm

This eliminates one gccas invocation for each source file compilation, and 
two translations between .ll and .bc.


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

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


Index: llvm-test/MultiSource/Applications/oggenc/Makefile
diff -u llvm-test/MultiSource/Applications/oggenc/Makefile:1.1 
llvm-test/MultiSource/Applications/oggenc/Makefile:1.2
--- llvm-test/MultiSource/Applications/oggenc/Makefile:1.1  Sat Jan 21 
08:50:01 2006
+++ llvm-test/MultiSource/Applications/oggenc/Makefile  Fri Feb  2 22:30:17 2007
@@ -1,8 +1,8 @@
 LEVEL = ../../..
 PROG = oggenc
 
-CPPFLAGS =
-LDFLAGS  = -lm
+CPPFLAGS := -g
+LDFLAGS  := -lm
 
 STDIN_FILENAME = $(SourceDir)/tune
 RUN_OPTIONS="-Q -s 901820 -"



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


[llvm-commits] CVS: llvm-test/MultiSource/Makefile.multisrc

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/MultiSource:

Makefile.multisrc updated: 1.56 -> 1.57
---
Log message:

For PR1159: http://llvm.org/PR1159 :
Avoid going to LLVM assembly files at all to improve performance of the
nightly test. Bytecode is now processed like this:

llvm-gcc -c -emit-llvm %.c -o %.bc
gccld -disable-opt -link-as-library *.bc -o %.linked.rbc
opt -std-compile-opts %.linked.rbc -o %.linked.bc
gccld %.linked.bc -o %.llvm

This eliminates one gccas invocation for each source file compilation, and 
two translations between .ll and .bc.


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

 Makefile.multisrc |   16 ++--
 1 files changed, 2 insertions(+), 14 deletions(-)


Index: llvm-test/MultiSource/Makefile.multisrc
diff -u llvm-test/MultiSource/Makefile.multisrc:1.56 
llvm-test/MultiSource/Makefile.multisrc:1.57
--- llvm-test/MultiSource/Makefile.multisrc:1.56Thu Jan 11 18:58:38 2007
+++ llvm-test/MultiSource/Makefile.multisrc Fri Feb  2 22:30:17 2007
@@ -20,13 +20,13 @@
 include $(LEVEL)/Makefile.programs
 
 # Figure out what object files we want to build...
-LObjs:= $(sort $(addsuffix .rbc, $(notdir $(basename $(Source)
+LObjs:= $(sort $(addsuffix .bc, $(notdir $(basename $(Source)
 LObjects := $(addprefix Output/,$(LObjs))
 
 NObjs:= $(sort $(addsuffix .o, $(notdir $(basename $(Source)
 NObjects := $(addprefix Output/,$(NObjs))
 
-.PRECIOUS: $(LObjects) $(NObjects) Output/%.linked.rll
+.PRECIOUS: $(LObjects) $(NObjects)
 
 Output/%.o: %.c Output/.dir
-$(CC) $(CPPFLAGS) $(CFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@
@@ -48,11 +48,6 @@
 bugpoint-cbe:   Output/$(PROG).bugpoint-cbe
 misopt: Output/$(PROG).misopt.out
 
-# Raw bytecode files are files created by simply assembling the output of the
-# GCC frontend, without running any optimizations.
-#
-Output/%.rbc: Output/%.ll $(LGCCAS)
-   -$(LGCCAS) -disable-opt $< -o $@
 
 ifndef USE_PRECOMPILED_BYTECODE
 
@@ -60,13 +55,6 @@
 Output/%.linked.rbc: $(LObjects) $(LGCCLDPROG)
-$(LGCCLDPROG) -link-as-library -disable-opt $(LObjects) -o $@
 
-# Output/*.linked.ll is all of the bytecode files of the program linked 
together
-# without any libraries linked in...
-#
-$(PROGRAMS_TO_TEST:%=Output/%.linked.rll): \
-Output/%.linked.rll: Output/%.linked.rbc $(LDIS)
-   -$(LDIS) $< -o $@ -f
-
 $(PROGRAMS_TO_TEST:%=Output/%.LOC.txt): \
 Output/%.LOC.txt: $(Source)
cat $^ $(wildcard $(SourceDir)/*.h) | wc -l > $@



___
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 Makefile.tests TEST.nightly.Makefile

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test:

Makefile.programs updated: 1.251 -> 1.252
Makefile.tests updated: 1.13 -> 1.14
TEST.nightly.Makefile updated: 1.44 -> 1.45
---
Log message:

For PR1159: http://llvm.org/PR1159 :
Avoid going to LLVM assembly files at all to improve performance of the
nightly test. Bytecode is now processed like this:

llvm-gcc -c -emit-llvm %.c -o %.bc
gccld -disable-opt -link-as-library *.bc -o %.linked.rbc
opt -std-compile-opts %.linked.rbc -o %.linked.bc
gccld %.linked.bc -o %.llvm

This eliminates one gccas invocation for each source file compilation, and 
two translations between .ll and .bc.


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

 Makefile.programs |   24 +++-
 Makefile.tests|   22 --
 TEST.nightly.Makefile |6 +++---
 3 files changed, 22 insertions(+), 30 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.251 llvm-test/Makefile.programs:1.252
--- llvm-test/Makefile.programs:1.251   Thu Feb  1 17:46:22 2007
+++ llvm-test/Makefile.programs Fri Feb  2 22:30:17 2007
@@ -44,7 +44,7 @@
 
 .PRECIOUS: Output/%.llvm Output/%.native Output/%.llc Output/%.llc.s
 .PRECIOUS: Output/%.cbe Output/%.cbe.c Output/%.llvm.bc
-.PRECIOUS: Output/%.linked.bc 
+.PRECIOUS: Output/%.linked.bc
 
 # If we're using the llvm-gcc3 compiler then we need to also link with the
 # llvm c runtime library, othwerwise we don't
@@ -233,11 +233,12 @@
 print-llcbeta-option:
@echo $(LLCBETAOPTION)
 
-# Given a version of the entire program linked together into a single unit of
-# raw output from the C frontend, optimize it.
+# Given an unoptimized bytecode file that is a simple linkage of all
+# the program's bytecode files, optimize the program using the
+# standard compilation optimizations.
 $(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \
-Output/%.linked.bc: Output/%.linked.rll $(LGCCAS)
-   -$(LGCCAS) $(STATS) $(EXTRA_GCCAS_OPTIONS) $< -o $@
+Output/%.linked.bc: Output/%.linked.rbc $(LOPT)
+   -$(LOPT) -std-compile-opts $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@
 
 $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc): \
 Output/%.llvm.stripped.bc: Output/%.llvm.bc $(LOPT)
@@ -285,9 +286,11 @@
 endif   # ifndef DISABLE_FOR_LLVM_PROGRAMS
 
 # Targets to get the pass arguments that gccas and gccld are using...
-Output/gccas-pass-args: $(LGCCAS) Output/.dir
-   -$(LGCCAS) $(EXTRA_GCCAS_OPTIONS) /dev/null -o /dev/null 
-debug-pass=Arguments > [EMAIL PROTECTED] 2>&1
-   sed 's/Pass Arguments: //' < [EMAIL PROTECTED] | sed 
's/-emitbytecode//' > $@
+Output/opt-pass-args: $(LOPT) Output/.dir
+   -$(LLVMAS) < /dev/null -o - | \
+ $(LOPT) $(EXTRA_LOPT_OPTIONS) -disable-output -debug-pass=Arguments 
2>&1 | \
+ sed 's/Pass Arguments: //' | sed 's/-emitbytecode//' > $@
+
 Output/gccld-pass-args: $(LGCCLDPROG) Output/.dir
$(LLVMAS) < /dev/null > Output/gccld.test.bc
$(LGCCLD) Output/gccld.test.bc -o Output/gccld.test-out 
-debug-pass=Arguments > [EMAIL PROTECTED] 2>&1
@@ -575,11 +578,6 @@
 Output/%.out-nat: $(SRCDIR)/%.reference_output Output/.dir
cp $< $@
 
-# To make a raw bytecode file up-to-date, just copy it over.
-$(PROGRAMS_TO_TEST:%=Output/%.linked.rll): \
-Output/%.linked.rll: $(SRCDIR)/%.linked.rll Output/.dir
-   cp $< $@
-
 $(PROGRAMS_TO_TEST:%=Output/%.LOC.txt): \
 Output/%.LOC.txt: $(SRCDIR)/%.LOC.txt Output/.dir
cp $< $@


Index: llvm-test/Makefile.tests
diff -u llvm-test/Makefile.tests:1.13 llvm-test/Makefile.tests:1.14
--- llvm-test/Makefile.tests:1.13   Sun Dec  3 15:15:49 2006
+++ llvm-test/Makefile.testsFri Feb  2 22:30:17 2007
@@ -49,31 +49,25 @@
$(RM) -rf Output/
 
 # Compile from X.c to Output/X.ll
-Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
-   -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
+Output/%.bc: %.c $(LCC1) Output/.dir $(INCLUDES)
+   -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -O0 -c $< -o $@ 
-emit-llvm
-$(call UPGRADE_LL,$@)
 
 # Compile from X.cpp to Output/X.ll
-Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
+Output/%.bc: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
+   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -c $< -o $@ 
-emit-llvm
-$(call UPGRADE_LL,$@)
 
 # Compile from X.cc to Output/X.ll
-Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
+Output/%.bc: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
+   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -c $< -o $@ 
-emit-llvm
-$(call UPGRADE_LL,$@)
 
 # Compile from X.C to Output/X.ll
-Output/%.ll: %.C $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
+Output/%.bc: %.C $(LCC1XX) Output/.dir $(INCLUDES)
+   -$(LLVM

[llvm-commits] CVS: llvm-test/SingleSource/Makefile.singlesrc

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/SingleSource:

Makefile.singlesrc updated: 1.32 -> 1.33
---
Log message:

For PR1159: http://llvm.org/PR1159 :
Avoid going to LLVM assembly files at all to improve performance of the
nightly test. Bytecode is now processed like this:

llvm-gcc -c -emit-llvm %.c -o %.bc
gccld -disable-opt -link-as-library *.bc -o %.linked.rbc
opt -std-compile-opts %.linked.rbc -o %.linked.bc
gccld %.linked.bc -o %.llvm

This eliminates one gccas invocation for each source file compilation, and 
two translations between .ll and .bc.


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

 Makefile.singlesrc |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm-test/SingleSource/Makefile.singlesrc
diff -u llvm-test/SingleSource/Makefile.singlesrc:1.32 
llvm-test/SingleSource/Makefile.singlesrc:1.33
--- llvm-test/SingleSource/Makefile.singlesrc:1.32  Thu Nov 23 15:21:45 2006
+++ llvm-test/SingleSource/Makefile.singlesrc   Fri Feb  2 22:30:17 2007
@@ -22,13 +22,12 @@
 .PRECIOUS: Output/%.linked.rll
 
 ifndef USE_PRECOMPILED_BYTECODE
-Output/%.linked.rbc: Output/%.ll
-   -$(LLVMAS) < $< > $@
-Output/%.linked.rll: Output/%.ll
-   -cp -f $< $@
+Output/%.linked.rbc: Output/%.bc
+   cp -f $< $@
 
 Output/%.LOC.txt: $(SourceDir)/%.c
cat $< | wc -l > $@
+
 Output/%.LOC.txt: $(SourceDir)/%.cpp
cat $< | wc -l > $@
 endif
@@ -36,6 +35,7 @@
 # FIXME: LIBS should be specified, not hardcoded to -lm
 Output/%.native: $(SourceDir)/%.c Output/.dir
-$(CC) $(CFLAGS) -O2 $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
+
 Output/%.native: $(SourceDir)/%.cpp Output/.dir
-$(CXX) $(CXXFLAGS) -O2 $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
 



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


[llvm-commits] CVS: llvm-test/External/Makefile.external

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/External:

Makefile.external updated: 1.3 -> 1.4
---
Log message:

For PR1159: http://llvm.org/PR1159 :
Avoid going to LLVM assembly files at all to improve performance of the
nightly test. Bytecode is now processed like this:

llvm-gcc -c -emit-llvm %.c -o %.bc
gccld -disable-opt -link-as-library *.bc -o %.linked.rbc
opt -std-compile-opts %.linked.rbc -o %.linked.bc
gccld %.linked.bc -o %.llvm

This eliminates one gccas invocation for each source file compilation, and 
two translations between .ll and .bc.


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

 Makefile.external |1 -
 1 files changed, 1 deletion(-)


Index: llvm-test/External/Makefile.external
diff -u llvm-test/External/Makefile.external:1.3 
llvm-test/External/Makefile.external:1.4
--- llvm-test/External/Makefile.external:1.3Sun Sep  5 02:56:51 2004
+++ llvm-test/External/Makefile.externalFri Feb  2 22:30:17 2007
@@ -7,4 +7,3 @@
 
##===--===##
 
 include $(LEVEL)/Makefile.programs
-.PRECIOUS: Output/%.linked.rll



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/oggenc/Makefile

2007-02-02 Thread Reid Spencer


Changes in directory llvm-test/MultiSource/Applications/oggenc:

Makefile updated: 1.2 -> 1.3
---
Log message:

Revert last patch, committed accidentally.


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

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


Index: llvm-test/MultiSource/Applications/oggenc/Makefile
diff -u llvm-test/MultiSource/Applications/oggenc/Makefile:1.2 
llvm-test/MultiSource/Applications/oggenc/Makefile:1.3
--- llvm-test/MultiSource/Applications/oggenc/Makefile:1.2  Fri Feb  2 
22:30:17 2007
+++ llvm-test/MultiSource/Applications/oggenc/Makefile  Fri Feb  2 22:34:05 2007
@@ -1,8 +1,8 @@
 LEVEL = ../../..
 PROG = oggenc
 
-CPPFLAGS := -g
-LDFLAGS  := -lm
+CPPFLAGS =
+LDFLAGS  = -lm
 
 STDIN_FILENAME = $(SourceDir)/tune
 RUN_OPTIONS="-Q -s 901820 -"



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


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

2007-02-02 Thread Chris Lattner


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.109 -> 1.110
---
Log message:

fill in the section on Set-like containers.


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

 ProgrammersManual.html |  238 -
 1 files changed, 218 insertions(+), 20 deletions(-)


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.109 
llvm/docs/ProgrammersManual.html:1.110
--- llvm/docs/ProgrammersManual.html:1.109  Fri Feb  2 21:06:52 2007
+++ llvm/docs/ProgrammersManual.htmlSat Feb  3 01:59:07 2007
@@ -46,17 +46,28 @@
   
   Picking the Right Data Structure for a Task
 
-Sequential Containers (std::vector, 
std::list, etc)
-Fixed Size Arrays
-Heap Allocated Arrays
-"llvm/ADT/SmallVector.h"
-
-llvm/ADT/ilist
-
+Sequential Containers (std::vector, 
std::list, etc)
+
+  Fixed Size Arrays
+  Heap Allocated Arrays
+  "llvm/ADT/SmallVector.h"
+  
+  
+  
+  llvm/ADT/ilist
+
+Set-Like Containers (std::set, SmallSet, SetVector, 
etc)
+
+  A sorted 'vector'
+  "llvm/ADT/SmallSet.h"
+  "llvm/ADT/SmallPtrSet.h"
+  "llvm/ADT/FoldingSet.h"
+  
+  "llvm/ADT/SetVector.h"
+  Other Options
 
-Set-Like Containers (std::set, SmallSet, SetVector, 
etc)
 Map-Like Containers (std::map, DenseMap, 
etc)
-
+  
   
   Helpful Hints for Common Operations
 
@@ -784,6 +795,22 @@
 
 
 
+  
+
+
+
+std::deque is, in some senses, a generalized version of std::vector.  Like
+std::vector, it provides constant time random access and other similar
+properties, but it also provides efficient access to the front of the list.  It
+does not guarantee continuity of elements within memory.
+
+In exchange for this extra flexibility, std::deque has significantly higher
+constant factor costs than std::vector.  If possible, use std::vector or
+something cheaper.
+
+
+
+
   
 
 
@@ -827,9 +854,7 @@
 
 
 
-Other STL containers are available, such as std::deque (which has similar
-characteristics to std::vector, but has higher constant factors and provides
-efficient push_front/pop_front methods) and std::string.
+Other STL containers are available, such as std::string.
 
 There are also various STL adapter classes such as std::queue,
 std::priority_queue, std::stack, etc.  These provide simplified access to an
@@ -845,18 +870,190 @@
 
 
 
+Set-like containers are useful when you need to canonicalize multiple values
+into a single representation.  There are several different choices for how to 
do
+this, providing various trade-offs.
+
+
+
+
+
+
+  A sorted 'vector'
+
+
+
+
+If you intend to insert a lot of elements, then do a lot of queries, one
+great approach is to use a vector (or other sequential container), and then use
+std::sort+std::unique to remove duplicates.  This approach works really well if
+your usage pattern has these two distinct phases (insert then query), and,
+coupled with a good choice of sequential container
+can provide the several nice properties: the result data is contiguous in 
memory
+(good for cache locality), has few allocations, is easy to address (iterators 
in
+the final vector are just indices or pointers), and can be efficiently queried
+with a standard binary search.
+
+
+
+
+
+  "llvm/ADT/SmallSet.h"
+
+
+
+
+If you have a set-like datastructure that is usually small and whose 
elements
+are reasonably small, a SmallSet is a good choice.  This set
+has space for N elements in place (thus, if the set is dynamically smaller than
+N, no malloc traffic is required) and access them with a simple linear search.
+When the set grows beyond 'N', it allocates a more expensive representation 
that
+guarantees efficient access (for most types, it falls back to std::set, but for
+pointers it uses something far better, see SmallPtrSet).
+
+The magic of this class is that it handles small sets extremely efficiently,
+but gracefully handles extremely large sets without loss of efficiency.  The
+drawback is that the interface is quite small: it supports insertion, queries
+and erasing, but does not support iteration.
+
+
+
+
+
+  "llvm/ADT/SmallPtrSet.h"
+
+
+
+
+SmallPtrSet has all the advantages of SmallSet (and a SmallSet of pointers 
is 
+transparently implemented with a SmallPtrSet), but also suports iterators.  If
+more than 'N' allocations are performed, a single quadratically
+probed hash table is allocated and grows as needed, providing extremely
+efficient access (constant time insertion/deleting/queries with low constant
+factors) and is very stingy with malloc traffic.
+
+Note that, unlike std::set, the iterators of SmallPtrSet are invalidated
+whenever an insertion occurs.  Also, the values visited by the iterators are 
not
+visited in sorted order.
+
+
+
+
+
+  "llvm/ADT/FoldingSet.h"
+
+
+
+
 
-SmallPtrSet
-SmallSet
-sorted vector
-FoldingSet
-hash_set