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

2007-05-12 Thread Chris Lattner


Changes in directory llvm/docs:

BitCodeFormat.html updated: 1.3 - 1.4
---
Log message:

continued description


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

 BitCodeFormat.html |  115 ++---
 1 files changed, 109 insertions(+), 6 deletions(-)


Index: llvm/docs/BitCodeFormat.html
diff -u llvm/docs/BitCodeFormat.html:1.3 llvm/docs/BitCodeFormat.html:1.4
--- llvm/docs/BitCodeFormat.html:1.3Sat May 12 00:37:42 2007
+++ llvm/docs/BitCodeFormat.htmlSat May 12 02:49:15 2007
@@ -18,6 +18,7 @@
 lia href=#abbrevidAbbreviation IDs/a/li
 lia href=#blocksBlocks/a/li
 lia href=#datarecordData Records/a/li
+lia href=#abbreviationsAbbreviations/a/li
 /ol
   /li
   lia href=#llvmirLLVM IR Encoding/a/li
@@ -213,12 +214,14 @@
 current block./li
 li1 - a href=#ENTER_SUBBLOCKENTER_SUBBLOCK/a - This abbrev ID marks the
 beginning of a new block./li
-li2 - DEFINE_ABBREV - This defines a new abbreviation./li
-li3 - UNABBREV_RECORD - This ID specifies the definition of an unabbreviated
-record./li
+li2 - a href=#DEFINE_ABBREVDEFINE_ABBREV/a - This defines a new
+abbreviation./li
+li3 - a href=#UNABBREV_RECORDUNABBREV_RECORD/a - This ID specifies the
+definition of an unabbreviated record./li
 /ul
 
-pAbbreviation IDs 4 and above are defined by the stream itself./p
+pAbbreviation IDs 4 and above are defined by the stream itself, and specify
+an a href=#abbrev_recordsabbreviated record encoding/a./p
 
 /div
 
@@ -303,11 +306,111 @@
 /div
 
 div class=doc_text
+p
+Data records consist of a record code and a number of (up to) 64-bit integer
+values.  The interpretation of the code and values is application specific and
+there are multiple different ways to encode a record (with an unabbrev record
+or with an abbreviation).  In the LLVM IR format, for example, there is a 
record
+which encodes the target triple of a module.  The code is MODULE_CODE_TRIPLE,
+and the values of the record are the ascii codes for the characters in the
+string./p
+
+/div
+
+!-- ___ 
--
+div class=doc_subsubsection a name=UNABBREV_RECORDUNABBREV_RECORD
+Encoding/a/div
+
+div class=doc_text
+
+ptt[UNABBREV_RECORD, codesubvbr6/sub, numopssubvbr6/sub,
+   op0subvbr6/sub, op1subvbr6/sub, ...]/tt/p
+
+pAn UNABBREV_RECORD provides a default fallback encoding, which is both
+completely general and also extremely inefficient.  It can describe an 
arbitrary
+record, by emitting the code and operands as vbrs./p
+
+pFor example, emitting an LLVM IR target triple as an unabbreviated record
+requires emitting the UNABBREV_RECORD abbrevid, a vbr6 for the
+MODULE_CODE_TRIPLE code, a vbr6 for the length of the string (which is equal to
+the number of operands), and a vbr6 for each character.  Since there are no
+letters with value less than 32, each letter would need to be emitted as at
+least a two-part VBR, which means that each letter would require at least 12
+bits.  This is not an efficient encoding, but it is fully general./p
+
+/div
+
+!-- ___ 
--
+div class=doc_subsubsection a name=abbrev_recordsAbbreviated Record
+Encoding/a/div
+
+div class=doc_text
+
+ptt[lt;abbrevidgt;, fields...]/tt/p
+
+pAn abbreviated record is a abbreviation id followed by a set of fields that
+are encoded according to the a href=#abbreviationsabbreviation 
+definition/a.  This allows records to be encoded significantly more densely
+than records encoded with the a href=#UNABBREV_RECORDUNABBREV_RECORD/a
+type, and allows the abbreviation types to be specified in the stream itself,
+which allows the files to be completely self describing.  The actual encoding
+of abbreviations is defined below.
+/p
+
+/div
+
+!-- === 
--
+div class=doc_subsectiona name=abbreviationsAbbreviations/a
+/div
 
+div class=doc_text
 p
-blah
+Abbreviations are an important form of compression for bitstreams.  The idea is
+to specify a dense encoding for a class of records once, then use that encoding
+to emit many records.  It takes space to emit the encoding into the file, but
+the space is recouped (hopefully plus some) when the records that use it are
+emitted.
 /p
 
+p
+Abbreviations can be determined dynamically per client, per file.  Since the
+abbreviations are stored in the bitstream itself, different streams of the same
+format can contain different sets of abbreviations if the specific stream does
+not need it.  As a concrete example, LLVM IR files usually emit an abbreviation
+for binary operators.  If a specific LLVM module contained no or few binary
+operators, the abbreviation does not need to be emitted.
+/p
+/div
+
+!-- ___ 
--
+div class=doc_subsubsectiona name=DEFINE_ABBREVDEFINE_ABBREV
+ Encoding/a/div
+
+div class=doc_text
+

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

2007-05-12 Thread Chris Lattner


Changes in directory llvm/docs:

BitCodeFormat.html updated: 1.4 - 1.5
---
Log message:

fix typo


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

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


