[llvm-commits] CVS: llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp BinInterface.h bitmath.h test1.cpp sparcdis.cpp sparcdis.h

Misha Brukman brukman at neo.cs.uiuc.edu
Wed Nov 13 14:16:01 PST 2002


Changes in directory llvm/lib/Reoptimizer/BinInterface:

BinInterface.cpp updated: 1.1 -> 1.2
BinInterface.h updated: 1.1 -> 1.2
bitmath.h updated: 1.1 -> 1.2
test1.cpp updated: 1.1 -> 1.2
sparcdis.cpp updated: 1.2 -> 1.3
sparcdis.h updated: 1.1 -> 1.2

---
Log message:

* Fixed comment headers
* Re-aligned, wrapped code
* Changed Windows end-of-line to Unix style
* Stopped including sparc9.hp in favor of sparc9.h


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp
diff -u llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp:1.1 llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp:1.2
--- llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp:1.1	Fri Nov  8 04:38:13 2002
+++ llvm/lib/Reoptimizer/BinInterface/BinInterface.cpp	Wed Nov 13 14:17:52 2002
@@ -8,14 +8,14 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include "salloc.h"
 #include "fvector.h"
 #include "analyze.h"
 #include "BinInterface.h"
 #include "machine.h"
 #include "sparcdis.h"
-#include "sparc9.hp"
-#include <assert.h>
+#include "sparc9.h"
 
 // 512kb initial size
 #define BIN_INIT_HEAP_SIZE 0x80000
