[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitstreamReader.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

BitstreamReader.h updated: 1.16 -> 1.17
---
Log message:

minor bugfix


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

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


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.16 
llvm/include/llvm/Bitcode/BitstreamReader.h:1.17
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.16Fri May  4 20:15:42 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h Sat May  5 02:20:34 2007
@@ -446,6 +446,7 @@
   }
 
   // Read a record.
+  Record.clear();
   switch (ReadRecord(Code, Record)) {
   default: break;  // Default behavior, ignore unknown content.
   case bitc::BLOCKINFO_CODE_SETBID:



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.39 -> 1.40
---
Log message:

add abbrevs for the constants tables.  This shrinks it from 4.49755e6 bits
to 3.85972e6 bits in kc++


---
Diffs of the changes:  (+123 -61)

 BitcodeWriter.cpp |  184 --
 1 files changed, 123 insertions(+), 61 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.39 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.40
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.39  Sat May  5 01:30:12 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 02:36:14 2007
@@ -34,7 +34,13 @@
   VST_ENTRY_8_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
   VST_ENTRY_7_ABBREV,
   VST_ENTRY_6_ABBREV,
-  VST_BBENTRY_6_ABBREV
+  VST_BBENTRY_6_ABBREV,
+  
+  // CONSTANTS_BLOCK abbrev id's.
+  CONSTANTS_SETTYPE_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
+  CONSTANTS_INTEGER_ABBREV,
+  CONSTANTS_CE_CAST_Abbrev,
+  CONSTANTS_NULL_Abbrev
 };
 
 
@@ -396,11 +402,23 @@
 
 static void WriteConstants(unsigned FirstVal, unsigned LastVal,
const ValueEnumerator &VE,
-   BitstreamWriter &Stream) {
+   BitstreamWriter &Stream, bool isGlobal) {
   if (FirstVal == LastVal) return;
   
-  Stream.EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 2);
+  Stream.EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 4);
 
+  unsigned AggregateAbbrev = 0;
+  unsigned GEPAbbrev = 0;
+  // If this is a constant pool for the module, emit module-specific abbrevs.
+  if (isGlobal) {
+// Abbrev for CST_CODE_AGGREGATE.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_AGGREGATE));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 
Log2_32_Ceil(LastVal+1)));
+AggregateAbbrev = Stream.EmitAbbrev(Abbv);
+  }  
+  
   // FIXME: Install and use abbrevs to reduce size.  Install them globally so
   // they don't need to be reemitted for each function body.
   
@@ -414,7 +432,8 @@
 if (V->getType() != LastTy) {
   LastTy = V->getType();
   Record.push_back(VE.getTypeID(LastTy));
-  Stream.EmitRecord(bitc::CST_CODE_SETTYPE, Record);
+  Stream.EmitRecord(bitc::CST_CODE_SETTYPE, Record,
+CONSTANTS_SETTYPE_ABBREV);
   Record.clear();
 }
 
@@ -437,6 +456,7 @@
 else
   Record.push_back((-V << 1) | 1);
 Code = bitc::CST_CODE_INTEGER;
+AbbrevToUse = CONSTANTS_INTEGER_ABBREV;
   } else { // Wide integers, > 64 bits in size.
 // We have an arbitrary precision integer value to write whose 
 // bit width is > 64. However, in canonical unsigned integer 
@@ -466,6 +486,7 @@
   Code = bitc::CST_CODE_AGGREGATE;
   for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
 Record.push_back(VE.getValueID(C->getOperand(i)));
+  AbbrevToUse = AggregateAbbrev;
 } else if (const ConstantExpr *CE = dyn_cast(C)) {
   switch (CE->getOpcode()) {
   default:
@@ -474,6 +495,7 @@
   Record.push_back(GetEncodedCastOpcode(CE->getOpcode()));
   Record.push_back(VE.getTypeID(C->getOperand(0)->getType()));
   Record.push_back(VE.getValueID(C->getOperand(0)));
+  AbbrevToUse = CONSTANTS_CE_CAST_Abbrev;
 } else {
   assert(CE->getNumOperands() == 2 && "Unknown constant expr!");
   Code = bitc::CST_CODE_CE_BINOP;
@@ -488,6 +510,7 @@
   Record.push_back(VE.getTypeID(C->getOperand(i)->getType()));
   Record.push_back(VE.getValueID(C->getOperand(i)));
 }
+AbbrevToUse = GEPAbbrev;
 break;
   case Instruction::Select:
 Code = bitc::CST_CODE_CE_SELECT;
@@ -540,7 +563,7 @@
   // We know globalvalues have been emitted by WriteModuleInfo.
   for (unsigned i = 0, e = Vals.size(); i != e; ++i) {
 if (!isa(Vals[i].first)) {
-  WriteConstants(i, Vals.size(), VE, Stream);
+  WriteConstants(i, Vals.size(), VE, Stream, true);
   return;
 }
   }
@@ -821,7 +844,7 @@
   // If there are function-local constants, emit them now.
   unsigned CstStart, CstEnd;
   VE.getFunctionConstantRange(CstStart, CstEnd);
-  WriteConstants(CstStart, CstEnd, VE, Stream);
+  WriteConstants(CstStart, CstEnd, VE, Stream, false);
   
   // Finally, emit all the instructions, in order.
   for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
@@ -875,6 +898,97 @@
   Stream.ExitBlock();
 }
 
+// Emit blockinfo, which defines the standard abbreviations etc.
+static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) 
{
+  // We only want to emit block info records for blocks that have multiple
+  // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK.  Other
+  // blocks can defined their abbrevs inline.
+  Stream.EnterBl

[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.40 -> 1.41
---
Log message:

add an abbrev for loads.  This shrinks the function block about 50K, from:

  Block ID #12 (FUNCTION_BLOCK):
  Num Instances: 2344
 Total Size: 8.8434e+06b/1.10542e+06B/276356W
  % of file: 35.6726
   Average Size: 3772.78b/471.598B/117.899W
  Tot/Avg SubBlocks: 4065/1.73422
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 128487/54.8153
  % Abbrev Recs: 0

to:

 Block ID #12 (FUNCTION_BLOCK):
  Num Instances: 2344
 Total Size: 8.44518e+06b/1.05565e+06B/263912W
  % of file: 34.6203
   Average Size: 3602.89b/450.362B/112.59W
  Tot/Avg SubBlocks: 4065/1.73422
Tot/Avg Abbrevs: 0/0
Tot/Avg Records: 128487/54.8153
  % Abbrev Recs: 22.2077



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

 BitcodeWriter.cpp |   23 ++-
 1 files changed, 22 insertions(+), 1 deletion(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.40 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.41
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.40  Sat May  5 02:36:14 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 02:44:49 2007
@@ -40,7 +40,10 @@
   CONSTANTS_SETTYPE_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
   CONSTANTS_INTEGER_ABBREV,
   CONSTANTS_CE_CAST_Abbrev,
-  CONSTANTS_NULL_Abbrev
+  CONSTANTS_NULL_Abbrev,
+  
+  // FUNCTION_BLOCK abbrev id's.
+  FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV
 };
 
 
@@ -722,6 +725,7 @@
 Vals.push_back(VE.getValueID(I.getOperand(0))); // ptr.
 Vals.push_back(Log2_32(cast(I).getAlignment())+1);
 Vals.push_back(cast(I).isVolatile());
+AbbrevToUse = FUNCTION_INST_LOAD_ABBREV;
 break;
   case Instruction::Store:
 Code = bitc::FUNC_CODE_INST_STORE;
@@ -947,6 +951,8 @@
   assert(0 && "Unexpected abbrev ordering!");
   }
   
+  
+  
   { // SETTYPE abbrev for CONSTANTS_BLOCK.
 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_SETTYPE));
@@ -986,6 +992,21 @@
   assert(0 && "Unexpected abbrev ordering!");
   }
   
+  // FIXME: This should only use space for first class types!
+ 
+  { // INST_LOAD abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_LOAD));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,   // typeid
+  Log2_32_Ceil(VE.getTypes().size()+1)));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Ptr
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 4)); // Align
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // volatile
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_LOAD_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
+  
   Stream.ExitBlock();
 }
 



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


[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86TargetAsmInfo.cpp

2007-05-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.104 -> 1.105
X86AsmPrinter.cpp updated: 1.241 -> 1.242
X86TargetAsmInfo.cpp updated: 1.40 -> 1.41
---
Log message:

Emit sections/directives in the proper order. This fixes PR1376: 
http://llvm.org/PR1376 . Also, 
some small cleanup was made.


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

 X86ATTAsmPrinter.cpp |   21 ++---
 X86AsmPrinter.cpp|4 +---
 X86TargetAsmInfo.cpp |   29 +
 3 files changed, 20 insertions(+), 34 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.104 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.105
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.104  Sun Apr 29 13:35:00 2007
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppSat May  5 04:04:50 2007
@@ -71,9 +71,7 @@
 /// method to print assembly for each instruction.
 ///
 bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  if (Subtarget->isTargetDarwin() ||
-  Subtarget->isTargetELF() ||
-  Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
 // Let PassManager know we need debug information and relay
 // the MachineModuleInfo address on to DwarfWriter.
 DW.SetModuleInfo(&getAnalysis());
@@ -150,9 +148,7 @@
F->getLinkage() == Function::WeakLinkage))
 O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
 
-  if (Subtarget->isTargetDarwin() ||
-  Subtarget->isTargetELF() ||
-  Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
 // Emit pre-function debug information.
 DW.BeginFunction(&MF);
   }
@@ -173,22 +169,17 @@
 }
   }
 
-  // Print out jump tables referenced by the function.
-  
-  // Mac OS X requires that the jump table follow the function, so that the 
jump
-  // table is part of the same atom that the function is in.
-  EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
-  
   if (TAI->hasDotTypeDotSizeDirective())
 O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
 