Index: llvm/docs/BitCodeFormat.html
diff -u llvm/docs/BitCodeFormat.html:1.4 llvm/docs/BitCodeFormat.html:1.5
--- llvm/docs/BitCodeFormat.html:1.4Sat May 12 02:49:15 2007
+++ llvm/docs/BitCodeFormat.htmlSat May 12 02:50:14 2007
@@ -162,7 +162,7 @@
 div class=doc_text
 
 p6-bit characters encode common characters into a fixed 6-bit field.  They
-represent the following characters with the following 6-bit values:s/p
+represent the following characters with the following 6-bit values:/p
 
 ul
 li'a' .. 'z' - 0 .. 25/li
@@ -433,7 +433,7 @@
  src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
  a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
 a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-Last modified: $Date: 2007/05/12 07:49:15 $
+Last modified: $Date: 2007/05/12 07:50:14 $
 /address
 /body
 /html



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


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

2007-05-12 Thread Reid Spencer


Changes in directory llvm/docs:

BitCodeFormat.html updated: 1.5 - 1.6
---
Log message:

Fix a grammaro.


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

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


Index: llvm/docs/BitCodeFormat.html
diff -u llvm/docs/BitCodeFormat.html:1.5 llvm/docs/BitCodeFormat.html:1.6
--- llvm/docs/BitCodeFormat.html:1.5Sat May 12 02:50:14 2007
+++ llvm/docs/BitCodeFormat.htmlSat May 12 03:01:52 2007
@@ -52,7 +52,7 @@
 and an a href=#llvmirencoding of LLVM IR/a into the container format./p
 
 p
-The bitstream format is an abstract encoding of structured data, like very
+The bitstream format is an abstract encoding of structured data, very
 similar to XML in some ways.  Like XML, bitstream files contain tags, and 
nested
 structures, and you can parse the file without having to understand the tags.
 Unlike XML, the bitstream format is a binary encoding, and unlike XML it
@@ -433,7 +433,7 @@
  src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
  a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
 a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-Last modified: $Date: 2007/05/12 07:50:14 $
+Last modified: $Date: 2007/05/12 08:01:52 $
 /address
 /body
 /html



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


[llvm-commits] CVS: llvm-www/DevMtgMay2007.html

2007-05-12 Thread Bill Wendling


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.138 - 1.139
---
Log message:

User HTML Entities.


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

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


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.138 llvm-www/DevMtgMay2007.html:1.139
--- llvm-www/DevMtgMay2007.html:1.138   Fri May 11 19:17:26 2007
+++ llvm-www/DevMtgMay2007.html Sat May 12 05:37:03 2007
@@ -139,7 +139,10 @@
 Processor Element./td
 /tr
 trtd13:50/tdtd14:10/tdtdJohnnbsp;Criswell/td
-  tdbSecure Virtual Architecture/b. A presentation on our research 
to create a virtual machine that operates below the operating system and a 
brief introduction to some of the novel security capabilities that our 
architecture can enable./td
+  tdbSecure Virtual Architecture/b. A presentation on our research to
+   create a virtual machine that operates below the operating system and a
+brief introduction to some of the novel security capabilities that our
+ architecture can enable./td
 /tr
 trtd14:10/tdtd14:30/tdtdJeffnbsp;Cohen/td
   tdbUsing LLVM For The Jolt Compiler/b. Jeff will share his
@@ -289,7 +292,7 @@
 trtdJosh Conner/tdtdApple Inc./td/tr
 trtdJohn Criswell/tdtdUIUC/td/tr
 trtdMike Engler/tdtdAdobe Systems Incorporated./td/tr
-trtdRafael Espindola/tdtdGoogle/td/tr
+trtdRafael Espiacute;ndola/tdtdGoogle/td/tr
 trtdTomas Evensen/tdtdWind River/td/tr
 trtdHan Gao/tdtdAdobe Systems Incorporated./td/tr
 trtdDan Gohman/tdtdCray Inc./td/tr
@@ -355,6 +358,6 @@
   src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a
   a href=http://validator.w3.org/check/referer;img
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
-br/Last modified: $Date: 2007/05/12 00:17:26 $
+br/Last modified: $Date: 2007/05/12 10:37:03 $
 /address
 !--#include virtual=footer.incl --



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


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

2007-05-12 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.81 - 1.82
---
Log message:

Get the size of auto arrays right, regardless of its changing size.


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

 IntrinsicLowering.cpp |   24 +---
 1 files changed, 13 insertions(+), 11 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.81 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.82
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.81 Mon Apr 16 17:21:14 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Sat May 12 06:07:40 2007
@@ -403,11 +403,12 @@
   }
 
   // Return a call to the implementation function
-  Value *Args[3];
-  Args[0] = CI-getOperand(1);
-  Args[1] = CI-getOperand(2);
-  Args[2] = CI-getOperand(3);
-  return new CallInst(F, Args, 3, CI-getName(), CI);
+  Value *Args[] = {
+CI-getOperand(1),
+CI-getOperand(2),
+CI-getOperand(3)
+  };
+  return new CallInst(F, Args, sizeof(Args)/sizeof(Args[0]), CI-getName(), 
CI);
 }
 
 /// Convert the llvm.part.set.iX.iY.iZ intrinsic. This intrinsic takes 
@@ -591,12 +592,13 @@
   }
 
   // Return a call to the implementation function
-  Value *Args[3];
-  Args[0] = CI-getOperand(1);
-  Args[1] = CI-getOperand(2);
-  Args[2] = CI-getOperand(3);
-  Args[3] = CI-getOperand(4);
-  return new CallInst(F, Args, 4, CI-getName(), CI);
+  Value *Args[] = {
+CI-getOperand(1),
+CI-getOperand(2),
+CI-getOperand(3),
+CI-getOperand(4)
+  };
+  return new CallInst(F, Args, sizeof(Args)/sizeof(Args[0]), CI-getName(), 
CI);
 }
 
 



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/test_part_set.c test_part_set.reference_output

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