@@ -23,141 +23,141 @@
 
 void BinInterface::process_branch(const insertion & i, unsigned ** brdest, int scns)
 {
-    unsigned cid = i.idstart;
-    unsigned *ibegin = i.begin;
-    unsigned *iend   = i.end;
-    unsigned tail    = sections[i.section];
+  unsigned cid = i.idstart;
+  unsigned *ibegin = i.begin;
+  unsigned *iend   = i.end;
+  unsigned tail    = sections[i.section];
 
     
-    while(ibegin!=iend)
-    {
-        // look at the instruction
-        unsigned flags = sparc_analyze(*ibegin);
-        unsigned * instr;
+  while(ibegin!=iend)
+  {
+    // look at the instruction
+    unsigned flags = sparc_analyze(*ibegin);
+    unsigned * instr;
 
-        if (flags & IF_BR)
-        {
+    if (flags & IF_BR)
+    {
 
-			int fwd = SIGN_EXTEND(RD_FLD(*ibegin,INSTR_DISP22),22);
-			unsigned * dest = ibegin + fwd;
+      int fwd = SIGN_EXTEND(RD_FLD(*ibegin,INSTR_DISP22),22);
+      unsigned * dest = ibegin + fwd;
 
-            // create a branch instruction
-            instr          = (unsigned *)alloca.alloc(SIZE_BRANCH * sizeof(unsigned));
-            instr[I_FLAGS] = flags;
-
-            instr[I_BRDEST] = 0;
-            // scan for branch destination
-            for (int l = 0; l<scns; l++)
-            {
-                if (dest == brdest[l])
-                {
-                    instr[I_BRDEST] = begin(l);
-                    break;
-                }         
-            }
-
-       //     assert(instr[I_BRDEST]!=0); // cannot loop back to prolog
-        }
-        else
+      // create a branch instruction
+      instr          = (unsigned *)alloca.alloc(SIZE_BRANCH * sizeof(unsigned));
+      instr[I_FLAGS] = flags;
+
+      instr[I_BRDEST] = 0;
+      // scan for branch destination
+      for (int l = 0; l<scns; l++)
+      {
+        if (dest == brdest[l])
         {
-            // create a generic ALU instruction
-            instr          = (unsigned *)alloca.alloc(SIZE_ALUOP * sizeof(unsigned));
-            instr[I_FLAGS] = flags;
-        }
+          instr[I_BRDEST] = begin(l);
+          break;
+        }         
+      }
+
+      //     assert(instr[I_BRDEST]!=0); // cannot loop back to prolog
+    }
+    else
+    {
+      // create a generic ALU instruction
+      instr          = (unsigned *)alloca.alloc(SIZE_ALUOP * sizeof(unsigned));
+      instr[I_FLAGS] = flags;
+    }
         
-        instr[I_INSTR] = *ibegin;
-        instr[I_SELF]  = cid;
+    instr[I_INSTR] = *ibegin;
+    instr[I_SELF]  = cid;
         
-        itable[cid]  = instr;
+    itable[cid]  = instr;
 
-        insert_instr(tail, instr);
-        tail = cid;
+    insert_instr(tail, instr);
+    tail = cid;
 
-        cid++;
-        ibegin++;
+    cid++;
+    ibegin++;
   
-    }
+  }
     
 }
 
 void BinInterface::reduce()
 {
-    assert(sections.size() <= MAX_SECTIONS);
-    // Compute  branch destination table by section
-    unsigned * brdest[MAX_SECTIONS];
+  assert(sections.size() <= MAX_SECTIONS);
+  // Compute  branch destination table by section
+  unsigned * brdest[MAX_SECTIONS];
     
-    for (int p = 0; p<MAX_SECTIONS; p++)
-        brdest[p] = NULL;
+  for (int p = 0; p<MAX_SECTIONS; p++)
+    brdest[p] = NULL;
 
-    for (int p = 0; p<queue.size(); p++)
-        if (!brdest[queue[p].section])
-            brdest[queue[p].section] = queue[p].begin;
+  for (int p = 0; p<queue.size(); p++)
+    if (!brdest[queue[p].section])
+      brdest[queue[p].section] = queue[p].begin;
 
-    // Complete delayed insertion
-    for (int p = 0; p<queue.size(); p++)
-        process_branch(queue[p], brdest,sections.size());
+  // Complete delayed insertion
+  for (int p = 0; p<queue.size(); p++)
+    process_branch(queue[p], brdest,sections.size());
 
-    // Instructions are internalized
-    queue.clear();
+  // Instructions are internalized
+  queue.clear();
 
-    // perform PHI node and dataflow analysis
+  // perform PHI node and dataflow analysis
 
 }
 
 void BinInterface::print(unsigned section)
 {
-    unsigned u = begin(section);
+  unsigned u = begin(section);
 
-    while (u!=end(section))
-    {
-        unsigned * instr = itable[u];
+  while (u!=end(section))
+  {
+    unsigned * instr = itable[u];
 
-		printf("%02d: ", instr[I_SELF]);
+    printf("%02d: ", instr[I_SELF]);
 		
-		if (instr[I_FLAGS] & IF_PHI)
-		{
-			//printf(" PHI{prolog=%02d, trace=%02d}\n", instr->phi.src_prolog, instr->phi.src_trace);
-            printf("PHI NODE\n");
-            u = next(u); 
-			continue;
-		}
+    if (instr[I_FLAGS] & IF_PHI)
+    {
+      //printf(" PHI{prolog=%02d, trace=%02d}\n", instr->phi.src_prolog, instr->phi.src_trace);
+      printf("PHI NODE\n");
+      u = next(u); 
+      continue;
+    }
 		
-		if (instr[I_FLAGS] & IF_BR)
-		{
-			//if (instr[I_FLAGS] & INTERNAL_BR)
-				printf("{%02d} ", instr[I_BRDEST]);
-			//else
-			//	printf("     ");	
-			printf("     ");	
-		}
-		else
-		{
-			if (instr[I_FLAGS] & IF_RS1)
-				printf("A=%02d ", instr[I_GENRS1]);
-			else
-				printf("     ");
+    if (instr[I_FLAGS] & IF_BR)
+    {
+      //if (instr[I_FLAGS] & INTERNAL_BR)
+      printf("{%02d} ", instr[I_BRDEST]);
+      //else
+      //	printf("     ");	
+      printf("     ");	
+    }
+    else
+    {
+      if (instr[I_FLAGS] & IF_RS1)
+        printf("A=%02d ", instr[I_GENRS1]);
+      else
+        printf("     ");
 			
-			if (instr[I_FLAGS] & IF_RS2)
-				printf("B=%02d ", instr[I_GENRS2]);
-			else
-				printf("     ");
-		}
-		sparc_print(instr[I_INSTR]);
+      if (instr[I_FLAGS] & IF_RS2)
+        printf("B=%02d ", instr[I_GENRS2]);
+      else
+        printf("     ");
+    }
+    sparc_print(instr[I_INSTR]);
 
 
-		printf("\n");
+    printf("\n");
 
-        u = next(u);    
-    }
+    u = next(u);    
+  }
 }
 
 void BinInterface::print()
 {
-	for (int p = 0; p< sections.size(); p++)
-    {
-        printf("Section %d\n",p);
-        print(p);
-    }
+  for (int p = 0; p< sections.size(); p++)
+  {
+    printf("Section %d\n",p);
+    print(p);
+  }
 }
 
 