-  if (Subtarget->isTargetDarwin() ||
-  Subtarget->isTargetELF() ||
-  Subtarget->isTargetCygMing()) {
+  if (TAI->doesSupportDebugInformation()) {
 // Emit post-function debug information.
 DW.EndFunction();
   }
 
+  // Print out jump tables referenced by the function.
+  EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
+  
   // We didn't modify anything.
   return false;
 }


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.241 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.242
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.241 Sun Apr 29 13:35:00 2007
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Sat May  5 04:04:50 2007
@@ -115,9 +115,7 @@
 
 /// doInitialization
 bool X86SharedAsmPrinter::doInitialization(Module &M) {
-  if (Subtarget->isTargetELF() ||
-  Subtarget->isTargetCygMing() ||
-  Subtarget->isTargetDarwin()) {
+  if (TAI->doesSupportDebugInformation()) {
 // Emit initial debug information.
 DW.BeginModule(&M);
   }


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.40 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.41
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.40   Thu May  3 11:38:57 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppSat May  5 04:04:50 2007
@@ -81,7 +81,8 @@
   // Emit a local label that is preserved until the linker runs.
   JumpTableSpecialLabelPrefix = "l";
 }
-
+
+SupportsDebugInformation = true;
 NeedsSet = true;
 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
@@ -97,26 +98,21 @@
 break;
 
   case X86Subtarget::isELF:
-// Set up DWARF directives
-HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
-AbsoluteDebugSectionOffsets = true;
-AbsoluteEHSectionOffsets = false;
-// bool HasLEB128; // Defaults to false.
-// hasDotLoc - True if target asm supports .loc directives.
-// bool HasDotLoc; // Defaults to false.
-// HasDotFile - True if target asm supports .file directives.
-// bool HasDotFile; // Defaults to false.
 ReadOnlySection = "\t.section\t.rodata\n";
 FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
 EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
-SixteenByteConstantSection =
- "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
+SixteenByteConstantSection = 
"\t.section\t.rodata.cst16,\"aM\",@progbits,16";
 CStringSection = "\t.section\t.rodata.str1.1,\"aMS\",@progbits,1";
 PrivateGlobalPrefix = ".L";
 WeakRefDirective = "\t.weak\t";
 SetDirective = "\t.set\t";
 PCSymbol = ".";
-
+
+// Set up DWARF directives
+HasLEB128 = true;  // Target asm supports leb128 d

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

2007-05-05 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.32 -> 1.33
---
Log message:

Emit sections/directives in the proper order. This fixes PR1376: 
http://llvm.org/PR1376 . Also, 
some small cleanup was made.


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

 TargetAsmInfo.h |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.32 
llvm/include/llvm/Target/TargetAsmInfo.h:1.33
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.32   Tue May  1 17:23:12 2007
+++ llvm/include/llvm/Target/TargetAsmInfo.hSat May  5 04:04:50 2007
@@ -282,8 +282,13 @@
 /// HasDotFile - True if target asm supports .file directives.
 ///
 bool HasDotFile; // Defaults to false.
-
-/// SupportsExceptionHandling - True if target supports exception handling.
+
+/// SupportsDebugInformation - True if target supports emission of 
debugging
+/// information.
+bool SupportsDebugInformation;
+
+/// SupportsExceptionHandling - True if target supports
+/// exception handling.
 ///
 bool SupportsExceptionHandling; // Defaults to false.
 
@@ -549,10 +554,13 @@
 bool hasDotFile() const {
   return HasDotFile;
 }
-bool getSupportsExceptionHandling() const {
+bool doesSupportDebugInformation() const {
+  return SupportsDebugInformation;
+}
+bool doesSupportExceptionHandling() const {
   return SupportsExceptionHandling;
 }
-bool getDwarfRequiresFrameSection() const {
+bool doesDwarfRequireFrameSection() const {
   return DwarfRequiresFrameSection;
 }
 const char *getDwarfSectionOffsetDirective() 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/TargetAsmInfo.cpp

2007-05-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.26 -> 1.27
---
Log message:

Emit sections/directives in the proper order. This fixes PR1376: 
http://llvm.org/PR1376 . Also, 
some small cleanup was made.


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

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


Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.26 
llvm/lib/Target/TargetAsmInfo.cpp:1.27
--- llvm/lib/Target/TargetAsmInfo.cpp:1.26  Thu May  3 13:46:30 2007
+++ llvm/lib/Target/TargetAsmInfo.cpp   Sat May  5 04:04:50 2007
@@ -80,6 +80,7 @@
   HasLEB128(false),
   HasDotLoc(false),
   HasDotFile(false),
+  SupportsDebugInformation(false),
   SupportsExceptionHandling(false),
   DwarfRequiresFrameSection(true),
   DwarfSectionOffsetDirective(0),



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


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

2007-05-05 Thread Anton Korobeynikov


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.133 -> 1.134
---
Log message:

Emit sections/directives in the proper order. This fixes PR1376: 
http://llvm.org/PR1376 . Also, 
some small cleanup was made.


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

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


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.133 
llvm/lib/CodeGen/DwarfWriter.cpp:1.134
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.133  Tue May  1 17:23:12 2007
+++ llvm/lib/CodeGen/DwarfWriter.cppSat May  5 04:04:50 2007
@@ -1955,7 +1955,7 @@
 didInitial = true;
 
 // Dwarf sections base addresses.
-if (TAI->getDwarfRequiresFrameSection()) {
+if (TAI->doesDwarfRequireFrameSection()) {
   Asm->SwitchToDataSection(TAI->getDwarfFrameSection());
   EmitLabel("section_frame", 0);
 }
@@ -2324,7 +2324,7 @@
   /// EmitInitialDebugFrame - Emit common frame info into a debug frame 
section.
   ///
   void EmitInitialDebugFrame() {
-if (!TAI->getDwarfRequiresFrameSection())
+if (!TAI->doesDwarfRequireFrameSection())
   return;
 
 int stackGrowth =
@@ -2367,7 +2367,7 @@
   /// EmitFunctionDebugFrame - Emit per function frame info into a debug frame
   /// section.
   void EmitFunctionDebugFrame() {
-if (!TAI->getDwarfRequiresFrameSection())
+if (!TAI->doesDwarfRequireFrameSection())
   return;

 // Start the dwarf frame section.
@@ -3124,7 +3124,7 @@
 
 if (MMI &&
 ExceptionHandling &&
-TAI->getSupportsExceptionHandling()) {
+TAI->doesSupportExceptionHandling()) {
   shouldEmit = true;
   // Assumes in correct section after the entry point.
   EmitLabel("eh_func_begin", ++SubprogramCount);



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


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

2007-05-05 Thread Duncan Sands


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.134 -> 1.135
---
Log message:

Spelling fix.


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

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


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.134 
llvm/lib/CodeGen/DwarfWriter.cpp:1.135
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.134  Sat May  5 04:04:50 2007
+++ llvm/lib/CodeGen/DwarfWriter.cppSat May  5 11:32:57 2007
@@ -2725,7 +2725,7 @@
   ///
   bool shouldEmit;
   
-  /// FuncCPPPersonality - C++ persoanlity function.
+  /// FuncCPPPersonality - C++ personality function.
   ///
   Function *FuncCPPPersonality;
 



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

2007-05-05 Thread Chris Lattner
On May 4, 2007, at 1:39 PM, Bill Wendling wrote:
> Add an "implies" field to features. This indicates that, if the  
> current
> feature is set, then the features in the implied list should be set  
> also.
> The opposite is also enforced: if a feature in the implied list  
> isn't set,
> then the feature that owns that implies list shouldn't be set either.

Looks good.  Does 3dnowa imply 3dnow?

Does 64-bit imply sse2 or sse3?

-Chris

>
> ---
> Diffs of the changes:  (+21 -17)
>
>  X86.td |   38 +-
>  1 files changed, 21 insertions(+), 17 deletions(-)
>
>
> Index: llvm/lib/Target/X86/X86.td
> diff -u llvm/lib/Target/X86/X86.td:1.31 llvm/lib/Target/X86/X86.td: 
> 1.32
> --- llvm/lib/Target/X86/X86.td:1.31   Wed Apr 25 16:31:48 2007
> +++ llvm/lib/Target/X86/X86.tdFri May  4 15:38:40 2007
> @@ -18,24 +18,28 @@
>
>  // 
> ===--- 
> ---===//
>  // X86 Subtarget features.
> -//
> +// 
> ===--- 
> ---===//
>
> -def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
> -"Support 64-bit  
> instructions">;
> -def FeatureMMX   : SubtargetFeature<"mmx","X86SSELevel", "MMX",
> -"Enable MMX instructions">;
> -def FeatureSSE1  : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
> -"Enable SSE instructions">;
> -def FeatureSSE2  : SubtargetFeature<"sse2", "X86SSELevel",  
> "SSE2",
> -"Enable SSE2 instructions">;
> -def FeatureSSE3  : SubtargetFeature<"sse3", "X86SSELevel",  
> "SSE3",
> -"Enable SSE3 instructions">;
> -def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel",  
> "SSSE3",
> -"Enable SSSE3 instructions">;
> -def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel",  
> "ThreeDNow",
> -"Enable 3DNow!  
> instructions">;
> -def Feature3DNowA: SubtargetFeature<"3dnowa", "X863DNowLevel",  
> "ThreeDNowA",
> -"Enable 3DNow! Athlon  
> instructions">;
> +def Feature64Bit   : SubtargetFeature<"64bit", "HasX86_64", "true",
> +  "Support 64-bit instructions">;
> +def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
> +  "Enable MMX instructions">;
> +def FeatureSSE1: SubtargetFeature<"sse", "X86SSELevel", "SSE1",
> +  "Enable SSE instructions",
> +  [FeatureMMX]>;
> +def FeatureSSE2: SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
> +  "Enable SSE2 instructions",
> +  [FeatureSSE1]>;
> +def FeatureSSE3: SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
> +  "Enable SSE3 instructions",
> +  [FeatureSSE2]>;
> +def FeatureSSSE3   : SubtargetFeature<"ssse3", "X86SSELevel",  
> "SSSE3",
> +  "Enable SSSE3 instructions",
> +  [FeatureSSE3]>;
> +def Feature3DNow   : SubtargetFeature<"3dnow", "X863DNowLevel",  
> "ThreeDNow",
> +  "Enable 3DNow! instructions">;
> +def Feature3DNowA  : SubtargetFeature<"3dnowa", "X863DNowLevel",  
> "ThreeDNowA",
> +  "Enable 3DNow! Athlon  
> instructions">;
>
>  // 
> ===--- 
> ---===//
>  // X86 processors supported.
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] [126948] Revert part of the positron merge patch.

2007-05-05 Thread clattner
Revision: 126948
Author:   clattner
Date: 2007-05-05 10:57:58 -0700 (Sat, 05 May 2007)

Log Message:
---
Revert part of the positron merge patch.  This is needed to unbreak
linux.  This should be revisited.

Modified Paths:
--
apple-local/branches/llvm/gcc/gsyslimits.h
apple-local/branches/llvm/gcc/limitx.h
apple-local/branches/llvm/gcc/limity.h

Modified: apple-local/branches/llvm/gcc/gsyslimits.h
===
--- apple-local/branches/llvm/gcc/gsyslimits.h  2007-05-05 04:01:18 UTC (rev 
126947)
+++ apple-local/branches/llvm/gcc/gsyslimits.h  2007-05-05 17:57:58 UTC (rev 
126948)
@@ -4,5 +4,5 @@
instead of this text.  */
 
 #define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
-/* APPLE LOCAL begin 4401222 */
-/* APPLE LOCAL end 4401222 */
+#include_next 
+#undef _GCC_NEXT_LIMITS_H

Modified: apple-local/branches/llvm/gcc/limitx.h
===
--- apple-local/branches/llvm/gcc/limitx.h  2007-05-05 04:01:18 UTC (rev 
126947)
+++ apple-local/branches/llvm/gcc/limitx.h  2007-05-05 17:57:58 UTC (rev 
126948)
@@ -1,13 +1,12 @@
 /* This administrivia gets added to the beginning of limits.h
if the system has its own version of limits.h.  */
 
-/* APPLE LOCAL begin 4401222 */
+/* We use _GCC_LIMITS_H_ because we want this not to match
+   any macros that the system's limits.h uses for its own purposes.  */
+#ifndef _GCC_LIMITS_H_  /* Terminated in limity.h.  */
+#define _GCC_LIMITS_H_
+
 #ifndef _LIBC_LIMITS_H_
 /* Use "..." so that we find syslimits.h only in this same directory.  */
 #include "syslimits.h"
 #endif
-#ifdef _GCC_NEXT_LIMITS_H
-#include_next 
-#undef _GCC_NEXT_LIMITS_H
-#endif
-/* APPLE LOCAL end 4401222 */

Modified: apple-local/branches/llvm/gcc/limity.h
===
--- apple-local/branches/llvm/gcc/limity.h  2007-05-05 04:01:18 UTC (rev 
126947)
+++ apple-local/branches/llvm/gcc/limity.h  2007-05-05 17:57:58 UTC (rev 
126948)
@@ -1,2 +1,10 @@
-/* APPLE LOCAL begin 4401222 */
-/* APPLE LOCAL end 4401222 */
+/* This administrivia gets added to the end of limits.h
+   if the system has its own version of limits.h.  */
+
+#else /* not _GCC_LIMITS_H_ */
+
+#ifdef _GCC_NEXT_LIMITS_H
+#include_next/* recurse down to the real one */
+#endif
+
+#endif /* not _GCC_LIMITS_H_ */


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


[llvm-commits] [126949] From Anton: this patch modifies the alias support in llvm-gcc

2007-05-05 Thread clattner
Revision: 126949
Author:   clattner
Date: 2007-05-05 11:11:46 -0700 (Sat, 05 May 2007)

Log Message:
---
>From Anton: this patch modifies the alias support in llvm-gcc
to not use c-front-end specific functions.

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

Modified: apple-local/branches/llvm/gcc/cgraph.c
===
--- apple-local/branches/llvm/gcc/cgraph.c  2007-05-05 17:57:58 UTC (rev 
126948)
+++ apple-local/branches/llvm/gcc/cgraph.c  2007-05-05 18:11:46 UTC (rev 
126949)
@@ -213,7 +213,13 @@
  historically been doing the wrong thing in assemble_alias by always
  printing the leading underscore.  Since we're not changing that, make
  sure user_label_prefix follows the '*' before matching.  */
+/* APPLE LOCAL begin LLVM */  
+#ifdef ENABLE_LLVM
+  if (IDENTIFIER_POINTER (decl_asmname)[0] == 1)
+#else  
   if (IDENTIFIER_POINTER (decl_asmname)[0] == '*')
+#endif
+/* APPLE LOCAL end LLVM */
 {
   const char *decl_str = IDENTIFIER_POINTER (decl_asmname) + 1;
   size_t ulp_len = strlen (user_label_prefix);

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-05-05 17:57:58 UTC 
(rev 126948)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-05-05 18:11:46 UTC 
(rev 126949)
@@ -58,7 +58,6 @@
 #include "coretypes.h"
 #include "flags.h"
 #include "tree.h"
-#include "c-tree.h" // For aliases
 #include "diagnostic.h"
 #include "output.h"
 #include "toplev.h"
@@ -534,48 +533,45 @@
   timevar_pop(TV_LLVM_FUNCS);
 }
 
-// emit_alias_to_llvm - Given decl and target emit alias to target. gcc is
-// little bit insane, it can ask us for alias emission in many places. Such
-// places are divided into two stages: it's allowed to have unresolved target 
at
-// stage 0 (hence result code -1), but not on stage 1 (error). Zero is returned
-// if alias was emitted.
-int emit_alias_to_llvm(tree decl, tree target, unsigned stage) {
-  if (errorcount || sorrycount) return -2;
-
+// emit_alias_to_llvm - Given decl and target emit alias to target.
+void emit_alias_to_llvm(tree decl, tree target, tree target_decl) {
+  if (errorcount || sorrycount) return;
+
   timevar_push(TV_LLVM_GLOBALS);
 
   // Get or create LLVM global for our alias.
   GlobalValue *V = cast(DECL_LLVM(decl));
   
-  // Try to grab decl from IDENTIFIER_NODE
-  GlobalValue *Aliasee = 0;
-  if (tree c_decl = lookup_name(target))
-Aliasee = cast(DECL_LLVM(c_decl));
+  GlobalValue *Aliasee = NULL;
+  
+  if (target_decl)
+Aliasee = cast(DECL_LLVM(target_decl));
+  else {
+// This is something insane. Probably only LTHUNKs can be here
+// Try to grab decl from IDENTIFIER_NODE
 
-  // Query SymTab for aliasee
-  const char* AliaseeName = IDENTIFIER_POINTER(target);
-  if (!Aliasee) {
+// Query SymTab for aliasee
+const char* AliaseeName = IDENTIFIER_POINTER(target);
 Aliasee =
   dyn_cast_or_null(TheModule->
 getValueSymbolTable().lookup(AliaseeName));
-  }
 
-  // Last resort. Query for name set via __asm__
-  if (!Aliasee) {
-std::string starred = std::string("\001") + AliaseeName;
-Aliasee =
-  dyn_cast_or_null(TheModule->
-getValueSymbolTable().lookup(starred));
-  }
-  
-  if (!Aliasee) {
-if (stage)
+// Last resort. Query for name set via __asm__
+if (!Aliasee) {
+  std::string starred = std::string("\001") + AliaseeName;
+  Aliasee =
+dyn_cast_or_null(TheModule->
+  getValueSymbolTable().lookup(starred));
+}
+
+if (!Aliasee) {
   error ("%J%qD aliased to undefined symbol %qE",
  decl, decl, target);
-timevar_pop(TV_LLVM_GLOBALS);
-return -1;
-  }  
-
+  timevar_pop(TV_LLVM_GLOBALS);
+  return;
+}
+  }
+  
   GlobalValue::LinkageTypes Linkage;
   GlobalValue::VisibilityTypes Visibility;
 
@@ -598,7 +594,7 @@
   else if (!V->use_empty()) {
 error ("%J Alias %qD used with invalid type!", decl, decl);
 timevar_pop(TV_LLVM_GLOBALS);
-return -1;
+return;
   }
 
   changeLLVMValue(V, GA);
@@ -611,9 +607,11 @@
 F->eraseFromParent();
   else
 assert(0 && "Unsuported global value");
+
+  TREE_ASM_WRITTEN(decl) = 1;
   
   timevar_pop(TV_LLVM_GLOBALS);
-  return 0;
+  return;
 }
 
   

Modified: apple-local/branches/llvm/gcc/llvm.h
===
--- apple-local/branches/llvm/gcc/llvm.h2007-05-05 17:57:58 UTC (rev 
126948)
+++ apple-local/branches/llvm/gcc/llvm.h2007-05-05 18:11:46 UTC (rev 
126949)
@@ -51,7 +51,7 @@
 
 /* emit_global_to_llv

[llvm-commits] [126950] add support for protected visibility (PR1363)

2007-05-05 Thread clattner
Revision: 126950
Author:   clattner
Date: 2007-05-05 11:15:40 -0700 (Sat, 05 May 2007)

Log Message:
---
add support for protected visibility (PR1363)
Patch by Lauro Venancio

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

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-05-05 18:11:46 UTC 
(rev 126949)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-05-05 18:15:40 UTC 
(rev 126950)
@@ -573,7 +573,6 @@
   }
   
   GlobalValue::LinkageTypes Linkage;
-  GlobalValue::VisibilityTypes Visibility;
 
   // Check for external weak linkage
   if (DECL_EXTERNAL(decl) && DECL_WEAK(decl))
@@ -586,8 +585,12 @@
   GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), Linkage, "",
 Aliasee, TheModule);
   // Handle visibility style
-  if (TREE_PUBLIC(decl) && DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
-GA->setVisibility(GlobalValue::HiddenVisibility);
+  if (TREE_PUBLIC(decl)) {
+if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+  GA->setVisibility(GlobalValue::HiddenVisibility);
+else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED)
+  GA->setVisibility(GlobalValue::ProtectedVisibility);
+  }
 
   if (V->getType() == GA->getType())
 V->replaceAllUsesWith(GA);
@@ -692,11 +695,15 @@
 #ifdef TARGET_ADJUST_LLVM_LINKAGE
   TARGET_ADJUST_LLVM_LINKAGE(GV,decl);
 #endif /* TARGET_ADJUST_LLVM_LINKAGE */
-  
+
   // Handle visibility style
-  if (TREE_PUBLIC(decl) && DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
-GV->setVisibility(GlobalValue::HiddenVisibility);
-  
+  if (TREE_PUBLIC(decl)) {
+if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+  GV->setVisibility(GlobalValue::HiddenVisibility);
+else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED)
+  GV->setVisibility(GlobalValue::ProtectedVisibility);
+  }
+
   // Set the section for the global.
   if (TREE_CODE(decl) == VAR_DECL || TREE_CODE(decl) == CONST_DECL) {
 if (DECL_SECTION_NAME(decl)) {
@@ -862,9 +869,13 @@
 #endif /* TARGET_ADJUST_LLVM_LINKAGE */
 
   // Handle visibility style
-  if (TREE_PUBLIC(decl) && DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
-FnEntry->setVisibility(Function::HiddenVisibility);
-  
+  if (TREE_PUBLIC(decl)) {
+if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+  FnEntry->setVisibility(GlobalValue::HiddenVisibility);
+else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED)
+  FnEntry->setVisibility(GlobalValue::ProtectedVisibility);
+  }
+
   assert(FnEntry->getName() == Name &&"Preexisting fn with the same 
name!");
 }
 SET_DECL_LLVM(decl, FnEntry);
@@ -892,8 +903,13 @@
 #endif /* TARGET_ADJUST_LLVM_LINKAGE */
 
   // Handle visibility style
-  if (TREE_PUBLIC(decl) && DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
-GV->setVisibility(Function::HiddenVisibility);
+  if (TREE_PUBLIC(decl)) {
+if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+  GV->setVisibility(GlobalValue::HiddenVisibility);
+else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED)
+  GV->setVisibility(GlobalValue::ProtectedVisibility);
+  }
+
 } else {
   // If the global has a name, prevent multiple vars with the same name 
from
   // being created.
@@ -912,9 +928,13 @@
 #endif /* TARGET_ADJUST_LLVM_LINKAGE */
 
 // Handle visibility style
-if (TREE_PUBLIC(decl) && DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
-  GV->setVisibility(Function::HiddenVisibility);
-
+if (TREE_PUBLIC(decl)) {
+  if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+GV->setVisibility(GlobalValue::HiddenVisibility);
+  else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED)
+GV->setVisibility(GlobalValue::ProtectedVisibility);
+}
+
 // If GV got renamed, then there is already an object with this name in
 // the symbol table.  If this happens, the old one must be a forward
 // decl, just replace it with a cast of the new one.

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===
--- apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-05-05 18:11:46 UTC 
(rev 126949)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-05-05 18:15:40 UTC 
(rev 126950)
@@ -486,11 +486,15 @@
 assert(Fn->getCallingConv() == CallingConv &&
"Calling convention disagreement between prototype and impl!");
 // The visibility can be changed from the last time we've seen this
-// function. Set to current.
-if (TREE_PUBLIC(FnDecl) && DECL_VISIBILITY(FnDecl) == VISIBILITY_HIDDEN)
-  Fn->setVisibility(Function::HiddenVisibility);
-else if (DECL_VISI

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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnroll.cpp updated: 1.42 -> 1.43
---
Log message:

make a temporary for *SI, no functionality change.


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

 LoopUnroll.cpp |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.42 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.43
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.42  Wed May  2 20:11:54 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Sat May  5 13:36:36 2007
@@ -302,17 +302,18 @@
 
 for (SmallPtrSet::iterator SI = Users.begin(), SE = 
Users.end();
  SI != SE; ++SI) {
-  Value* InVal = (*SI)->getIncomingValueForBlock(LatchBlock);
+  PHINode *PN = *SI;
+  Value* InVal = PN->getIncomingValueForBlock(LatchBlock);
   if (isa(InVal))
 InVal = LastValueMap[InVal];
-  (*SI)->removeIncomingValue(LatchBlock, false);
+  PN->removeIncomingValue(LatchBlock, false);
   if (InVal)
-(*SI)->addIncoming(InVal, cast(LastValueMap[LatchBlock]));
-  if ((*SI)->getNumIncomingValues() == 0) {
+PN->addIncoming(InVal, cast(LastValueMap[LatchBlock]));
+  if (PN->getNumIncomingValues() == 0) {
 // Remove this phi node.
 // If anyone is using this PHI, make them use a dummy value instead...
-(*SI)->replaceAllUsesWith(UndefValue::get((*SI)->getType()));
-(*SI)->eraseFromParent();
+PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+PN->eraseFromParent();
   }
 }
   }



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


[llvm-commits] use correct personality function in DwarfWriter

2007-05-05 Thread Duncan Sands
For some reason DwarfWriter hardwires the personality function
as __gxx_personality_v0 (the C++ personality function) even
though the correct one is available from MMI.  This patch fixes
that - helpful for Ada :)

Ciao,

Duncan.
Index: llvm.master/lib/CodeGen/DwarfWriter.cpp
===
--- llvm.master.orig/lib/CodeGen/DwarfWriter.cpp	2007-05-05 19:05:05.0 +0200
+++ llvm.master/lib/CodeGen/DwarfWriter.cpp	2007-05-05 19:07:22.0 +0200
@@ -2725,10 +2725,6 @@
   ///
   bool shouldEmit;
   
-  /// FuncCPPPersonality - C++ persoanlity function.
-  ///
-  Function *FuncCPPPersonality;
-
   /// EmitCommonEHFrame - Emit the common eh unwind frame.
   ///
   void EmitCommonEHFrame() {
@@ -2738,7 +2734,7 @@
 
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
-Function *Personality = FuncCPPPersonality;
+Function *Personality = MMI->getPersonality();
 
 // Size and sign of stack growth.
 int stackGrowth =
@@ -2818,8 +2814,7 @@
   void EmitEHFrame() {
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
-Function *Personality = FuncCPPPersonality;
-//Function *Personality = MMI->getPersonality();
+Function *Personality = MMI->getPersonality();
 MachineFrameInfo *MFI = MF->getFrameInfo();
 
 Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
@@ -3094,7 +3089,6 @@
   : Dwarf(OS, A, T)
   , didInitial(false)
   , shouldEmit(false)
-  , FuncCPPPersonality(NULL)
   {}
   
   virtual ~DwarfException() {}
@@ -3109,7 +3103,6 @@
   /// content.
   void BeginModule(Module *M) {
 this->M = M;
-FuncCPPPersonality = M->getFunction("__gxx_personality_v0");
   }
 
   /// EndModule - Emit all exception information that should come after the
; RUN: llvm-as < %s | llc -march=x86 -enable-eh -o - | grep zPLR

@error = external global i8		;  [#uses=2]

define void @_ada_x() {
entry:
	invoke void @raise( )
			to label %eh_then unwind label %unwind

unwind:		; preds = %entry
	%eh_ptr = tail call i8* @llvm.eh.exception( )		;  [#uses=2]
	%eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error )		;  [#uses=1]
	%eh_typeid = tail call i32 @llvm.eh.typeid.for( i8* @error )		;  [#uses=1]
	%tmp2 = icmp eq i32 %eh_select, %eh_typeid		;  [#uses=1]
	br i1 %tmp2, label %eh_then, label %Unwind

eh_then:		; preds = %unwind, %entry
	ret void

Unwind:		; preds = %unwind
	tail call i32 (...)* @_Unwind_Resume( i8* %eh_ptr )		; :0 [#uses=0]
	unreachable
}

declare void @raise()

declare i8* @llvm.eh.exception()

declare i32 @llvm.eh.selector(i8*, i8*, ...)

declare i32 @llvm.eh.typeid.for(i8*)

declare i32 @__gnat_eh_personality(...)

declare i32 @_Unwind_Resume(...)
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/LoopUnroll:

2007-05-05-UnrollMiscomp.ll added (r1.1)
---
Log message:

new testcase for PR1385: http://llvm.org/PR1385 


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

 2007-05-05-UnrollMiscomp.ll |   36 
 1 files changed, 36 insertions(+)


Index: llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll
diff -c /dev/null 
llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll:1.1
*** /dev/null   Sat May  5 13:49:02 2007
--- llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll Sat May  5 
13:48:52 2007
***
*** 0 
--- 1,36 
+ ; RUN: llvm-as < %s | opt -loop-unroll | llvm-dis | not grep undef
+ ; PR1385
+ 
+ target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+ target triple = "i686-apple-darwin8"
+ %struct.__mpz_struct = type { i32, i32, i32* }
+ 
+ 
+ define void @Foo(%struct.__mpz_struct* %base) {
+ entry:
+ %want = alloca [1 x %struct.__mpz_struct], align 16 ; <[1 
x %struct.__mpz_struct]*> [#uses=4]
+ %want1 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 
0  ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_init( %struct.__mpz_struct* %want1 )
+ %want27 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 
0 ; <%struct.__mpz_struct*> [#uses=1]
+ %want3 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 
0  ; <%struct.__mpz_struct*> [#uses=1]
+ %want2 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 
0  ; <%struct.__mpz_struct*> [#uses=2]
+ br label %bb
+ 
+ bb: ; preds = %bb, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]  ; 
 [#uses=1]
+ %want23.0 = phi %struct.__mpz_struct* [ %want27, %entry ], [ %want2, 
%bb ]  ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_mul( %struct.__mpz_struct* %want23.0, 
%struct.__mpz_struct* %want3, %struct.__mpz_struct* %base )
+ %indvar.next = add i32 %i.01.0, 1   ;  [#uses=2]
+ %exitcond = icmp ne i32 %indvar.next, 2 ;  [#uses=1]
+ br i1 %exitcond, label %bb, label %bb10
+ 
+ bb10:   ; preds = %bb
+ %want2.lcssa = phi %struct.__mpz_struct* [ %want2, %bb ]  
  ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_clear( %struct.__mpz_struct* %want2.lcssa )
+ ret void
+ }
+ 
+ declare void @__gmpz_init(%struct.__mpz_struct*)
+ declare void @__gmpz_mul(%struct.__mpz_struct*, %struct.__mpz_struct*, 
%struct.__mpz_struct*)
+ declare void @__gmpz_clear(%struct.__mpz_struct*)
+ 



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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnroll.cpp updated: 1.43 -> 1.44
---
Log message:

Fix Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll and PR1385: 
http://llvm.org/PR1385 .

If we have a LCSSA, only modify the input value if the inval was defined
by an instruction in the loop.  If defined by something before the loop,
it is still valid.



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

 LoopUnroll.cpp |   35 +--
 1 files changed, 17 insertions(+), 18 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.43 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.44
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.43  Sat May  5 13:36:36 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Sat May  5 13:49:57 2007
@@ -203,7 +203,8 @@
 
   // For the first iteration of the loop, we should use the precloned values 
for
   // PHI nodes.  Insert associations now.
-  DenseMap LastValueMap;
+  typedef DenseMap ValueMapTy;
+  ValueMapTy LastValueMap;
   std::vector OrigPHINode;
   for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) {
 PHINode *PN = cast(I);
@@ -231,7 +232,7 @@
 
 for (std::vector::iterator BB = LoopBlocks.begin(),
  E = LoopBlocks.end(); BB != E; ++BB) {
-  DenseMap ValueMap;
+  ValueMapTy ValueMap;
   BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer);
   Header->getParent()->getBasicBlockList().push_back(New);
 
@@ -250,8 +251,8 @@
 
   // Update our running map of newest clones
   LastValueMap[*BB] = New;
-  for (DenseMap::iterator VI = ValueMap.begin(),
-   VE = ValueMap.end(); VI != VE; ++VI)
+  for (ValueMapTy::iterator VI = ValueMap.begin(), VE = ValueMap.end();
+   VI != VE; ++VI)
 LastValueMap[VI->first] = VI->second;
 
   L->addBasicBlockToLoop(New, *LI);
@@ -291,30 +292,28 @@
   }
 
   
- 
-  // Update PHI nodes that reference the final latch block
+  // The latch block exits the loop.  If there are any PHI nodes in the
+  // successor blocks, update them to use the appropriate values computed as 
the
+  // last iteration of the loop.
   if (TripCount > 1) {
 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);
-
+
+BasicBlock *LastIterationBB = cast(LastValueMap[LatchBlock]);
 for (SmallPtrSet::iterator SI = Users.begin(), SE = 
Users.end();
  SI != SE; ++SI) {
   PHINode *PN = *SI;
-  Value* InVal = PN->getIncomingValueForBlock(LatchBlock);
-  if (isa(InVal))
-InVal = LastValueMap[InVal];
-  PN->removeIncomingValue(LatchBlock, false);
-  if (InVal)
-PN->addIncoming(InVal, cast(LastValueMap[LatchBlock]));
-  if (PN->getNumIncomingValues() == 0) {
-// Remove this phi node.
-// If anyone is using this PHI, make them use a dummy value instead...
-PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
-PN->eraseFromParent();
+  Value *InVal = PN->removeIncomingValue(LatchBlock, false);
+  // If this value was defined in the loop, take the value defined by the
+  // last iteration of the loop.
+  if (Instruction *InValI = dyn_cast(InVal)) {
+if (L->contains(InValI->getParent()))
+  InVal = LastValueMap[InVal];
   }
+  PN->addIncoming(InVal, LastIterationBB);
 }
   }
 



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.38 -> 1.39
---
Log message:

add support for BLOCKINFO records at the module level.  This fixes the reader
issues reid noticed last night.



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

 BitcodeReader.cpp |4 
 1 files changed, 4 insertions(+)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.38 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.39
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.38  Fri May  4 19:17:00 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 13:57:30 2007
@@ -805,6 +805,10 @@
 if (Stream.SkipBlock())
   return Error("Malformed block record");
 break;
+  case bitc::BLOCKINFO_BLOCK_ID:
+if (Stream.ReadBlockInfoBlock())
+  return Error("Malformed BlockInfoBlock");
+break;
   case bitc::PARAMATTR_BLOCK_ID:
 if (ParseParamAttrBlock())
   return true;



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

2007-05-05-VecCastExpand.ll added (r1.1)
---
Log message:

new testcase for PR1371: http://llvm.org/PR1371 


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

 2007-05-05-VecCastExpand.ll |   21 +
 1 files changed, 21 insertions(+)


Index: llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll
diff -c /dev/null llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll:1.1
*** /dev/null   Sat May  5 14:38:53 2007
--- llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll   Sat May  5 14:38:43 2007
***
*** 0 
--- 1,21 
+ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=i386 -mattr=+sse
+ ; PR1371
+ 
+ %str = external global [18 x sbyte]
+ 
+ void %test() {
+ bb.i:
+   %tmp.i660 = load <4 x float>* null
+   call void (int, ...)* %printf( int 0, sbyte* getelementptr ([18 x 
sbyte]* %str, int 0, uint 0), double 0.00e+00, double 0.00e+00, double 
0.00e+00, double 0.00e+00 )
+   %tmp152.i = load <4 x uint>* null
+   %tmp156.i = cast <4 x uint> %tmp152.i to <4 x int>
+   %tmp175.i = cast <4 x float> %tmp.i660 to <4 x int>
+   %tmp176.i = xor <4 x int> %tmp156.i, < int -1, int -1, int -1, int -1 >
+   %tmp177.i = and <4 x int> %tmp176.i, %tmp175.i
+   %tmp190.i = or <4 x int> %tmp177.i, zeroinitializer
+   %tmp191.i = cast <4 x int> %tmp190.i to <4 x float>
+   store <4 x float> %tmp191.i, <4 x float>* null
+   ret void
+ }
+ 
+ declare void %printf(int, ...)



___
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-05-05 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.491 -> 1.492
---
Log message:

Propagate alignment/volatility in two places.

Implement support for expanding a bitcast from an illegal vector type to
a legal one (e.g. 4xi32 -> 4xf32 in SSE1).  This fixes PR1371: 
http://llvm.org/PR1371  and
CodeGen/X86/2007-05-05-VecCastExpand.ll


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

 LegalizeDAG.cpp |   20 
 1 files changed, 16 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.491 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.492
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.491 Sat Apr 28 01:42:38 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Sat May  5 14:39:05 2007
@@ -1881,7 +1881,8 @@
 }
 
 Lo = DAG.getStore(Tmp1, Lo, Tmp2, ST->getSrcValue(),
-  ST->getSrcValueOffset());
+  ST->getSrcValueOffset(), ST->isVolatile(),
+  ST->getAlignment());
 
 if (Hi.Val == NULL) {
   // Must be int <-> float one-to-one expansion.
@@ -1896,7 +1897,8 @@
 // FIXME: This sets the srcvalue of both halves to be the same, which 
is
 // wrong.
 Hi = DAG.getStore(Tmp1, Hi, Tmp2, ST->getSrcValue(),
-  ST->getSrcValueOffset());
+  ST->getSrcValueOffset(), ST->isVolatile(),
+  std::min(ST->getAlignment(), IncrementSize));
 Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi);
 break;
   }
@@ -5667,8 +5669,18 @@
  PackVectorOp(Node->getOperand(0), EVT));
 break;
   } else {
-// FIXME: UNIMP!
-assert(0 && "Cast from unsupported vector type not implemented yet!");
+// If the input vector type isn't legal, then go through memory.
+SDOperand Ptr = CreateStackTemporary(NewVT);
+// Get the alignment for the store.
+const TargetData &TD = *TLI.getTargetData();
+unsigned Align = 
+  TD.getABITypeAlignment(MVT::getTypeForValueType(NewVT));
+
+SDOperand St = DAG.getStore(DAG.getEntryNode(),
+Node->getOperand(0), Ptr, NULL, 0, false,
+Align);
+Result = DAG.getLoad(NewVT, St, Ptr, 0, 0);
+break;
   }
 }
 break;



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


Re: [llvm-commits] use correct personality function in DwarfWriter

2007-05-05 Thread Chris Lattner

On May 5, 2007, at 11:38 AM, Duncan Sands wrote:

> For some reason DwarfWriter hardwires the personality function
> as __gxx_personality_v0 (the C++ personality function) even
> though the correct one is available from MMI.  This patch fixes
> that - helpful for Ada :)

Huh, very strange.  Looks good to me, plz apply,

-Chris

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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/2007-05-05-Personality.ll

2007-05-05 Thread Duncan Sands


Changes in directory llvm/test/CodeGen/Generic:

2007-05-05-Personality.ll added (r1.1)
---
Log message:

Check that the right eh personality function is used.


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

 2007-05-05-Personality.ll |   35 +++
 1 files changed, 35 insertions(+)


Index: llvm/test/CodeGen/Generic/2007-05-05-Personality.ll
diff -c /dev/null llvm/test/CodeGen/Generic/2007-05-05-Personality.ll:1.1
*** /dev/null   Sat May  5 15:22:18 2007
--- llvm/test/CodeGen/Generic/2007-05-05-Personality.ll Sat May  5 15:22:08 2007
***
*** 0 
--- 1,35 
+ ; RUN: llvm-as < %s | llc -march=x86 -enable-eh -o - | grep zPLR
+ 
+ @error = external global i8   ;  [#uses=2]
+ 
+ define void @_ada_x() {
+ entry:
+   invoke void @raise( )
+   to label %eh_then unwind label %unwind
+ 
+ unwind:   ; preds = %entry
+   %eh_ptr = tail call i8* @llvm.eh.exception( )   ;  
[#uses=2]
+   %eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector( i8* 
%eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error )   
 ;  [#uses=1]
+   %eh_typeid = tail call i32 @llvm.eh.typeid.for( i8* @error )
;  [#uses=1]
+   %tmp2 = icmp eq i32 %eh_select, %eh_typeid  ;  [#uses=1]
+   br i1 %tmp2, label %eh_then, label %Unwind
+ 
+ eh_then:  ; preds = %unwind, %entry
+   ret void
+ 
+ Unwind:   ; preds = %unwind
+   tail call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; 
:0 [#uses=0]
+   unreachable
+ }
+ 
+ declare void @raise()
+ 
+ declare i8* @llvm.eh.exception()
+ 
+ declare i32 @llvm.eh.selector(i8*, i8*, ...)
+ 
+ declare i32 @llvm.eh.typeid.for(i8*)
+ 
+ declare i32 @__gnat_eh_personality(...)
+ 
+ declare i32 @_Unwind_Resume(...)



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


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

2007-05-05 Thread Duncan Sands


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.135 -> 1.136
---
Log message:

Use the personality function that was registered with MMI rather than
hardwiring in the C++ one.


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

 DwarfWriter.cpp |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.135 
llvm/lib/CodeGen/DwarfWriter.cpp:1.136
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.135  Sat May  5 11:32:57 2007
+++ llvm/lib/CodeGen/DwarfWriter.cppSat May  5 15:27:00 2007
@@ -2725,10 +2725,6 @@
   ///
   bool shouldEmit;
   
-  /// FuncCPPPersonality - C++ personality function.
-  ///
-  Function *FuncCPPPersonality;
-
   /// EmitCommonEHFrame - Emit the common eh unwind frame.
   ///
   void EmitCommonEHFrame() {
@@ -2738,7 +2734,7 @@
 
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
-Function *Personality = FuncCPPPersonality;
+Function *Personality = MMI->getPersonality();
 
 // Size and sign of stack growth.
 int stackGrowth =
@@ -2818,8 +2814,7 @@
   void EmitEHFrame() {
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
-Function *Personality = FuncCPPPersonality;
-//Function *Personality = MMI->getPersonality();
+Function *Personality = MMI->getPersonality();
 MachineFrameInfo *MFI = MF->getFrameInfo();
 
 Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
@@ -3094,7 +3089,6 @@
   : Dwarf(OS, A, T)
   , didInitial(false)
   , shouldEmit(false)
-  , FuncCPPPersonality(NULL)
   {}
   
   virtual ~DwarfException() {}
@@ -3109,7 +3103,6 @@
   /// content.
   void BeginModule(Module *M) {
 this->M = M;
-FuncCPPPersonality = M->getFunction("__gxx_personality_v0");
   }
 
   /// EndModule - Emit all exception information that should come after the



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

2007-05-05 Thread Bill Wendling

On May 5, 2007, at 10:56 AM, Chris Lattner wrote:

> On May 4, 2007, at 1:39 PM, Bill Wendling wrote:
>> Add an "implies" field to features. This indicates that, if the
>> current
>> feature is set, then the features in the implied list should be set
>> also.
>> The opposite is also enforced: if a feature in the implied list
>> isn't set,
>> then the feature that owns that implies list shouldn't be set either.
>
> Looks good.  Does 3dnowa imply 3dnow?
>
I didn't know if they should or not. Should they? :-)

> Does 64-bit imply sse2 or sse3?
>
Again, I didn't know. :-) If they do, I can fix it.

-bw

> -Chris
>
>>
>> ---
>> Diffs of the changes:  (+21 -17)
>>
>>  X86.td |   38 +-
>>  1 files changed, 21 insertions(+), 17 deletions(-)
>>
>>
>> Index: llvm/lib/Target/X86/X86.td
>> diff -u llvm/lib/Target/X86/X86.td:1.31 llvm/lib/Target/X86/X86.td:
>> 1.32
>> --- llvm/lib/Target/X86/X86.td:1.31  Wed Apr 25 16:31:48 2007
>> +++ llvm/lib/Target/X86/X86.td   Fri May  4 15:38:40 2007
>> @@ -18,24 +18,28 @@
>>
>>  //
>> ===-- 
>> -
>> ---===//
>>  // X86 Subtarget features.
>> -//
>> +//
>> ===-- 
>> -
>> ---===//
>>
>> -def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64",  
>> "true",
>> -"Support 64-bit
>> instructions">;
>> -def FeatureMMX   : SubtargetFeature<"mmx","X86SSELevel", "MMX",
>> -"Enable MMX instructions">;
>> -def FeatureSSE1  : SubtargetFeature<"sse", "X86SSELevel",  
>> "SSE1",
>> -"Enable SSE instructions">;
>> -def FeatureSSE2  : SubtargetFeature<"sse2", "X86SSELevel",
>> "SSE2",
>> -"Enable SSE2 instructions">;
>> -def FeatureSSE3  : SubtargetFeature<"sse3", "X86SSELevel",
>> "SSE3",
>> -"Enable SSE3 instructions">;
>> -def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel",
>> "SSSE3",
>> -"Enable SSSE3  
>> instructions">;
>> -def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel",
>> "ThreeDNow",
>> -"Enable 3DNow!
>> instructions">;
>> -def Feature3DNowA: SubtargetFeature<"3dnowa", "X863DNowLevel",
>> "ThreeDNowA",
>> -"Enable 3DNow! Athlon
>> instructions">;
>> +def Feature64Bit   : SubtargetFeature<"64bit", "HasX86_64", "true",
>> +  "Support 64-bit  
>> instructions">;
>> +def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
>> +  "Enable MMX instructions">;
>> +def FeatureSSE1: SubtargetFeature<"sse", "X86SSELevel", "SSE1",
>> +  "Enable SSE instructions",
>> +  [FeatureMMX]>;
>> +def FeatureSSE2: SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
>> +  "Enable SSE2 instructions",
>> +  [FeatureSSE1]>;
>> +def FeatureSSE3: SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
>> +  "Enable SSE3 instructions",
>> +  [FeatureSSE2]>;
>> +def FeatureSSSE3   : SubtargetFeature<"ssse3", "X86SSELevel",
>> "SSSE3",
>> +  "Enable SSSE3 instructions",
>> +  [FeatureSSE3]>;
>> +def Feature3DNow   : SubtargetFeature<"3dnow", "X863DNowLevel",
>> "ThreeDNow",
>> +  "Enable 3DNow! instructions">;
>> +def Feature3DNowA  : SubtargetFeature<"3dnowa", "X863DNowLevel",
>> "ThreeDNowA",
>> +  "Enable 3DNow! Athlon
>> instructions">;
>>
>>  //
>> ===-- 
>> -
>> ---===//
>>  // X86 processors supported.
>>
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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

2007-05-05 Thread Anton Korobeynikov
Hello, Bill.

> I didn't know if they should or not. Should they? :-)
I can check anything 3dnow-related in hardware. Do you have some
testcase?

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


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

2007-05-05 Thread Bill Wendling
On May 5, 2007, at 1:32 PM, Anton Korobeynikov wrote:

> Hello, Bill.
>
>> I didn't know if they should or not. Should they? :-)
> I can check anything 3dnow-related in hardware. Do you have some
> testcase?
>
Not for 3dnow...In truth, our support for 3dnow is lacking. We don't  
have a lot of the builtins for it supported.

-bw

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


[llvm-commits] CVS: llvm/test/Verifier/2004-01-22-FloatNormalization.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Verifier:

2004-01-22-FloatNormalization.ll (r1.4) removed
---
Log message:

remove bogus xfailed testcase


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/DebugInfo:

2006-11-06-StackTrace.cpp updated: 1.11 -> 1.12
---
Log message:

fix failure on ahs3's tester


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

 2006-11-06-StackTrace.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp
diff -u llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11 
llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.12
--- llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11  Sun Apr 15 17:37:04 2007
+++ llvm/test/DebugInfo/2006-11-06-StackTrace.cpp   Sat May  5 15:50:35 2007
@@ -8,7 +8,9 @@
 // RUN:   grep {#0  DeepStack::deepest.*(this=.*,.*x=33)}
 // RUN: gdb -q -batch -n -x %t.in %t.exe | \
 // RUN:   grep {#7  0x.* in main.*(argc=\[12\],.*argv=.*)}
-// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64
+
+// Only works on ppc.  Should generalize?
+// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64
 
 #include 
 



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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Jeff Cohen
Are you sure that's the problem?  Even on my machine, where the OS 
identifies the hardware as amd64, the test was correctly XFAILing.

Chris Lattner wrote:
> Changes in directory llvm/test/DebugInfo:
>
> 2006-11-06-StackTrace.cpp updated: 1.11 -> 1.12
> ---
> Log message:
>
> fix failure on ahs3's tester
>
>
> ---
> Diffs of the changes:  (+3 -1)
>
>  2006-11-06-StackTrace.cpp |4 +++-
>  1 files changed, 3 insertions(+), 1 deletion(-)
>
>
> Index: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp
> diff -u llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11 
> llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.12
> --- llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11Sun Apr 15 
> 17:37:04 2007
> +++ llvm/test/DebugInfo/2006-11-06-StackTrace.cpp Sat May  5 15:50:35 2007
> @@ -8,7 +8,9 @@
>  // RUN:   grep {#0  DeepStack::deepest.*(this=.*,.*x=33)}
>  // RUN: gdb -q -batch -n -x %t.in %t.exe | \
>  // RUN:   grep {#7  0x.* in main.*(argc=\[12\],.*argv=.*)}
> -// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64
> +
> +// Only works on ppc.  Should generalize?
> +// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64
>  
>  #include 
>  
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>   

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

2007-05-05 Thread Chris Lattner

On May 5, 2007, at 1:43 PM, Bill Wendling wrote:

> On May 5, 2007, at 1:32 PM, Anton Korobeynikov wrote:
>
>> Hello, Bill.
>>
>>> I didn't know if they should or not. Should they? :-)
>> I can check anything 3dnow-related in hardware. Do you have some
>> testcase?
>>
> Not for 3dnow...In truth, our support for 3dnow is lacking. We don't
> have a lot of the builtins for it supported.

One question: are there any cpus that support "3dnowa" but not  
"3dnow"?  I would guess not.

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

2007-05-05 Thread Chris Lattner
>
>> Does 64-bit imply sse2 or sse3?
>>
> Again, I didn't know. :-) If they do, I can fix it.

X86Subtarget.cpp says that SSE2 is always available if the cpu is 64- 
bit.  Can the logic in that file be simplified with your changes?   
(is it ever possible to have SSE2 bit set but not SSE1 now?)

-Chris

> -bw
>
>> -Chris
>>
>>>
>>> ---
>>> Diffs of the changes:  (+21 -17)
>>>
>>>  X86.td |   38 +-
>>>  1 files changed, 21 insertions(+), 17 deletions(-)
>>>
>>>
>>> Index: llvm/lib/Target/X86/X86.td
>>> diff -u llvm/lib/Target/X86/X86.td:1.31 llvm/lib/Target/X86/X86.td:
>>> 1.32
>>> --- llvm/lib/Target/X86/X86.td:1.31 Wed Apr 25 16:31:48 2007
>>> +++ llvm/lib/Target/X86/X86.td  Fri May  4 15:38:40 2007
>>> @@ -18,24 +18,28 @@
>>>
>>>  //
>>> ===- 
>>> -
>>> -
>>> ---===//
>>>  // X86 Subtarget features.
>>> -//
>>> +//
>>> ===- 
>>> -
>>> -
>>> ---===//
>>>
>>> -def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64",
>>> "true",
>>> -"Support 64-bit
>>> instructions">;
>>> -def FeatureMMX   : SubtargetFeature<"mmx","X86SSELevel", "MMX",
>>> -"Enable MMX instructions">;
>>> -def FeatureSSE1  : SubtargetFeature<"sse", "X86SSELevel",
>>> "SSE1",
>>> -"Enable SSE instructions">;
>>> -def FeatureSSE2  : SubtargetFeature<"sse2", "X86SSELevel",
>>> "SSE2",
>>> -"Enable SSE2  
>>> instructions">;
>>> -def FeatureSSE3  : SubtargetFeature<"sse3", "X86SSELevel",
>>> "SSE3",
>>> -"Enable SSE3  
>>> instructions">;
>>> -def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel",
>>> "SSSE3",
>>> -"Enable SSSE3
>>> instructions">;
>>> -def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel",
>>> "ThreeDNow",
>>> -"Enable 3DNow!
>>> instructions">;
>>> -def Feature3DNowA: SubtargetFeature<"3dnowa", "X863DNowLevel",
>>> "ThreeDNowA",
>>> -"Enable 3DNow! Athlon
>>> instructions">;
>>> +def Feature64Bit   : SubtargetFeature<"64bit", "HasX86_64", "true",
>>> +  "Support 64-bit
>>> instructions">;
>>> +def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
>>> +  "Enable MMX instructions">;
>>> +def FeatureSSE1: SubtargetFeature<"sse", "X86SSELevel", "SSE1",
>>> +  "Enable SSE instructions",
>>> +  [FeatureMMX]>;
>>> +def FeatureSSE2: SubtargetFeature<"sse2", "X86SSELevel",  
>>> "SSE2",
>>> +  "Enable SSE2 instructions",
>>> +  [FeatureSSE1]>;
>>> +def FeatureSSE3: SubtargetFeature<"sse3", "X86SSELevel",  
>>> "SSE3",
>>> +  "Enable SSE3 instructions",
>>> +  [FeatureSSE2]>;
>>> +def FeatureSSSE3   : SubtargetFeature<"ssse3", "X86SSELevel",
>>> "SSSE3",
>>> +  "Enable SSSE3 instructions",
>>> +  [FeatureSSE3]>;
>>> +def Feature3DNow   : SubtargetFeature<"3dnow", "X863DNowLevel",
>>> "ThreeDNow",
>>> +  "Enable 3DNow!  
>>> instructions">;
>>> +def Feature3DNowA  : SubtargetFeature<"3dnowa", "X863DNowLevel",
>>> "ThreeDNowA",
>>> +  "Enable 3DNow! Athlon
>>> instructions">;
>>>
>>>  //
>>> ===- 
>>> -
>>> -
>>> ---===//
>>>  // X86 processors supported.
>>>
>>>
>>>
>>> ___
>>> llvm-commits mailing list
>>> llvm-commits@cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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

2007-05-05 Thread Anton Korobeynikov
> One question: are there any cpus that support "3dnowa" but not  
> "3dnow"?
I definitely think, that no.

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Chris Lattner
On May 5, 2007, at 2:03 PM, Jeff Cohen wrote:
> Are you sure that's the problem?  Even on my machine, where the OS
> identifies the hardware as amd64, the test was correctly XFAILing.

No, I'm not sure.  A better question is: why is this ppc specific? :)

-Chris

> Chris Lattner wrote:
>> Changes in directory llvm/test/DebugInfo:
>>
>> 2006-11-06-StackTrace.cpp updated: 1.11 -> 1.12
>> ---
>> Log message:
>>
>> fix failure on ahs3's tester
>>
>>
>> ---
>> Diffs of the changes:  (+3 -1)
>>
>>  2006-11-06-StackTrace.cpp |4 +++-
>>  1 files changed, 3 insertions(+), 1 deletion(-)
>>
>>
>> Index: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp
>> diff -u llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11 llvm/ 
>> test/DebugInfo/2006-11-06-StackTrace.cpp:1.12
>> --- llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.11   Sun Apr 15  
>> 17:37:04 2007
>> +++ llvm/test/DebugInfo/2006-11-06-StackTrace.cppSat May  5  
>> 15:50:35 2007
>> @@ -8,7 +8,9 @@
>>  // RUN:   grep {#0  DeepStack::deepest.*(this=.*,.*x=33)}
>>  // RUN: gdb -q -batch -n -x %t.in %t.exe | \
>>  // RUN:   grep {#7  0x.* in main.*(argc=\[12\],.*argv=.*)}
>> -// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64
>> +
>> +// Only works on ppc.  Should generalize?
>> +// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64
>>
>>  #include 
>>
>>
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>>
>>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] CVS: llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/C++Frontend:

2006-09-27-Debug-Protection.cpp updated: 1.4 -> 1.5
---
Log message:

llvm-gcc3 is gone


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

 2006-09-27-Debug-Protection.cpp |1 -
 1 files changed, 1 deletion(-)


Index: llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp
diff -u llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp:1.4 
llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp:1.5
--- llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp:1.4   Sun Apr 15 
15:41:31 2007
+++ llvm/test/C++Frontend/2006-09-27-Debug-Protection.cpp   Sat May  5 
16:35:44 2007
@@ -1,4 +1,3 @@
-// XFAIL: llvmgcc3
 // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep {i32 1,}
 // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep {i32 2,}
 



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


[llvm-commits] CVS: llvm/test/CFrontend/2004-02-13-StringInit.c.tr

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CFrontend:

2004-02-13-StringInit.c.tr (r1.2) removed
---
Log message:

remove this xfailed testcase, move it into a comment in PR279: 
http://llvm.org/PR279 , an enhancement PR.


---
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] [126951] Fix PR1252, patch by Anton K.

2007-05-05 Thread clattner
Revision: 126951
Author:   clattner
Date: 2007-05-05 14:40:50 -0700 (Sat, 05 May 2007)

Log Message:
---
Fix PR1252, patch by Anton K.

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

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===
--- apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-05-05 18:15:40 UTC 
(rev 126950)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-05-05 21:40:50 UTC 
(rev 126951)
@@ -517,6 +517,7 @@
 if (FnEntry) {
   FnEntry->replaceAllUsesWith(ConstantExpr::getBitCast(Fn,

FnEntry->getType()));
+  changeLLVMValue(FnEntry, Fn);
   FnEntry->eraseFromParent();
 }
 SET_DECL_LLVM(FnDecl, Fn);


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


[llvm-commits] CVS: llvm/test/CFrontend/2003-02-12-NonlocalGoto.c

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CFrontend:

2003-02-12-NonlocalGoto.c (r1.6) removed
---
Log message:

this tests for a missing feature.  Move it to PR1391: http://llvm.org/PR1391  
instead of being an 
xfailed testcase


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/Assembler/2004-12-06-ConstantFloatRange.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Assembler:

2004-12-06-ConstantFloatRange.ll (r1.6) removed
---
Log message:

Remove bogus testcase, PR409: http://llvm.org/PR409  is wontfix


---
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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Jeff Cohen
Chris Lattner wrote:
> On May 5, 2007, at 2:03 PM, Jeff Cohen wrote:
>> Are you sure that's the problem?  Even on my machine, where the OS
>> identifies the hardware as amd64, the test was correctly XFAILing.
>
> No, I'm not sure.  A better question is: why is this ppc specific? :)
>
> -Chris

On my machine, anyway, the gdb stack trace shows that the debugging info 
is basically garbage.

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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/bit-intrinsics.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

bit-intrinsics.ll updated: 1.3 -> 1.4
---
Log message:

unxfail this, llc doesn't support this feature yet, so don't run it.


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

 bit-intrinsics.ll |2 --
 1 files changed, 2 deletions(-)


Index: llvm/test/CodeGen/Generic/bit-intrinsics.ll
diff -u llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.3 
llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.4
--- llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.3 Mon Apr 16 16:52:56 2007
+++ llvm/test/CodeGen/Generic/bit-intrinsics.ll Sat May  5 16:51:34 2007
@@ -2,8 +2,6 @@
 ; intrinsic is supported natively or IntrinsicLowering provides it.
 ; RUN: llvm-as < %s > %t.bc
 ; RUN: lli --force-interpreter=true %t.bc
-; RUN: llc %t.bc -o /dev/null -f
-; XFAIL: *
 
 declare i32 @llvm.part.set.i32.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo)
 declare i16 @llvm.part.set.i16.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo)



___
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/2007-03-15-GEP-Idx-Sink.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/ARM:

2007-03-15-GEP-Idx-Sink.ll (r1.4) removed
---
Log message:

remove xfailed testcase (attached to pr)


---
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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Chris Lattner

On May 5, 2007, at 2:49 PM, Jeff Cohen wrote:

> Chris Lattner wrote:
>> On May 5, 2007, at 2:03 PM, Jeff Cohen wrote:
>>> Are you sure that's the problem?  Even on my machine, where the OS
>>> identifies the hardware as amd64, the test was correctly XFAILing.
>>
>> No, I'm not sure.  A better question is: why is this ppc specific? :)
>>
>> -Chris
>
> On my machine, anyway, the gdb stack trace shows that the debugging  
> info is basically garbage.

Ok, then it really is failing.

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


[llvm-commits] CVS: llvm/test/CodeGen/X86/2005-12-03-IndirectTailCall.ll fast-cc-tail-call.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

2005-12-03-IndirectTailCall.ll (r1.6) removed
fast-cc-tail-call.ll (r1.5) removed
---
Log message:

We need support for tail calls, this is moved to PR1392: http://llvm.org/PR1392 


---
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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Anton Korobeynikov
> Ok, then it really is failing.
Same here. This is strange, however I haven't tested debug information
on C++ programs. Will try to look. 

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


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


Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Jeff Cohen
Chris Lattner wrote:
>
> On May 5, 2007, at 2:49 PM, Jeff Cohen wrote:
>
>> Chris Lattner wrote:
>>> On May 5, 2007, at 2:03 PM, Jeff Cohen wrote:
 Are you sure that's the problem?  Even on my machine, where the OS
 identifies the hardware as amd64, the test was correctly XFAILing.
>>>
>>> No, I'm not sure.  A better question is: why is this ppc specific? :)
>>>
>>> -Chris
>>
>> On my machine, anyway, the gdb stack trace shows that the debugging 
>> info is basically garbage.
>
> Ok, then it really is failing.
>
> -Chris
This is the output on my machine.  It looks better than when I last 
looked at it, but still leaves a lot to be desired.

Breakpoint 1 at 0x4007d0: file 2006-11-06-StackTrace.cpp, line 27.

Breakpoint 1, DeepStack::deepest (this=0x7fffe6c8, x=27) at 
2006-11-06-StackTrace.cpp:27
27int deepest   ( int x ) { return x + 7; }
#0  DeepStack::deepest (this=0x7fffe6c8, x=27) at 
2006-11-06-StackTrace.cpp:27
#1  0x00400821 in DeepStack::deeper (this=0x7fffe6c8, x=27) 
at 2006-11-06-StackTrace.cpp:26
#2  0x1f927800 in ?? ()
#3  0x1f90949a in find_symdef () from /libexec/ld-elf.so.1
#4  0x00400881 in DeepStack::shallow (this=0x1fe7ca92, x=0) at 
2006-11-06-StackTrace.cpp:24
#5  0x1feee2f0 in strcspn () from /lib/libc.so.6
#6  0x1f927800 in ?? ()
#7  0x00140002 in ?? ()
#8  0x7fffe6c8 in ?? ()
#9  0x7fffe660 in ?? ()
#10 0x004008b1 in DeepStack::shallower (this=0x1fe7ca92, x=0) at 
2006-11-06-StackTrace.cpp:23
#11 0x0246 in ?? ()
#12 0x in ?? ()
#13 0x0012001c in ?? ()
#14 0x7fffe6c8 in ?? ()
#15 0x7fffe690 in ?? ()
#16 0x004008e0 in DeepStack::shallowest (this=0x1fe7ca92, x=0) 
at 2006-11-06-StackTrace.cpp:22
#17 0x in ?? ()
#18 0x0002 in ?? ()
#19 0x0011e6f0 in ?? ()
#20 0x7fffe6c8 in ?? ()
#21 0x7fffe6b0 in ?? ()
#22 0x00400909 in DeepStack::runit (this=0x1fe7ca92) at 
2006-11-06-StackTrace.cpp:29
#23 0x0011 in ?? ()
#24 0x7fffe6c8 in ?? ()
#25 0x7fffe6f0 in ?? ()
#26 0x00400757 in main (argc=0, argv=0x1fe7ca72) at 
2006-11-06-StackTrace.cpp:35


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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.166 -> 1.167
---
Log message:

move CodeGen/X86/overlap-add.ll here.


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

 README.txt |   27 +++
 1 files changed, 27 insertions(+)


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.166 
llvm/lib/Target/X86/README.txt:1.167
--- llvm/lib/Target/X86/README.txt:1.166Mon Apr 16 19:02:37 2007
+++ llvm/lib/Target/X86/README.txt  Sat May  5 17:10:24 2007
@@ -1004,6 +1004,33 @@
 movl %edi, %eax
 ret
 
+Another example is:
+
+;; X's live range extends beyond the shift, so the register allocator
+;; cannot coalesce it with Y.  Because of this, a copy needs to be
+;; emitted before the shift to save the register value before it is
+;; clobbered.  However, this copy is not needed if the register
+;; allocator turns the shift into an LEA.  This also occurs for ADD.
+
+; Check that the shift gets turned into an LEA.
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \
+; RUN:   not grep {mov E.X, E.X}
+
+%G = external global int
+
+int %test1(int %X, int %Y) {
+%Z = add int %X, %Y
+volatile store int %Y, int* %G
+volatile store int %Z, int* %G
+ret int %X
+}
+
+int %test2(int %X) {
+%Z = add int %X, 1  ;; inc
+volatile store int %Z, int* %G
+ret int %X
+}
+
 //===-===//
 
 We use push/pop of stack space around calls in situations where we don't have 
to.



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/overlap-add.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

overlap-add.ll (r1.7) removed
---
Log message:

remove this xfail'd test, move it to the X86 readme.


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/isunord.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

isunord.ll updated: 1.5 -> 1.6
---
Log message:

the sparc v8 backend handles this correctly


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

 isunord.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/CodeGen/Generic/isunord.ll
diff -u llvm/test/CodeGen/Generic/isunord.ll:1.5 
llvm/test/CodeGen/Generic/isunord.ll:1.6
--- llvm/test/CodeGen/Generic/isunord.ll:1.5Sat Dec  2 14:38:10 2006
+++ llvm/test/CodeGen/Generic/isunord.llSat May  5 17:12:57 2007
@@ -1,5 +1,5 @@
 ; RUN: llvm-upgrade < %s | llvm-as | llc
-; XFAIL: ia64|sparcv8
+; XFAIL: ia64
 
 
 declare bool %llvm.isunordered.f64(double, double)



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


[llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.td

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Target/IA64:

IA64InstrInfo.td updated: 1.49 -> 1.50
---
Log message:

implement anyextend from i1 -> i64


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

 IA64InstrInfo.td |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Target/IA64/IA64InstrInfo.td
diff -u llvm/lib/Target/IA64/IA64InstrInfo.td:1.49 
llvm/lib/Target/IA64/IA64InstrInfo.td:1.50
--- llvm/lib/Target/IA64/IA64InstrInfo.td:1.49  Sat Nov 25 22:34:26 2006
+++ llvm/lib/Target/IA64/IA64InstrInfo.td   Sat May  5 17:17:00 2007
@@ -162,6 +162,8 @@
 // zero extend a bool (predicate reg) into an integer reg
 def ZXTb : Pat<(zext PR:$src),
   (TPCADDIMM22 (ADDS r0, 0), 1, PR:$src)>;
+def AXTb : Pat<(anyext PR:$src),
+  (TPCADDIMM22 (ADDS r0, 0), 1, PR:$src)>; 
 
 // normal sign/zero-extends
 def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src",



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


[llvm-commits] CVS: llvm/test/Transforms/CorrelatedExprs/looptest.ll nullpointer.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/CorrelatedExprs:

looptest.ll (r1.7) removed
nullpointer.ll (r1.8) removed
---
Log message:

remvoe two tests that cee has never gotten right


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/Transforms/Mem2Reg/DifferingTypes.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/Mem2Reg:

DifferingTypes.ll (r1.6) removed
---
Log message:


Move Mem2Reg/DifferingTypes.ll -> ScalarRepl/DifferingTypes.ll.  -scalarrepl
implements this xform.


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/Transforms/ScalarRepl/DifferingTypes.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/ScalarRepl:

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


Move Mem2Reg/DifferingTypes.ll -> ScalarRepl/DifferingTypes.ll.  -scalarrepl
implements this xform.


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

 DifferingTypes.ll |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/test/Transforms/ScalarRepl/DifferingTypes.ll
diff -c /dev/null llvm/test/Transforms/ScalarRepl/DifferingTypes.ll:1.1
*** /dev/null   Sat May  5 17:22:13 2007
--- llvm/test/Transforms/ScalarRepl/DifferingTypes.ll   Sat May  5 17:22:03 2007
***
*** 0 
--- 1,19 
+ ; This is a feature test.  Hopefully one day this will be implemented.  The 
+ ; generated code should perform the appropriate masking operations required 
+ ; depending on the endianness of the target...
+ ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
+ ; RUN:   not grep alloca
+ 
+ implementation
+ 
+ int %testfunc(int %i, sbyte %j) {
+   %I = alloca int
+ 
+   store int %i, int* %I
+ 
+   %P = cast int* %I to sbyte*
+   store sbyte %j, sbyte* %P
+ 
+   %t = load int* %I
+   ret int %t
+ }



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


[llvm-commits] CVS: llvm/test/Transforms/TailCallElim/tail_call_with_branch.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/TailCallElim:

tail_call_with_branch.ll (r1.4) removed
---
Log message:

move these xfailed tests to lib/Target/README.txt


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

 0 files changed



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


[llvm-commits] CVS: llvm/test/Transforms/Reassociate/backwards.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/Reassociate:

backwards.ll (r1.1) removed
---
Log message:

move these xfailed tests to lib/Target/README.txt


---
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/lib/Target/README.txt

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Target:

README.txt updated: 1.59 -> 1.60
---
Log message:

the mason example is implemented.  Move some examples out of llvm/test, 
upgrade the syntax of some other examples.


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

 README.txt |   87 +++--
 1 files changed, 51 insertions(+), 36 deletions(-)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.59 llvm/lib/Target/README.txt:1.60
--- llvm/lib/Target/README.txt:1.59 Sat Mar 24 01:01:32 2007
+++ llvm/lib/Target/README.txt  Sat May  5 17:29:06 2007
@@ -18,25 +18,6 @@
 
 //===-===//
 
-FreeBench/mason contains code like this:
-
-typedef struct { int a; int b; int c; } p_type;
-extern int m[];
-p_type m0u(p_type *p) {
-  int m[]={0, 8, 1, 2, 16, 5, 13, 7, 14, 9, 3, 4, 11, 12, 15, 10, 17, 6};
-  p_type pu;
-  pu.a = m[p->a];
-  pu.b = m[p->b];
-  pu.c = m[p->c];
-  return pu;
-}
-
-We currently compile this into a memcpy from a static array into 'm', then
-a bunch of loads from m.  It would be better to avoid the memcpy and just do
-loads from the static array.
-
-//===-===//
-
 Make the PPC branch selector target independant
 
 //===-===//
@@ -112,6 +93,8 @@
   return bar(z, n) + bar(2*z, 2*n);
 }
 
+Reassociate should handle the example in GCC PR16157.
+
 //===-===//
 
 These two functions should generate the same code on big-endian systems:
@@ -187,17 +170,18 @@
 
 Scalar Repl cannot currently promote this testcase to 'ret long cst':
 
-%struct.X = type { int, int }
+%struct.X = type { i32, i32 }
 %struct.Y = type { %struct.X }
-ulong %bar() {
-%retval = alloca %struct.Y, align 8 
-%tmp12 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 0
-store int 0, int* %tmp12
-%tmp15 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 1
-store int 1, int* %tmp15
-%retval = bitcast %struct.Y* %retval to ulong*
-%retval = load ulong* %retval
-ret ulong %retval
+
+define i64 @bar() {
+%retval = alloca %struct.Y, align 8
+%tmp12 = getelementptr %struct.Y* %retval, i32 0, i32 0, i32 0
+store i32 0, i32* %tmp12
+%tmp15 = getelementptr %struct.Y* %retval, i32 0, i32 0, i32 1
+store i32 1, i32* %tmp15
+%retval.upgrd.1 = bitcast %struct.Y* %retval to i64*
+%retval.upgrd.2 = load i64* %retval.upgrd.1
+ret i64 %retval.upgrd.2
 }
 
 it should be extended to do so.
@@ -208,16 +192,14 @@
 
 %struct..0anon = type { <4 x float> }
 
-implementation   ; Functions:
-
-void %test1(<4 x float> %V, float* %P) {
+define void @test1(<4 x float> %V, float* %P) {
 %u = alloca %struct..0anon, align 16
-%tmp = getelementptr %struct..0anon* %u, int 0, uint 0
+%tmp = getelementptr %struct..0anon* %u, i32 0, i32 0
 store <4 x float> %V, <4 x float>* %tmp
 %tmp1 = bitcast %struct..0anon* %u to [4 x float]*
-%tmp = getelementptr [4 x float]* %tmp1, int 0, int 1
-%tmp = load float* %tmp
-%tmp3 = mul float %tmp, 2.00e+00
+%tmp.upgrd.1 = getelementptr [4 x float]* %tmp1, i32 0, i32 1
+%tmp.upgrd.2 = load float* %tmp.upgrd.1
+%tmp3 = mul float %tmp.upgrd.2, 2.00e+00
 store float %tmp3, float* %P
 ret void
 }
@@ -409,3 +391,36 @@
 
 //===-===//
 
+Tail call elim should be more aggressive, checking to see if the call is
+followed by an uncond branch to an exit block.
+
+; This testcase is due to tail-duplication not wanting to copy the return
+; instruction into the terminating blocks because there was other code
+; optimized out of the function after the taildup happened.
+;RUN: llvm-upgrade < %s | llvm-as | opt -tailcallelim | llvm-dis | not grep 
call
+
+int %t4(int %a) {
+entry:
+%tmp.1 = and int %a, 1
+%tmp.2 = cast int %tmp.1 to bool
+br bool %tmp.2, label %then.0, label %else.0
+
+then.0:
+%tmp.5 = add int %a, -1
+%tmp.3 = call int %t4( int %tmp.5 )
+br label %return
+
+else.0:
+%tmp.7 = setne int %a, 0
+br bool %tmp.7, label %then.1, label %return
+
+then.1:
+%tmp.11 = add int %a, -2
+%tmp.9 = call int %t4( int %tmp.11 )
+br label %return
+
+return:
+%result.0 = phi int [ 0, %else.0 ], [ %tmp.3, %then.0 ],
+[ %tmp.9, %then.1 ]
+ret int %result.0
+}



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

CorrelatedExprs.cpp updated: 1.60 -> 1.61
InstructionCombining.cpp updated: 1.758 -> 1.759
Reg2Mem.cpp updated: 1.15 -> 1.16
---
Log message:

wrap long lines


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

 CorrelatedExprs.cpp  |   10 +-
 InstructionCombining.cpp |   16 
 Reg2Mem.cpp  |3 ++-
 3 files changed, 15 insertions(+), 14 deletions(-)


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.60 
llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.61
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.60 Wed May  2 20:11:54 2007
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp  Sat May  5 17:32:24 2007
@@ -353,9 +353,9 @@
   //
   std::vector children;
   EF->getChildren(BB, children);
-  if (!RI.empty()) {// Time opt: only propagate if we can change 
something
-for (std::vector::iterator CI = children.begin(), E = 
children.end();
- CI != E; ++CI) {
+  if (!RI.empty()) { // Time opt: only propagate if we can change something
+for (std::vector::iterator CI = children.begin(), 
+ E = children.end(); CI != E; ++CI) {
   assert(RegionInfoMap.find(*CI) == RegionInfoMap.end() &&
  "RegionInfo should be calculated in dominanace order!");
   getRegionInfo(*CI) = RI;
@@ -383,8 +383,8 @@
 }
 
   // Now that all of our successors have information, recursively process them.
-  for (std::vector::iterator CI = children.begin(), E = 
children.end();
-   CI != E; ++CI)
+  for (std::vector::iterator CI = children.begin(), 
+   E = children.end(); CI != E; ++CI)
 Changed |= TransformRegion(*CI, VisitedBlocks);
 
   return Changed;


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.758 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.759
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.758   Fri May  4 
20:59:31 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat May  5 17:32:24 2007
@@ -6419,7 +6419,7 @@
   Offset += TySize;
   assert(Offset >= 0);
 }
-assert((uint64_t)Offset < (uint64_t)TySize && "Out of range 
offset");
+assert((uint64_t)Offset < (uint64_t)TySize &&"Out of range 
offset");
   }
   
   NewIndices.push_back(ConstantInt::get(IntPtrTy, FirstIdx));
@@ -6932,8 +6932,8 @@
   if (Instruction *V = PromoteCastOfAllocation(CI, *AI))
 return V;
 
-// If the source and destination are pointers, and this cast is equivalent 
to
-// a getelementptr X, 0, 0, 0...  turn it into the appropriate 
getelementptr.
+// If the source and destination are pointers, and this cast is equivalent
+// to a getelementptr X, 0, 0, 0...  turn it into the appropriate gep.
 // This can enhance SROA and other transforms that want type-safe pointers.
 Constant *ZeroUInt = Constant::getNullValue(Type::Int32Ty);
 unsigned NumZeros = 0;
@@ -8973,15 +8973,15 @@
 if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1))
   return false;
   } else {
-// Otherwise, the other block ended with a conditional branch.  If one of 
the
+// Otherwise, the other block ended with a conditional branch. If one of 
the
 // destinations is StoreBB, then we have the if/then case.
 if (OtherBr->getSuccessor(0) != StoreBB && 
 OtherBr->getSuccessor(1) != StoreBB)
   return false;
 
 // Okay, we know that OtherBr now goes to Dest and StoreBB, so this is an
-// if/then triangle.  See if there is a store to the same ptr as SI that 
lives
-// in OtherBB.
+// if/then triangle.  See if there is a store to the same ptr as SI that
+// lives in OtherBB.
 for (;; --BBI) {
   // Check to see if we find the matching store.
   if ((OtherStore = dyn_cast(BBI))) {
@@ -8989,8 +8989,8 @@
   return false;
 break;
   }
-  // If we find something that may be using the stored value, or if we run 
out
-  // of instructions, we can't do the xform.
+  // If we find something that may be using the stored value, or if we run
+  // out of instructions, we can't do the xform.
   if (isa(BBI) || BBI->mayWriteToMemory() ||
   BBI == OtherBB->begin())
 return false;


Index: llvm/lib/Transforms/Scalar/Reg2Mem.cpp
diff -u llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.15 
llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.16
--- llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.15 Wed May  2 20:11:54 2007
+++ llvm/lib/Transforms/Scalar/Reg2Mem.cpp  Sat May  5 17:32:24 2007
@@ -55,7 +55,8 @@
   if (!F.isDeclaration()) {
 //give us a clean block
 BasicBlock* bbold = &F.getEntryBlock();
-BasicBlock* bbnew = new BasicBlock("allocablock", &F, 
&F.getEntryBlock());
+BasicBlock* bbnew = new BasicBlock("allocab

Re: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp

2007-05-05 Thread Anton Korobeynikov
Jeff,
> This is the output on my machine.  It looks better than when I last 
> looked at it, but still leaves a lot to be desired.
Could you please send me output from your native compiler.
Something like 'gcc -g -O0 -S -dA foo.c' should be enough.

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/InstCombine:

cast_ptr.ll updated: 1.6 -> 1.7
---
Log message:

un-xfail this.


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

 cast_ptr.ll |1 -
 1 files changed, 1 deletion(-)


Index: llvm/test/Transforms/InstCombine/cast_ptr.ll
diff -u llvm/test/Transforms/InstCombine/cast_ptr.ll:1.6 
llvm/test/Transforms/InstCombine/cast_ptr.ll:1.7
--- llvm/test/Transforms/InstCombine/cast_ptr.ll:1.6Sat Apr 14 15:13:02 2007
+++ llvm/test/Transforms/InstCombine/cast_ptr.llSat May  5 17:41:13 2007
@@ -1,6 +1,5 @@
 ; Tests to make sure elimination of casts is working correctly
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | notcast
-; XFAIL: *
 
 target pointersize = 32
 



___
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-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.759 -> 1.760
---
Log message:

Implement Transforms/InstCombine/cast_ptr.ll


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

 InstructionCombining.cpp |   23 ++-
 1 files changed, 22 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.759 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.760
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.759   Sat May  5 
17:32:24 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat May  5 17:41:33 2007
@@ -5593,7 +5593,28 @@
   const Type *DestTy= LHSCI->getType();
   Value *RHSCIOp;
 
-  // We only handle extension cast instructions, so far. Enforce this.
+  // Turn icmp (ptrtoint x), (ptrtoint/c) into a compare of the input if the 
+  // integer type is the same size as the pointer type.
+  if (LHSCI->getOpcode() == Instruction::PtrToInt &&
+  getTargetData().getPointerSizeInBits() == 
+ cast(DestTy)->getBitWidth()) {
+Value *RHSOp = 0;
+if (Constant *RHSC = dyn_cast(ICI.getOperand(1))) {
+  RHSOp = ConstantExpr::getPtrToInt(RHSC, SrcTy);
+} else if (PtrToIntInst *RHSC = dyn_cast(ICI.getOperand(1))) 
{
+  RHSOp = RHSC->getOperand(0);
+  // If the pointer types don't match, insert a bitcast.
+  if (LHSCIOp->getType() != RHSOp->getType())
+RHSOp = InsertCastBefore(Instruction::BitCast, RHSOp,
+ LHSCIOp->getType(), ICI);
+}
+
+if (RHSOp)
+  return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSOp);
+  }
+  
+  // The code below only handles extension cast instructions, so far.
+  // Enforce this.
   if (LHSCI->getOpcode() != Instruction::ZExt &&
   LHSCI->getOpcode() != Instruction::SExt)
 return 0;



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


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/2006-05-10-InvalidIndexUndef.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/InstCombine:

2006-05-10-InvalidIndexUndef.ll (r1.3) removed
---
Log message:

remove an old xfailed test


---
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/lib/Target/README.txt

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Target:

README.txt updated: 1.60 -> 1.61
---
Log message:

add a note


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

 README.txt |   25 +
 1 files changed, 25 insertions(+)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.60 llvm/lib/Target/README.txt:1.61
--- llvm/lib/Target/README.txt:1.60 Sat May  5 17:29:06 2007
+++ llvm/lib/Target/README.txt  Sat May  5 17:44:08 2007
@@ -424,3 +424,28 @@
 [ %tmp.9, %then.1 ]
 ret int %result.0
 }
+
+//===-===//
+
+Argument promotion should promote arguments for recursive functions, like 
+this:
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion | llvm-dis | grep x.val
+
+implementation   ; Functions:
+
+internal int %foo(int* %x) {
+entry:
+%tmp = load int* %x
+%tmp.foo = call int %foo(int *%x)
+ret int %tmp.foo
+}
+
+int %bar(int* %x) {
+entry:
+%tmp3 = call int %foo( int* %x); [#uses=1]
+ret int %tmp3
+}
+
+
+



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


[llvm-commits] CVS: llvm/test/Transforms/ArgumentPromotion/recursion.ll

2007-05-05 Thread Chris Lattner


Changes in directory llvm/test/Transforms/ArgumentPromotion:

recursion.ll (r1.4) removed
---
Log message:

this test is now in Target/README.txt


---
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/include/llvm/Bitcode/BitstreamWriter.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

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

fix a bug I introduced when I merged some code together


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

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


Index: llvm/include/llvm/Bitcode/BitstreamWriter.h
diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.12 
llvm/include/llvm/Bitcode/BitstreamWriter.h:1.13
--- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.12Fri May  4 20:15:42 2007
+++ llvm/include/llvm/Bitcode/BitstreamWriter.h Sat May  5 18:40:48 2007
@@ -258,7 +258,7 @@
   Emit(V, Op.getEncodingData());
   break;
 case BitCodeAbbrevOp::VBR:
-  EmitVBR(V, Op.getEncodingData());
+  EmitVBR64(V, Op.getEncodingData());
   break;
 case BitCodeAbbrevOp::Char6:
   Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6);



___
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-05-05 Thread Lauro Ramos Venancio


Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.93 -> 1.94
---
Log message:

Fix PR1390: http://llvm.org/PR1390 .
Don't spill extra register to align the stack.


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

 ARMRegisterInfo.cpp |   48 ++--
 1 files changed, 10 insertions(+), 38 deletions(-)


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.93 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.94
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.93Thu May  3 15:28:35 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Sat May  5 18:44:41 2007
@@ -1131,26 +1131,6 @@
   NumGPRSpills++;
 }
 
-// If stack and double are 8-byte aligned and we are spilling an odd number
-// of GPRs. Spill one extra callee save GPR so we won't have to pad between
-// the integer and double callee save areas.
-unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
-if (TargetAlign == 8 && (NumGPRSpills & 1)) {
-  if (CS1Spilled && !UnspilledCS1GPRs.empty()) {
-unsigned Reg = UnspilledCS1GPRs.front();
-MF.setPhysRegUsed(Reg);
-AFI->setCSRegisterIsSpilled(Reg);
-if (!isReservedReg(MF, Reg))
-  ExtraCSSpill = true;
-  } else if (!UnspilledCS2GPRs.empty()) {
-unsigned Reg = UnspilledCS2GPRs.front();
-MF.setPhysRegUsed(Reg);
-AFI->setCSRegisterIsSpilled(Reg);
-if (!isReservedReg(MF, Reg))
-  ExtraCSSpill = true;
-  }
-}
-
 // Estimate if we might need to scavenge a register at some point in order
 // to materialize a stack offset. If so, either spill one additiona
 // callee-saved register or reserve a special spill slot to facilitate
@@ -1180,29 +1160,26 @@
   if (Size >= Limit) {
 // If any non-reserved CS register isn't spilled, just spill one or two
 // extra. That should take care of it!
-unsigned NumExtras = TargetAlign / 4;
-SmallVector Extras;
-while (NumExtras && !UnspilledCS1GPRs.empty()) {
+unsigned Extra;
+while (!ExtraCSSpill && !UnspilledCS1GPRs.empty()) {
   unsigned Reg = UnspilledCS1GPRs.back();
   UnspilledCS1GPRs.pop_back();
   if (!isReservedReg(MF, Reg)) {
-Extras.push_back(Reg);
-NumExtras--;
+Extra = Reg;
+ExtraCSSpill = true;
   }
 }
-while (NumExtras && !UnspilledCS2GPRs.empty()) {
+while (!ExtraCSSpill && !UnspilledCS2GPRs.empty()) {
   unsigned Reg = UnspilledCS2GPRs.back();
   UnspilledCS2GPRs.pop_back();
   if (!isReservedReg(MF, Reg)) {
-Extras.push_back(Reg);
-NumExtras--;
+Extra = Reg;
+ExtraCSSpill = true;
   }
 }
-if (Extras.size() && NumExtras == 0) {
-  for (unsigned i = 0, e = Extras.size(); i != e; ++i) {
-MF.setPhysRegUsed(Extras[i]);
-AFI->setCSRegisterIsSpilled(Extras[i]);
-  }
+if (ExtraCSSpill) {
+  MF.setPhysRegUsed(Extra);
+  AFI->setCSRegisterIsSpilled(Extra);
 } else {
   // Reserve a slot closest to SP or frame pointer.
   const TargetRegisterClass *RC = &ARM::GPRRegClass;
@@ -1263,7 +1240,6 @@
   ARMFunctionInfo *AFI = MF.getInfo();
   bool isThumb = AFI->isThumbFunction();
   unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
-  unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
   unsigned NumBytes = MFI->getStackSize();
   const std::vector &CSI = MFI->getCalleeSavedInfo();
 
@@ -1330,10 +1306,6 @@
 }
   }
 
-  if (Align == 8 && (GPRCS1Size & 7) != 0)
-// Pad CS1 to ensure proper alignment.
-GPRCS1Size += 4;
-
   if (!isThumb) {
 // Build the new SUBri to adjust SP for integer callee-save spill area 1.
 emitSPUpdate(MBB, MBBI, -GPRCS1Size, isThumb, TII);



___
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/2007-05-05-InvalidPushPop.ll

2007-05-05 Thread Lauro Ramos Venancio


Changes in directory llvm/test/CodeGen/ARM:

2007-05-05-InvalidPushPop.ll added (r1.1)
---
Log message:

Fix PR1390: http://llvm.org/PR1390 .
Don't spill extra register to align the stack.


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

 2007-05-05-InvalidPushPop.ll |   41 +
 1 files changed, 41 insertions(+)


Index: llvm/test/CodeGen/ARM/2007-05-05-InvalidPushPop.ll
diff -c /dev/null llvm/test/CodeGen/ARM/2007-05-05-InvalidPushPop.ll:1.1
*** /dev/null   Sat May  5 18:44:51 2007
--- llvm/test/CodeGen/ARM/2007-05-05-InvalidPushPop.ll  Sat May  5 18:44:41 2007
***
*** 0 
--- 1,41 
+ ; RUN: llvm-as < %s | llc | not grep r11
+ 
+ target triple = "thumb-linux-gnueabi"
+   %struct.__sched_param = type { i32 }
+   %struct.pthread_attr_t = type { i32, i32, %struct.__sched_param, i32, 
i32, i32, i32, i8*, i32 }
+ @i.1882 = internal global i32 1   ;  [#uses=2]
+ @.str = internal constant [14 x i8] c"Thread 1: %d\0A\00" ; <[14 
x i8]*> [#uses=1]
+ @.str1 = internal constant [14 x i8] c"Thread 2: %d\0A\00"; <[14 
x i8]*> [#uses=1]
+ 
+ define i8* @f(i8* %a) {
+ entry:
+   %tmp1 = load i32* @i.1882   ;  [#uses=1]
+   %tmp2 = add i32 %tmp1, 1;  [#uses=2]
+   store i32 %tmp2, i32* @i.1882
+   %tmp34 = inttoptr i32 %tmp2 to i8*  ;  [#uses=1]
+   ret i8* %tmp34
+ }
+ 
+ define i32 @main() {
+ entry:
+   %t = alloca i32, align 4;  [#uses=4]
+   %ret = alloca i32, align 4  ;  [#uses=3]
+   %tmp1 = call i32 @pthread_create( i32* %t, %struct.pthread_attr_t* 
null, i8* (i8*)* @f, i8* null )  ;  [#uses=0]
+   %tmp2 = load i32* %t;  [#uses=1]
+   %ret3 = bitcast i32* %ret to i8**   ;  [#uses=2]
+   %tmp4 = call i32 @pthread_join( i32 %tmp2, i8** %ret3 ) ;  
[#uses=0]
+   %tmp5 = load i32* %ret  ;  [#uses=1]
+   %tmp7 = call i32 (i8*, ...)* @printf( i8* getelementptr ([14 x i8]* 
@.str, i32 0, i32 0), i32 %tmp5 )   ;  [#uses=0]
+   %tmp8 = call i32 @pthread_create( i32* %t, %struct.pthread_attr_t* 
null, i8* (i8*)* @f, i8* null )  ;  [#uses=0]
+   %tmp9 = load i32* %t;  [#uses=1]
+   %tmp11 = call i32 @pthread_join( i32 %tmp9, i8** %ret3 )
;  [#uses=0]
+   %tmp12 = load i32* %ret ;  [#uses=1]
+   %tmp14 = call i32 (i8*, ...)* @printf( i8* getelementptr ([14 x i8]* 
@.str1, i32 0, i32 0), i32 %tmp12 );  [#uses=0]
+   ret i32 0
+ }
+ 
+ declare i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
+ 
+ declare i32 @pthread_join(i32, i8**)
+ 
+ declare i32 @printf(i8*, ...)



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Globals.cpp updated: 1.24 -> 1.25
---
Log message:

handle gep aliasee


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

 Globals.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.24 llvm/lib/VMCore/Globals.cpp:1.25
--- llvm/lib/VMCore/Globals.cpp:1.24Thu May  3 17:09:21 2007
+++ llvm/lib/VMCore/Globals.cpp Sat May  5 18:49:02 2007
@@ -210,7 +210,7 @@
   setOperand(0, Aliasee);
 }
 
-const GlobalValue *GlobalAlias::getAliasedGlobal() const  {
+const GlobalValue *GlobalAlias::getAliasedGlobal() const {
   const Constant *C = getAliasee();
   if (C) {
 if (const GlobalValue *GV = dyn_cast(C))
@@ -218,8 +218,9 @@
 else {
   const ConstantExpr *CE = 0;
   if ((CE = dyn_cast(C)) &&
-  (CE->getOpcode() == Instruction::BitCast))
-return cast(CE->getOperand(0));
+  (CE->getOpcode() == Instruction::BitCast || 
+   CE->getOpcode() == Instruction::GetElementPtr))
+return dyn_cast(CE->getOperand(0));
   else
 assert(0 && "Unsupported aliasee");
 }



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.41 -> 1.42
---
Log message:

stop encoding type/value pairs when the type is implied by the value.
This shrinks the function block of kc++ from 1055K to 906K


---
Diffs of the changes:  (+48 -35)

 BitcodeWriter.cpp |   83 +++---
 1 files changed, 48 insertions(+), 35 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.41 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.42
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.41  Sat May  5 02:44:49 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 19:00:00 2007
@@ -572,9 +572,29 @@
   }
 }
 
+/// PushValueAndType - The file has to encode both the value and type id for
+/// many values, because we need to know what type to create for forward
+/// references.  However, most operands are not forward references, so this 
type
+/// field is not needed.
+///
+/// This function adds V's value ID to Vals.  If the value ID is higher than 
the
+/// instruction ID, then it is a forward reference, and it also includes the
+/// type ID.
+static bool PushValueAndType(Value *V, unsigned InstID,
+ SmallVector &Vals, 
+ ValueEnumerator &VE) {
+  unsigned ValID = VE.getValueID(V);
+  Vals.push_back(ValID);
+  if (ValID >= InstID) {
+Vals.push_back(VE.getTypeID(V->getType()));
+return true;
+  }
+  return false;
+}
+
 /// WriteInstruction - Emit an instruction to the specified stream.
-static void WriteInstruction(const Instruction &I, ValueEnumerator &VE, 
- BitstreamWriter &Stream,
+static void WriteInstruction(const Instruction &I, unsigned InstID,
+ ValueEnumerator &VE, BitstreamWriter &Stream,
  SmallVector &Vals) {
   unsigned Code = 0;
   unsigned AbbrevToUse = 0;
@@ -598,10 +618,8 @@
 
   case Instruction::GetElementPtr:
 Code = bitc::FUNC_CODE_INST_GEP;
-for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
-  Vals.push_back(VE.getTypeID(I.getOperand(i)->getType()));
-  Vals.push_back(VE.getValueID(I.getOperand(i)));
-}
+for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
+  PushValueAndType(I.getOperand(i), InstID, Vals, VE);
 break;
   case Instruction::Select:
 Code = bitc::FUNC_CODE_INST_SELECT;
@@ -633,18 +651,15 @@
   case Instruction::ICmp:
   case Instruction::FCmp:
 Code = bitc::FUNC_CODE_INST_CMP;
-Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 Vals.push_back(VE.getValueID(I.getOperand(1)));
 Vals.push_back(cast(I).getPredicate());
 break;
 
   case Instruction::Ret:
 Code = bitc::FUNC_CODE_INST_RET;
-if (I.getNumOperands()) {
-  Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-  Vals.push_back(VE.getValueID(I.getOperand(0)));
-}
+if (I.getNumOperands())
+  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 break;
   case Instruction::Br:
 Code = bitc::FUNC_CODE_INST_BR;
@@ -663,10 +678,9 @@
   case Instruction::Invoke: {
 Code = bitc::FUNC_CODE_INST_INVOKE;
 Vals.push_back(cast(I).getCallingConv());
-Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));  // callee
-Vals.push_back(VE.getValueID(I.getOperand(1)));  // normal
-Vals.push_back(VE.getValueID(I.getOperand(2)));  // unwind
+Vals.push_back(VE.getValueID(I.getOperand(1)));  // normal dest
+Vals.push_back(VE.getValueID(I.getOperand(2)));  // unwind dest
+PushValueAndType(I.getOperand(0), InstID, Vals, VE); // callee
 
 // Emit value #'s for the fixed parameters.
 const PointerType *PTy = cast(I.getOperand(0)->getType());
@@ -676,12 +690,9 @@
 
 // Emit type/value pairs for varargs params.
 if (FTy->isVarArg()) {
-  unsigned NumVarargs = I.getNumOperands()-3-FTy->getNumParams();
-  for (unsigned i = I.getNumOperands()-NumVarargs, e = I.getNumOperands();
-   i != e; ++i) {
-Vals.push_back(VE.getTypeID(I.getOperand(i)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(i)));
-  }
+  for (unsigned i = 3+FTy->getNumParams(), e = I.getNumOperands();
+   i != e; ++i)
+PushValueAndType(I.getOperand(i), InstID, Vals, VE); // vararg
 }
 break;
   }
@@ -721,11 +732,11 @@
 
   case Instruction::Load:
 Code = bitc::FUNC_CODE_INST_LOAD;
-Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0))); // ptr.
+if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))  // ptr
+  AbbrevToUse = FUNCTION_INST_LOAD_ABBREV;
+  
 Vals.push_back(Log2_32(cast(I).getAlignment())+1);
 Val

[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp BitcodeReader.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.39 -> 1.40
BitcodeReader.h updated: 1.17 -> 1.18
---
Log message:

stop encoding type/value pairs when the type is implied by the value.
This shrinks the function block of kc++ from 1055K to 906K


---
Diffs of the changes:  (+97 -75)

 BitcodeReader.cpp |  144 +-
 BitcodeReader.h   |   28 ++
 2 files changed, 97 insertions(+), 75 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.39 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.40
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.39  Sat May  5 13:57:30 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 19:00:00 2007
@@ -1168,23 +1168,20 @@
   break;
 }
 case bitc::FUNC_CODE_INST_GEP: { // GEP: [n x operands]
-  if (Record.size() < 2 || (Record.size() & 1))
-return Error("Invalid GEP record");
-  const Type *OpTy = getTypeByID(Record[0]);
-  Value *Op = getFnValueByID(Record[1], OpTy);
-  if (OpTy == 0 || Op == 0)
+  unsigned OpNum = 0;
+  Value *BasePtr;
+  if (getValueTypePair(Record, OpNum, NextValueNo, BasePtr))
 return Error("Invalid GEP record");
 
   SmallVector GEPIdx;
-  for (unsigned i = 1, e = Record.size()/2; i != e; ++i) {
-const Type *IdxTy = getTypeByID(Record[i*2]);
-Value *Idx = getFnValueByID(Record[i*2+1], IdxTy);
-if (IdxTy == 0 || Idx == 0)
+  while (OpNum != Record.size()) {
+Value *Op;
+if (getValueTypePair(Record, OpNum, NextValueNo, Op))
   return Error("Invalid GEP record");
-GEPIdx.push_back(Idx);
+GEPIdx.push_back(Op);
   }
 
-  I = new GetElementPtrInst(Op, &GEPIdx[0], GEPIdx.size());
+  I = new GetElementPtrInst(BasePtr, &GEPIdx[0], GEPIdx.size());
   break;
 }
   
@@ -1242,16 +1239,17 @@
 }
   
 case bitc::FUNC_CODE_INST_CMP: { // CMP: [opty, opval, opval, pred]
-  if (Record.size() < 4) return Error("Invalid CMP record");
-  const Type *OpTy = getTypeByID(Record[0]);
-  Value *LHS = getFnValueByID(Record[1], OpTy);
-  Value *RHS = getFnValueByID(Record[2], OpTy);
-  if (OpTy == 0 || LHS == 0 || RHS == 0)
+  unsigned OpNum = 0;
+  Value *LHS, *RHS;
+  if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
+  getValue(Record, OpNum, LHS->getType(), RHS) ||
+  OpNum+1 != Record.size())
 return Error("Invalid CMP record");
-  if (OpTy->isFPOrFPVector())
-I = new FCmpInst((FCmpInst::Predicate)Record[3], LHS, RHS);
+  
+  if (LHS->getType()->isFPOrFPVector())
+I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
   else
-I = new ICmpInst((ICmpInst::Predicate)Record[3], LHS, RHS);
+I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
   break;
 }
 
@@ -1259,16 +1257,15 @@
   if (Record.size() == 0) {
 I = new ReturnInst();
 break;
-  }
-  if (Record.size() == 2) {
-const Type *OpTy = getTypeByID(Record[0]);
-Value *Op = getFnValueByID(Record[1], OpTy);
-if (!OpTy || !Op)
+  } else {
+unsigned OpNum = 0;
+Value *Op;
+if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
+OpNum != Record.size())
   return Error("Invalid RET record");
 I = new ReturnInst(Op);
 break;
   }
-  return Error("Invalid RET record");
 case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#]
   if (Record.size() != 1 && Record.size() != 3)
 return Error("Invalid BR record");
@@ -1312,46 +1309,42 @@
 }
   
 case bitc::FUNC_CODE_INST_INVOKE: { // INVOKE: [cc,fnty, op0,op1,op2, ...]
-  if (Record.size() < 5)
-return Error("Invalid INVOKE record");
+  if (Record.size() < 3) return Error("Invalid INVOKE record");
   unsigned CCInfo = Record[0];
-  const PointerType *CalleeTy =
-dyn_cast_or_null(getTypeByID(Record[1]));
-  Value *Callee = getFnValueByID(Record[2], CalleeTy);
-  BasicBlock *NormalBB = getBasicBlock(Record[3]);
-  BasicBlock *UnwindBB = getBasicBlock(Record[4]);
-  if (CalleeTy == 0 || Callee == 0 || NormalBB == 0 || UnwindBB == 0)
+  BasicBlock *NormalBB = getBasicBlock(Record[1]);
+  BasicBlock *UnwindBB = getBasicBlock(Record[2]);
+  
+  unsigned OpNum = 3;
+  Value *Callee;
+  if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
 return Error("Invalid INVOKE record");
   
-  const FunctionType *FTy =
+  const PointerType *CalleeTy = dyn_cast(Callee->getType());
+  const FunctionType *FTy = !CalleeTy ? 0 :
 dyn_cast(CalleeTy->getElementType());
 
   // Check that the right number of fixed parameters are here.
-  if (FTy == 0 || Record.size() < 5+FTy->getNum

[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.42 -> 1.43
---
Log message:

further reduce the redundancy of types in the instruction encoding.  This
shrinks function bodies in kc++ from 891913B to 884073B


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

 BitcodeWriter.cpp |   32 
 1 files changed, 12 insertions(+), 20 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.42 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.43
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.42  Sat May  5 19:00:00 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 19:21:25 2007
@@ -602,17 +602,15 @@
   default:
 if (Instruction::isCast(I.getOpcode())) {
   Code = bitc::FUNC_CODE_INST_CAST;
-  Vals.push_back(GetEncodedCastOpcode(I.getOpcode()));
+  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
   Vals.push_back(VE.getTypeID(I.getType()));
-  Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-  Vals.push_back(VE.getValueID(I.getOperand(0)));
+  Vals.push_back(GetEncodedCastOpcode(I.getOpcode()));
 } else {
   assert(isa(I) && "Unknown instruction!");
   Code = bitc::FUNC_CODE_INST_BINOP;
-  Vals.push_back(GetEncodedBinaryOpcode(I.getOpcode()));
-  Vals.push_back(VE.getTypeID(I.getType()));
-  Vals.push_back(VE.getValueID(I.getOperand(0)));
+  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
   Vals.push_back(VE.getValueID(I.getOperand(1)));
+  Vals.push_back(GetEncodedBinaryOpcode(I.getOpcode()));
 }
 break;
 
@@ -623,28 +621,24 @@
 break;
   case Instruction::Select:
 Code = bitc::FUNC_CODE_INST_SELECT;
-Vals.push_back(VE.getTypeID(I.getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
-Vals.push_back(VE.getValueID(I.getOperand(1)));
+PushValueAndType(I.getOperand(1), InstID, Vals, VE);
 Vals.push_back(VE.getValueID(I.getOperand(2)));
+Vals.push_back(VE.getValueID(I.getOperand(0)));
 break;
   case Instruction::ExtractElement:
 Code = bitc::FUNC_CODE_INST_EXTRACTELT;
-Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 Vals.push_back(VE.getValueID(I.getOperand(1)));
 break;
   case Instruction::InsertElement:
 Code = bitc::FUNC_CODE_INST_INSERTELT;
-Vals.push_back(VE.getTypeID(I.getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 Vals.push_back(VE.getValueID(I.getOperand(1)));
 Vals.push_back(VE.getValueID(I.getOperand(2)));
 break;
   case Instruction::ShuffleVector:
 Code = bitc::FUNC_CODE_INST_SHUFFLEVEC;
-Vals.push_back(VE.getTypeID(I.getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 Vals.push_back(VE.getValueID(I.getOperand(1)));
 Vals.push_back(VE.getValueID(I.getOperand(2)));
 break;
@@ -719,8 +713,7 @@
 
   case Instruction::Free:
 Code = bitc::FUNC_CODE_INST_FREE;
-Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
-Vals.push_back(VE.getValueID(I.getOperand(0)));
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);
 break;
 
   case Instruction::Alloca:
@@ -740,9 +733,8 @@
 break;
   case Instruction::Store:
 Code = bitc::FUNC_CODE_INST_STORE;
-Vals.push_back(VE.getTypeID(I.getOperand(1)->getType()));   // Pointer
-Vals.push_back(VE.getValueID(I.getOperand(0))); // val.
-Vals.push_back(VE.getValueID(I.getOperand(1))); // ptr.
+PushValueAndType(I.getOperand(0), InstID, Vals, VE);  // val.
+Vals.push_back(VE.getValueID(I.getOperand(1)));   // ptr.
 Vals.push_back(Log2_32(cast(I).getAlignment())+1);
 Vals.push_back(cast(I).isVolatile());
 break;



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.40 -> 1.41
---
Log message:

further reduce the redundancy of types in the instruction encoding.  This
shrinks function bodies in kc++ from 891913B to 884073B


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

 BitcodeReader.cpp |  129 +++---
 1 files changed, 65 insertions(+), 64 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.40 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.41
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.40  Sat May  5 19:00:00 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 19:21:25 2007
@@ -1145,24 +1145,29 @@
   CurBB = FunctionBBs[0];
   continue;
   
-case bitc::FUNC_CODE_INST_BINOP: {// BINOP: [opcode, ty, opval, opval]
-  if (Record.size() < 4) return Error("Invalid BINOP record");
-  const Type *Ty = getTypeByID(Record[1]);
-  int Opc = GetDecodedBinaryOpcode(Record[0], Ty);
-  Value *LHS = getFnValueByID(Record[2], Ty);
-  Value *RHS = getFnValueByID(Record[3], Ty);
-  if (Opc == -1 || Ty == 0 || LHS == 0 || RHS == 0)
- return Error("Invalid BINOP record");
+case bitc::FUNC_CODE_INST_BINOP: {// BINOP: [opval, ty, opval, opcode]
+  unsigned OpNum = 0;
+  Value *LHS, *RHS;
+  if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
+  getValue(Record, OpNum, LHS->getType(), RHS) ||
+  OpNum+1 != Record.size())
+return Error("Invalid BINOP record");
+  
+  int Opc = GetDecodedBinaryOpcode(Record[OpNum], LHS->getType());
+  if (Opc == -1) return Error("Invalid BINOP record");
   I = BinaryOperator::create((Instruction::BinaryOps)Opc, LHS, RHS);
   break;
 }
-case bitc::FUNC_CODE_INST_CAST: {// CAST: [opcode, ty, opty, opval]
-  if (Record.size() < 4) return Error("Invalid CAST record");
-  int Opc = GetDecodedCastOpcode(Record[0]);
-  const Type *ResTy = getTypeByID(Record[1]);
-  const Type *OpTy = getTypeByID(Record[2]);
-  Value *Op = getFnValueByID(Record[3], OpTy);
-  if (Opc == -1 || ResTy == 0 || OpTy == 0 || Op == 0)
+case bitc::FUNC_CODE_INST_CAST: {// CAST: [opval, opty, destty, 
castopc]
+  unsigned OpNum = 0;
+  Value *Op;
+  if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
+  OpNum+2 != Record.size())
+return Error("Invalid CAST record");
+  
+  const Type *ResTy = getTypeByID(Record[OpNum]);
+  int Opc = GetDecodedCastOpcode(Record[OpNum+1]);
+  if (Opc == -1 || ResTy == 0)
 return Error("Invalid CAST record");
   I = CastInst::create((Instruction::CastOps)Opc, Op, ResTy);
   break;
@@ -1185,54 +1190,52 @@
   break;
 }
   
-case bitc::FUNC_CODE_INST_SELECT: { // SELECT: [ty, opval, opval, opval]
-  if (Record.size() < 4) return Error("Invalid SELECT record");
-  const Type *Ty = getTypeByID(Record[0]);
-  Value *Cond = getFnValueByID(Record[1], Type::Int1Ty);
-  Value *LHS = getFnValueByID(Record[2], Ty);
-  Value *RHS = getFnValueByID(Record[3], Ty);
-  if (Ty == 0 || Cond == 0 || LHS == 0 || RHS == 0)
+case bitc::FUNC_CODE_INST_SELECT: { // SELECT: [opval, ty, opval, opval]
+  unsigned OpNum = 0;
+  Value *TrueVal, *FalseVal, *Cond;
+  if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
+  getValue(Record, OpNum, TrueVal->getType(), FalseVal) ||
+  getValue(Record, OpNum, Type::Int1Ty, Cond))
 return Error("Invalid SELECT record");
-  I = new SelectInst(Cond, LHS, RHS);
+  
+  I = new SelectInst(Cond, TrueVal, FalseVal);
   break;
 }
   
 case bitc::FUNC_CODE_INST_EXTRACTELT: { // EXTRACTELT: [opty, opval, opval]
-  if (Record.size() < 3) return Error("Invalid EXTRACTELT record");
-  const Type *OpTy = getTypeByID(Record[0]);
-  Value *Vec = getFnValueByID(Record[1], OpTy);
-  Value *Idx = getFnValueByID(Record[2], Type::Int32Ty);
-  if (OpTy == 0 || Vec == 0 || Idx == 0)
+  unsigned OpNum = 0;
+  Value *Vec, *Idx;
+  if (getValueTypePair(Record, OpNum, NextValueNo, Vec) ||
+  getValue(Record, OpNum, Type::Int32Ty, Idx))
 return Error("Invalid EXTRACTELT record");
   I = new ExtractElementInst(Vec, Idx);
   break;
 }
   
 case bitc::FUNC_CODE_INST_INSERTELT: { // INSERTELT: [ty, 
opval,opval,opval]
-  if (Record.size() < 4) return Error("Invalid INSERTELT record");
-  const VectorType *OpTy = 
-dyn_cast_or_null(getTypeByID(Record[0]));
-  if (OpTy == 0) return Error("Invalid INSERTELT record");
-  Value *Vec = getFnValueByID(Record[1], OpTy);
-  Value *Elt = getFnValueByID(Record[2], OpTy->getElementType());
-  Value *Idx = getFnValueByID(Record[3], Type::Int32Ty);
-  if (Vec == 0 || Elt == 0 || Idx == 0)
+  unsigned OpNum

[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.41 -> 1.42
---
Log message:

implement the 'string constant' optimization.  This shrinks kc.bit from
2878544 to 2815788


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

 BitcodeReader.cpp |   16 +++-
 1 files changed, 15 insertions(+), 1 deletion(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.41 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.42
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.41  Sat May  5 19:21:25 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 19:35:24 2007
@@ -642,7 +642,21 @@
   }
   break;
 }
-
+case bitc::CST_CODE_STRING: { // STRING: [values]
+  if (Record.empty())
+return Error("Invalid CST_AGGREGATE record");
+
+  const ArrayType *ATy = cast(CurTy);
+  const Type *EltTy = ATy->getElementType();
+  
+  unsigned Size = Record.size();
+  std::vector Elts;
+  
+  for (unsigned i = 0; i != Size; ++i)
+Elts.push_back(ConstantInt::get(EltTy, Record[i]));
+  V = ConstantArray::get(ATy, Elts);
+  break;
+}
 case bitc::CST_CODE_CE_BINOP: {  // CE_BINOP: [opcode, opval, opval]
   if (Record.size() < 3) return Error("Invalid CE_BINOP record");
   int Opc = GetDecodedBinaryOpcode(Record[0], CurTy);



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp ValueEnumerator.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.43 -> 1.44
ValueEnumerator.cpp updated: 1.11 -> 1.12
---
Log message:

implement the 'string constant' optimization.  This shrinks kc.bit from
2878544 to 2815788


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

 BitcodeWriter.cpp   |6 ++
 ValueEnumerator.cpp |9 +
 2 files changed, 11 insertions(+), 4 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.43 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.44
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.43  Sat May  5 19:21:25 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 19:35:24 2007
@@ -484,6 +484,12 @@
 assert (CFP->getType() == Type::DoubleTy && "Unknown FP type!");
 Record.push_back(DoubleToBits((double)CFP->getValue()));
   }
+} else if (isa(C) && cast(C)->isString()) {
+  // Emit constant strings specially.
+  Code = bitc::CST_CODE_STRING;
+  for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
+Record.push_back(cast(C->getOperand(i))->getZExtValue());
+  
 } else if (isa(C) || isa(V) ||
isa(V)) {
   Code = bitc::CST_CODE_AGGREGATE;


Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff -u llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.11 
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.12
--- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.11Fri May  4 00:21:47 2007
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Sat May  5 19:35:24 2007
@@ -12,6 +12,7 @@
 
//===--===//
 
 #include "ValueEnumerator.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/TypeSymbolTable.h"
@@ -65,8 +66,6 @@
I != E; ++I)
 EnumerateValue(I->getAliasee());
   
-  // FIXME: Implement the 'string constant' optimization.
-
   // Enumerate types used by the type symbol table.
   EnumerateTypeSymbolTable(M->getTypeSymbolTable());
 
@@ -105,8 +104,6 @@
   // Now that we rearranged the type table, rebuild TypeMap.
   for (unsigned i = 0, e = Types.size(); i != e; ++i)
 TypeMap[Types[i].first] = i+1;
-  
-  // FIXME: Sort value tables by frequency.
 }
 
 // Optimize constant ordering.
@@ -176,6 +173,10 @@
   if (const Constant *C = dyn_cast(V)) {
 if (isa(C)) {
   // Initializers for globals are handled explicitly elsewhere.
+} else if (isa(C) && cast(C)->isString()) {
+  // Do not enumerate the initializers for an array of simple characters.
+  // The initializers just polute the value table, and we emit the strings
+  // specially.
 } else {
   // This makes sure that if a constant has uses (for example an array of
   // const ints), that they are inserted also.



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/LLVMBitCodes.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

LLVMBitCodes.h updated: 1.16 -> 1.17
---
Log message:

implement the 'string constant' optimization.  This shrinks kc.bit from
2878544 to 2815788


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

 LLVMBitCodes.h |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)


Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h
diff -u llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.16 
llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.17
--- llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.16   Fri May  4 14:10:48 2007
+++ llvm/include/llvm/Bitcode/LLVMBitCodes.hSat May  5 19:35:24 2007
@@ -106,14 +106,15 @@
 CST_CODE_WIDE_INTEGER  =  5,  // WIDE_INTEGER:  [n x intval]
 CST_CODE_FLOAT =  6,  // FLOAT: [fpval]
 CST_CODE_AGGREGATE =  7,  // AGGREGATE: [n x value number]
-CST_CODE_CE_BINOP  =  8,  // CE_BINOP:  [opcode, opval, opval]
-CST_CODE_CE_CAST   =  9,  // CE_CAST:   [opcode, opty, opval]
-CST_CODE_CE_GEP= 10,  // CE_GEP:[n x operands]
-CST_CODE_CE_SELECT = 11,  // CE_SELECT: [opval, opval, opval]
-CST_CODE_CE_EXTRACTELT = 12,  // CE_EXTRACTELT: [opty, opval, opval]
-CST_CODE_CE_INSERTELT  = 13,  // CE_INSERTELT:  [opval, opval, opval]
-CST_CODE_CE_SHUFFLEVEC = 14,  // CE_SHUFFLEVEC: [opval, opval, opval]
-CST_CODE_CE_CMP= 15   // CE_CMP:[opty, opval, opval, pred]
+CST_CODE_STRING=  8,  // STRING:[values]
+CST_CODE_CE_BINOP  =  9,  // CE_BINOP:  [opcode, opval, opval]
+CST_CODE_CE_CAST   = 10,  // CE_CAST:   [opcode, opty, opval]
+CST_CODE_CE_GEP= 11,  // CE_GEP:[n x operands]
+CST_CODE_CE_SELECT = 12,  // CE_SELECT: [opval, opval, opval]
+CST_CODE_CE_EXTRACTELT = 13,  // CE_EXTRACTELT: [opty, opval, opval]
+CST_CODE_CE_INSERTELT  = 14,  // CE_INSERTELT:  [opval, opval, opval]
+CST_CODE_CE_SHUFFLEVEC = 15,  // CE_SHUFFLEVEC: [opval, opval, opval]
+CST_CODE_CE_CMP= 16   // CE_CMP:[opty, opval, opval, pred]
   };
   
   /// CastOpcodes - These are values used in the bitcode files to encode which



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


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

2007-05-05 Thread Lauro Ramos Venancio


Changes in directory llvm:

CREDITS.TXT updated: 1.76 -> 1.77
---
Log message:

Add myself.



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

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


Index: llvm/CREDITS.TXT
diff -u llvm/CREDITS.TXT:1.76 llvm/CREDITS.TXT:1.77
--- llvm/CREDITS.TXT:1.76   Tue Apr 24 19:14:49 2007
+++ llvm/CREDITS.TXTSat May  5 19:41:36 2007
@@ -211,6 +211,11 @@
 E: [EMAIL PROTECTED]
 D: C++ bugs filed, and C++ front-end bug fixes.
 
+N: Lauro Ramos Venancio
+E: [EMAIL PROTECTED]
+D: ARM backend improvements
+D: Thread Local Storage implementation
+
 N: Bill Wendling
 E: [EMAIL PROTECTED]
 W: http://web.mac.com/bwendling/



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.44 -> 1.45
---
Log message:

add an abbreviation for the string constants opzn, shrinking the constnats
block from:

  Block ID #11 (CONSTANTS_BLOCK):
  Num Instances: 1722
 Total Size: 3.85976e+06b/482470B/120617W
  % of file: 16.7609
   Average Size: 2241.44b/280.18B/70.045W
  Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 1/0.00058072
Tot/Avg Records: 26423/15.3444
  % Abbrev Recs: 69.1746

to:

 Block ID #11 (CONSTANTS_BLOCK):
  Num Instances: 1724
 Total Size: 2.62406e+06b/328008B/82001.9W
  % of file: 12.041
   Average Size: 1522.08b/190.26B/47.5649W
  Tot/Avg SubBlocks: 0/0
Tot/Avg Abbrevs: 2/0.00116009
Tot/Avg Records: 26280/15.2436
  % Abbrev Recs: 68.9992

This shrinks kc++ from 2815788 to 2724088 bytes, which means the bitcode
file is now smaller than the bytecode file.



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

 BitcodeWriter.cpp |   21 -
 1 files changed, 16 insertions(+), 5 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.44 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.45
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.44  Sat May  5 19:35:24 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 19:42:18 2007
@@ -411,7 +411,7 @@
   Stream.EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 4);
 
   unsigned AggregateAbbrev = 0;
-  unsigned GEPAbbrev = 0;
+  unsigned String7Abbrev = 0;
   // If this is a constant pool for the module, emit module-specific abbrevs.
   if (isGlobal) {
 // Abbrev for CST_CODE_AGGREGATE.
@@ -420,6 +420,13 @@
 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 
Log2_32_Ceil(LastVal+1)));
 AggregateAbbrev = Stream.EmitAbbrev(Abbv);
+
+// Abbrev for CST_CODE_STRING.
+Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
+String7Abbrev = Stream.EmitAbbrev(Abbv);
   }  
   
   // FIXME: Install and use abbrevs to reduce size.  Install them globally so
@@ -487,9 +494,14 @@
 } else if (isa(C) && cast(C)->isString()) {
   // Emit constant strings specially.
   Code = bitc::CST_CODE_STRING;
-  for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
-Record.push_back(cast(C->getOperand(i))->getZExtValue());
-  
+  bool isStr7 = true;
+  for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) {
+unsigned char V = cast(C->getOperand(i))->getZExtValue();
+Record.push_back(V);
+isStr7 &= (V & 128) == 0;
+  }
+  if (isStr7)
+AbbrevToUse = String7Abbrev;
 } else if (isa(C) || isa(V) ||
isa(V)) {
   Code = bitc::CST_CODE_AGGREGATE;
@@ -519,7 +531,6 @@
   Record.push_back(VE.getTypeID(C->getOperand(i)->getType()));
   Record.push_back(VE.getValueID(C->getOperand(i)));
 }
-AbbrevToUse = GEPAbbrev;
 break;
   case Instruction::Select:
 Code = bitc::CST_CODE_CE_SELECT;



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.42 -> 1.43
---
Log message:

add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.



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

 BitcodeReader.cpp |   14 ++
 1 files changed, 14 insertions(+)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.42 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.43
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.42  Sat May  5 19:35:24 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 19:53:07 2007
@@ -651,9 +651,23 @@
   
   unsigned Size = Record.size();
   std::vector Elts;
+  for (unsigned i = 0; i != Size; ++i)
+Elts.push_back(ConstantInt::get(EltTy, Record[i]));
+  V = ConstantArray::get(ATy, Elts);
+  break;
+}
+case bitc::CST_CODE_CSTRING: { // CSTRING: [values]
+  if (Record.empty())
+return Error("Invalid CST_AGGREGATE record");
+  
+  const ArrayType *ATy = cast(CurTy);
+  const Type *EltTy = ATy->getElementType();
   
+  unsigned Size = Record.size();
+  std::vector Elts;
   for (unsigned i = 0; i != Size; ++i)
 Elts.push_back(ConstantInt::get(EltTy, Record[i]));
+  Elts.push_back(Constant::getNullValue(EltTy));
   V = ConstantArray::get(ATy, Elts);
   break;
 }



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.45 -> 1.46
---
Log message:

add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.



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

 BitcodeWriter.cpp |   44 
 1 files changed, 36 insertions(+), 8 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.45 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.46
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.45  Sat May  5 19:42:18 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 19:53:07 2007
@@ -411,7 +411,9 @@
   Stream.EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 4);
 
   unsigned AggregateAbbrev = 0;
-  unsigned String7Abbrev = 0;
+  unsigned String8Abbrev = 0;
+  unsigned CString7Abbrev = 0;
+  unsigned CString6Abbrev = 0;
   // If this is a constant pool for the module, emit module-specific abbrevs.
   if (isGlobal) {
 // Abbrev for CST_CODE_AGGREGATE.
@@ -425,8 +427,20 @@
 Abbv = new BitCodeAbbrev();
 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));
 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
+String8Abbrev = Stream.EmitAbbrev(Abbv);
+// Abbrev for CST_CODE_CSTRING.
+Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
-String7Abbrev = Stream.EmitAbbrev(Abbv);
+CString7Abbrev = Stream.EmitAbbrev(Abbv);
+// Abbrev for CST_CODE_CSTRING.
+Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
+CString6Abbrev = Stream.EmitAbbrev(Abbv);
   }  
   
   // FIXME: Install and use abbrevs to reduce size.  Install them globally so
@@ -493,15 +507,29 @@
   }
 } else if (isa(C) && cast(C)->isString()) {
   // Emit constant strings specially.
-  Code = bitc::CST_CODE_STRING;
-  bool isStr7 = true;
-  for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) {
+  unsigned NumOps = C->getNumOperands();
+  // If this is a null-terminated string, use the denser CSTRING encoding.
+  if (C->getOperand(NumOps-1)->isNullValue()) {
+Code = bitc::CST_CODE_CSTRING;
+--NumOps;  // Don't encode the null, which isn't allowed by char6.
+  } else {
+Code = bitc::CST_CODE_STRING;
+AbbrevToUse = String8Abbrev;
+  }
+  bool isCStr7 = Code == bitc::CST_CODE_CSTRING;
+  bool isCStrChar6 = Code == bitc::CST_CODE_CSTRING;
+  for (unsigned i = 0; i != NumOps; ++i) {
 unsigned char V = cast(C->getOperand(i))->getZExtValue();
 Record.push_back(V);
-isStr7 &= (V & 128) == 0;
+isCStr7 &= (V & 128) == 0;
+if (isCStrChar6) 
+  isCStrChar6 = BitCodeAbbrevOp::isChar6(V);
   }
-  if (isStr7)
-AbbrevToUse = String7Abbrev;
+  
+  if (isCStrChar6)
+AbbrevToUse = CString6Abbrev;
+  else if (isCStr7)
+AbbrevToUse = CString7Abbrev;
 } else if (isa(C) || isa(V) ||
isa(V)) {
   Code = bitc::CST_CODE_AGGREGATE;



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/LLVMBitCodes.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

LLVMBitCodes.h updated: 1.17 -> 1.18
---
Log message:

add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.



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

 LLVMBitCodes.h |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)


Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h
diff -u llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.17 
llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.18
--- llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.17   Sat May  5 19:35:24 2007
+++ llvm/include/llvm/Bitcode/LLVMBitCodes.hSat May  5 19:53:07 2007
@@ -107,14 +107,15 @@
 CST_CODE_FLOAT =  6,  // FLOAT: [fpval]
 CST_CODE_AGGREGATE =  7,  // AGGREGATE: [n x value number]
 CST_CODE_STRING=  8,  // STRING:[values]
-CST_CODE_CE_BINOP  =  9,  // CE_BINOP:  [opcode, opval, opval]
-CST_CODE_CE_CAST   = 10,  // CE_CAST:   [opcode, opty, opval]
-CST_CODE_CE_GEP= 11,  // CE_GEP:[n x operands]
-CST_CODE_CE_SELECT = 12,  // CE_SELECT: [opval, opval, opval]
-CST_CODE_CE_EXTRACTELT = 13,  // CE_EXTRACTELT: [opty, opval, opval]
-CST_CODE_CE_INSERTELT  = 14,  // CE_INSERTELT:  [opval, opval, opval]
-CST_CODE_CE_SHUFFLEVEC = 15,  // CE_SHUFFLEVEC: [opval, opval, opval]
-CST_CODE_CE_CMP= 16   // CE_CMP:[opty, opval, opval, pred]
+CST_CODE_CSTRING   =  9,  // CSTRING:   [values]
+CST_CODE_CE_BINOP  = 10,  // CE_BINOP:  [opcode, opval, opval]
+CST_CODE_CE_CAST   = 11,  // CE_CAST:   [opcode, opty, opval]
+CST_CODE_CE_GEP= 12,  // CE_GEP:[n x operands]
+CST_CODE_CE_SELECT = 13,  // CE_SELECT: [opval, opval, opval]
+CST_CODE_CE_EXTRACTELT = 14,  // CE_EXTRACTELT: [opty, opval, opval]
+CST_CODE_CE_INSERTELT  = 15,  // CE_INSERTELT:  [opval, opval, opval]
+CST_CODE_CE_SHUFFLEVEC = 16,  // CE_SHUFFLEVEC: [opval, opval, opval]
+CST_CODE_CE_CMP= 17   // CE_CMP:[opty, opval, opval, pred]
   };
   
   /// CastOpcodes - These are values used in the bitcode files to encode which



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/tools/llvm-bcanalyzer:

llvm-bcanalyzer.cpp updated: 1.20 -> 1.21
---
Log message:

add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.



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

 llvm-bcanalyzer.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.20 
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.21
--- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.20 Fri May  4 20:46:49 2007
+++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp  Sat May  5 19:53:07 2007
@@ -163,6 +163,8 @@
 case bitc::CST_CODE_WIDE_INTEGER:  return "WIDE_INTEGER";
 case bitc::CST_CODE_FLOAT: return "FLOAT";
 case bitc::CST_CODE_AGGREGATE: return "AGGREGATE";
+case bitc::CST_CODE_STRING:return "STRING";
+case bitc::CST_CODE_CSTRING:   return "CSTRING";
 case bitc::CST_CODE_CE_BINOP:  return "CE_BINOP";
 case bitc::CST_CODE_CE_CAST:   return "CE_CAST";
 case bitc::CST_CODE_CE_GEP:return "CE_GEP";



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

ValueEnumerator.cpp updated: 1.12 -> 1.13
---
Log message:

enumerate the operands of a constant before we enumerate the constant itself
This avoids fwd references in the reader.


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

 ValueEnumerator.cpp |   31 ++-
 1 files changed, 22 insertions(+), 9 deletions(-)


Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff -u llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.12 
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.13
--- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.12Sat May  5 19:35:24 2007
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Sat May  5 20:00:28 2007
@@ -165,11 +165,10 @@
 Values[ValueID-1].second++;
 return;
   }
-  
-  // Add the value.
-  Values.push_back(std::make_pair(V, 1U));
-  ValueID = Values.size();
 
+  // Enumerate the type of this value.
+  EnumerateType(V->getType());
+  
   if (const Constant *C = dyn_cast(V)) {
 if (isa(C)) {
   // Initializers for globals are handled explicitly elsewhere.
@@ -177,16 +176,30 @@
   // Do not enumerate the initializers for an array of simple characters.
   // The initializers just polute the value table, and we emit the strings
   // specially.
-} else {
-  // This makes sure that if a constant has uses (for example an array of
-  // const ints), that they are inserted also.
+} else if (C->getNumOperands()) {
+  // If a constant has operands, enumerate them.  This makes sure that if a
+  // constant has uses (for example an array of const ints), that they are
+  // inserted also.
+  
+  // We prefer to enumerate them with values before we enumerate the user
+  // itself.  This makes it more likely that we can avoid forward 
references
+  // in the reader.  We know that there can be no cycles in the constants
+  // graph that don't go through a global variable.
   for (User::const_op_iterator I = C->op_begin(), E = C->op_end();
I != E; ++I)
 EnumerateValue(*I);
+  
+  // Finally, add the value.  Doing this could make the ValueID reference 
be
+  // dangling, don't reuse it.
+  Values.push_back(std::make_pair(V, 1U));
+  ValueMap[V] = Values.size();
+  return;
 }
   }
-
-  EnumerateType(V->getType());
+  
+  // Add the value.
+  Values.push_back(std::make_pair(V, 1U));
+  ValueID = Values.size();
 }
 
 



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.46 -> 1.47
---
Log message:

add some abbrevs for ret and unreachable, shrinking kc++ from 2717360->2705388


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

 BitcodeWriter.cpp |   34 +++---
 1 files changed, 31 insertions(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.46 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.46  Sat May  5 19:53:07 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 20:28:01 2007
@@ -43,7 +43,10 @@
   CONSTANTS_NULL_Abbrev,
   
   // FUNCTION_BLOCK abbrev id's.
-  FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV
+  FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
+  FUNCTION_INST_RET_VOID_ABBREV,
+  FUNCTION_INST_RET_VAL_ABBREV,
+  FUNCTION_INST_UNREACHABLE_ABBREV
 };
 
 
@@ -697,8 +700,10 @@
 
   case Instruction::Ret:
 Code = bitc::FUNC_CODE_INST_RET;
-if (I.getNumOperands())
-  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+if (!I.getNumOperands())
+  AbbrevToUse = FUNCTION_INST_RET_VOID_ABBREV;
+else if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
+  AbbrevToUse = FUNCTION_INST_RET_VAL_ABBREV;
 break;
   case Instruction::Br:
 Code = bitc::FUNC_CODE_INST_BR;
@@ -740,6 +745,7 @@
 break;
   case Instruction::Unreachable:
 Code = bitc::FUNC_CODE_INST_UNREACHABLE;
+AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV;
 break;
   
   case Instruction::PHI:
@@ -1056,6 +1062,28 @@
Abbv) != FUNCTION_INST_LOAD_ABBREV)
   assert(0 && "Unexpected abbrev ordering!");
   }
+  { // INST_RET abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_RET_VOID_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
+  { // INST_RET abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ValID
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_RET_VAL_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
+  { // INST_UNREACHABLE abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_UNREACHABLE));
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_UNREACHABLE_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
   
   Stream.ExitBlock();
 }



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


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

2007-05-05 Thread Reid Spencer


Changes in directory llvm:

CREDITS.TXT updated: 1.77 -> 1.78
---
Log message:

Make my credits refer to my wiki page.


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

 CREDITS.TXT |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


Index: llvm/CREDITS.TXT
diff -u llvm/CREDITS.TXT:1.77 llvm/CREDITS.TXT:1.78
--- llvm/CREDITS.TXT:1.77   Sat May  5 19:41:36 2007
+++ llvm/CREDITS.TXTSat May  5 20:30:17 2007
@@ -202,10 +202,7 @@
 N: Reid Spencer
 E: [EMAIL PROTECTED]
 W: http://reidspencer.com/
-D: Stacker, llvmc, llvm-ld, llvm-ar, llvm2cpp, lib/Archive, lib/Linker, 
-D: lib/System, bytecode enhancements, symtab hacking, unoverloading of 
-D: intrinsics, makefile and configuration system, documentation, various bug 
-D: fixing.
+D: http://wiki.llvm.org/index.php/User:Reid
 
 N: Adam Treat
 E: [EMAIL PROTECTED]



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitstreamReader.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

BitstreamReader.h updated: 1.17 -> 1.18
---
Log message:

Fix a subtle bug that prevented round-tripping 470.lbm


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

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


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.17 
llvm/include/llvm/Bitcode/BitstreamReader.h:1.18
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.17Sat May  5 02:20:34 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h Sat May  5 20:43:38 2007
@@ -105,7 +105,7 @@
   
   /// GetCurrentBitNo - Return the bit # of the bit we are reading.
   uint64_t GetCurrentBitNo() const {
-return (NextChar-FirstChar)*8 + (32-BitsInCurWord);
+return (NextChar-FirstChar)*8 + ((32-BitsInCurWord) & 31);
   }
   
   /// JumpToBit - Reset the stream to the specified bit number.



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/LLVMBitCodes.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

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

add inline asm code


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

 LLVMBitCodes.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h
diff -u llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.18 
llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.19
--- llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.18   Sat May  5 19:53:07 2007
+++ llvm/include/llvm/Bitcode/LLVMBitCodes.hSat May  5 20:50:11 2007
@@ -115,7 +115,8 @@
 CST_CODE_CE_EXTRACTELT = 14,  // CE_EXTRACTELT: [opty, opval, opval]
 CST_CODE_CE_INSERTELT  = 15,  // CE_INSERTELT:  [opval, opval, opval]
 CST_CODE_CE_SHUFFLEVEC = 16,  // CE_SHUFFLEVEC: [opval, opval, opval]
-CST_CODE_CE_CMP= 17   // CE_CMP:[opty, opval, opval, pred]
+CST_CODE_CE_CMP= 17,  // CE_CMP:[opty, opval, opval, pred]
+CST_CODE_INLINEASM = 18   // INLINEASM: 
[sideeffect,asmstr,conststr]
   };
   
   /// CastOpcodes - These are values used in the bitcode files to encode which



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/tools/llvm-bcanalyzer:

llvm-bcanalyzer.cpp updated: 1.21 -> 1.22
---
Log message:

add inline asm code


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

 llvm-bcanalyzer.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.21 
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.22
--- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.21 Sat May  5 19:53:07 2007
+++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp  Sat May  5 20:50:11 2007
@@ -173,6 +173,7 @@
 case bitc::CST_CODE_CE_INSERTELT:  return "CE_INSERTELT";
 case bitc::CST_CODE_CE_SHUFFLEVEC: return "CE_SHUFFLEVEC";
 case bitc::CST_CODE_CE_CMP:return "CE_CMP";
+case bitc::CST_CODE_INLINEASM: return "INLINEASM";
 }
   case bitc::FUNCTION_BLOCK_ID:
 switch (CodeID) {



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.43 -> 1.44
---
Log message:

implement reading/writing of inlineasm objects


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

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


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.43 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.44
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.43  Sat May  5 19:53:07 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat May  5 20:58:20 2007
@@ -15,6 +15,7 @@
 #include "BitcodeReader.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/InlineAsm.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
 #include "llvm/ParameterAttributes.h"
@@ -759,6 +760,26 @@
 V = ConstantExpr::getICmp(Record[3], Op0, Op1);
   break;
 }
+case bitc::CST_CODE_INLINEASM: {
+  if (Record.size() < 2) return Error("Invalid INLINEASM record");
+  std::string AsmStr, ConstrStr;
+  bool HasSideEffects = Record[0];
+  unsigned AsmStrSize = Record[1];
+  if (2+AsmStrSize >= Record.size())
+return Error("Invalid INLINEASM record");
+  unsigned ConstStrSize = Record[2+AsmStrSize];
+  if (3+AsmStrSize+ConstStrSize > Record.size())
+return Error("Invalid INLINEASM record");
+  
+  for (unsigned i = 0; i != AsmStrSize; ++i)
+AsmStr += (char)Record[2+i];
+  for (unsigned i = 0; i != ConstStrSize; ++i)
+ConstrStr += (char)Record[3+AsmStrSize+i];
+  const PointerType *PTy = cast(CurTy);
+  V = InlineAsm::get(cast(PTy->getElementType()),
+ AsmStr, ConstrStr, HasSideEffects);
+  break;
+}
 }
 
 ValueList.AssignValue(V, NextCstNo);



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.47 -> 1.48
---
Log message:

implement reading/writing of inlineasm objects


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

 BitcodeWriter.cpp |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.48
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47  Sat May  5 20:28:01 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 20:58:20 2007
@@ -17,6 +17,7 @@
 #include "ValueEnumerator.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/InlineAsm.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
 #include "llvm/ParameterAttributes.h"
@@ -446,9 +447,6 @@
 CString6Abbrev = Stream.EmitAbbrev(Abbv);
   }  
   
-  // FIXME: Install and use abbrevs to reduce size.  Install them globally so
-  // they don't need to be reemitted for each function body.
-  
   SmallVector Record;
 
   const ValueEnumerator::ValueList &Vals = VE.getValues();
@@ -465,7 +463,21 @@
 }
 
 if (const InlineAsm *IA = dyn_cast(V)) {
-  assert(0 && IA && "FIXME: Inline asm writing unimp!");
+  Record.push_back(unsigned(IA->hasSideEffects()));
+  
+  // Add the asm string.
+  const std::string &AsmStr = IA->getAsmString();
+  Record.push_back(AsmStr.size());
+  for (unsigned i = 0, e = AsmStr.size(); i != e; ++i)
+Record.push_back(AsmStr[i]);
+  
+  // Add the constraint string.
+  const std::string &ConstraintStr = IA->getConstraintString();
+  Record.push_back(ConstraintStr.size());
+  for (unsigned i = 0, e = ConstraintStr.size(); i != e; ++i)
+Record.push_back(ConstraintStr[i]);
+  Stream.EmitRecord(bitc::CST_CODE_INLINEASM, Record);
+  Record.clear();
   continue;
 }
 const Constant *C = cast(V);
@@ -894,8 +906,6 @@
   Stream.EmitRecord(bitc::FUNC_CODE_DECLAREBLOCKS, Vals);
   Vals.clear();
   
-  // FIXME: Function attributes?
-  
   // If there are function-local constants, emit them now.
   unsigned CstStart, CstEnd;
   VE.getFunctionConstantRange(CstStart, CstEnd);



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/ReaderWriter.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bitcode:

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

add a new CreateBitcodeWriterPass method, which creates a bitcode writer as
a pass


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

 ReaderWriter.h |5 +
 1 files changed, 5 insertions(+)


Index: llvm/include/llvm/Bitcode/ReaderWriter.h
diff -u llvm/include/llvm/Bitcode/ReaderWriter.h:1.2 
llvm/include/llvm/Bitcode/ReaderWriter.h:1.3
--- llvm/include/llvm/Bitcode/ReaderWriter.h:1.2Sun Apr 29 02:54:31 2007
+++ llvm/include/llvm/Bitcode/ReaderWriter.hSat May  5 21:30:12 2007
@@ -21,6 +21,7 @@
   class Module;
   class ModuleProvider;
   class MemoryBuffer;
+  class ModulePass;
   
   /// getBitcodeModuleProvider - Read the header of the specified bitcode 
buffer
   /// and prepare for lazy deserialization of function bodies.  If successful,
@@ -38,6 +39,10 @@
   /// WriteBitcodeToFile - Write the specified module to the specified output
   /// stream.
   void WriteBitcodeToFile(const Module *M, std::ostream &Out);
+  
+  /// CreateBitcodeWriterPass - Create and return a pass that writes the module
+  /// to the specified ostream.
+  ModulePass *CreateBitcodeWriterPass(std::ostream &Str);
 } // End llvm namespace
 
 #endif



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriterPass.cpp added (r1.1)
---
Log message:

add a new CreateBitcodeWriterPass method, which creates a bitcode writer as
a pass


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

 BitcodeWriterPass.cpp |   43 +++
 1 files changed, 43 insertions(+)


Index: llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
diff -c /dev/null llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp:1.1
*** /dev/null   Sat May  5 21:30:22 2007
--- llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp   Sat May  5 21:30:12 2007
***
*** 0 
--- 1,43 
+ //===--- Bitcode/Writer/BitcodeWriterPass.cpp - Bitcode Writer 
===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Chris Lattner and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for 
details.
+ //
+ 
//===--===//
+ //
+ // BitcodeWriterPass implementation.
+ //
+ 
//===--===//
+ 
+ #include "llvm/Bitcode/ReaderWriter.h"
+ #include "llvm/Pass.h"
+ using namespace llvm;
+ 
+ namespace {
+   class WriteBitcodePass : public ModulePass {
+ std::ostream *Out; // ostream to print on
+   public:
+ static char ID; // Pass identifcation, replacement for typeid
+ WriteBitcodePass() : ModulePass((intptr_t) &ID), Out(0) { } 
+ WriteBitcodePass(std::ostream &o) : ModulePass((intptr_t) &ID), Out(&o) {}
+ 
+ bool runOnModule(Module &M) {
+   if (Out)
+ WriteBitcodeToFile(&M, *Out);
+   return false;
+ }
+   };
+ }
+ 
+ char WriteBitcodePass::ID = 0;
+ static RegisterPass X("emitbitcode", "Bitcode Writer");
+ 
+ /// CreateBitcodeWriterPass - Create and return a pass that writes the module
+ /// to the specified ostream.
+ ModulePass *llvm::CreateBitcodeWriterPass(std::ostream &Str) {
+   return new WriteBitcodePass(Str);
+ }
+ 
+ 



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.48 -> 1.49
---
Log message:

add abbrevs for binops and casts.  This shrinks a testcase from 725132->682500 
bytes.


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

 BitcodeWriter.cpp |   32 +---
 1 files changed, 29 insertions(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.48 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.49
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.48  Sat May  5 20:58:20 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 21:38:57 2007
@@ -45,6 +45,8 @@
   
   // FUNCTION_BLOCK abbrev id's.
   FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
+  FUNCTION_INST_BINOP_ABBREV,
+  FUNCTION_INST_CAST_ABBREV,
   FUNCTION_INST_RET_VOID_ABBREV,
   FUNCTION_INST_RET_VAL_ABBREV,
   FUNCTION_INST_UNREACHABLE_ABBREV
@@ -662,13 +664,15 @@
   default:
 if (Instruction::isCast(I.getOpcode())) {
   Code = bitc::FUNC_CODE_INST_CAST;
-  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+  if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
+AbbrevToUse = FUNCTION_INST_CAST_ABBREV;
   Vals.push_back(VE.getTypeID(I.getType()));
   Vals.push_back(GetEncodedCastOpcode(I.getOpcode()));
 } else {
   assert(isa(I) && "Unknown instruction!");
   Code = bitc::FUNC_CODE_INST_BINOP;
-  PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+  if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
+AbbrevToUse = FUNCTION_INST_BINOP_ABBREV;
   Vals.push_back(VE.getValueID(I.getOperand(1)));
   Vals.push_back(GetEncodedBinaryOpcode(I.getOpcode()));
 }
@@ -895,7 +899,7 @@
 /// WriteFunction - Emit a function body to the module stream.
 static void WriteFunction(const Function &F, ValueEnumerator &VE, 
   BitstreamWriter &Stream) {
-  Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 3);
+  Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);
   VE.incorporateFunction(F);
 
   SmallVector Vals;
@@ -1072,6 +1076,28 @@
Abbv) != FUNCTION_INST_LOAD_ABBREV)
   assert(0 && "Unexpected abbrev ordering!");
   }
+  { // INST_BINOP abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_BINOP));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_BINOP_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
+  { // INST_CAST abbrev for FUNCTION_BLOCK.
+BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_CAST));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));// OpVal
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,   // dest ty
+  Log2_32_Ceil(VE.getTypes().size()+1)));
+Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4));  // opc
+if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+   Abbv) != FUNCTION_INST_CAST_ABBREV)
+  assert(0 && "Unexpected abbrev ordering!");
+  }
+  
   { // INST_RET abbrev for FUNCTION_BLOCK.
 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/tools/opt:

Makefile updated: 1.61 -> 1.62
opt.cpp updated: 1.137 -> 1.138
---
Log message:

if -bitcode is specified, read and write a bitcode file instead of a bytecode 
file.


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

 Makefile |2 +-
 opt.cpp  |   34 ++
 2 files changed, 31 insertions(+), 5 deletions(-)


Index: llvm/tools/opt/Makefile
diff -u llvm/tools/opt/Makefile:1.61 llvm/tools/opt/Makefile:1.62
--- llvm/tools/opt/Makefile:1.61Sat Feb  3 17:15:56 2007
+++ llvm/tools/opt/Makefile Sat May  5 21:42:03 2007
@@ -10,6 +10,6 @@
 TOOLNAME = opt
 REQUIRES_EH := 1
 
-LINK_COMPONENTS := bcreader bcwriter instrumentation scalaropts ipo
+LINK_COMPONENTS := bcreader bcwriter bitreader bitwriter instrumentation 
scalaropts ipo
 
 include $(LEVEL)/Makefile.common


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.137 llvm/tools/opt/opt.cpp:1.138
--- llvm/tools/opt/opt.cpp:1.137Wed May  2 20:11:54 2007
+++ llvm/tools/opt/opt.cpp  Sat May  5 21:42:03 2007
@@ -16,6 +16,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/WriteBytecodePass.h"
+#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Analysis/LoopPass.h"
@@ -24,6 +25,7 @@
 #include "llvm/Support/PassNameParser.h"
 #include "llvm/System/Signals.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Support/SystemUtils.h"
@@ -35,6 +37,8 @@
 #include 
 using namespace llvm;
 
+static cl::opt Bitcode("bitcode");
+
 // The OptimizationList is automatically populated with registered Passes by 
the
 // PassNameParser.
 //
@@ -262,8 +266,26 @@
 std::string ErrorMessage;
 
 // Load the input module...
-std::auto_ptr M(ParseBytecodeFile(InputFilename, 
-Compressor::decompressToNewBuffer, &ErrorMessage));
+std::auto_ptr M;
+if (Bitcode) {
+  MemoryBuffer *Buffer;
+  if (InputFilename == "-") {
+Buffer = MemoryBuffer::getSTDIN();
+  } else {
+Buffer = MemoryBuffer::getFile(&InputFilename[0], 
InputFilename.size());
+  }
+  
+  if (Buffer == 0)
+ErrorMessage = "Error reading file '" + InputFilename + "'";
+  else
+M.reset(ParseBitcodeFile(Buffer, &ErrorMessage));
+  
+  delete Buffer;
+} else {
+  M.reset(ParseBytecodeFile(InputFilename, 
+Compressor::decompressToNewBuffer,
+&ErrorMessage));
+}
 if (M.get() == 0) {
   cerr << argv[0] << ": ";
   if (ErrorMessage.size())
@@ -355,8 +377,12 @@
 
 // Write bytecode out to disk or cout as the last step...
 OStream L(*Out);
-if (!NoOutput && !AnalyzeOnly)
-  Passes.add(new WriteBytecodePass(&L, false, !NoCompress));
+if (!NoOutput && !AnalyzeOnly) {
+  if (Bitcode)
+Passes.add(CreateBitcodeWriterPass(*Out));
+  else
+Passes.add(new WriteBytecodePass(&L, false, !NoCompress));
+}
 
 // Now that we have all of the passes ready, run them.
 Passes.run(*M.get());



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


[llvm-commits] CVS: llvm/win32/llvm.sln

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/win32:

llvm.sln updated: 1.28 -> 1.29
---
Log message:

Unbreak VC++.

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

 llvm.sln |1 +
 1 files changed, 1 insertion(+)


Index: llvm/win32/llvm.sln
diff -u llvm/win32/llvm.sln:1.28 llvm/win32/llvm.sln:1.29
--- llvm/win32/llvm.sln:1.28Sun Apr 22 10:00:52 2007
+++ llvm/win32/llvm.sln Sat May  5 22:12:47 2007
@@ -175,6 +175,7 @@
{28AA9146-3482-4F41-9CC6-407B1D258508} = 
{28AA9146-3482-4F41-9CC6-407B1D258508}
{19514E48-456C-4B9D-8637-F2285476461E} = 
{19514E48-456C-4B9D-8637-F2285476461E}
{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = 
{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
+   {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = 
{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = 
{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
{C59374C1-9FC0-4147-B836-327DFDC52D99} = 
{C59374C1-9FC0-4147-B836-327DFDC52D99}
{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = 
{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}



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


[llvm-commits] CVS: llvm/win32/Bitcode/Bitcode.vcproj

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/win32/Bitcode:

Bitcode.vcproj updated: 1.3 -> 1.4
---
Log message:

Unbreak VC++.

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

 Bitcode.vcproj |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/win32/Bitcode/Bitcode.vcproj
diff -u llvm/win32/Bitcode/Bitcode.vcproj:1.3 
llvm/win32/Bitcode/Bitcode.vcproj:1.4
--- llvm/win32/Bitcode/Bitcode.vcproj:1.3   Sun Apr 29 09:22:14 2007
+++ llvm/win32/Bitcode/Bitcode.vcproj   Sat May  5 22:12:47 2007
@@ -108,6 +108,9 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"

UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+   
+   




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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.49 -> 1.50
---
Log message:

Unbreak VC++.

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

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


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.49 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.50
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.49  Sat May  5 21:38:57 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sat May  5 22:12:47 2007
@@ -808,7 +808,7 @@
   case Instruction::Call: {
 Code = bitc::FUNC_CODE_INST_CALL;
 Vals.push_back((cast(I).getCallingConv() << 1) |
-   cast(I).isTailCall());
+   unsigned(cast(I).isTailCall()));
 PushValueAndType(I.getOperand(0), InstID, Vals, VE);  // Callee
 
 // Emit value #'s for the fixed parameters.



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/include/llvm/Bitcode:

BitCodes.h updated: 1.7 -> 1.8
BitstreamReader.h updated: 1.18 -> 1.19
BitstreamWriter.h updated: 1.13 -> 1.14
---
Log message:

Unbreak VC++.

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

 BitCodes.h|2 ++
 BitstreamReader.h |   12 ++--
 BitstreamWriter.h |4 ++--
 3 files changed, 10 insertions(+), 8 deletions(-)


Index: llvm/include/llvm/Bitcode/BitCodes.h
diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.7 
llvm/include/llvm/Bitcode/BitCodes.h:1.8
--- llvm/include/llvm/Bitcode/BitCodes.h:1.7Fri May  4 20:15:42 2007
+++ llvm/include/llvm/Bitcode/BitCodes.hSat May  5 22:12:47 2007
@@ -136,6 +136,7 @@
 if (C == '.') return 62;
 if (C == '_') return 63;
 assert(0 && "Not a value Char6 character!");
+return 0;
   }
   
   static char DecodeChar6(unsigned V) {
@@ -146,6 +147,7 @@
 if (V == 62) return '.';
 if (V == 63) return '_';
 assert(0 && "Not a value Char6 character!");
+return ' ';
   }
   
 };


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.18 
llvm/include/llvm/Bitcode/BitstreamReader.h:1.19
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.18Sat May  5 20:43:38 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h Sat May  5 22:12:47 2007
@@ -110,8 +110,8 @@
   
   /// JumpToBit - Reset the stream to the specified bit number.
   void JumpToBit(uint64_t BitNo) {
-unsigned ByteNo = (BitNo/8) & ~3;
-unsigned WordBitNo = BitNo & 31;
+unsigned ByteNo = unsigned(BitNo/8) & ~3;
+unsigned WordBitNo = unsigned(BitNo) & 31;
 assert(ByteNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
 
 // Move the cursor to the right word.
@@ -327,10 +327,10 @@
   switch (Op.getEncoding()) {
   default: assert(0 && "Unknown encoding!");
   case BitCodeAbbrevOp::Fixed:
-Vals.push_back(Read(Op.getEncodingData()));
+Vals.push_back(Read((unsigned)Op.getEncodingData()));
 break;
   case BitCodeAbbrevOp::VBR:
-Vals.push_back(ReadVBR64(Op.getEncodingData()));
+Vals.push_back(ReadVBR64((unsigned)Op.getEncodingData()));
 break;
   case BitCodeAbbrevOp::Char6:
 Vals.push_back(BitCodeAbbrevOp::DecodeChar6(Read(6)));
@@ -370,7 +370,7 @@
   }
 }
 
-unsigned Code = Vals[0];
+unsigned Code = (unsigned)Vals[0];
 Vals.erase(Vals.begin());
 return Code;
   }
@@ -451,7 +451,7 @@
   default: break;  // Default behavior, ignore unknown content.
   case bitc::BLOCKINFO_CODE_SETBID:
 if (Record.size() < 1) return true;
-CurBlockInfo = &getOrCreateBlockInfo(Record[0]);
+CurBlockInfo = &getOrCreateBlockInfo((unsigned)Record[0]);
 break;
   }
 }  


Index: llvm/include/llvm/Bitcode/BitstreamWriter.h
diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.13 
llvm/include/llvm/Bitcode/BitstreamWriter.h:1.14
--- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.13Sat May  5 18:40:48 2007
+++ llvm/include/llvm/Bitcode/BitstreamWriter.h Sat May  5 22:12:47 2007
@@ -255,10 +255,10 @@
 switch (Op.getEncoding()) {
 default: assert(0 && "Unknown encoding!");
 case BitCodeAbbrevOp::Fixed:
-  Emit(V, Op.getEncodingData());
+  Emit((unsigned)V, (unsigned)Op.getEncodingData());
   break;
 case BitCodeAbbrevOp::VBR:
-  EmitVBR64(V, Op.getEncodingData());
+  EmitVBR64(V, (unsigned)Op.getEncodingData());
   break;
 case BitCodeAbbrevOp::Char6:
   Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6);



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.h

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/lib/Bitcode/Reader:

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

Keep header file free of 'possible loss of data' warnings.

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

 BitcodeReader.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.h
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.h:1.18 
llvm/lib/Bitcode/Reader/BitcodeReader.h:1.19
--- llvm/lib/Bitcode/Reader/BitcodeReader.h:1.18Sat May  5 19:00:00 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.h Sat May  5 22:23:14 2007
@@ -154,7 +154,7 @@
   bool getValueTypePair(SmallVector &Record, unsigned &Slot,
 unsigned InstNum, Value *&ResVal) {
 if (Slot == Record.size()) return true;
-unsigned ValNo = Record[Slot++];
+unsigned ValNo = (unsigned)Record[Slot++];
 if (ValNo < InstNum) {
   // If this is not a forward reference, just return the value we already
   // have.
@@ -164,14 +164,14 @@
   return true;
 }
 
-unsigned TypeNo = Record[Slot++];
+unsigned TypeNo = (unsigned)Record[Slot++];
 ResVal = getFnValueByID(ValNo, getTypeByID(TypeNo));
 return ResVal == 0;
   }
   bool getValue(SmallVector &Record, unsigned &Slot,
 const Type *Ty, Value *&ResVal) {
 if (Slot == Record.size()) return true;
-unsigned ValNo = Record[Slot++];
+unsigned ValNo = (unsigned)Record[Slot++];
 ResVal = getFnValueByID(ValNo, Ty);
 return ResVal == 0;
   }



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


[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitstreamReader.h

2007-05-05 Thread Jeff Cohen


Changes in directory llvm/include/llvm/Bitcode:

BitstreamReader.h updated: 1.19 -> 1.20
---
Log message:

Make code more 64-bit aware.

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

 BitstreamReader.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.19 
llvm/include/llvm/Bitcode/BitstreamReader.h:1.20
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.19Sat May  5 22:12:47 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h Sat May  5 22:24:19 2007
@@ -110,9 +110,9 @@
   
   /// JumpToBit - Reset the stream to the specified bit number.
   void JumpToBit(uint64_t BitNo) {
-unsigned ByteNo = unsigned(BitNo/8) & ~3;
-unsigned WordBitNo = unsigned(BitNo) & 31;
-assert(ByteNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
+uintptr_t ByteNo = uintptr_t(BitNo/8) & ~3;
+uintptr_t WordBitNo = uintptr_t(BitNo) & 31;
+assert(ByteNo < (uintptr_t)(LastChar-FirstChar) && "Invalid location");
 
 // Move the cursor to the right word.
 NextChar = FirstChar+ByteNo;



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


[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td

2007-05-05 Thread Nate Begeman


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.td updated: 1.306 -> 1.307
---
Log message:

Reference correct header


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

 X86InstrInfo.td |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.306 
llvm/lib/Target/X86/X86InstrInfo.td:1.307
--- llvm/lib/Target/X86/X86InstrInfo.td:1.306   Wed Apr 25 16:31:48 2007
+++ llvm/lib/Target/X86/X86InstrInfo.td Sat May  5 23:00:55 2007
@@ -267,7 +267,7 @@
 //
 
 // X86 specific condition code. These correspond to CondCode in
-// X86ISelLowering.h. They must be kept in synch.
+// X86InstrInfo.h. They must be kept in synch.
 def X86_COND_A   : PatLeaf<(i8 0)>;
 def X86_COND_AE  : PatLeaf<(i8 1)>;
 def X86_COND_B   : PatLeaf<(i8 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/Support/MemoryBuffer.h

2007-05-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Support:

MemoryBuffer.h updated: 1.1 -> 1.2
---
Log message:

Add a helper that either opens a file or stdin.


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

 MemoryBuffer.h |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/include/llvm/Support/MemoryBuffer.h
diff -u llvm/include/llvm/Support/MemoryBuffer.h:1.1 
llvm/include/llvm/Support/MemoryBuffer.h:1.2
--- llvm/include/llvm/Support/MemoryBuffer.h:1.1Sun Apr 29 01:58:52 2007
+++ llvm/include/llvm/Support/MemoryBuffer.hSat May  5 23:41:59 2007
@@ -76,6 +76,17 @@
   /// getSTDIN - Read all of stdin into a file buffer, and return it.  This
   /// fails if stdin is empty.
   static MemoryBuffer *getSTDIN();
+  
+  
+  /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
+  /// if the Filename is "-".
+  static MemoryBuffer *getFileOrSTDIN(const char *FilenameStart,unsigned 
FnSize,
+  int64_t FileSize = -1) {
+if (FnSize == 1 && FilenameStart[0] == '-')
+  return getSTDIN();
+return getFile(FilenameStart, FnSize, FileSize);
+  }
+  
 };
 
 } // 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/tools/opt/opt.cpp

2007-05-05 Thread Chris Lattner


Changes in directory llvm/tools/opt:

opt.cpp updated: 1.138 -> 1.139
---
Log message:

add support to llvm-prof for reading from a bitcode file


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

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


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.138 llvm/tools/opt/opt.cpp:1.139
--- llvm/tools/opt/opt.cpp:1.138Sat May  5 21:42:03 2007
+++ llvm/tools/opt/opt.cpp  Sat May  5 23:43:00 2007
@@ -268,12 +268,8 @@
 // Load the input module...
 std::auto_ptr M;
 if (Bitcode) {
-  MemoryBuffer *Buffer;
-  if (InputFilename == "-") {
-Buffer = MemoryBuffer::getSTDIN();
-  } else {
-Buffer = MemoryBuffer::getFile(&InputFilename[0], 
InputFilename.size());
-  }
+  MemoryBuffer *Buffer
+= MemoryBuffer::getFileOrSTDIN(&InputFilename[0], 
InputFilename.size());
   
   if (Buffer == 0)
 ErrorMessage = "Error reading file '" + InputFilename + "'";



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


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

2007-05-05 Thread Chris Lattner


Changes in directory llvm/tools/llvm-prof:

Makefile updated: 1.9 -> 1.10
llvm-prof.cpp updated: 1.31 -> 1.32
---
Log message:

add support to llvm-prof for reading from a bitcode file


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

 Makefile  |2 +-
 llvm-prof.cpp |   20 +---
 2 files changed, 18 insertions(+), 4 deletions(-)


Index: llvm/tools/llvm-prof/Makefile
diff -u llvm/tools/llvm-prof/Makefile:1.9 llvm/tools/llvm-prof/Makefile:1.10
--- llvm/tools/llvm-prof/Makefile:1.9   Mon Sep  4 00:59:09 2006
+++ llvm/tools/llvm-prof/Makefile   Sat May  5 23:43:00 2007
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-prof
-LINK_COMPONENTS = bcreader analysis
+LINK_COMPONENTS = bcreader bitreader analysis
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common


Index: llvm/tools/llvm-prof/llvm-prof.cpp
diff -u llvm/tools/llvm-prof/llvm-prof.cpp:1.31 
llvm/tools/llvm-prof/llvm-prof.cpp:1.32
--- llvm/tools/llvm-prof/llvm-prof.cpp:1.31 Sun Mar  4 18:00:42 2007
+++ llvm/tools/llvm-prof/llvm-prof.cpp  Sat May  5 23:43:00 2007
@@ -18,8 +18,10 @@
 #include "llvm/Assembly/AsmAnnotationWriter.h"
 #include "llvm/Analysis/ProfileInfoLoader.h"
 #include "llvm/Bytecode/Reader.h"
+#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/System/Signals.h"
 #include 
 #include 
@@ -30,6 +32,7 @@
 using namespace llvm;
 
 namespace {
+  cl::opt Bitcode("bitcode");
   cl::opt
   BytecodeFile(cl::Positional, cl::desc(""),
cl::Required);
@@ -116,9 +119,20 @@
 
 // Read in the bytecode file...
 std::string ErrorMessage;
-Module *M = ParseBytecodeFile(BytecodeFile, 
-  Compressor::decompressToNewBuffer, 
-  &ErrorMessage);
+Module *M;
+if (Bitcode) {
+  MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&BytecodeFile[0],
+  BytecodeFile.size());
+  if (Buffer == 0)
+ErrorMessage = "Error reading file '" + BytecodeFile + "'";
+  else
+M = ParseBitcodeFile(Buffer, &ErrorMessage);
+  delete Buffer;
+} else {
+  M = ParseBytecodeFile(BytecodeFile, 
+Compressor::decompressToNewBuffer, 
+&ErrorMessage);
+}
 if (M == 0) {
   std::cerr << argv[0] << ": " << BytecodeFile << ": " 
 << ErrorMessage << "\n";



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


  1   2   >