test_part_set.c added (r1.1)
test_part_set.reference_output added (r1.1)
---
Log message:

Add a new test case.


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

 test_part_set.c|   19 +++
 test_part_set.reference_output |1 +
 2 files changed, 20 insertions(+)


Index: llvm-test/SingleSource/UnitTests/Integer/test_part_set.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/test_part_set.c:1.1
*** /dev/null   Sat May 12 06:14:10 2007
--- llvm-test/SingleSource/UnitTests/Integer/test_part_set.cSat May 12 
06:14:00 2007
***
*** 0 
--- 1,19 
+ #include bits.h
+ 
+ uint68 test_part_set(uint68 x, uint60 y)
+ {
+ return part_set(x, y, 0, (bitwidthof(y)-1));
+ }
+ 
+ uint1 test_reduce(uint68 x)
+ {
+ return reduce(or, x);
+ }
+ 
+ int main(int argc, char** argv) {
+   uint68 A = 0xF0F0F0F0F0F0F0F0ULL;
+   uint60 B = 0x0F0F0F0F0F0F0F0FULL;
+   uint68 X = test_part_set(A, B);
+   uint1 Y = test_reduce(X);
+   return (int) Y;
+ }


Index: llvm-test/SingleSource/UnitTests/Integer/test_part_set.reference_output
diff -c /dev/null 
llvm-test/SingleSource/UnitTests/Integer/test_part_set.reference_output:1.1
*** /dev/null   Sat May 12 06:14:17 2007
--- llvm-test/SingleSource/UnitTests/Integer/test_part_set.reference_output 
Sat May 12 06:14:00 2007
***
*** 0 
--- 1 
+ exit 1



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/test4.reference_output

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

test4.reference_output updated: 1.1 - 1.2
---
Log message:

Update for change in program output.


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

 test4.reference_output |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/test4.reference_output
diff -u llvm-test/SingleSource/UnitTests/Integer/test4.reference_output:1.1 
llvm-test/SingleSource/UnitTests/Integer/test4.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/test4.reference_output:1.1 Sat Apr 
21 12:51:54 2007
+++ llvm-test/SingleSource/UnitTests/Integer/test4.reference_output Sat May 
12 06:13:33 2007
@@ -1,3 +1,5 @@
-
-
+concat(i25,i39)=
+n1 = 
+n2 = 
+concat(i68 n2, i60 
-1)=
 exit 0



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


[llvm-commits] CVS: llvm/test/ExecutionEngine/2007-05-12-APInt-Shl.ll

2007-05-12 Thread Reid Spencer


Changes in directory llvm/test/ExecutionEngine:

2007-05-12-APInt-Shl.ll added (r1.1)
---
Log message:

Add a test case for shl of APInt integers  64 bits by 0 shift amount.


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

 2007-05-12-APInt-Shl.ll |   30 ++
 1 files changed, 30 insertions(+)


Index: llvm/test/ExecutionEngine/2007-05-12-APInt-Shl.ll
diff -c /dev/null llvm/test/ExecutionEngine/2007-05-12-APInt-Shl.ll:1.1
*** /dev/null   Sat May 12 13:00:05 2007
--- llvm/test/ExecutionEngine/2007-05-12-APInt-Shl.ll   Sat May 12 12:59:55 2007
***
*** 0 
--- 1,30 
+ ; RUN: llvm-as %s -f -o %t.bc
+ ; RUN: lli -force-interpreter=true %t.bc | tee %t.out | grep 10
+ 
+ ; Test that APInt shift left works when bitwidth  64 and shiftamt == 0
+ 
+ declare i32 @putchar(i32)
+ 
+ define void @putBit(i65 %x, i65 %bitnum) {
+   %tmp1 = shl i65 1, %bitnum
+   %tmp2 = and i65 %x, %tmp1
+   %cond = icmp ne i65 %tmp2, 0
+   br i1 %cond, label %cond_true, label %cond_false
+ 
+ cond_true:
+   call i32 @putchar(i32 49)
+   br label %cond_next
+ 
+ cond_false:
+   call i32 @putchar(i32 48)
+   br label %cond_next
+ 
+ cond_next:
+   ret void
+ }
+ 
+ define i32 @main() {
+   call void @putBit(i65 1, i65 0)
+   call void @putBit(i65 0, i65 0)
+   ret i32 0
+ }



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