@@ -165,23 +165,23 @@
 
 unsigned    BinInterface::newepilog()
 {
-    unsigned v = sections.size();
-    push_section();
-    return v;
+  unsigned v = sections.size();
+  push_section();
+  return v;
 }
 
 
 
 void BinInterface::insert_instr(unsigned instr_id, unsigned * instr)
 {
-    unsigned a = instr_id;
-    unsigned c = itable[a][I_NEXT];
+  unsigned a = instr_id;
+  unsigned c = itable[a][I_NEXT];
    
-    itable[a][I_NEXT] = instr[I_SELF];
-    instr[I_PREV]     = a;
+  itable[a][I_NEXT] = instr[I_SELF];
+  instr[I_PREV]     = a;
     
-    instr[I_NEXT]     = c;
-    itable[c][I_PREV] = instr[I_SELF];
+  instr[I_NEXT]     = c;
+  itable[c][I_PREV] = instr[I_SELF];
 }
 
 //
@@ -191,48 +191,48 @@
 //   AFTER  INSTR        AFTER->NEXT
 void BinInterface::push_section() 
 {
-    // create header node   
-    unsigned * instr = (unsigned *)alloca.alloc(SIZE_HEADER * sizeof(unsigned));
-    instr[I_NEXT]  = itable.size();
-    instr[I_PREV]  = itable.size();
-    instr[I_FLAGS] = 0;
-    instr[I_SELF]  = itable.size();
+  // create header node   
+  unsigned * instr = (unsigned *)alloca.alloc(SIZE_HEADER * sizeof(unsigned));
+  instr[I_NEXT]  = itable.size();
+  instr[I_PREV]  = itable.size();
+  instr[I_FLAGS] = 0;
+  instr[I_SELF]  = itable.size();
 
-    sections.push_back(itable.size());
-    itable.push_back(instr);  
+  sections.push_back(itable.size());
+  itable.push_back(instr);  
     
 }
 
 unsigned BinInterface::insert(unsigned section, unsigned *ibegin, unsigned * iend) {
-    insertion i;
-    i.begin   = ibegin;
-    i.end     = iend;
-    i.section = section;
-    i.idstart = itable.size();
+  insertion i;
+  i.begin   = ibegin;
+  i.end     = iend;
+  i.section = section;
+  i.idstart = itable.size();
 
-    itable.inc(iend - ibegin);
-    queue.push_back(i);
+  itable.inc(iend - ibegin);
+  queue.push_back(i);
 
-    return i.idstart;
+  return i.idstart;
 }
 
 BinInterface::BinInterface(unsigned instr_count) 
-      : alloca(BIN_INIT_HEAP_SIZE + instr_count * 16) , itable(&alloca), sections(&alloca),
-        queue(&alloca)
+  : alloca(BIN_INIT_HEAP_SIZE + instr_count * 16) , itable(&alloca), sections(&alloca),
+    queue(&alloca)
 {
-    // create prolog and trace link nodes
-    push_section();
-    push_section();   
+  // create prolog and trace link nodes
+  push_section();
+  push_section();   
 }
 
 void  BinInterface::clear()
 {
-    itable.clear();
-    sections.clear();
-    queue.clear();
-    alloca.clear();
-    // create prolog and trace link nodes
-    push_section();
-    push_section();  
+  itable.clear();
+  sections.clear();
+  queue.clear();
+  alloca.clear();
+  // create prolog and trace link nodes
+  push_section();
+  push_section();  
 }
 