[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

2007-05-12 Thread Reid Spencer


Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.79 - 1.80
---
Log message:

Fix shl to produce the correct result when the bitwidth is  64 and the
shift amount is 0. Previously this code would do a lshr by the bit width
which can lead to incorrect results. 


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

 APInt.cpp |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.79 llvm/lib/Support/APInt.cpp:1.80
--- llvm/lib/Support/APInt.cpp:1.79 Thu May  3 13:15:36 2007
+++ llvm/lib/Support/APInt.cpp  Sat May 12 13:01:57 2007
@@ -1199,6 +1199,12 @@
   if (shiftAmt == BitWidth)
 return APInt(BitWidth, 0);
 
+  // If none of the bits are shifted out, the result is *this. This avoids a
+  // lshr by the words size in the loop below which can produce incorrect
+  // results. It also avoids the expensive computation below for a common case.
+  if (shiftAmt == 0)
+return *this;
+
   // Create some space for the result.
   uint64_t * val = new uint64_t[getNumWords()];
 



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/part_select.c part_select.reference_output

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

part_select.c updated: 1.4 - 1.5
part_select.reference_output updated: 1.2 - 1.3
---
Log message:

Make the output easier to validate.


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

 part_select.c|   25 ---
 part_select.reference_output |   93 +--
 2 files changed, 65 insertions(+), 53 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.c
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.4 
llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.4  Tue Apr 17 
19:53:49 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.c  Sat May 12 
13:41:12 2007
@@ -17,10 +17,10 @@
 
 #ifdef ENABLE_LARGE_INTEGERS
 typedef uint256 BitType;
-const BitType X = 0xFEDCBA9876543210ULL;
+const BitType X = 0xULL;
 #else
 typedef uint47 BitType;
-const BitType X = 0xFEDCBA9876543210ULL;
+const BitType X = 0xULL;
 #endif
 
 int main(int argc, char** argv)
@@ -37,15 +37,26 @@
   unsigned i, j;
 
   for (i = 0; i  bitwidthof(BitType); ++i) {
-BitType left = rand() % bitwidthof(BitType);
-BitType right = i;
-printf(part_select(Y, %3u, %3u) = , (unsigned)left, (unsigned)right);
-BitType Z = part_select(Y, right, left );
+BitType high = rand() % bitwidthof(BitType);
+BitType low = i;
+printf(part_select(Y, %3u, %3u) = , (unsigned)low, (unsigned)high);
+BitType Z = part_select(Y, low, high );
 printBits(Z);
 uint64_t val = Z;
-printf( (%lx), val);
+printf( (%llx), val);
 printf(\n);
   }
 
+  BitType Z = part_select(Y, 0, bitwidthof(Y)-1);
+  if (Z == Y)
+printf( True: );
+  else
+printf(False: );
+  printBits(Z);
+  printf( == );
+  printBits(Y);
+  printf(\n);
+
+
   return 0;
 }


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.2 
llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.3
--- llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.2   
Mon Feb 12 17:17:34 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output   
Sat May 12 13:41:12 2007
@@ -1,48 +1,49 @@
-part_select(Y,  38,   0) = 00111110110010101110011 
(76543210)
-part_select(Y,   4,   1) = 0001000 (8)
-part_select(Y,  18,   2) = 00111001100 
(10c84)
-part_select(Y,  23,   3) = 000101011100110 
(a8642)
-part_select(Y,  17,   4) = 0110011 
(321)
-part_select(Y,  26,   5) = 011001010111001 
(32a190)
-part_select(Y,  16,   6) = 00011001000 (c8)
-part_select(Y,   3,   7) = 0001000 (8)
-part_select(Y,  28,   8) = 0010110010101110010 
(165432)
-part_select(Y,  28,   9) = 0001011001010111001 
(b2a19)
+part_select(Y,   0,  38) = 010101010101010101010101010101010101010 
(2a)
+part_select(Y,   1,   4) = 101 (5)
+part_select(Y,   2,  18) = 0001010101010101010 
()
+part_select(Y,   3,  23) = 00101010101010101010101 
(15)
+part_select(Y,   4,  17) = 010101010101010 
(2aaa)
+part_select(Y,   5,  26) = 00101010101010101010101 
(15)
+part_select(Y,   6,  16) = 01010101010 
(2aa)
+part_select(Y,   7,   3) = 0010101 (15)
+part_select(Y,   8,  28) = 00010101010101010101010 
(a)
+part_select(Y,   9,  28) = 1010101010101010101 
(5)
 part_select(Y,  10,  10) = 000 (0)
-part_select(Y,  17,  11) = 110 (6)
-part_select(Y,  44,  12) = 001101010011111011001010111 
(a9876543)
-part_select(Y,  28,  13) = 000101100101011 
(b2a1)
-part_select(Y,   2,  14) = 1100110 
(426)
-part_select(Y,  20,  15) = 0101000 (28)
-part_select(Y,  22,  16) = 1010100 (54)
-part_select(Y,  21,  17) = 0001010 (a)
-part_select(Y,  18,  18) = 001 (1)
-part_select(Y,  36,  19) = 011111011001010 
(30eca)
-part_select(Y,  34,  20) = 11101100101 
(765)
-part_select(Y,  37,  21) = 

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_select.c

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

bit_select.c updated: 1.4 - 1.5
---
Log message:

Simplify test case.


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

 bit_select.c |7 +--
 1 files changed, 1 insertion(+), 6 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_select.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.4 
llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.4   Tue Apr 17 
19:53:49 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_select.c   Sat May 12 
13:41:57 2007
@@ -32,12 +32,7 @@
 
   BitType i;
 
-  for (i = bitwidthof(BitType); i  0; --i) {
-if (bit_select(Y, i-1)) 
-  printf(1);
-else
-  printf(0);
-  }
+  printBits(Y);
 
   printf(\n);
   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/SingleSource/UnitTests/Integer/bits.h

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

bits.h updated: 1.5 - 1.6
---
Log message:

Add some types needed by the tests.
Fix the reduce macro to generate the correct builtin name.


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

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


Index: llvm-test/SingleSource/UnitTests/Integer/bits.h
diff -u llvm-test/SingleSource/UnitTests/Integer/bits.h:1.5 
llvm-test/SingleSource/UnitTests/Integer/bits.h:1.6
--- llvm-test/SingleSource/UnitTests/Integer/bits.h:1.5 Tue May  1 21:35:26 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bits.h Sat May 12 13:44:37 2007
@@ -33,11 +33,13 @@
 typedef unsigned int __attribute__((bitwidth(39))) uint39;
 typedef unsigned int __attribute__((bitwidth(47))) uint47;
 typedef unsigned int __attribute__((bitwidth(48))) uint48;