Index: llvm/lib/Reoptimizer/BinInterface/BinInterface.h
diff -u llvm/lib/Reoptimizer/BinInterface/BinInterface.h:1.1 llvm/lib/Reoptimizer/BinInterface/BinInterface.h:1.2
--- llvm/lib/Reoptimizer/BinInterface/BinInterface.h:1.1	Fri Nov  8 04:38:13 2002
+++ llvm/lib/Reoptimizer/BinInterface/BinInterface.h	Wed Nov 13 14:17:52 2002
@@ -55,77 +55,77 @@
 
 class BinInterface
 {
-private:
+ private:
 
-    StackAllocator      alloca;   // primary stack allocator
-    fvector<unsigned *> itable;   // maps an unsigned ID
-                                  // to an instruction  
+  StackAllocator      alloca;   // primary stack allocator
+  fvector<unsigned *> itable;   // maps an unsigned ID
+  // to an instruction  
 
-    fvector<unsigned> sections; 
+  fvector<unsigned> sections; 
 
-    // make SURE instr has already has its SELF index
-    // assigned!
-    void insert_instr(unsigned instr_id, unsigned * instr);
-    void push_section();
+  // make SURE instr has already has its SELF index
+  // assigned!
+  void insert_instr(unsigned instr_id, unsigned * instr);
+  void push_section();
 
 
-    // insertions are delayed to facilitate branch analysis
+  // insertions are delayed to facilitate branch analysis
 
-    struct insertion
-    {
-        unsigned * begin;
-        unsigned * end;
-        unsigned   section;
-        unsigned   idstart;
-    };
+  struct insertion
+  {
+    unsigned * begin;
+    unsigned * end;
+    unsigned   section;
+    unsigned   idstart;
+  };
 
-    void process_branch(const insertion & i, unsigned ** brdest, int scns);
+  void process_branch(const insertion & i, unsigned ** brdest, int scns);
 
-    fvector<insertion> queue;
+  fvector<insertion> queue;
     
 
-public:
+ public:
 
-    const static unsigned SECTION_PROLOG =0;
-    const static unsigned SECTION_TRACE  =1;
+  const static unsigned SECTION_PROLOG =0;
+  const static unsigned SECTION_TRACE  =1;
 
-    // create a new section and get back ID  
-    unsigned    newepilog();
+  // create a new section and get back ID  
+  unsigned    newepilog();
 
-    // switch to section (for insertion)
-    unsigned insert(unsigned section, unsigned *ibegin, unsigned * iend);
-
-    unsigned begin(unsigned sectionid) { return (itable[sections[sectionid]])[I_NEXT]; }
-    unsigned end  (unsigned sectionid) { return sections[sectionid]; }
-
-    // iterator over instructions
-    unsigned next(unsigned t) { return (itable[t])[I_NEXT]; }
-    unsigned prev(unsigned t) { return (itable[t])[I_PREV]; }
-
-    void        remove(unsigned);
-    void        move(unsigned first, unsigned last, unsigned after_this);
-    void        swap(unsigned a, unsigned b);
-    unsigned    getopcode(unsigned);
-    unsigned getrs1(unsigned);
-    unsigned getrs2(unsigned);
-    unsigned getcc0(unsigned);
+  // switch to section (for insertion)
+  unsigned insert(unsigned section, unsigned *ibegin, unsigned * iend);
+
+  unsigned begin(unsigned sectionid) { return (itable[sections[sectionid]])[I_NEXT]; }
+  unsigned end  (unsigned sectionid) { return sections[sectionid]; }
+
+  // iterator over instructions
+  unsigned next(unsigned t) { return (itable[t])[I_NEXT]; }
+  unsigned prev(unsigned t) { return (itable[t])[I_PREV]; }
+
+  void        remove(unsigned);
+  void        move(unsigned first, unsigned last, unsigned after_this);
+  void        swap(unsigned a, unsigned b);
+  unsigned    getopcode(unsigned);
+  unsigned getrs1(unsigned);
+  unsigned getrs2(unsigned);
+  unsigned getcc0(unsigned);
     
-    // use 'move' to place these instructions into the stream
-    unsigned newbranch(unsigned op, unsigned dest);
-    unsigned newalu   (unsigned op, unsigned rs1, unsigned rs2);
-    unsigned newalucc (unsigned op, unsigned rs1, unsigned rs2, unsigned cc0);
-
-    void        reduce();
-    void        select();
-    unsigned    predict();
-    void        emit(unsigned char * out);
-    void        print();
-    void        print(unsigned scn);
+  // use 'move' to place these instructions into the stream
+  unsigned newbranch(unsigned op, unsigned dest);
+  unsigned newalu   (unsigned op, unsigned rs1, unsigned rs2);
+  unsigned newalucc (unsigned op, unsigned rs1, unsigned rs2, unsigned cc0);
+
+  void        reduce();
+  void        select();
+  unsigned    predict();
+  void        emit(unsigned char * out);
+  void        print();
+  void        print(unsigned scn);
 
-    void        clear();
+  void        clear();
 
 
-    BinInterface(unsigned instr_count);
+  BinInterface(unsigned instr_count);
 
 };
-#endif
\ No newline at end of file
+#endif


Index: llvm/lib/Reoptimizer/BinInterface/bitmath.h
diff -u llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.1 llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.2
--- llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.1	Fri Nov  8 04:38:13 2002
+++ llvm/lib/Reoptimizer/BinInterface/bitmath.h	Wed Nov 13 14:17:52 2002
@@ -1,97 +1,94 @@
-//*****************************************************************************
-//
-//			   High Performance Bit Utility Functions
+//===-----------------------------------------------------------*- C++ -*--===//
+//             High Performance Bit Utility Functions
 //
 //
 // 2002 Cameron Buschardt
-//*****************************************************************************
+//===----------------------------------------------------------------------===//
+
+#ifndef __BITMATH_H__
+#define __BITMATH_H__
+              
+#define IS_POWER_2(x)    !(x & (x-1))
+#define LOWEST_BIT(x)    x & ~(x & (x-1))
+#define UPPER_BITS(x)    (x & (x-1))
+
+// Good if expected number of bits set < 4
+inline static int countbits_sparse(unsigned m)          //VALIDATED
+{
+  int c = 0;
+  while (m)
+  {
+    c++;
+    m = UPPER_BITS(m);
+  }
+  return c;
+}
+
+// base 2 sum of digits
+inline static int countbits_dense(unsigned w)           //VALIDATED
+{
+  w = (0x55555555 & w) + (0x55555555 & (w >> 1));
+  w = (0x33333333 & w) + (0x33333333 & (w >> 2));
+  w = (w + (w>>4)) & 0x0f0f0f0f;
+  w = w + (w>>16);
+  w = w + (w>>8);
+  return w&0xFF;
+}
+
+inline static bool ismod3(unsigned w)                   //VALIDATED
+{
+  w = (w >> 16) + (w&0xFFFF);
+  w = (w >> 8)  + (w&0xFF);
+  w = (w >> 4)  + (w&0xF);
+  w = (w >> 2)  + (w&0x3);
+  return (0xB6DB6DB6 >> w) & 1;
+}
+
+
+inline static int mod3(unsigned w)                      //VALIDATED
+{
+  w = (w >> 16) + (w&0xFFFF);
+  w = (w >> 8)  + (w&0xFF);
+  w = (w >> 4)  + (w&0xF);
+  w = (w >> 2)  + (w&0x3);
+  //use lookuptable
+  return (0x24924924 >> (w<<1)) & 3;
+}
+
+
+inline static int parity(unsigned w)                    //VALIDATED
+{
+  w = w >> 16;
+  w = w >> 8;
+  w = w >> 4;
+  w = w >> 2;
+  w = w >> 1;
+  return w & 1;
+}
+
+
+inline static int log2(unsigned w)                      //VALIDATED
+{
+  int n = 0;
+
+  if (w >> 16) 
+  {
+    w >>= 16;
+    n+=16;
+  }
+  if (w >> 8) 
+  {
+    w >>= 8;
+    n+=8;
+  }
+  if (w >> 4) 
+  {
+    w >>= 4;
+    n+=4;
+  }
+
+  w <<= 1;
+  return ((0xFFFFAA50 >> w) & 3)+n;
+}
 