+typedef unsigned int __attribute__((bitwidth(54))) uint54;
 typedef unsigned int __attribute__((bitwidth(60))) uint60;
 typedef unsigned int __attribute__((bitwidth(63))) uint63;
 typedef unsigned int __attribute__((bitwidth(64))) uint64;
 typedef unsigned int __attribute__((bitwidth(65))) uint65;
 typedef unsigned int __attribute__((bitwidth(68))) uint68;
+typedef unsigned int __attribute__((bitwidth(69))) uint69;
 typedef unsigned int __attribute__((bitwidth(128))) uint128;
 
 typedef int __attribute__((bitwidth(9)))  int9;
@@ -46,6 +48,7 @@
 typedef int __attribute__((bitwidth(24))) int24;
 typedef int __attribute__((bitwidth(32))) int32;
 typedef int __attribute__((bitwidth(33))) int33;
+typedef int __attribute__((bitwidth(54))) int54;
 typedef int __attribute__((bitwidth(68))) int68;
 typedef int __attribute__((bitwidth(69))) int69;
 
@@ -93,10 +96,10 @@
   Result; \
 })
 
-#define reduce(how, what) { \
+#define reduce(how, what) ({ \
   typeof(what) what2 = what; \
-  __bulitin_bit_reduce_ ## how(what2); \
-}
+  __builtin_bit_ ## how ## _reduce(what2); \
+})
 
 #define printBits(val) { \
   int bit = bitwidthof(val); \



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/test4.c

2007-05-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

test4.c updated: 1.2 - 1.3
---
Log message:

Clean up this test case.


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

 test4.c |   15 ---
 1 files changed, 12 insertions(+), 3 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/test4.c
diff -u llvm-test/SingleSource/UnitTests/Integer/test4.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/test4.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/test4.c:1.2Sat Apr 21 
12:51:54 2007
+++ llvm-test/SingleSource/UnitTests/Integer/test4.cSat May 12 13:46:55 2007
@@ -4,18 +4,27 @@
 
 int main(int argc, char ** argv)
 {
-  uint68 n;
+  int68 n1;
+  uint68 n2;
   uint63 t1;
   uint3 t2;
   uint128 t3;
   unsigned long long t4;
 
+  printf(concat(i25,i39)=);
   t4 = bit_concat((uint25) -1, (uint39)-1);
   printBits(t4);
   printf(\n);
   
-  n = -1;
-  t3 = bit_concat(n, (uint60)-1);
+  n1 = -1;
+  n2 = -1;
+  printf(n1 = );
+  printBits(n1);
+  printf(\nn2 = );
+  printBits(n2);
+  printf(\n);
+  printf(concat(i68 n2, i60 -1)=);
+  t3 = bit_concat(n2, (uint60)-1);
   printBits(t3);
   printf(\n);
   



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


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

2007-05-12 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target/X86:

X86RegisterInfo.cpp updated: 1.219 - 1.220
X86TargetAsmInfo.cpp updated: 1.41 - 1.42
---
Log message:

More DWARF-related things cleanup:
1. Fix PR1380: http://llvm.org/PR1380 
2. Apply Duncan's patch from PR1410: http://llvm.org/PR1410 
3. Insert workaround for one personality function per module as noted in 
PR1414: http://llvm.org/PR1414 
4. Emit correct debug frames for x86/linux. This partly fixes 
DebugInfo/2006-11-06-StackTrace.cpp: stack trace is 
shown correctly, but arguments for function on top of stack are displayed 
incorrectly.


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

 X86RegisterInfo.cpp  |   17 ++---
 X86TargetAsmInfo.cpp |2 --
 2 files changed, 10 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.219 
llvm/lib/Target/X86/X86RegisterInfo.cpp:1.220
--- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.219   Wed May  2 14:53:33 2007
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp Sat May 12 17:36:25 2007
@@ -1153,11 +1153,6 @@
TargetFrameInfo::StackGrowsUp ?
TAI-getAddressSize() : -TAI-getAddressSize());
 