-#ifndef __BITMATH_H__
-#define __BITMATH_H__
-              
-#define IS_POWER_2(x)    !(x & (x-1))
-#define LOWEST_BIT(x)    x & ~(x & (x-1))
-#define UPPER_BITS(x)    (x & (x-1))
-
-// Good if expected number of bits set < 4
-static int __forceinline countbits_sparse(unsigned m)          //VALIDATED
-{
-	int c = 0;
-	while (m)
-	{
-		c++;
-		m = UPPER_BITS(m);
-	}
-	return c;
-}
-
-// base 2 sum of digits
-static int __forceinline countbits_dense(unsigned w)           //VALIDATED
-{
-	w = (0x55555555 & w) + (0x55555555 & (w >> 1));
-	w = (0x33333333 & w) + (0x33333333 & (w >> 2));
-	w = (w + (w>>4)) & 0x0f0f0f0f;
-	w = w + (w>>16);
-	w = w + (w>>8);
-	return w&0xFF;
-}
-
-static bool __forceinline ismod3(unsigned w)                   //VALIDATED
-{
-	w = (w >> 16) + (w&0xFFFF);
-	w = (w >> 8)  + (w&0xFF);
-	w = (w >> 4)  + (w&0xF);
-	w = (w >> 2)  + (w&0x3);
-	return (0xB6DB6DB6 >> w) & 1;
-}
-
-
-static int __forceinline mod3(unsigned w)                      //VALIDATED
-{
-	w = (w >> 16) + (w&0xFFFF);
-	w = (w >> 8)  + (w&0xFF);
-	w = (w >> 4)  + (w&0xF);
-	w = (w >> 2)  + (w&0x3);
-	//use lookuptable
-	return (0x24924924 >> (w<<1)) & 3;
-}
-
-
-static int __forceinline parity(unsigned w)                    //VALIDATED
-{
-	w = w >> 16;
-	w = w >> 8;
-	w = w >> 4;
-	w = w >> 2;
-	w = w >> 1;
-	return w & 1;
-}
-
-
-static int __forceinline log2(unsigned w)                      //VALIDATED
-{
-	int n = 0;
-
-	if (w >> 16) 
-	{
-		w >>= 16;
-		n+=16;
-	}
-	if (w >> 8) 
-	{
-		w >>= 8;
-		n+=8;
-	}
-	if (w >> 4) 
-	{
-		w >>= 4;
-		n+=4;
-	}
-
-	w <<= 1;
-	return ((0xFFFFAA50 >> w) & 3)+n;
-}
-
-
-
-#endif
\ No newline at end of file
+#endif


Index: llvm/lib/Reoptimizer/BinInterface/test1.cpp
diff -u llvm/lib/Reoptimizer/BinInterface/test1.cpp:1.1 llvm/lib/Reoptimizer/BinInterface/test1.cpp:1.2
--- llvm/lib/Reoptimizer/BinInterface/test1.cpp:1.1	Fri Nov  8 04:38:14 2002
+++ llvm/lib/Reoptimizer/BinInterface/test1.cpp	Wed Nov 13 14:17:52 2002
@@ -1,69 +1,57 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include "sparc9.hp"
+#include <assert.h>
+#include <windows.h>
+#include <vector>
+#include "sparc9.h"
 #include "analyze.h"
 #include "sparcdis.h"
-#include <assert.h>
-
-#include <windows.h>
-#include <vector>
-using std::vector;
-
+#include "BinInterface.h"
+using std::vector;
 
 // cache line is 2^4 bytes
 #define MSA_CACHE_LINE 4
 
-
-#include "BinInterface.h"
-
-
 //*********************************
 //       Fast Vector Class
 //*********************************
 
-
-
-
-
-
-
 unsigned ex1[] = {0x853A2001, 0x92120009, 0x8528A00C, 0x900A0002, 0x81C3E008};
-
-
 unsigned ex1_prolog[] = {0x86100008};
 unsigned ex1_trace[] = {0x8400FFFF, 0x8688C002, 0x12BFFFFE, 0x92026001};
 unsigned ex1_epilog[] = {0x81C3E008};
 
 #define arrsize(x) (sizeof(x) / sizeof(*x))
 
-
 void main()
 {
-	BinInterface bin(1024);
+  BinInterface bin(1024);
 
-    unsigned __int64 s,e,f;
-    QueryPerformanceCounter((LARGE_INTEGER *)&s);
+  unsigned __int64 s,e,f;
+  QueryPerformanceCounter((LARGE_INTEGER *)&s);
     
-    for (int l = 0; l<1024;l++)
-    {
-        bin.clear();
-        unsigned epilog = bin.newepilog(); 
-        bin.insert(BinInterface::SECTION_PROLOG,ex1_prolog, ex1_prolog + arrsize(ex1_prolog));
-	    bin.insert(BinInterface::SECTION_TRACE,ex1_trace, ex1_trace + arrsize(ex1_trace));
-	    bin.insert(epilog,ex1_epilog, ex1_epilog + arrsize(ex1_epilog));
-        bin.reduce();
-    }
-    QueryPerformanceCounter((LARGE_INTEGER *)&e);
-    QueryPerformanceFrequency((LARGE_INTEGER *)&f);
-
-    e-=s;
-    e*=1000000000;
-    e/=f;
-
-    double nsi = e;
-    nsi/=1024;
-    printf("Executed in %gns per iteration.\n", nsi);
-
-	bin.print();
-	getchar();
-}	
+  for (int l = 0; l<1024;l++)
+  {
+    bin.clear();
+    unsigned epilog = bin.newepilog(); 
+    bin.insert(BinInterface::SECTION_PROLOG, ex1_prolog,
+               ex1_prolog + arrsize(ex1_prolog));
+    bin.insert(BinInterface::SECTION_TRACE, ex1_trace,
+               ex1_trace + arrsize(ex1_trace));
+    bin.insert(epilog,ex1_epilog, ex1_epilog + arrsize(ex1_epilog));
+    bin.reduce();
+  }
+  QueryPerformanceCounter((LARGE_INTEGER *)&e);
+  QueryPerformanceFrequency((LARGE_INTEGER *)&f);
+
+  e-=s;
+  e*=1000000000;
+  e/=f;
+
+  double nsi = e;
+  nsi/=1024;
+  printf("Executed in %gns per iteration.\n", nsi);
+
+  bin.print();
+  getchar();
+} 


Index: llvm/lib/Reoptimizer/BinInterface/sparcdis.cpp
diff -u llvm/lib/Reoptimizer/BinInterface/sparcdis.cpp:1.2 llvm/lib/Reoptimizer/BinInterface/sparcdis.cpp:1.3
--- llvm/lib/Reoptimizer/BinInterface/sparcdis.cpp:1.2	Tue Nov 12 20:47:14 2002
+++ llvm/lib/Reoptimizer/BinInterface/sparcdis.cpp	Wed Nov 13 14:17:52 2002
@@ -1,14 +1,12 @@
 //===-----------------------------------------------------------*- C++ -*--===//
 //                          SPARC Disassembler
 //
-//  
 //
 // 2002 Cameron Buschardt
 //===----------------------------------------------------------------------===//
 
 #include <stdio.h>
 #include <stdlib.h>
-
 #include "sparc9.h"
 
 void sparc_printbr(unsigned instr)


Index: llvm/lib/Reoptimizer/BinInterface/sparcdis.h
diff -u llvm/lib/Reoptimizer/BinInterface/sparcdis.h:1.1 llvm/lib/Reoptimizer/BinInterface/sparcdis.h:1.2
--- llvm/lib/Reoptimizer/BinInterface/sparcdis.h:1.1	Fri Nov  8 04:38:14 2002
+++ llvm/lib/Reoptimizer/BinInterface/sparcdis.h	Wed Nov 13 14:17:52 2002
@@ -1,2 +1 @@
-void sparc_print(unsigned instr);
-
+void sparc_print(unsigned instr);





More information about the llvm-commits mailing list