-// Add return address to move list
-MachineLocation CSDst(StackPtr, stackGrowth);
-MachineLocation CSSrc(getRARegister());
-Moves.push_back(MachineMove(StartLabelId, CSDst, CSSrc));
-
 if (NumBytes) {
   // Show update of SP.
   if (hasFP(MF)) {
@@ -1282,10 +1277,18 @@
 
 void X86RegisterInfo::getInitialFrameState(std::vectorMachineMove Moves)
  const 
{
-  // Initial state of the frame pointer is esp.
+  // Calculate amount of bytes used for return address storing
+  int stackGrowth = (Is64Bit ? -8 : -4);
+
+  // Initial state of the frame pointer is esp+4.
   MachineLocation Dst(MachineLocation::VirtualFP);
-  MachineLocation Src(StackPtr, 0);
+  MachineLocation Src(StackPtr, stackGrowth);
   Moves.push_back(MachineMove(0, Dst, Src));
+
+  // Add return address to move list
+  MachineLocation CSDst(StackPtr, stackGrowth);
+  MachineLocation CSSrc(getRARegister());
+  Moves.push_back(MachineMove(0, CSDst, CSSrc));
 }
 
 unsigned X86RegisterInfo::getEHExceptionRegister() const {


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.41 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.42
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.41   Sat May  5 04:04:50 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppSat May 12 17:36:25 2007
@@ -113,7 +113,6 @@
 AbsoluteDebugSectionOffsets = true;
 AbsoluteEHSectionOffsets = false;
 SupportsDebugInformation = true;
-DwarfRequiresFrameSection = false;
 DwarfAbbrevSection =  \t.section\t.debug_abbrev,\\,@progbits;
 DwarfInfoSection =\t.section\t.debug_info,\\,@progbits;
 DwarfLineSection =\t.section\t.debug_line,\\,@progbits;
@@ -149,7 +148,6 @@
 AbsoluteDebugSectionOffsets = true;
 AbsoluteEHSectionOffsets = false;
 SupportsDebugInformation = true;
-DwarfRequiresFrameSection = false;
 DwarfSectionOffsetDirective = \t.secrel32\t;
 DwarfAbbrevSection =  \t.section\t.debug_abbrev,\dr\;
 DwarfInfoSection =\t.section\t.debug_info,\dr\;



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

2007-05-12 Thread Anton Korobeynikov


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.141 - 1.142
MachineModuleInfo.cpp updated: 1.12 - 1.13
---
Log message:

More DWARF-related things cleanup:
1. Fix PR1380: http://llvm.org/PR1380 
2. Apply Duncan's patch from PR1410: http://llvm.org/PR1410 
3. Insert workaround for one personality function per module as noted in 
PR1414: http://llvm.org/PR1414 
4. Emit correct debug frames for x86/linux. This partly fixes 
DebugInfo/2006-11-06-StackTrace.cpp: stack trace is 
shown correctly, but arguments for function on top of stack are displayed 
incorrectly.


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

 DwarfWriter.cpp   |  111 --
 MachineModuleInfo.cpp |   15 +-
 2 files changed, 75 insertions(+), 51 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.141 
llvm/lib/CodeGen/DwarfWriter.cpp:1.142
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.141  Fri May 11 03:47:35 2007
+++ llvm/lib/CodeGen/DwarfWriter.cppSat May 12 17:36:25 2007
@@ -963,7 +963,7 @@
   /// EmitFrameMoves - Emit frame instructions to describe the layout of the
   /// frame.
   void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
-   std::vectorMachineMove Moves) {
+  const std::vectorMachineMove Moves) {
 int stackGrowth =
 Asm-TM.getFrameInfo()-getStackGrowthDirection() ==
   TargetFrameInfo::StackGrowsUp ?
@@ -971,7 +971,7 @@
 bool IsLocal = BaseLabel  strcmp(BaseLabel, label) == 0;
 
 for (unsigned i = 0, N = Moves.size(); i  N; ++i) {
-  MachineMove Move = Moves[i];
+  const MachineMove Move = Moves[i];
   unsigned LabelID = Move.getLabelID();
   
   if (LabelID) {
@@ -2356,6 +2356,7 @@
 
 std::vectorMachineMove Moves;
 RI-getInitialFrameState(Moves);
+
 EmitFrameMoves(NULL, 0, Moves);
 
 Asm-EmitAlignment(2);
@@ -2379,7 +2380,7 @@
 
 EmitLabel(frame_begin, SubprogramCount);
 
-EmitSectionOffset(frame_common_begin, section_frame, 0, 0, true, 
false);
+EmitSectionOffset(frame_common, section_frame, 0, 0, true, false);
 Asm-EOL(FDE CIE offset);
 
 EmitReference(func_begin, SubprogramCount);
@@ -2716,11 +2717,20 @@
 class DwarfException : public Dwarf  {
 
 private:
+  struct FunctionEHFrameInfo {
+std::string FnName;
+unsigned Number;
+bool hasCalls;
+bool hasLandingPads;
+std::vectorMachineMove Moves;
 
-  /// didInitial - Flag to indicate if initial emission has been done.
-  ///
-  bool didInitial;
-  
+FunctionEHFrameInfo(const std::string FN, unsigned Num, bool hC, bool hL,
+const std::vectorMachineMove M):
+  FnName(FN), Number(Num), hasCalls(hC), hasLandingPads(hL), Moves(M) { };
+  };
+
+  std::vectorFunctionEHFrameInfo EHFrames;
+
   /// shouldEmit - Flag to indicate if debug information should be emitted.
   ///
   bool shouldEmit;
@@ -2728,10 +2738,6 @@
   /// EmitCommonEHFrame - Emit the common eh unwind frame.
   ///
   void EmitCommonEHFrame() {
-// Only do it once.
-if (didInitial) return;
-didInitial = true;
-
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
 Function *Personality = MMI-getPersonality();
@@ -2809,41 +2815,40 @@
 Asm-EOL();
   }
   
-  /// EmitEHFrame - Emit initial exception information.
+  /// EmitEHFrame - Emit function exception frame information.
   ///
-  void EmitEHFrame() {
+  void EmitEHFrame(const FunctionEHFrameInfo EHFrameInfo) {
 // If there is a personality present then we need to indicate that
 // in the common eh frame.
 Function *Personality = MMI-getPersonality();
-MachineFrameInfo *MFI = MF-getFrameInfo();
 
 Asm-SwitchToTextSection(TAI-getDwarfEHFrameSection());
 
 // Externally visible entry into the functions eh frame info.
 if (const char *GlobalDirective = TAI-getGlobalDirective())
-  O  GlobalDirective  getAsm()-CurrentFnName  .eh\n;
+  O  GlobalDirective  EHFrameInfo.FnName  .eh\n;
 
 // If there are no calls then you can't unwind.
-if (!MFI-hasCalls()) { 
-  O  getAsm()-CurrentFnName  .eh = 0\n;
+if (!EHFrameInfo.hasCalls) { 
+  O  EHFrameInfo.FnName  .eh = 0\n;
 } else {
-  O  getAsm()-CurrentFnName  .eh:\n;
+  O  EHFrameInfo.FnName  .eh:\n;
   
   // EH frame header.
-  EmitDifference(eh_frame_end, SubprogramCount,
- eh_frame_begin, SubprogramCount, true);
+  EmitDifference(eh_frame_end, EHFrameInfo.Number,
+ eh_frame_begin, EHFrameInfo.Number, true);
   Asm-EOL(Length of Frame Information Entry);
   
-  EmitLabel(eh_frame_begin, SubprogramCount);
+  EmitLabel(eh_frame_begin, EHFrameInfo.Number);
 
   EmitSectionOffset(eh_frame_begin, section_eh_frame,
-SubprogramCount, 0, true, true);
+

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

2007-05-12 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/CodeGen:

MachineModuleInfo.h updated: 1.12 - 1.13
---
Log message:

More DWARF-related things cleanup:
1. Fix PR1380: http://llvm.org/PR1380 
2. Apply Duncan's patch from PR1410: http://llvm.org/PR1410 
3. Insert workaround for one personality function per module as noted in 
PR1414: http://llvm.org/PR1414 
4. Emit correct debug frames for x86/linux. This partly fixes 
DebugInfo/2006-11-06-StackTrace.cpp: stack trace is 
shown correctly, but arguments for function on top of stack are displayed 
incorrectly.


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

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


Index: llvm/include/llvm/CodeGen/MachineModuleInfo.h
diff -u llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.12 
llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.13
--- llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.12  Thu May 10 17:34:59 2007
+++ llvm/include/llvm/CodeGen/MachineModuleInfo.h   Sat May 12 17:36:25 2007
@@ -1020,6 +1020,7 @@
   //
   std::vectorGlobalVariable * TypeInfos;
 
+  Function *Personality;
 public:
   static char ID; // Pass identification, replacement for typeid
 



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


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

2007-05-12 Thread Chris Lattner


Changes in directory llvm/docs:

BitCodeFormat.html updated: 1.6 - 1.7
---
Log message:

finish the description of the bitstream format.


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

 BitCodeFormat.html |   93 ++---
 1 files changed, 89 insertions(+), 4 deletions(-)


Index: llvm/docs/BitCodeFormat.html
diff -u llvm/docs/BitCodeFormat.html:1.6 llvm/docs/BitCodeFormat.html:1.7
--- llvm/docs/BitCodeFormat.html:1.6Sat May 12 03:01:52 2007
+++ llvm/docs/BitCodeFormat.htmlSat May 12 19:59:52 2007
@@ -19,6 +19,7 @@
 lia href=#blocksBlocks/a/li
 lia href=#datarecordData Records/a/li
 lia href=#abbreviationsAbbreviations/a/li
+lia href=#stdblocksStandard Blocks/a/li
 /ol
   /li
   lia href=#llvmirLLVM IR Encoding/a/li
@@ -403,16 +404,100 @@
 is always a single specific value.  This specific value is emitted as a vbr8
 after the bit indicating that it is a literal operand./li
 liEncoding info without data - tt[0sub1/sub, encodingsub3/sub]/tt
- - blah
+ - Operand encodings that do not have extra data are just emitted as their 
code.
 /li
 liEncoding info with data - tt[0sub1/sub, encodingsub3/sub, 
-valuesubvbr5/sub]/tt -
-
+valuesubvbr5/sub]/tt - Operand encodings that do have extra data are
+emitted as their code, followed by the extra data.
 /li
 /ol
 
+pThe possible operand encodings are:/p
+
+ul
+li1 - Fixed - The field should be emitted as a a 
+href=#fixedwidthfixed-width value/a, whose width
+is specified by the encoding operand./li
+li2 - VBR - The field should be emitted as a a 
+href=#variablewidthvariable-width value/a, whose width
+is specified by the encoding operand./li
+li3 - Array - This field is an array of values.  The element type of the 
array
+is specified by the next encoding operand./li
+li4 - Char6 - This field should be emitted as a a 
href=#char6char6-encoded
+value/a./li
+/ul
+
+pFor example, target triples in LLVM modules are encoded as a record of the
+form tt[TRIPLE, 'a', 'b', 'c', 'd']/tt.  Consider if the bitstream emitted
+the following abbrev entry:/p
+
+ul
+litt[0, Fixed, 4]/tt/li
+litt[0, Array]/tt/li
+litt[0, Char6]/tt/li
+/ul
+
+pWhen emitting a record with this abbreviation, the above entry would be
+emitted as:/p
+
+ptt[4subabbrevwidth/sub, 2sub4/sub, 4subvbr6/sub,
+   0sub6/sub, 1sub6/sub, 2sub6/sub, 3sub6/sub]/tt/p
+
+pThese values are:/p
+
+ol
+liThe first value, 4, is the abbreviation ID for this abbreviation./li
+liThe second value, 2, is the code for TRIPLE in LLVM IR files./li
+liThe third value, 4, is the length of the array./li
+liThe rest of the values are the char6 encoded values for abcd./li
+/ol
+
+pWith this abbreviation, the triple is emitted with only 37 bits (assuming a
+abbrev id width of 3).  Without the abbreviation, significantly more space 
would
+be required to emit the target triple.  Also, since the TRIPLE value is not
+emitted as a literal in the abbreviation, the abbreviation can also be used for
+any other string value.
+/p
+
+/div
+
+!-- === 
--
+div class=doc_subsectiona name=stdblocksStandard Blocks/a
+/div
+
+div class=doc_text
+
+p
+In addition to the basic block structure and record encodings, the bitstream
+also defines specific builtin block types.  These block types specify how the
+stream is to be decoded or other metadata.  In the future, new standard blocks
+may be added.
+/p
+
 /div
 
+!-- ___ 
--
+div class=doc_subsubsectiona name=BLOCKINFO#0 - BLOCKINFO
+Block/a/div
+
+div class=doc_text
+
+pThe BLOCKINFO block allows the description of metadata for other blocks.  
The
+  currently specified records are:/p
+ 
+ul
+litt[SETBID (#1), blockid]/tt/li
+litt[DEFINE_ABBREV, ...]/tt/li
+/ul
+
+p
+The SETBID record indicates which block ID is being described.  The standard
+DEFINE_ABBREV record specifies an abbreviation.  The abbreviation is associated
+with the record ID, and any records with matching ID automatically get the
+abbreviation. 
+/p
+
+/div
 
 !-- *** 
--
 div class=doc_section a name=llvmirLLVM IR Encoding/a/div
@@ -433,7 +518,7 @@
  src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
  a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
 a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-Last modified: $Date: 2007/05/12 08:01:52 $
+Last modified: $Date: 2007/05/13 00:59:52 $
 /address
 /body
 /html



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


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

2007-05-12 Thread Chris Lattner


Changes in directory llvm/docs:

BitCodeFormat.html updated: 1.7 - 1.8
---
Log message:

add initial description of llvm top-level stuff.


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

 BitCodeFormat.html |   98 ++---
 1 files changed, 94 insertions(+), 4 deletions(-)


Index: llvm/docs/BitCodeFormat.html
diff -u llvm/docs/BitCodeFormat.html:1.7 llvm/docs/BitCodeFormat.html:1.8
--- llvm/docs/BitCodeFormat.html:1.7Sat May 12 19:59:52 2007
+++ llvm/docs/BitCodeFormat.htmlSat May 12 20:39:44 2007
@@ -22,7 +22,11 @@
 lia href=#stdblocksStandard Blocks/a/li
 /ol
   /li
-  lia href=#llvmirLLVM IR Encoding/a/li
+  lia href=#llvmirLLVM IR Encoding/a
+ol
+lia href=#basicsBasics/a/li
+/ol
+  /li
 /ol
 div class=doc_author
   pWritten by a href=mailto:[EMAIL PROTECTED]Chris Lattner/a.
@@ -114,7 +118,8 @@
 
 p
 A bitstream literally consists of a stream of bits.  This stream is made up of 
a
-number of primitive values that encode a stream of integer values.  These
+number of primitive values that encode a stream of unsigned integer values.
+These
 integers are are encoded in two ways: either as a href=#fixedwidthFixed
 Width Integers/a or as a href=#variablewidthVariable Width
 Integers/a.
@@ -505,7 +510,92 @@
 
 div class=doc_text
 
-p/p
+pLLVM IR is encoded into a bitstream by defining blocks and records.  It uses
+blocks for things like constant pools, functions, symbol tables, etc.  It uses
+records for things like instructions, global variable descriptors, type
+descriptions, etc.  This document does not describe the set of abbreviations
+that the writer uses, as these are fully self-described in the file, and the
+reader is not allowed to build in any knowledge of this./p
+
+/div
+
+!-- === 
--
+div class=doc_subsectiona name=basicsBasics/a
+/div
+
+!-- ___ 
--
+div class=doc_subsubsectiona name=ir_magicLLVM IR Magic 
Number/a/div
+
+div class=doc_text
+
+p
+The magic number for LLVM IR files is:
+/p
+
+ptt['B'sub8/sub, 'C'sub8/sub, 0x0sub4/sub, 0xCsub4/sub,
+0xEsub4/sub, 0xDsub4/sub]/tt/p
+
+pWhen viewed as bytes, this is BC 0xC0DE./p
+
+/div
+
+!-- ___ 
--
+div class=doc_subsubsectiona name=ir_signed_vbrSigned VBRs/a/div
+
+div class=doc_text
+
+p
+a href=#variablewidthVariable Width Integers/a are an efficient way to
+encode arbitrary sized unsigned values, but is an extremely inefficient way to
+encode signed values (as signed values are otherwise treated as maximally large
+unsigned values)./p
+
+pAs such, signed vbr values of a specific width are emitted as follows:/p
+
+ul
+liPositive values are emitted as vbrs of the specified width, but with their
+value shifted left by one./li
+liNegative values are emitted as vbrs of the specified width, but the negated
+value is shifted left by one, and the low bit is set./li
+/ul
+
+pWith this encoding, small positive and small negative values can both be
+emitted efficiently./p
+
+/div
+
+
+!-- ___ 
--
+div class=doc_subsubsectiona name=ir_blocksLLVM IR Blocks/a/div
+
+div class=doc_text
+
+p
+LLVM IR is defined with the following blocks:
+/p
+
+ul
+li8  - MODULE_BLOCK - This is the top-level block that contains the
+entire module, and describes a variety of per-module information./li
+li9  - PARAMATTR_BLOCK - This enumerates the parameter attributes./li
+li10 - TYPE_BLOCK - This describes all of the types in the module./li
+li11 - CONSTANTS_BLOCK - This describes constants for a module or
+function./li
+li12 - FUNCTION_BLOCK - This describes a function body./li
+li13 - TYPE_SYMTAB_BLOCK - This describes the type symbol table./li
+li14 - VALUE_SYMTAB_BLOCK - This describes a value symbol table./li
+/ul
+
+/div
+
+!-- === 
--
+div class=doc_subsectiona name=MODULE_BLOCKMODULE_BLOCK Contents/a
+/div
+
+div class=doc_text
+
+p
+/p
 
 /div
 
@@ -518,7 +608,7 @@
  src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
  a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
 a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-Last modified: $Date: 2007/05/13 00:59:52 $
+Last modified: $Date: 2007/05/13 01:39:44 $
 /address
 /body
 /html



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