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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/tools/gccas:

gccas.sh updated: 1.2 - 1.3
---
Log message:

Write the deprecation message to stderr instead of stdout so that it 
doesn't get mingled with the output bytecode.


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

 gccas.sh |1 +
 1 files changed, 1 insertion(+)


Index: llvm/tools/gccas/gccas.sh
diff -u llvm/tools/gccas/gccas.sh:1.2 llvm/tools/gccas/gccas.sh:1.3
--- llvm/tools/gccas/gccas.sh:1.2   Fri Feb  2 15:49:27 2007
+++ llvm/tools/gccas/gccas.sh   Fri Feb  9 09:10:26 2007
@@ -18,6 +18,7 @@
 # 
 
##===--===##
 #
+echo gccas: This tool is deprecated, please use opt 12
 [EMAIL PROTECTED]@
 OPTOPTS=-std-compile-opts -f
 ASOPTS=



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


[llvm-commits] CVS: llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c 2006-01-13-Includes.c 2006-01-13-StackSave.c 2006-01-23-FileScopeAsm.c 2006-03-03-MissingInitializer.c

2007-02-09 Thread Reid Spencer


Changes in directory llvm/test/CFrontend:

2005-09-24-AsmUserPrefix.c updated: 1.1 - 1.2
2006-01-13-Includes.c updated: 1.6 - 1.7
2006-01-13-StackSave.c updated: 1.3 - 1.4
2006-01-23-FileScopeAsm.c updated: 1.3 - 1.4
2006-03-03-MissingInitializer.c updated: 1.2 - 1.3
---
Log message:

Eliminate the use of gccas in the test suite.


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

 2005-09-24-AsmUserPrefix.c  |7 ---
 2006-01-13-Includes.c   |3 ++-
 2006-01-13-StackSave.c  |4 ++--
 2006-01-23-FileScopeAsm.c   |3 ++-
 2006-03-03-MissingInitializer.c |3 ++-
 5 files changed, 12 insertions(+), 8 deletions(-)


Index: llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c
diff -u llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c:1.1 
llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c:1.2
--- llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c:1.1  Sat Sep 24 03:38:28 2005
+++ llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c  Fri Feb  9 09:15:21 2007
@@ -1,6 +1,7 @@
-// RUN: %llvmgcc %s -S -o - | gccas 
-// RUN: %llvmgcc %s -S -o - | gccas | llc 
-// RUN: %llvmgcc %s -S -o - | gccas | llc | not grep _foo2
+// RUN: %llvmgcc %s -S -o - | llvm-as | opt -std-compile-opts 
+// RUN: %llvmgcc %s -S -o - | llvm-as | opt -std-compile-opts | llc 
+// RUN: %llvmgcc %s -S -o - | llvm-as | llc -std-compile-opts | llc | \
+// RUN:not grep _foo2
 
 void foo() __asm__(foo2);
 


Index: llvm/test/CFrontend/2006-01-13-Includes.c
diff -u llvm/test/CFrontend/2006-01-13-Includes.c:1.6 
llvm/test/CFrontend/2006-01-13-Includes.c:1.7
--- llvm/test/CFrontend/2006-01-13-Includes.c:1.6   Wed Jan 17 02:01:13 2007
+++ llvm/test/CFrontend/2006-01-13-Includes.c   Fri Feb  9 09:15:21 2007
@@ -1,4 +1,5 @@
-// RUN: %llvmgcc %s -g -S -o - | gccas | llvm-dis | grep test/CFrontend
+// RUN: %llvmgcc %s -g -S -o - | llvm-as | opt -std-compile-opts | \
+// RUN:   llvm-dis | grep test/CFrontend
 // PR676
 
 #include stdio.h


Index: llvm/test/CFrontend/2006-01-13-StackSave.c
diff -u llvm/test/CFrontend/2006-01-13-StackSave.c:1.3 
llvm/test/CFrontend/2006-01-13-StackSave.c:1.4
--- llvm/test/CFrontend/2006-01-13-StackSave.c:1.3  Wed Feb  7 22:31:15 2007
+++ llvm/test/CFrontend/2006-01-13-StackSave.c  Fri Feb  9 09:15:21 2007
@@ -1,6 +1,6 @@
-// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep llvm.stacksave
-
 // PR691
+// RUN: %llvmgcc %s -S -o - | llvm-as | opt -std-compile-opts | \
+// RUN:llvm-dis | grep llvm.stacksave
 
 void test(int N) {
   int i;


Index: llvm/test/CFrontend/2006-01-23-FileScopeAsm.c
diff -u llvm/test/CFrontend/2006-01-23-FileScopeAsm.c:1.3 
llvm/test/CFrontend/2006-01-23-FileScopeAsm.c:1.4
--- llvm/test/CFrontend/2006-01-23-FileScopeAsm.c:1.3   Wed Feb  7 22:31:15 2007
+++ llvm/test/CFrontend/2006-01-23-FileScopeAsm.c   Fri Feb  9 09:15:21 2007
@@ -1,4 +1,5 @@
-// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep foo[12345] | wc -l | 
grep 5
+// RUN: %llvmgcc %s -S -o - | llvm-as | opt -std-compile-opts | \
+// RUN:llvm-dis | grep foo[12345] | wc -l | grep 5
 
 __asm__ (foo1);
 __asm__ (foo2);


Index: llvm/test/CFrontend/2006-03-03-MissingInitializer.c
diff -u llvm/test/CFrontend/2006-03-03-MissingInitializer.c:1.2 
llvm/test/CFrontend/2006-03-03-MissingInitializer.c:1.3
--- llvm/test/CFrontend/2006-03-03-MissingInitializer.c:1.2 Sun Dec 31 
00:01:59 2006
+++ llvm/test/CFrontend/2006-03-03-MissingInitializer.c Fri Feb  9 09:15:21 2007
@@ -1,4 +1,5 @@
-// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep nate | grep 'global i32 
0'
+// RUN: %llvmgcc %s -S -o - | llvm-as | opt -std-compile-opts | \
+// RUN:llvm-dis | grep '@nate.*internal global i32 0'
 
 struct X { int *XX; int Y;};
 



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


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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/tools/gccld:

gccld.sh updated: 1.2 - 1.3
---
Log message:

Write the deprecation message to stderr instead of stdout so that it 
doesn't get mingled with the output bytecode.


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

 gccld.sh |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/gccld/gccld.sh
diff -u llvm/tools/gccld/gccld.sh:1.2 llvm/tools/gccld/gccld.sh:1.3
--- llvm/tools/gccld/gccld.sh:1.2   Thu Feb  8 21:12:21 2007
+++ llvm/tools/gccld/gccld.sh   Fri Feb  9 09:16:59 2007
@@ -18,6 +18,6 @@
 # 
 
##===--===##
 #
-echo gccld: This tool is deprecated, please use llvm-ld
+echo gccld: This tool is deprecated, please use llvm-ld 12
 [EMAIL PROTECTED]@
 $TOOLDIR/llvm-ld $@



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


[llvm-commits] CVS: llvm/tools/gccld/Makefile GenerateCode.cpp gccld.cpp gccld.h

2007-02-09 Thread Reid Spencer


Changes in directory llvm/tools/gccld:

Makefile updated: 1.18 - 1.19
GenerateCode.cpp (r1.70) removed
gccld.cpp (r1.116) removed
gccld.h (r1.19) removed
---
Log message:

End of life for gccld. Remove its source code and enable the generation
of a shell script to stand in its place. The shell script just pawns the
execution off to llvm-ld.


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

 Makefile |6 --
 1 files changed, 6 deletions(-)


Index: llvm/tools/gccld/Makefile
diff -u llvm/tools/gccld/Makefile:1.18 llvm/tools/gccld/Makefile:1.19
--- llvm/tools/gccld/Makefile:1.18  Thu Feb  8 21:15:18 2007
+++ llvm/tools/gccld/Makefile   Fri Feb  9 09:21:02 2007
@@ -9,13 +9,8 @@
 
 LEVEL = ../..
 
-TOOLNAME = gccld
-LINK_COMPONENTS = bcreader bcwriter ipo scalaropts ipa linker
-REQUIRES_EH := 1
-
 include $(LEVEL)/Makefile.common
 
-ifdef DONT_USE_THIS
 install-local:: $(PROJ_bindir)/gccld

 $(PROJ_bindir)/gccld : gccld.sh Makefile
@@ -32,4 +27,3 @@
 
 clean-local::
$(Verb)$(RM) -f $(ToolDir)/gccld
-endif



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


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

2007-02-09 Thread LLVM


Changes in directory llvm/docs/CommandGuide:

gccld.pod (r1.6) removed
---
Log message:

gccld is gone.


---
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/Makefile.rules

2007-02-09 Thread Reid Spencer


Changes in directory llvm:

Makefile.rules updated: 1.424 - 1.425
---
Log message:

Don't use gccld or gccas


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

 Makefile.rules |   24 +++-
 1 files changed, 11 insertions(+), 13 deletions(-)


Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.424 llvm/Makefile.rules:1.425
--- llvm/Makefile.rules:1.424   Wed Feb  7 13:13:19 2007
+++ llvm/Makefile.rules Fri Feb  9 09:52:07 2007
@@ -312,11 +312,8 @@
   endif
 endif
 LLVM_CONFIG := $(LLVMToolDir)/llvm-config 
-ifndef GCCAS
-GCCAS:= $(LLVMToolDir)/gccas$(EXEEXT)
-endif
-ifndef GCCLD
-GCCLD:= $(LLVMToolDir)/gccld$(EXEEXT)
+ifndef LLVMLD
+LLVMLD:= $(LLVMToolDir)/gccld$(EXEEXT)
 endif
 ifndef LLVMDIS
 LLVMDIS  := $(LLVMToolDir)/llvm-dis$(EXEEXT)
@@ -712,14 +709,14 @@
 else
 
 Module := $(LibDir)/$(MODULE_NAME).bc
-LinkModule := $(GCCLD) -L$(CFERuntimeLibDir)
+LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir)
 
 
 ifdef EXPORTED_SYMBOL_FILE
 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
 endif
 
-$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
+$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
$(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
 
@@ -842,10 +839,10 @@
 all-local:: $(LibName.BCA)
 
 ifdef EXPORTED_SYMBOL_FILE
-BCLinkLib = $(GCCLD) -L$(CFERuntimeLibDir) \
+BCLinkLib = $(LLVMLD) -L$(CFERuntimeLibDir) \
  -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
 
-$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
+$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
 $(LLVMToolDir)/llvm-ar
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
  (internalize)
@@ -1182,13 +1179,14 @@
 
 # make the C and C++ compilers strip debug info out of bytecode libraries.
 ifdef DEBUG_RUNTIME
-$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(GCCAS)
+$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
$(Echo) Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)
-   $(Verb) $(GCCAS) $ -o $@
+   $(Verb) $(LLVMAS) $ -o - | $(LOPT) -std-compile-opts $ -o $@
 else
-$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(GCCAS)
+$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
$(Echo) Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)
-   $(Verb) $(GCCAS) -strip-debug $ -o $@
+   $(Verb) $(LLVMAS) $ -o - | \
+ $(LOPT) -std-compile-opts -strip-debug $ -o $@
 endif
 
 



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


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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.123 - 1.124
---
Log message:

Change a reference to gccas to a reference to opt.


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

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


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.123 
llvm/docs/ProgrammersManual.html:1.124
--- llvm/docs/ProgrammersManual.html:1.123  Thu Feb  8 13:14:21 2007
+++ llvm/docs/ProgrammersManual.htmlFri Feb  9 10:00:28 2007
@@ -575,7 +575,7 @@
 /pre
 /div
 
-  p When running ttgccas/tt on a C file from the SPEC benchmark
+  p When running ttopt/tt on a C file from the SPEC benchmark
 suite, it gives a report that looks like this:/p
 
 div class=doc_code
@@ -3177,7 +3177,7 @@
   a href=mailto:[EMAIL PROTECTED]Dinakar Dhurjati/a and
   a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
   a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/02/08 19:14:21 $
+  Last modified: $Date: 2007/02/09 16:00:28 $
 /address
 
 /body



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


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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

llvmgcc.pod updated: 1.7 - 1.8
llvmgxx.pod updated: 1.7 - 1.8
gccas.pod (r1.7) removed
---
Log message:

Remove gccas.pod and references to gccas and gccld.


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

 llvmgcc.pod |2 +-
 llvmgxx.pod |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/CommandGuide/llvmgcc.pod
diff -u llvm/docs/CommandGuide/llvmgcc.pod:1.7 
llvm/docs/CommandGuide/llvmgcc.pod:1.8
--- llvm/docs/CommandGuide/llvmgcc.pod:1.7  Mon Mar 13 23:42:07 2006
+++ llvm/docs/CommandGuide/llvmgcc.pod  Fri Feb  9 10:56:25 2007
@@ -85,7 +85,7 @@
 
 =head1 SEE ALSO
 
-Lllvm-g++|llvmgxx, Lgccas|gccas, Lgccld|gccld
+Lllvm-g++|llvmgxx
 
 =head1 AUTHORS
 


Index: llvm/docs/CommandGuide/llvmgxx.pod
diff -u llvm/docs/CommandGuide/llvmgxx.pod:1.7 
llvm/docs/CommandGuide/llvmgxx.pod:1.8
--- llvm/docs/CommandGuide/llvmgxx.pod:1.7  Mon Mar 13 23:42:07 2006
+++ llvm/docs/CommandGuide/llvmgxx.pod  Fri Feb  9 10:56:25 2007
@@ -85,7 +85,7 @@
 
 =head1 SEE ALSO
 
-Lllvm-gcc|llvmgcc, Lgccas, Lgccld
+Lllvm-gcc|llvmgcc
 
 =head1 AUTHORS
 



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


[llvm-commits] CVS: llvm/tools/Makefile

2007-02-09 Thread Reid Spencer


Changes in directory llvm/tools:

Makefile updated: 1.61 - 1.62
---
Log message:

Now that gccas and gccld are just schell scripts, adjust the build ordering 
for parallel builds so that we space out the large links.


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

 Makefile |   21 ++---
 1 files changed, 10 insertions(+), 11 deletions(-)


Index: llvm/tools/Makefile
diff -u llvm/tools/Makefile:1.61 llvm/tools/Makefile:1.62
--- llvm/tools/Makefile:1.61Mon Jan  8 00:25:29 2007
+++ llvm/tools/Makefile Fri Feb  9 11:02:07 2007
@@ -8,17 +8,16 @@
 
##===--===##
 
 LEVEL := ..
-# Note .. the tools are organized in triples consisting of one large and two
-# small executables. This is done to minimize memory load in parallel builds.
-# Please retain this ordering.
-PARALLEL_DIRS := llvm-config llvm-upgrade \
- opt llvm-as llvm-dis \
- llc llvm-ranlib llvm-ar \
-lli llvm-link llvm-nm \
-bugpoint llvm-db llvm-extract \
- gccas llvm-bcanalyzer llvm-stub \
-gccld llvm2cpp \
- llvm-ld llvmc llvm-prof
+# NOTE: The tools are organized into five groups of four consisting of one 
+# large and three small executables. This is done to minimize memory load 
+# in parallel builds.  Please retain this ordering.
+PARALLEL_DIRS := llvm-config 
+ opt llvm-as llvm-dis llvm-upgrade \
+ llc llvm-ranlib llvm-ar llvm-nm \
+ llvm-ld llvmc llvm-prof llvm-link  \
+lli gccas gccld llvm-extract llvm-db llvm2cpp \
+bugpoint llvm-stub llvm-bcanalyzer llvm-stub \
+   
 
 include $(LEVEL)/Makefile.config
 



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


[llvm-commits] CVS: llvm/Makefile.rules

2007-02-09 Thread Reid Spencer


Changes in directory llvm:

Makefile.rules updated: 1.425 - 1.426
---
Log message:

Fix some bugs in module building that broke llvm-stacker project.


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

 Makefile.rules |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.425 llvm/Makefile.rules:1.426
--- llvm/Makefile.rules:1.425   Fri Feb  9 09:52:07 2007
+++ llvm/Makefile.rules Fri Feb  9 11:09:14 2007
@@ -313,7 +313,7 @@
 endif
 LLVM_CONFIG := $(LLVMToolDir)/llvm-config 
 ifndef LLVMLD
-LLVMLD:= $(LLVMToolDir)/gccld$(EXEEXT)
+LLVMLD:= $(LLVMToolDir)/llvm-ld$(EXEEXT)
 endif
 ifndef LLVMDIS
 LLVMDIS  := $(LLVMToolDir)/llvm-dis$(EXEEXT)
@@ -1181,12 +1181,12 @@
 ifdef DEBUG_RUNTIME
 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
$(Echo) Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)
-   $(Verb) $(LLVMAS) $ -o - | $(LOPT) -std-compile-opts $ -o $@
+   $(Verb) $(LLVMAS) $ -o - | $(LOPT) -std-compile-opts -o $@ -f
 else
 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
$(Echo) Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)
$(Verb) $(LLVMAS) $ -o - | \
- $(LOPT) -std-compile-opts -strip-debug $ -o $@
+  $(LOPT) -std-compile-opts -strip-debug -o $@ -f
 endif
 
 



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


[llvm-commits] CVS: llvm/tools/Makefile

2007-02-09 Thread Reid Spencer


Changes in directory llvm/tools:

Makefile updated: 1.62 - 1.63
---
Log message:

Get the use of \ right.


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

 Makefile |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/tools/Makefile
diff -u llvm/tools/Makefile:1.62 llvm/tools/Makefile:1.63
--- llvm/tools/Makefile:1.62Fri Feb  9 11:02:07 2007
+++ llvm/tools/Makefile Fri Feb  9 11:18:42 2007
@@ -11,12 +11,12 @@
 # NOTE: The tools are organized into five groups of four consisting of one 
 # large and three small executables. This is done to minimize memory load 
 # in parallel builds.  Please retain this ordering.
-PARALLEL_DIRS := llvm-config 
+PARALLEL_DIRS := llvm-config  \
  opt llvm-as llvm-dis llvm-upgrade \
  llc llvm-ranlib llvm-ar llvm-nm \
- llvm-ld llvmc llvm-prof llvm-link  \
+ llvm-ld llvmc llvm-prof llvm-link \
 lli gccas gccld llvm-extract llvm-db llvm2cpp \
-bugpoint llvm-stub llvm-bcanalyzer llvm-stub \
+bugpoint llvm-stub llvm-bcanalyzer llvm-stub

 
 include $(LEVEL)/Makefile.config



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


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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.110 - 1.111
---
Log message:

add a note


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

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


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.110 
llvm/lib/Target/PowerPC/README.txt:1.111
--- llvm/lib/Target/PowerPC/README.txt:1.110Thu Feb  8 22:19:54 2007
+++ llvm/lib/Target/PowerPC/README.txt  Fri Feb  9 11:38:01 2007
@@ -596,3 +596,32 @@
 This sort of thing occurs a lot due to globalopt.
 
 ===-===
+
+We currently compile 32-bit bswap:
+
+declare i32 @llvm.bswap.i32(i32 %A)
+define i32 @test(i32 %A) {
+%B = call i32 @llvm.bswap.i32(i32 %A)
+ret i32 %B
+}
+
+to:
+
+_test:
+rlwinm r2, r3, 24, 16, 23
+slwi r4, r3, 24
+rlwimi r2, r3, 8, 24, 31
+rlwimi r4, r3, 8, 8, 15
+rlwimi r4, r2, 0, 16, 31
+mr r3, r4
+blr 
+
+it would be more efficient to produce:
+
+_foo:   mr r0,r3
+rlwinm r3,r3,8,0x
+rlwimi r3,r0,24,0,7
+rlwimi r3,r0,24,16,23
+blr
+
+===-===



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


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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/docs:

GetElementPtr.html updated: 1.14 - 1.15
---
Log message:

int - i32, etc.


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

 GetElementPtr.html |   86 ++---
 1 files changed, 43 insertions(+), 43 deletions(-)


Index: llvm/docs/GetElementPtr.html
diff -u llvm/docs/GetElementPtr.html:1.14 llvm/docs/GetElementPtr.html:1.15
--- llvm/docs/GetElementPtr.html:1.14   Wed Aug 16 22:26:50 2006
+++ llvm/docs/GetElementPtr.htmlFri Feb  9 11:56:02 2007
@@ -120,13 +120,13 @@
   pre
   void %munge(%struct.munger_struct* %P) {
   entry:
-%tmp = getelementptr %struct.munger_struct* %P, int 1, uint 0
-%tmp = load int* %tmp
-%tmp6 = getelementptr %struct.munger_struct* %P, int 2, uint 1
-%tmp7 = load int* %tmp6
-%tmp8 = add int %tmp7, %tmp
-%tmp9 = getelementptr %struct.munger_struct* %P, int 0, uint 0
-store int %tmp8, int* %tmp9
+%tmp = getelementptr %struct.munger_struct* %P, i32 1, i32 0
+%tmp = load i32* %tmp
+%tmp6 = getelementptr %struct.munger_struct* %P, i32 2, i32 1
+%tmp7 = load i32* %tmp6
+%tmp8 = add i32 %tmp7, %tmp
+%tmp9 = getelementptr %struct.munger_struct* %P, i32 0, i32 0
+store i32 %tmp8, i32* %tmp9
 ret void
   }/pre
   pIn each case the first operand is the pointer through which the GEP
@@ -134,11 +134,11 @@
   argument, allocated memory, or a global variable. /p
   pTo make this clear, let's consider a more obtuse example:/p
   pre
-  %MyVar = unintialized global int
+  %MyVar = unintialized global i32
   ...
-  %idx1 = getelementptr int* %MyVar, long 0
-  %idx2 = getelementptr int* %MyVar, long 1
-  %idx3 = getelementptr int* %MyVar, long 2/pre
+  %idx1 = getelementptr i32* %MyVar, i64 0
+  %idx2 = getelementptr i32* %MyVar, i64 1
+  %idx3 = getelementptr i32* %MyVar, i64 2/pre
   pThese GEP instructions are simply making address computations from the 
   base address of ttMyVar/tt.  They compute, as follows (using C syntax):
   /p
@@ -147,14 +147,14 @@
 li idx2 = (char*) amp;MyVar + 4/li
 li idx3 = (char*) amp;MyVar + 8/li
   /ul
-  pSince the type ttint/tt is known to be four bytes long, the indices 
+  pSince the type tti32/tt is known to be four bytes long, the indices 
   0, 1 and 2 translate into memory offsets of 0, 4, and 8, respectively. No 
   memory is accessed to make these computations because the address of 
   tt%MyVar/tt is passed directly to the GEP instructions./p
   pThe obtuse part of this example is in the cases of tt%idx2/tt and 
   tt%idx3/tt. They result in the computation of addresses that point to
   memory past the end of the tt%MyVar/tt global, which is only one
-  ttint/tt long, not three ttint/tts long.  While this is legal in 
LLVM,
+  tti32/tt long, not three tti32/tts long.  While this is legal in 
LLVM,
   it is inadvisable because any load or store with the pointer that results 
   from these GEP instructions would produce undefined results./p
 /div
@@ -169,29 +169,29 @@
   pThis question arises most often when the GEP instruction is applied to a
   global variable which is always a pointer type. For example, consider
   this:/ppre
-  %MyStruct = uninitialized global { float*, int }
+  %MyStruct = uninitialized global { float*, i32 }
   ...
-  %idx = getelementptr { float*, int }* %MyStruct, long 0, ubyte 1/pre
-  pThe GEP above yields an ttint*/tt by indexing the ttint/tt typed 
+  %idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1/pre
+  pThe GEP above yields an tti32*/tt by indexing the tti32/tt typed 
   field of the structure tt%MyStruct/tt. When people first look at it, 
they 
-  wonder why the ttlong 0/tt index is needed. However, a closer inspection 
+  wonder why the tti64 0/tt index is needed. However, a closer inspection 
   of how globals and GEPs work reveals the need. Becoming aware of the 
following
   facts will dispell the confusion:/p
   ol
-liThe type of tt%MyStruct/tt is inot/i tt{ float*, int }/tt 
-but rather tt{ float*, int }*/tt. That is, tt%MyStruct/tt is a 
+liThe type of tt%MyStruct/tt is inot/i tt{ float*, i32 }/tt 
+but rather tt{ float*, i32 }*/tt. That is, tt%MyStruct/tt is a 
 pointer to a structure containing a pointer to a ttfloat/tt and an 
-ttint/tt./li
+tti32/tt./li
 liPoint #1 is evidenced by noticing the type of the first operand of 
 the GEP instruction (tt%MyStruct/tt) which is 
-tt{ float*, int }*/tt./li
-liThe first index, ttlong 0/tt is required to step over the global
+tt{ float*, i32 }*/tt./li
+liThe first index, tti64 0/tt is required to step over the global
 variable tt%MyStruct/tt.  Since the first argument to the GEP
 instruction must always be a value of pointer type, the first index 
 steps through that pointer. A value of 0 means 0 elements offset from that
 pointer./li
-liThe second index, ttubyte 1/tt selects the second field of the
-structure (the ttint/tt). /li
+liThe 

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

2007-02-09 Thread Reid Spencer


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.158 - 1.159
---
Log message:

Use int32_t and uint32_t to hopefully help weak compilers (cygwin) not
generate errors about being unable to resolve overloaded type.


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

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


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.158 
llvm/lib/Bytecode/Writer/Writer.cpp:1.159
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.158   Fri Feb  9 01:53:20 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Feb  9 12:03:35 2007
@@ -70,8 +70,8 @@
   }
 }
 
-inline void BytecodeWriter::output(int i) {
-  output((unsigned)i);
+inline void BytecodeWriter::output(int32_t i) {
+  output((uint32_t)i);
 }
 
 /// output_vbr - Output an unsigned value, by using the least number of bytes
@@ -93,7 +93,7 @@
   }
 }
 
-inline void BytecodeWriter::output_vbr(unsigned i) {
+inline void BytecodeWriter::output_vbr(uint32_t i) {
   while (1) {
 if (i  0x80) { // done?
   Out.push_back((unsigned char)i);   // We know the high bit is clear...



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMConstantIslandPass.cpp updated: 1.24 - 1.25
---
Log message:

Add reference counting to constantpool entries. Delete the unused ones.

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

 ARMConstantIslandPass.cpp |  149 ++
 1 files changed, 113 insertions(+), 36 deletions(-)


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.24 
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.25
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.24  Fri Feb  2 20:08:34 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp   Fri Feb  9 14:54:44 2007
@@ -24,11 +24,12 @@
 #include llvm/Target/TargetMachine.h
 #include llvm/Support/Compiler.h
 #include llvm/Support/Debug.h
+#include llvm/ADT/SmallVector.h
 #include llvm/ADT/STLExtras.h
 #include llvm/ADT/Statistic.h
-#include iostream
 using namespace llvm;
 
+STATISTIC(NumCPEs, Number of constpool entries);
 STATISTIC(NumSplit,Number of uncond branches inserted);
 STATISTIC(NumCBrFixed, Number of cond branches fixed);
 STATISTIC(NumUBrFixed, Number of uncond branches fixed);
@@ -51,13 +52,13 @@
 
 /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed
 /// by MBB Number.
-std::vectorunsigned BBSizes;
+SmallVectorunsigned, 8 BBSizes;
 
 /// WaterList - A sorted list of basic blocks where islands could be placed
 /// (i.e. blocks that don't fall through to the following block, due
 /// to a return, unreachable, or unconditional branch).
-std::vectorMachineBasicBlock* WaterList;
-
+SmallVectorMachineBasicBlock*, 8 WaterList;
+
 /// CPUser - One user of a constant pool, keeping the machine instruction
 /// pointer, the constant pool being referenced, and the max displacement
 /// allowed from the instruction to the CP.
@@ -71,7 +72,22 @@
 
 /// CPUsers - Keep track of all of the machine instructions that use 
various
 /// constant pools and their max displacement.
-std::vectorCPUser CPUsers;
+SmallVectorCPUser, 16 CPUsers;
+
+/// CPEntry - One per constant pool entry, keeping the machine instruction
+/// pointer, the constpool index, and the number of CPUser's which
+/// reference this entry.
+struct CPEntry {
+  MachineInstr *CPEMI;
+  unsigned CPI;
+  unsigned RefCount;
+  CPEntry(MachineInstr *cpemi, unsigned cpi, unsigned rc = 0)
+: CPEMI(cpemi), CPI(cpi), RefCount(rc) {}
+};
+
+/// CPEntries - Keep track of all of the constant pool entry machine
+/// instructions. For each constpool index, it keeps a vector of entries.
+std::vectorstd::vectorCPEntry  CPEntries;
 
 /// ImmBranch - One per immediate branch, keeping the machine instruction
 /// pointer, conditional or unconditional, the max displacement,
@@ -88,11 +104,11 @@
 
 /// Branches - Keep track of all the immediate branch instructions.
 ///
-std::vectorImmBranch ImmBranches;
+SmallVectorImmBranch, 32 ImmBranches;
 
 /// PushPopMIs - Keep track of all the Thumb push / pop instructions.
 ///
-std::vectorMachineInstr* PushPopMIs;
+SmallVectorMachineInstr*, 4 PushPopMIs;
 
 /// HasFarJump - True if any far jump instruction has been emitted during
 /// the branch fix up pass.
@@ -109,9 +125,10 @@
 
   private:
 void DoInitialPlacement(MachineFunction Fn,
-std::vectorMachineInstr* CPEMIs);
+SmallVectorMachineInstr*, 16 CPEMIs);
+CPEntry *findConstPoolEntry(unsigned CPI, const MachineInstr *CPEMI);
 void InitialFunctionScan(MachineFunction Fn,
- const std::vectorMachineInstr* CPEMIs);
+ const SmallVectorMachineInstr*, 16 CPEMIs);
 MachineBasicBlock *SplitBlockBeforeInstr(MachineInstr *MI);
 void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB);
 bool HandleConstantPoolUser(MachineFunction Fn, CPUser U);
@@ -147,7 +164,7 @@
 
   // Perform the initial placement of the constant pool entries.  To start 
with,
   // we put them all at the end of the function.
-  std::vectorMachineInstr* CPEMIs;
+  SmallVectorMachineInstr*, 16 CPEMIs;
   if (!MCP.isEmpty())
 DoInitialPlacement(Fn, CPEMIs);
   
@@ -182,7 +199,9 @@
   BBSizes.clear();
   WaterList.clear();
   CPUsers.clear();
+  CPEntries.clear();
   ImmBranches.clear();
+  PushPopMIs.clear();
 
   return MadeChange;
 }
@@ -190,7 +209,7 @@
 /// DoInitialPlacement - Perform the initial placement of the constant pool
 /// entries.  To start with, we put them all at the end of the function.
 void ARMConstantIslands::DoInitialPlacement(MachineFunction Fn,
-std::vectorMachineInstr* 
CPEMIs){
+SmallVectorMachineInstr*, 16 
CPEMIs){
   // Create the basic block to hold the CPE's.
   MachineBasicBlock 

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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.168 - 1.169
---
Log message:

Fix clients like this:
  
  delete ParseBytecodeFile(InputFilename, 0, ErrorMessage);
  llvm_shutdown();
  delete ParseBytecodeFile(InputFilename, 0, ErrorMessage);

The primitive type objects failed to ressurect themselves after shutdown, 
leading
to crashes in clients that used them after llvm_shutdown().

This solution isn't wonderful, because we clearly have static ctors.  However,
the code it replaces was just as bad, so it's not a regression.



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

 Type.cpp |   43 +++
 1 files changed, 15 insertions(+), 28 deletions(-)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.168 llvm/lib/VMCore/Type.cpp:1.169
--- llvm/lib/VMCore/Type.cpp:1.168  Mon Feb  5 14:47:20 2007
+++ llvm/lib/VMCore/Type.cppFri Feb  9 16:24:04 2007
@@ -347,34 +347,21 @@
 //  Primitive 'Type' data
 
//===--===//
 
-#define DeclarePrimType(TY, Str)   \
-  namespace {  \
-struct VISIBILITY_HIDDEN TY##Type : public Type {  \
-  TY##Type() : Type(Str, Type::TY##TyID) {}\
-}; \
-  }\
-  static ManagedStaticTY##Type The##TY##Ty;  \
-  const Type *Type::TY##Ty = *The##TY##Ty
-
-#define DeclareIntegerType(TY, BitWidth) \
-  namespace {\
-struct VISIBILITY_HIDDEN TY##Type : public IntegerType { \
-  TY##Type() : IntegerType(BitWidth) {}  \
-};   \
-  }  \
-  static ManagedStaticTY##Type The##TY##Ty;\
-  const IntegerType *Type::TY##Ty = *The##TY##Ty
-
-DeclarePrimType(Void,   void);
-DeclarePrimType(Float,  float);
-DeclarePrimType(Double, double);
-DeclarePrimType(Label,  label);
-DeclareIntegerType(Int1,1);
-DeclareIntegerType(Int8,8);
-DeclareIntegerType(Int16,  16);
-DeclareIntegerType(Int32,  32);
-DeclareIntegerType(Int64,  64);
-#undef DeclarePrimType
+const Type *Type::VoidTy   = new Type(void, Type::VoidTyID);
+const Type *Type::FloatTy  = new Type(float, Type::FloatTyID);
+const Type *Type::DoubleTy = new Type(double, Type::DoubleTyID);
+const Type *Type::LabelTy  = new Type(label, Type::LabelTyID);
+
+namespace {
+  struct BuiltinIntegerType : public IntegerType {
+BuiltinIntegerType(unsigned W) : IntegerType(W) {}
+  };
+}
+const IntegerType *Type::Int1Ty  = new BuiltinIntegerType(1);
+const IntegerType *Type::Int8Ty  = new BuiltinIntegerType(8);
+const IntegerType *Type::Int16Ty = new BuiltinIntegerType(16);
+const IntegerType *Type::Int32Ty = new BuiltinIntegerType(32);
+const IntegerType *Type::Int64Ty = new BuiltinIntegerType(64);
 
 
 
//===--===//



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg test_rec.yuv

2007-02-09 Thread Evan Cheng


Changes in directory llvm-test/MultiSource/Applications/JM/ldecod/data:

decoder.cfg updated: 1.3 - 1.4
test_rec.yuv (r1.3) removed
---
Log message:

Unixfy

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

 decoder.cfg |   36 ++--
 1 files changed, 18 insertions(+), 18 deletions(-)


Index: llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg
diff -u llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg:1.3 
llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg:1.4
--- llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg:1.3   Sun Feb 
 4 08:38:32 2007
+++ llvm-test/MultiSource/Applications/JM/ldecod/data/decoder.cfg   Fri Feb 
 9 16:51:50 2007
@@ -1,18 +1,18 @@
-test.264 H.264/AVC coded bitstream
-test_dec.yuv Output file, YUV/RGB
-test_rec.yuv Ref sequence (for SNR)
-1Write 4:2:0 chroma components for monochrome 
streams
-0NAL mode (0=Annex B, 1: RTP packets)
-0SNR computation offset
-2Poc Scale (1 or 2)
-50   Rate_Decoder
-104000   B_decoder
-73000F_decoder
-leakybucketparam.cfg LeakyBucket Params
-0Err Concealment(0:Off,1:Frame Copy,2:Motion 
Copy)
-2Reference POC gap (2: IPP (Default), 4: IbP / 
IpP)
-2POC gap (2: IPP /IbP/IpP (Default), 4: IPP 
with frame skip = 1 etc.)
-0Silent decode
-
-This is a file containing input parameters to the JVT H.264/AVC decoder.
-The text line following each parameter is discarded by the decoder.
+test.264 H.264/AVC coded bitstream
+test_dec.yuv Output file, YUV/RGB
+test_rec.yuv Ref sequence (for SNR)
+1Write 4:2:0 chroma components for monochrome 
streams
+0NAL mode (0=Annex B, 1: RTP packets)
+0SNR computation offset
+2Poc Scale (1 or 2)
+50   Rate_Decoder
+104000   B_decoder
+73000F_decoder
+leakybucketparam.cfg LeakyBucket Params
+0Err Concealment(0:Off,1:Frame Copy,2:Motion 
Copy)
+2Reference POC gap (2: IPP (Default), 4: IbP / 
IpP)
+2POC gap (2: IPP /IbP/IpP (Default), 4: IPP 
with frame skip = 1 etc.)
+0Silent decode
+
+This is a file containing input parameters to the JVT H.264/AVC decoder.
+The text line following each parameter is discarded by the decoder.



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

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

These vectors are frequently large. Use std::vector instead.

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

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


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.25 
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.26
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.25  Fri Feb  9 14:54:44 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp   Fri Feb  9 17:59:14 2007
@@ -52,12 +52,12 @@
 
 /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed
 /// by MBB Number.
-SmallVectorunsigned, 8 BBSizes;
+std::vectorunsigned BBSizes;
 
 /// WaterList - A sorted list of basic blocks where islands could be placed
 /// (i.e. blocks that don't fall through to the following block, due
 /// to a return, unreachable, or unconditional branch).
-SmallVectorMachineBasicBlock*, 8 WaterList;
+std::vectorMachineBasicBlock* WaterList;
 
 /// CPUser - One user of a constant pool, keeping the machine instruction
 /// pointer, the constant pool being referenced, and the max displacement
@@ -72,7 +72,7 @@
 
 /// CPUsers - Keep track of all of the machine instructions that use 
various
 /// constant pools and their max displacement.
-SmallVectorCPUser, 16 CPUsers;
+std::vectorCPUser CPUsers;
 
 /// CPEntry - One per constant pool entry, keeping the machine instruction
 /// pointer, the constpool index, and the number of CPUser's which
@@ -104,7 +104,7 @@
 
 /// Branches - Keep track of all the immediate branch instructions.
 ///
-SmallVectorImmBranch, 32 ImmBranches;
+std::vectorImmBranch ImmBranches;
 
 /// PushPopMIs - Keep track of all the Thumb push / pop instructions.
 ///
@@ -125,10 +125,10 @@
 
   private:
 void DoInitialPlacement(MachineFunction Fn,
-SmallVectorMachineInstr*, 16 CPEMIs);
+std::vectorMachineInstr* CPEMIs);
 CPEntry *findConstPoolEntry(unsigned CPI, const MachineInstr *CPEMI);
 void InitialFunctionScan(MachineFunction Fn,
- const SmallVectorMachineInstr*, 16 CPEMIs);
+ const std::vectorMachineInstr* CPEMIs);
 MachineBasicBlock *SplitBlockBeforeInstr(MachineInstr *MI);
 void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB);
 bool HandleConstantPoolUser(MachineFunction Fn, CPUser U);
@@ -164,7 +164,7 @@
 
   // Perform the initial placement of the constant pool entries.  To start 
with,
   // we put them all at the end of the function.
-  SmallVectorMachineInstr*, 16 CPEMIs;
+  std::vectorMachineInstr* CPEMIs;
   if (!MCP.isEmpty())
 DoInitialPlacement(Fn, CPEMIs);
   
@@ -209,7 +209,7 @@
 /// DoInitialPlacement - Perform the initial placement of the constant pool
 /// entries.  To start with, we put them all at the end of the function.
 void ARMConstantIslands::DoInitialPlacement(MachineFunction Fn,
-SmallVectorMachineInstr*, 16 
CPEMIs){
+std::vectorMachineInstr* CPEMIs){
   // Create the basic block to hold the CPE's.
   MachineBasicBlock *BB = new MachineBasicBlock();
   Fn.getBasicBlockList().push_back(BB);
@@ -276,7 +276,7 @@
 /// information about the sizes of each block, the location of all the water,
 /// and finding all of the constant pool users.
 void ARMConstantIslands::InitialFunctionScan(MachineFunction Fn,
- const SmallVectorMachineInstr*, 16 CPEMIs) 
{
+ const std::vectorMachineInstr* CPEMIs) {
   for (MachineFunction::iterator MBBI = Fn.begin(), E = Fn.end();
MBBI != E; ++MBBI) {
 MachineBasicBlock MBB = *MBBI;
@@ -460,7 +460,7 @@
   
   // Next, update WaterList.  Specifically, we need to add NewMBB as having 
   // available water after it.
-  SmallVectorMachineBasicBlock*, 8::iterator IP =
+  std::vectorMachineBasicBlock*::iterator IP =
 std::lower_bound(WaterList.begin(), WaterList.end(), NewBB,
  CompareMBBNumbers);
   WaterList.insert(IP, NewBB);



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.357 - 1.358
---
Log message:

Rename some variables to avoid confusion with SelectionDAGISel::BB.

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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.357 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.358
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.357Sat Feb  3 
19:35:11 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Feb  9 19:08:18 2007
@@ -3822,9 +3822,9 @@
   bool MadeChange = true;
   while (MadeChange) {
 MadeChange = false;
-  for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
+  for (Function::iterator FNI = Fn.begin(), E = Fn.end(); FNI != E; ++FNI) {
 // Split all critical edges where the dest block has a PHI.
-TerminatorInst *BBTI = BB-getTerminator();
+TerminatorInst *BBTI = FNI-getTerminator();
 if (BBTI-getNumSuccessors()  1) {
   for (unsigned i = 0, e = BBTI-getNumSuccessors(); i != e; ++i)
 if (isaPHINode(BBTI-getSuccessor(i)-begin()) 
@@ -3833,7 +3833,7 @@
 }
 
 
-for (BasicBlock::iterator BBI = BB-begin(), E = BB-end(); BBI != E; ) {
+for (BasicBlock::iterator BBI = FNI-begin(), E = FNI-end(); BBI != E; ) {
   Instruction *I = BBI++;
   
   if (CallInst *CI = dyn_castCallInst(I)) {
@@ -3843,7 +3843,7 @@
   if (const TargetAsmInfo *TAI = 
 TLI.getTargetMachine().getTargetAsmInfo()) {
 if (TAI-ExpandInlineAsm(CI))
-  BBI = BB-begin();
+  BBI = FNI-begin();
   }
   } else if (GetElementPtrInst *GEPI = dyn_castGetElementPtrInst(I)) {
 MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData());
@@ -3975,10 +3975,10 @@
 }
 
 void SelectionDAGISel::
-LowerArguments(BasicBlock *BB, SelectionDAGLowering SDL,
+LowerArguments(BasicBlock *LLVMBB, SelectionDAGLowering SDL,
std::vectorSDOperand UnorderedChains) {
   // If this is the entry block, emit arguments.
-  Function F = *BB-getParent();
+  Function F = *LLVMBB-getParent();
   FunctionLoweringInfo FuncInfo = SDL.FuncInfo;
   SDOperand OldRoot = SDL.DAG.getRoot();
   std::vectorSDOperand Args = TLI.LowerArguments(F, SDL.DAG);



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/include/llvm/CodeGen:

MachineBasicBlock.h updated: 1.54 - 1.55
---
Log message:

Add live-ins to MachineBasicBlock.

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

 MachineBasicBlock.h |   24 ++--
 1 files changed, 22 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.54 
llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.55
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.54  Sat Dec 16 23:15:12 2006
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h   Fri Feb  9 20:36:39 2007
@@ -63,11 +63,18 @@
   Instructions Insts;
   MachineBasicBlock *Prev, *Next;
   const BasicBlock *BB;
-  std::vectorMachineBasicBlock * Predecessors;
-  std::vectorMachineBasicBlock * Successors;
   int Number;
   MachineFunction *Parent;
 
+  /// Predecessors/Successors - Keep track of the predecessor / successor
+  /// basicblocks.
+  std::vectorMachineBasicBlock * Predecessors;
+  std::vectorMachineBasicBlock * Successors;
+
+  /// LiveIns - Keep track of the physical registers that are livein of
+  /// the basicblock.
+  std::vectorunsigned LiveIns;
+
 public:
   MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb),
 Number(-1), Parent(0) {
@@ -125,6 +132,19 @@
   unsigned succ_size()  const { return Successors.size();}
   bool succ_empty() const { return Successors.empty();   }
 
+  // LiveIn management methods.
+
+  /// addLiveIn - Add the specified register as a live in.  Note that it
+  /// is an error to add the same register to the same set more than once.
+  void addLiveIn(unsigned Reg)  { LiveIns.push_back(Reg); }
+
+  // Iteration support for live in sets.  These sets are kept in sorted
+  // order by their register number.
+  typedef std::vectorunsigned::const_iterator livein_iterator;
+  livein_iterator livein_begin() const { return LiveIns.begin(); }
+  livein_iterator livein_end()   const { return LiveIns.end(); }
+  boollivein_empty() const { return LiveIns.empty(); }
+
   // Code Layout methods.
   
   /// moveBefore/moveAfter - move 'this' block before or after the specified



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

MachineBasicBlock.cpp updated: 1.38 - 1.39
---
Log message:

Add live-ins to MachineBasicBlock.

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

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


Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.38 
llvm/lib/CodeGen/MachineBasicBlock.cpp:1.39
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.38 Fri Dec 15 20:15:42 2006
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp  Fri Feb  9 20:38:19 2007
@@ -15,6 +15,7 @@
 #include llvm/BasicBlock.h
 #include llvm/CodeGen/MachineFunction.h
 #include llvm/CodeGen/MachineInstr.h
+#include llvm/Target/MRegisterInfo.h
 #include llvm/Target/TargetData.h
 #include llvm/Target/TargetInstrInfo.h
 #include llvm/Target/TargetMachine.h
@@ -89,8 +90,20 @@
   print(*cerr.stream());
 }
 
+static inline void OutputReg(std::ostream os, unsigned RegNo,
+ const MRegisterInfo *MRI = 0) {
+  if (!RegNo || MRegisterInfo::isPhysicalRegister(RegNo)) {
+if (MRI)
+  os   %  MRI-get(RegNo).Name;
+else
+  os   %mreg(  RegNo  );
+  } else
+os   %reg  RegNo;
+}
+
 void MachineBasicBlock::print(std::ostream OS) const {
-  if(!getParent()) {
+  const MachineFunction *MF = getParent();
+  if(!MF) {
 OS  Can't print out MachineBasicBlock because parent MachineFunction
  is null\n;
 return;
@@ -101,6 +114,14 @@
   if (LBB) OS  LBB-getName();
   OS   (  (const void*)this
   , LLVM BB @  (const void*) LBB  , ID#  getNumber() ):\n;
+
+  const MRegisterInfo *MRI = MF-getTarget().getRegisterInfo();  
+  if (livein_begin() != livein_end()) {
+OS  Live Ins:;
+for (livein_iterator I = livein_begin(), E = livein_end(); I != E; ++I)
+  OutputReg(OS, *I, MRI);
+OS  \n;
+  }
   // Print the preds of this block according to the CFG.
   if (!pred_empty()) {
 OS  Predecessors according to CFG:;



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


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

2007-02-09 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.358 - 1.359
---
Log message:

Add function live-ins to entry block live-in set.

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

 SelectionDAGISel.cpp |8 
 1 files changed, 8 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.358 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.359
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.358Fri Feb  9 
19:08:18 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Feb  9 20:43:39 2007
@@ -3891,6 +3891,14 @@
   for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
 SelectBasicBlock(I, MF, FuncInfo);
 
+  // Add function live-ins to entry block live-in set.
+  BasicBlock *EntryBB = Fn.getEntryBlock();
+  BB = FuncInfo.MBBMap[EntryBB];
+  if (!MF.livein_empty())
+for (MachineFunction::livein_iterator I = MF.livein_begin(),
+   E = MF.livein_end(); I != E; ++I)
+  BB-addLiveIn(I-first);
+
   return true;
 }
 



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.84 - 1.85
SlotCalculator.h updated: 1.29 - 1.30
Writer.cpp updated: 1.159 - 1.160
---
Log message:

rename getSlot - getSlotType and getOrCreateSlot -getOrCreateTypeSlot
for types.


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

 SlotCalculator.cpp |   43 ++-
 SlotCalculator.h   |4 ++--
 Writer.cpp |   38 +++---
 3 files changed, 43 insertions(+), 42 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.84 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.85
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.84Fri Feb  9 09:25:50 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:15:40 2007
@@ -55,7 +55,7 @@
   insertType(Type::FloatTy,  true); // 1: FloatTySlot
   insertType(Type::DoubleTy, true); // 2: DoubleTySlot
   insertType(Type::LabelTy,  true); // 3: LabelTySlot
-  assert(TypeMap.size() == Type::FirstDerivedTyID  Invalid primitive 
insert);
+  assert(TypeMap.size() == Type::FirstDerivedTyID Invalid primitive 
insert);
   // Above here *must* correspond 1:1 with the primitive types.
   insertType(Type::Int1Ty,   true); // 4: BoolTySlot
   insertType(Type::Int8Ty,   true); // 5: Int8TySlot
@@ -161,7 +161,7 @@
 isaInlineAsm(*OI))
   getOrCreateSlot(*OI);
   }
-  getOrCreateSlot(I-getType());
+  getOrCreateTypeSlot(I-getType());
 }
   }
 
@@ -212,7 +212,7 @@
 void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *TST) {
   for (TypeSymbolTable::const_iterator TI = TST-begin(), TE = TST-end(); 
TI != TE; ++TI )
-getOrCreateSlot(TI-second);
+getOrCreateTypeSlot(TI-second);
 }
 
 // processSymbolTable - Insert all of the values in the specified symbol table
@@ -237,7 +237,8 @@
   ModuleTypeLevel = Types.size();
 
   // Iterate over function arguments, adding them to the value table...
-  for(Function::const_arg_iterator I = F-arg_begin(), E = F-arg_end(); I != 
E; ++I)
+  for(Function::const_arg_iterator I = F-arg_begin(), E = F-arg_end();
+  I != E; ++I)
 getOrCreateSlot(I);
 
   if (!ModuleContainsAllFunctionConstants) {
@@ -326,7 +327,7 @@
   return -1;
 }
 
-int SlotCalculator::getSlot(const Type*T) const {
+int SlotCalculator::getTypeSlot(const Type*T) const {
   std::mapconst Type*, unsigned::const_iterator I = TypeMap.find(T);
   if (I != TypeMap.end())
 return (int)I-second;
@@ -369,33 +370,33 @@
   return insertValue(V);
 }
 
-int SlotCalculator::getOrCreateSlot(const Type* T) {
-  int SlotNo = getSlot(T);// Check to see if it's already in!
-  if (SlotNo != -1) return SlotNo;
-  return insertType(T);
-}
-
-int SlotCalculator::insertValue(const Value *D, bool dontIgnore) {
-  assert(D  Can't insert a null value!);
-  assert(getSlot(D) == -1  Value is already in the table!);
+int SlotCalculator::insertValue(const Value *V, bool dontIgnore) {
+  assert(V  Can't insert a null value!);
+  assert(getSlot(V) == -1  Value is already in the table!);
 
   // If this node does not contribute to a plane, or if the node has a
   // name and we don't want names, then ignore the silly node... Note that 
types
   // do need slot numbers so that we can keep track of where other values land.
   //
-  if (!dontIgnore)   // Don't ignore nonignorables!
-if (D-getType() == Type::VoidTy ) { // Ignore void type nodes
-  SC_DEBUG(ignored value   *D  \n);
+  if (!dontIgnore)  // Don't ignore nonignorables!
+if (V-getType() == Type::VoidTy) { // Ignore void type nodes
+  SC_DEBUG(ignored value   *V  \n);
   return -1;  // We do need types unconditionally though
 }
 
   // Okay, everything is happy, actually insert the silly value now...
-  return doInsertValue(D);
+  return doInsertValue(V);
+}
+
+int SlotCalculator::getOrCreateTypeSlot(const Type* T) {
+  int SlotNo = getTypeSlot(T);// Check to see if it's already in!
+  if (SlotNo != -1) return SlotNo;
+  return insertType(T);
 }
 
 int SlotCalculator::insertType(const Type *Ty, bool dontIgnore) {
   assert(Ty  Can't insert a null type!);
-  assert(getSlot(Ty) == -1  Type is already in the table!);
+  assert(getTypeSlot(Ty) == -1  Type is already in the table!);
 
   // Insert the current type before any subtypes.  This is important because
   // recursive types elements are inserted in a bottom up order.  Changing
@@ -414,7 +415,7 @@
 if (*I != Ty) {
   const Type *SubTy = *I;
   // If we haven't seen this sub type before, add it to our type table!
-  if (getSlot(SubTy) == -1) {
+  if (getTypeSlot(SubTy) == -1) {
 SC_DEBUG(  Inserting subtype:   SubTy-getDescription()  \n);
 doInsertType(SubTy);
 SC_DEBUG(  Inserted subtype:   SubTy-getDescription()  \n);
@@ -436,7 +437,7 @@
   //  llvm_cerr 

[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.85 - 1.86
SlotCalculator.h updated: 1.30 - 1.31
---
Log message:

remove dead 'dontIgnore' flag for insertType


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

 SlotCalculator.cpp |   22 +++---
 SlotCalculator.h   |2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.85 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.86
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.85Fri Feb  9 22:15:40 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:17:41 2007
@@ -51,17 +51,17 @@
   // Reader.h which uses them directly to extract values of these types.
   SC_DEBUG(Inserting primitive types:\n);
 // See WellKnownTypeSlots in Reader.h
-  insertType(Type::VoidTy,   true); // 0: VoidTySlot
-  insertType(Type::FloatTy,  true); // 1: FloatTySlot
-  insertType(Type::DoubleTy, true); // 2: DoubleTySlot
-  insertType(Type::LabelTy,  true); // 3: LabelTySlot
+  insertType(Type::VoidTy  ); // 0: VoidTySlot
+  insertType(Type::FloatTy ); // 1: FloatTySlot
+  insertType(Type::DoubleTy); // 2: DoubleTySlot
+  insertType(Type::LabelTy ); // 3: LabelTySlot
   assert(TypeMap.size() == Type::FirstDerivedTyID Invalid primitive 
insert);
   // Above here *must* correspond 1:1 with the primitive types.
-  insertType(Type::Int1Ty,   true); // 4: BoolTySlot
-  insertType(Type::Int8Ty,   true); // 5: Int8TySlot
-  insertType(Type::Int16Ty,  true); // 6: Int16TySlot
-  insertType(Type::Int32Ty,  true); // 7: Int32TySlot
-  insertType(Type::Int64Ty,  true); // 8: Int64TySlot
+  insertType(Type::Int1Ty  ); // 4: BoolTySlot
+  insertType(Type::Int8Ty  ); // 5: Int8TySlot
+  insertType(Type::Int16Ty ); // 6: Int16TySlot
+  insertType(Type::Int32Ty ); // 7: Int32TySlot
+  insertType(Type::Int64Ty ); // 8: Int64TySlot
 }
 
 SlotCalculator::SlotCalculator(const Module *M ) {
@@ -394,7 +394,7 @@
   return insertType(T);
 }
 
-int SlotCalculator::insertType(const Type *Ty, bool dontIgnore) {
+int SlotCalculator::insertType(const Type *Ty) {
   assert(Ty  Can't insert a null type!);
   assert(getTypeSlot(Ty) == -1  Type is already in the table!);
 
@@ -440,7 +440,7 @@
 int ValSlot = getTypeSlot(Typ);
 if (ValSlot == -1) {// Have we already entered this type?
   // Nope, this is the first we have seen the type, process it.
-  ValSlot = insertType(Typ, true);
+  ValSlot = insertType(Typ);
   assert(ValSlot != -1  ProcessType returned -1 for a type?);
 }
 Ty = (unsigned)ValSlot;


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.30 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.31
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.30  Fri Feb  9 22:15:40 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:17:41 2007
@@ -123,7 +123,7 @@
   // because of the IgnoreNamedNodes flag.
   //
   int insertValue(const Value *D, bool dontIgnore = false);
-  int insertType(const Type *T, bool dontIgnore = false);
+  int insertType(const Type *T);
 
   // doInsertValue - Small helper function to be called only be insertVal.
   int doInsertValue(const Value *V);



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.86 - 1.87
SlotCalculator.h updated: 1.31 - 1.32
---
Log message:

insertvalue's second operand is always false


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

 SlotCalculator.cpp |   16 ++--
 SlotCalculator.h   |2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.86 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.87
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.86Fri Feb  9 22:17:41 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:19:31 2007
@@ -370,19 +370,15 @@
   return insertValue(V);
 }
 
-int SlotCalculator::insertValue(const Value *V, bool dontIgnore) {
+int SlotCalculator::insertValue(const Value *V) {
   assert(V  Can't insert a null value!);
   assert(getSlot(V) == -1  Value is already in the table!);
 
-  // If this node does not contribute to a plane, or if the node has a
-  // name and we don't want names, then ignore the silly node... Note that 
types
-  // do need slot numbers so that we can keep track of where other values land.
-  //
-  if (!dontIgnore)  // Don't ignore nonignorables!
-if (V-getType() == Type::VoidTy) { // Ignore void type nodes
-  SC_DEBUG(ignored value   *V  \n);
-  return -1;  // We do need types unconditionally though
-}
+  // If this node does not contribute to a plane, ignore the node.
+  if (V-getType() == Type::VoidTy) { // Ignore void type nodes
+SC_DEBUG(ignored value   *V  \n);
+return -1;
+  }
 
   // Okay, everything is happy, actually insert the silly value now...
   return doInsertValue(V);


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.31 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.32
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.31  Fri Feb  9 22:17:41 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:19:31 2007
@@ -122,7 +122,7 @@
   // slot that it occupies, or -1 if the declaration is to be ignored
   // because of the IgnoreNamedNodes flag.
   //
-  int insertValue(const Value *D, bool dontIgnore = false);
+  int insertValue(const Value *V);
   int insertType(const Type *T);
 
   // doInsertValue - Small helper function to be called only be insertVal.



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.88 - 1.89
---
Log message:

merge insertValue into its single caller, eliminate some redundant checks.


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

 SlotCalculator.cpp |   13 +
 1 files changed, 1 insertion(+), 12 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.88 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.89
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.88Fri Feb  9 22:22:30 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:25:02 2007
@@ -367,19 +367,8 @@
   }
 }
 
-  return insertValue(V);
-}
-
-int SlotCalculator::insertValue(const Value *V) {
-  assert(V  Can't insert a null value!);
-  assert(getSlot(V) == -1  Value is already in the table!);
-
-  // If this node does not contribute to a plane, ignore the node.
   const Type *Typ = V-getType();
-  if (Typ == Type::VoidTy) { // Ignore void type nodes
-SC_DEBUG(ignored value   *V  \n);
-return -1;
-  }
+  assert(Typ != Type::VoidTy  Can't handle voidty);
 
   unsigned Ty;
   



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.89 - 1.90
SlotCalculator.h updated: 1.33 - 1.34
---
Log message:

inline hasNullValue, rename some variables, simplify some code.


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

 SlotCalculator.cpp |   53 -
 SlotCalculator.h   |1 -
 2 files changed, 24 insertions(+), 30 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.89 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.90
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.89Fri Feb  9 22:25:02 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:29:03 2007
@@ -314,11 +314,6 @@
   SC_DEBUG(end purgeFunction!\n);
 }
 
-static inline bool hasNullValue(const Type *Ty) {
-  return Ty != Type::LabelTy  Ty != Type::VoidTy  !isaOpaqueType(Ty);
-}
-
-
 int SlotCalculator::getSlot(const Value *V) const {
   std::mapconst Value*, unsigned::const_iterator I = NodeMap.find(V);
   if (I != NodeMap.end())
@@ -336,7 +331,8 @@
 }
 
 int SlotCalculator::getOrCreateSlot(const Value *V) {
-  if (V-getType() == Type::VoidTy) return -1;
+  const Type *Ty = V-getType();
+  if (Ty == Type::VoidTy) return -1;
 
   int SlotNo = getSlot(V);// Check to see if it's already in!
   if (SlotNo != -1) return SlotNo;
@@ -367,43 +363,42 @@
   }
 }
 
-  const Type *Typ = V-getType();
-  assert(Typ != Type::VoidTy  Can't handle voidty);
-
-  unsigned Ty;
-  
-  if (Typ-isDerivedType()) {
-int ValSlot = getTypeSlot(Typ);
+  unsigned TyPlane;
+  if (Ty-isDerivedType()) {
+int ValSlot = getTypeSlot(Ty);
 if (ValSlot == -1) {// Have we already entered this type?
   // Nope, this is the first we have seen the type, process it.
-  ValSlot = insertType(Typ);
+  ValSlot = insertType(Ty);
   assert(ValSlot != -1  ProcessType returned -1 for a type?);
 }
-Ty = (unsigned)ValSlot;
+TyPlane = (unsigned)ValSlot;
   } else {
-Ty = Typ-getTypeID();
+TyPlane = Ty-getTypeID();
   }
   
-  if (Table.size() = Ty)// Make sure we have the type plane allocated...
-Table.resize(Ty+1, TypePlane());
+  if (Table.size() = TyPlane)// Make sure we have the type plane 
allocated.
+Table.resize(TyPlane+1, TypePlane());
   
   // If this is the first value to get inserted into the type plane, make sure
-  // to insert the implicit null value...
-  if (Table[Ty].empty()  hasNullValue(Typ)) {
-Value *ZeroInitializer = Constant::getNullValue(Typ);
-
-// If we are pushing zeroinit, it will be handled below.
-if (V != ZeroInitializer) {
-  Table[Ty].push_back(ZeroInitializer);
-  NodeMap[ZeroInitializer] = 0;
+  // to insert the implicit null value.
+  if (Table[TyPlane].empty()) {
+// Label's and opaque types can't have a null value.
+if (Ty != Type::LabelTy  !isaOpaqueType(Ty)) {
+  Value *ZeroInitializer = Constant::getNullValue(Ty);
+  
+  // If we are pushing zeroinit, it will be handled below.
+  if (V != ZeroInitializer) {
+Table[TyPlane].push_back(ZeroInitializer);
+NodeMap[ZeroInitializer] = 0;
+  }
 }
   }
   
   // Insert node into table and NodeMap...
-  unsigned DestSlot = NodeMap[V] = Table[Ty].size();
-  Table[Ty].push_back(V);
+  unsigned DestSlot = NodeMap[V] = Table[TyPlane].size();
+  Table[TyPlane].push_back(V);
   
-  SC_DEBUG(  Inserting value [  Ty  ] =   *V   slot= 
+  SC_DEBUG(  Inserting value [  TyPlane  ] =   *V   slot= 
DestSlot   [);
   // G = Global, C = Constant, T = Type, F = Function, o = other
   SC_DEBUG((isaGlobalVariable(V) ? G : (isaConstant(V) ? C :


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.33 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.34
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.33  Fri Feb  9 22:22:30 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:29:03 2007
@@ -122,7 +122,6 @@
   // slot that it occupies, or -1 if the declaration is to be ignored
   // because of the IgnoreNamedNodes flag.
   //
-  int insertValue(const Value *V);
   int insertType(const Type *T);
 
   // doInsertValue - Small helper function to be called only be insertVal.



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.90 - 1.91
---
Log message:

only one client of getOrCreateSlot can pass a void typed value.  Check type
there.


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

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


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.90 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.91
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.90Fri Feb  9 22:29:03 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:31:52 2007
@@ -261,7 +261,8 @@
   for (Function::const_iterator BB = F-begin(), E = F-end(); BB != E; ++BB) {
 getOrCreateSlot(BB);
 for (BasicBlock::const_iterator I = BB-begin(), E = BB-end(); I!=E; ++I) 
{
-  getOrCreateSlot(I);
+  if (I-getType() != Type::VoidTy)
+getOrCreateSlot(I);
 }
   }
 
@@ -332,7 +333,7 @@
 
 int SlotCalculator::getOrCreateSlot(const Value *V) {
   const Type *Ty = V-getType();
-  if (Ty == Type::VoidTy) return -1;
+  assert(Ty != Type::VoidTy  Can't insert void values!);
 
   int SlotNo = getSlot(V);// Check to see if it's already in!
   if (SlotNo != -1) return SlotNo;



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.92 - 1.93
SlotCalculator.h updated: 1.35 - 1.36
---
Log message:

Remove dead ctor


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

 SlotCalculator.cpp |   11 ---
 SlotCalculator.h   |2 --
 2 files changed, 13 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.92 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.93
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.92Fri Feb  9 22:36:10 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:38:34 2007
@@ -73,17 +73,6 @@
   processModule();
 }
 
-SlotCalculator::SlotCalculator(const Function *M ) {
-  TheModule = M ? M-getParent() : 0;
-
-  insertPrimitives();
-
-  if (TheModule == 0) return;   // Empty table...
-
-  processModule();  // Process module level stuff
-  incorporateFunction(M);   // Start out in incorporated state
-}
-
 // processModule - Process all of the module level function declarations and
 // types that are available.
 //


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.35 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.36
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.35  Fri Feb  9 22:36:10 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:38:34 2007
@@ -61,8 +61,6 @@
   void operator=(const SlotCalculator );  // DO NOT IMPLEMENT
 public:
   SlotCalculator(const Module *M);
-  // Start out in incorp state
-  SlotCalculator(const Function *F);
 
   /// getSlot - Return the slot number of the specified value in it's type
   /// plane.  This returns  0 on error!



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.93 - 1.94
---
Log message:

simplify some logic, reduce nesting


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

 SlotCalculator.cpp |   45 -
 1 files changed, 20 insertions(+), 25 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.93 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.94
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.93Fri Feb  9 22:38:34 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:42:30 2007
@@ -63,7 +63,7 @@
   insertType(Type::Int64Ty ); // 8: Int64TySlot
 }
 
-SlotCalculator::SlotCalculator(const Module *M ) {
+SlotCalculator::SlotCalculator(const Module *M) {
   ModuleTypeLevel = 0;
   TheModule = M;
 
@@ -297,37 +297,32 @@
 }
 
 int SlotCalculator::getOrCreateSlot(const Value *V) {
-  const Type *Ty = V-getType();
-  assert(Ty != Type::VoidTy  Can't insert void values!);
-
   int SlotNo = getSlot(V);// Check to see if it's already in!
   if (SlotNo != -1) return SlotNo;
 
-  if (const GlobalValue *GV = dyn_castGlobalValue(V))
-assert(GV-getParent() != 0  Global not embedded into a module!);
-
-  if (!isaGlobalValue(V))  // Initializers for globals are handled explicitly
-if (const Constant *C = dyn_castConstant(V)) {
-
+  const Type *Ty = V-getType();
+  assert(Ty != Type::VoidTy  Can't insert void values!);
+  
+  if (const Constant *C = dyn_castConstant(V)) {
+if (isaGlobalValue(C)) {
+  // Initializers for globals are handled explicitly elsewhere.
+} else if (isaConstantArray(C)  castConstantArray(C)-isString()) {
   // Do not index the characters that make up constant strings.  We emit
   // constant strings as special entities that don't require their
   // individual characters to be emitted.
-  if (!isaConstantArray(C) || !castConstantArray(C)-isString()) {
-// This makes sure that if a constant has uses (for example an array of
-// const ints), that they are inserted also.
-//
-for (User::const_op_iterator I = C-op_begin(), E = C-op_end();
- I != E; ++I)
-  getOrCreateSlot(*I);
-  } else {
-assert(ModuleLevel.empty() 
-   How can a constant string be directly accessed in a 
function?);
-// Otherwise, if we are emitting a bytecode file and this IS a string,
-// remember it.
-if (!C-isNullValue())
-  ConstantStrings.push_back(castConstantArray(C));
-  }
+  assert(ModuleLevel.empty() 
+ How can a constant string be directly accessed in a function?);
+  // Otherwise, this IS a string: remember it.
+  if (!C-isNullValue())
+ConstantStrings.push_back(castConstantArray(C));
+} else {
+  // This makes sure that if a constant has uses (for example an array of
+  // const ints), that they are inserted also.
+  for (User::const_op_iterator I = C-op_begin(), E = C-op_end();
+   I != E; ++I)
+getOrCreateSlot(*I);
 }
+  }
 
   unsigned TyPlane;
   if (Ty-isDerivedType()) {



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.94 - 1.95
SlotCalculator.h updated: 1.36 - 1.37
---
Log message:

simplify code.


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

 SlotCalculator.cpp |   40 ++--
 SlotCalculator.h   |6 +++---
 2 files changed, 13 insertions(+), 33 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.94 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.95
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.94Fri Feb  9 22:42:30 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:47:51 2007
@@ -64,12 +64,11 @@
 }
 
 SlotCalculator::SlotCalculator(const Module *M) {
+  assert(M);
   ModuleTypeLevel = 0;
   TheModule = M;
 
   insertPrimitives();
-
-  if (M == 0) return;   // Empty table...
   processModule();
 }
 
@@ -324,19 +323,7 @@
 }
   }
 
-  unsigned TyPlane;
-  if (Ty-isDerivedType()) {
-int ValSlot = getTypeSlot(Ty);
-if (ValSlot == -1) {// Have we already entered this type?
-  // Nope, this is the first we have seen the type, process it.
-  ValSlot = insertType(Ty);
-  assert(ValSlot != -1  ProcessType returned -1 for a type?);
-}
-TyPlane = (unsigned)ValSlot;
-  } else {
-TyPlane = Ty-getTypeID();
-  }
-  
+  unsigned TyPlane = getOrCreateTypeSlot(Ty);
   if (Table.size() = TyPlane)// Make sure we have the type plane 
allocated.
 Table.resize(TyPlane+1, TypePlane());
   
@@ -369,13 +356,13 @@
 }
 
 
-int SlotCalculator::getOrCreateTypeSlot(const Type* T) {
+unsigned SlotCalculator::getOrCreateTypeSlot(const Type* T) {
   int SlotNo = getTypeSlot(T);// Check to see if it's already in!
-  if (SlotNo != -1) return SlotNo;
+  if (SlotNo != -1) return (unsigned)SlotNo;
   return insertType(T);
 }
 
-int SlotCalculator::insertType(const Type *Ty) {
+unsigned SlotCalculator::insertType(const Type *Ty) {
   assert(Ty  Can't insert a null type!);
   assert(getTypeSlot(Ty) == -1  Type is already in the table!);
 
@@ -385,7 +372,7 @@
   //
   //global { \2 * } { { \2 }* null }
   //
-  int ResultSlot = doInsertType(Ty);
+  unsigned ResultSlot = doInsertType(Ty);
   SC_DEBUG(  Inserted type:   Ty-getDescription()   slot= 
ResultSlot  \n);
 
@@ -394,13 +381,8 @@
   for (po_iteratorconst Type* I = po_begin(Ty), E = po_end(Ty);
I != E; ++I) {
 if (*I != Ty) {
-  const Type *SubTy = *I;
   // If we haven't seen this sub type before, add it to our type table!
-  if (getTypeSlot(SubTy) == -1) {
-SC_DEBUG(  Inserting subtype:   SubTy-getDescription()  \n);
-doInsertType(SubTy);
-SC_DEBUG(  Inserted subtype:   SubTy-getDescription()  \n);
-  }
+  getOrCreateTypeSlot(*I);
 }
   }
   return ResultSlot;
@@ -410,12 +392,10 @@
 // doInsertType - This is a small helper function to be called only
 // be insertType.
 //
-int SlotCalculator::doInsertType(const Type *Ty) {
-
-  // Insert node into table and NodeMap...
+unsigned SlotCalculator::doInsertType(const Type *Ty) {
+  // Insert into TypeMap.
   unsigned DestSlot = TypeMap[Ty] = Types.size();
   Types.push_back(Ty);
-
   SC_DEBUG(  Inserting type [  DestSlot  ] =   *Ty  \n );
-  return (int)DestSlot;
+  return DestSlot;
 }


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.36 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.37
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.36  Fri Feb  9 22:38:34 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:47:51 2007
@@ -109,16 +109,16 @@
   // they are ignored.
   //
   int getOrCreateSlot(const Value *V);
-  int getOrCreateTypeSlot(const Type *T);
+  unsigned getOrCreateTypeSlot(const Type *T);
 
   // insertValue - Insert a value into the value table... Return the
   // slot that it occupies, or -1 if the declaration is to be ignored
   // because of the IgnoreNamedNodes flag.
   //
-  int insertType(const Type *T);
+  unsigned insertType(const Type *T);
 
   // doInsertValue - Small helper function to be called only be insertVal.
-  int doInsertType(const Type *T);
+  unsigned doInsertType(const Type *T);
 
   // processModule - Process all of the module level function declarations and
   // types that are available.



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.95 - 1.96
SlotCalculator.h updated: 1.37 - 1.38
---
Log message:

refactor callers of insertType.  inline insertType into its one remaining 
caller.


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

 SlotCalculator.cpp |   28 +++-
 SlotCalculator.h   |6 --
 2 files changed, 11 insertions(+), 23 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.95 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.96
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.95Fri Feb  9 22:47:51 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:51:21 2007
@@ -50,17 +50,17 @@
   // Reader.h which uses them directly to extract values of these types.
   SC_DEBUG(Inserting primitive types:\n);
 // See WellKnownTypeSlots in Reader.h
-  insertType(Type::VoidTy  ); // 0: VoidTySlot
-  insertType(Type::FloatTy ); // 1: FloatTySlot
-  insertType(Type::DoubleTy); // 2: DoubleTySlot
-  insertType(Type::LabelTy ); // 3: LabelTySlot
+  getOrCreateTypeSlot(Type::VoidTy  ); // 0: VoidTySlot
+  getOrCreateTypeSlot(Type::FloatTy ); // 1: FloatTySlot
+  getOrCreateTypeSlot(Type::DoubleTy); // 2: DoubleTySlot
+  getOrCreateTypeSlot(Type::LabelTy ); // 3: LabelTySlot
   assert(TypeMap.size() == Type::FirstDerivedTyID Invalid primitive 
insert);
   // Above here *must* correspond 1:1 with the primitive types.
-  insertType(Type::Int1Ty  ); // 4: BoolTySlot
-  insertType(Type::Int8Ty  ); // 5: Int8TySlot
-  insertType(Type::Int16Ty ); // 6: Int16TySlot
-  insertType(Type::Int32Ty ); // 7: Int32TySlot
-  insertType(Type::Int64Ty ); // 8: Int64TySlot
+  getOrCreateTypeSlot(Type::Int1Ty  ); // 4: BoolTySlot
+  getOrCreateTypeSlot(Type::Int8Ty  ); // 5: Int8TySlot
+  getOrCreateTypeSlot(Type::Int16Ty ); // 6: Int16TySlot
+  getOrCreateTypeSlot(Type::Int32Ty ); // 7: Int32TySlot
+  getOrCreateTypeSlot(Type::Int64Ty ); // 8: Int64TySlot
 }
 
 SlotCalculator::SlotCalculator(const Module *M) {
@@ -356,15 +356,9 @@
 }
 
 
-unsigned SlotCalculator::getOrCreateTypeSlot(const Type* T) {
-  int SlotNo = getTypeSlot(T);// Check to see if it's already in!
+unsigned SlotCalculator::getOrCreateTypeSlot(const Type *Ty) {
+  int SlotNo = getTypeSlot(Ty);// Check to see if it's already in!
   if (SlotNo != -1) return (unsigned)SlotNo;
-  return insertType(T);
-}
-
-unsigned SlotCalculator::insertType(const Type *Ty) {
-  assert(Ty  Can't insert a null type!);
-  assert(getTypeSlot(Ty) == -1  Type is already in the table!);
 
   // Insert the current type before any subtypes.  This is important because
   // recursive types elements are inserted in a bottom up order.  Changing


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.37 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.38
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.37  Fri Feb  9 22:47:51 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:51:21 2007
@@ -111,12 +111,6 @@
   int getOrCreateSlot(const Value *V);
   unsigned getOrCreateTypeSlot(const Type *T);
 
-  // insertValue - Insert a value into the value table... Return the
-  // slot that it occupies, or -1 if the declaration is to be ignored
-  // because of the IgnoreNamedNodes flag.
-  //
-  unsigned insertType(const Type *T);
-
   // doInsertValue - Small helper function to be called only be insertVal.
   unsigned doInsertType(const Type *T);
 



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.96 - 1.97
SlotCalculator.h updated: 1.38 - 1.39
---
Log message:

rename getOrCreateSlot - CreateSlotIfNeeded.  Noone cares about the retval


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

 SlotCalculator.cpp |   31 +--
 SlotCalculator.h   |6 +-
 2 files changed, 14 insertions(+), 23 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.96 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.97
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.96Fri Feb  9 22:51:21 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:54:01 2007
@@ -82,21 +82,21 @@
   //
   for (Module::const_global_iterator I = TheModule-global_begin(),
  E = TheModule-global_end(); I != E; ++I)
-getOrCreateSlot(I);
+CreateSlotIfNeeded(I);
 
   // Scavenge the types out of the functions, then add the functions themselves
   // to the value table...
   //
   for (Module::const_iterator I = TheModule-begin(), E = TheModule-end();
I != E; ++I)
-getOrCreateSlot(I);
+CreateSlotIfNeeded(I);
 
   // Add all of the module level constants used as initializers
   //
   for (Module::const_global_iterator I = TheModule-global_begin(),
  E = TheModule-global_end(); I != E; ++I)
 if (I-hasInitializer())
-  getOrCreateSlot(I-getInitializer());
+  CreateSlotIfNeeded(I-getInitializer());
 
   // Now that all global constants have been added, rearrange constant planes
   // that contain constant strings so that the strings occur at the start of 
the
@@ -137,7 +137,7 @@
  OI != E; ++OI) {
   if ((isaConstant(*OI)  !isaGlobalValue(*OI)) ||
   isaInlineAsm(*OI))
-getOrCreateSlot(*OI);
+CreateSlotIfNeeded(*OI);
 }
 getOrCreateTypeSlot(I-getType());
   }
@@ -199,7 +199,7 @@
 void SlotCalculator::processValueSymbolTable(const ValueSymbolTable *VST) {
   for (ValueSymbolTable::const_iterator VI = VST-begin(), VE = VST-end(); 
VI != VE; ++VI)
-getOrCreateSlot(VI-second);
+CreateSlotIfNeeded(VI-second);
 }
 
 void SlotCalculator::incorporateFunction(const Function *F) {
@@ -217,16 +217,16 @@
   // Iterate over function arguments, adding them to the value table...
   for(Function::const_arg_iterator I = F-arg_begin(), E = F-arg_end();
   I != E; ++I)
-getOrCreateSlot(I);
+CreateSlotIfNeeded(I);
 
   SC_DEBUG(Inserting Instructions:\n);
 
   // Add all of the instructions to the type planes...
   for (Function::const_iterator BB = F-begin(), E = F-end(); BB != E; ++BB) {
-getOrCreateSlot(BB);
+CreateSlotIfNeeded(BB);
 for (BasicBlock::const_iterator I = BB-begin(), E = BB-end(); I!=E; ++I) 
{
   if (I-getType() != Type::VoidTy)
-getOrCreateSlot(I);
+CreateSlotIfNeeded(I);
 }
   }
 
@@ -295,9 +295,9 @@
   return -1;
 }
 
-int SlotCalculator::getOrCreateSlot(const Value *V) {
-  int SlotNo = getSlot(V);// Check to see if it's already in!
-  if (SlotNo != -1) return SlotNo;
+void SlotCalculator::CreateSlotIfNeeded(const Value *V) {
+  // Check to see if it's already in!
+  if (getSlot(V) != -1) return;
 
   const Type *Ty = V-getType();
   assert(Ty != Type::VoidTy  Can't insert void values!);
@@ -319,7 +319,7 @@
   // const ints), that they are inserted also.
   for (User::const_op_iterator I = C-op_begin(), E = C-op_end();
I != E; ++I)
-getOrCreateSlot(*I);
+CreateSlotIfNeeded(*I);
 }
   }
 
@@ -347,12 +347,7 @@
   Table[TyPlane].push_back(V);
   
   SC_DEBUG(  Inserting value [  TyPlane  ] =   *V   slot= 
-   DestSlot   [);
-  // G = Global, C = Constant, T = Type, F = Function, o = other
-  SC_DEBUG((isaGlobalVariable(V) ? G : (isaConstant(V) ? C :
-(isaFunction(V) ? F : o;
-  SC_DEBUG(]\n);
-  return (int)DestSlot;
+   DestSlot  \n);
 }
 
 


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.38 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.39
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.38  Fri Feb  9 22:51:21 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 22:54:01 2007
@@ -104,11 +104,7 @@
   string_iterator string_end() const   { return ConstantStrings.end(); }
 
 private:
-  // getOrCreateSlot - Values can be crammed into here at will... if
-  // they haven't been inserted already, they get inserted, otherwise
-  // they are ignored.
-  //
-  int getOrCreateSlot(const Value *V);
+  void CreateSlotIfNeeded(const Value *V);
   unsigned getOrCreateTypeSlot(const Type *T);
 
   // doInsertValue - Small helper function to be called only be insertVal.



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.97 - 1.98
---
Log message:

simplify and speed up recursive type processing.


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

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


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.97 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.98
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.97Fri Feb  9 22:54:01 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 22:57:36 2007
@@ -362,16 +362,14 @@
   //global { \2 * } { { \2 }* null }
   //
   unsigned ResultSlot = doInsertType(Ty);
-  SC_DEBUG(  Inserted type:   Ty-getDescription()   slot= 
-   ResultSlot  \n);
 
   // Loop over any contained types in the definition... in post
   // order.
   for (po_iteratorconst Type* I = po_begin(Ty), E = po_end(Ty);
I != E; ++I) {
-if (*I != Ty) {
+if (*I != Ty  !TypeMap.count(*I)) {
   // If we haven't seen this sub type before, add it to our type table!
-  getOrCreateTypeSlot(*I);
+  doInsertType(*I);
 }
   }
   return ResultSlot;



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.98 - 1.99
SlotCalculator.h updated: 1.39 - 1.40
---
Log message:

simplify getOrCreateTypeSlot, eliminat doInsertType.  Eliminate post-order 
iteration stuff.


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

 SlotCalculator.cpp |   39 ++-
 SlotCalculator.h   |3 ---
 2 files changed, 10 insertions(+), 32 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.98 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.99
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.98Fri Feb  9 22:57:36 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:02:50 2007
@@ -24,7 +24,6 @@
 #include llvm/TypeSymbolTable.h
 #include llvm/Type.h
 #include llvm/ValueSymbolTable.h
-#include llvm/ADT/PostOrderIterator.h
 #include llvm/ADT/STLExtras.h
 #include algorithm
 #include functional
@@ -355,34 +354,16 @@
   int SlotNo = getTypeSlot(Ty);// Check to see if it's already in!
   if (SlotNo != -1) return (unsigned)SlotNo;
 
-  // Insert the current type before any subtypes.  This is important because
-  // recursive types elements are inserted in a bottom up order.  Changing
-  // this here can break things.  For example:
-  //
-  //global { \2 * } { { \2 }* null }
-  //
-  unsigned ResultSlot = doInsertType(Ty);
-
-  // Loop over any contained types in the definition... in post
-  // order.
-  for (po_iteratorconst Type* I = po_begin(Ty), E = po_end(Ty);
-   I != E; ++I) {
-if (*I != Ty  !TypeMap.count(*I)) {
-  // If we haven't seen this sub type before, add it to our type table!
-  doInsertType(*I);
-}
-  }
-  return ResultSlot;
-}
-
-
-// doInsertType - This is a small helper function to be called only
-// be insertType.
-//
-unsigned SlotCalculator::doInsertType(const Type *Ty) {
   // Insert into TypeMap.
-  unsigned DestSlot = TypeMap[Ty] = Types.size();
+  unsigned ResultSlot = TypeMap[Ty] = Types.size();
   Types.push_back(Ty);
-  SC_DEBUG(  Inserting type [  DestSlot  ] =   *Ty  \n );
-  return DestSlot;
+  SC_DEBUG(  Inserting type [  ResultSlot  ] =   *Ty  \n );
+  
+  // Loop over any contained types in the definition, ensuring they are also
+  // inserted.
+  for (Type::subtype_iterator I = Ty-subtype_begin(), E = Ty-subtype_end();
+   I != E; ++I)
+getOrCreateTypeSlot(*I);
+
+  return ResultSlot;
 }


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.39 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.40
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.39  Fri Feb  9 22:54:01 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 23:02:50 2007
@@ -107,9 +107,6 @@
   void CreateSlotIfNeeded(const Value *V);
   unsigned getOrCreateTypeSlot(const Type *T);
 
-  // doInsertValue - Small helper function to be called only be insertVal.
-  unsigned doInsertType(const Type *T);
-
   // processModule - Process all of the module level function declarations and
   // types that are available.
   //



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.99 - 1.100
SlotCalculator.h updated: 1.40 - 1.41
Writer.cpp updated: 1.160 - 1.161
---
Log message:

getSlot can never fail.  Make it assert internally, eliminate checks in
clients.  Same for getTypeSlot.


---
Diffs of the changes:  (+32 -63)

 SlotCalculator.cpp |   20 +-
 SlotCalculator.h   |2 -
 Writer.cpp |   73 -
 3 files changed, 32 insertions(+), 63 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.99 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.100
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.99Fri Feb  9 23:02:50 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:13:03 2007
@@ -278,25 +278,21 @@
   SC_DEBUG(end purgeFunction!\n);
 }
 
-int SlotCalculator::getSlot(const Value *V) const {
+unsigned SlotCalculator::getSlot(const Value *V) const {
   std::mapconst Value*, unsigned::const_iterator I = NodeMap.find(V);
-  if (I != NodeMap.end())
-return (int)I-second;
-
-  return -1;
+  assert(I != NodeMap.end()  Value not in slotcalculator!);
+  return (int)I-second;
 }
 
 int SlotCalculator::getTypeSlot(const Type*T) const {
   std::mapconst Type*, unsigned::const_iterator I = TypeMap.find(T);
-  if (I != TypeMap.end())
-return (int)I-second;
-
-  return -1;
+  assert(I != TypeMap.end()  Type not in slotcalc!);
+  return (int)I-second;
 }
 
 void SlotCalculator::CreateSlotIfNeeded(const Value *V) {
   // Check to see if it's already in!
-  if (getSlot(V) != -1) return;
+  if (NodeMap.count(V)) return;
 
   const Type *Ty = V-getType();
   assert(Ty != Type::VoidTy  Can't insert void values!);
@@ -351,8 +347,8 @@
 
 
 unsigned SlotCalculator::getOrCreateTypeSlot(const Type *Ty) {
-  int SlotNo = getTypeSlot(Ty);// Check to see if it's already in!
-  if (SlotNo != -1) return (unsigned)SlotNo;
+  std::mapconst Type*, unsigned::iterator TyIt = TypeMap.find(Ty);
+  if (TyIt != TypeMap.end()) return TyIt-second;
 
   // Insert into TypeMap.
   unsigned ResultSlot = TypeMap[Ty] = Types.size();


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.40 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.41
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.40  Fri Feb  9 23:02:50 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 23:13:03 2007
@@ -65,7 +65,7 @@
   /// getSlot - Return the slot number of the specified value in it's type
   /// plane.  This returns  0 on error!
   ///
-  int getSlot(const Value *V) const;
+  unsigned getSlot(const Value *V) const;
   int getTypeSlot(const Type* T) const;
 
   inline unsigned getNumPlanes() const { return Table.size(); }


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.160 
llvm/lib/Bytecode/Writer/Writer.cpp:1.161
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.160   Fri Feb  9 22:15:40 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Feb  9 23:13:03 2007
@@ -306,11 +306,10 @@
 output_vbr(CE-getOpcode());  // Put out the CE op code
 
 for (User::const_op_iterator OI = CE-op_begin(); OI != CE-op_end(); 
++OI){
-  int Slot = Table.getSlot(*OI);
-  assert(Slot != -1  Unknown constant used in ConstantExpr!!);
-  output_vbr((unsigned)Slot);
+  unsigned Slot = Table.getSlot(*OI);
+  output_vbr(Slot);
   Slot = Table.getTypeSlot((*OI)-getType());
-  output_typeid((unsigned)Slot);
+  output_typeid(Slot);
 }
 if (CE-isCompare())
   output_vbr((unsigned)CE-getPredicate());
@@ -338,33 +337,23 @@
 const ConstantArray *CPA = castConstantArray(CPV);
 assert(!CPA-isString()  Constant strings should be handled 
specially!);
 
-for (unsigned i = 0, e = CPA-getNumOperands(); i != e; ++i) {
-  int Slot = Table.getSlot(CPA-getOperand(i));
-  assert(Slot != -1  Constant used but not available!!);
-  output_vbr((unsigned)Slot);
-}
+for (unsigned i = 0, e = CPA-getNumOperands(); i != e; ++i)
+  output_vbr(Table.getSlot(CPA-getOperand(i)));
 break;
   }
 
   case Type::PackedTyID: {
 const ConstantPacked *CP = castConstantPacked(CPV);
-
-for (unsigned i = 0, e = CP-getNumOperands(); i != e; ++i) {
-  int Slot = Table.getSlot(CP-getOperand(i));
-  assert(Slot != -1  Constant used but not available!!);
-  output_vbr((unsigned)Slot);
-}
+for (unsigned i = 0, e = CP-getNumOperands(); i != e; ++i)
+  output_vbr(Table.getSlot(CP-getOperand(i)));
 break;
   }
 
   case Type::StructTyID: {
 const ConstantStruct *CPS = castConstantStruct(CPV);
 
-for (unsigned i = 0, e = CPS-getNumOperands(); i != e; ++i) {
-  int Slot = Table.getSlot(CPS-getOperand(i));
-  assert(Slot != -1  Constant used but not available!!);
-  output_vbr((unsigned)Slot);
-}
+for (unsigned i = 0, e = 

[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.100 - 1.101
SlotCalculator.h updated: 1.41 - 1.42
Writer.cpp updated: 1.161 - 1.162
---
Log message:

getTypeSlot can never fail


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

 SlotCalculator.cpp |4 +-
 SlotCalculator.h   |2 -
 Writer.cpp |   82 ++---
 3 files changed, 26 insertions(+), 62 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.100 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.101
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.100   Fri Feb  9 23:13:03 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:17:48 2007
@@ -284,10 +284,10 @@
   return (int)I-second;
 }
 
-int SlotCalculator::getTypeSlot(const Type*T) const {
+unsigned SlotCalculator::getTypeSlot(const Type*T) const {
   std::mapconst Type*, unsigned::const_iterator I = TypeMap.find(T);
   assert(I != TypeMap.end()  Type not in slotcalc!);
-  return (int)I-second;
+  return I-second;
 }
 
 void SlotCalculator::CreateSlotIfNeeded(const Value *V) {


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.41 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.42
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.41  Fri Feb  9 23:13:03 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 23:17:48 2007
@@ -66,7 +66,7 @@
   /// plane.  This returns  0 on error!
   ///
   unsigned getSlot(const Value *V) const;
-  int getTypeSlot(const Type* T) const;
+  unsigned getTypeSlot(const Type* T) const;
 
   inline unsigned getNumPlanes() const { return Table.size(); }
   inline unsigned getNumTypes() const { return Types.size(); }


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.161 
llvm/lib/Bytecode/Writer/Writer.cpp:1.162
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.161   Fri Feb  9 23:13:03 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Feb  9 23:17:48 2007
@@ -214,9 +214,7 @@
 break;
   case Type::FunctionTyID: {
 const FunctionType *MT = castFunctionType(T);
-int Slot = Table.getTypeSlot(MT-getReturnType());
-assert(Slot != -1  Type used but not available!!);
-output_typeid((unsigned)Slot);
+output_typeid(Table.getTypeSlot(MT-getReturnType()));
 output_vbr(unsigned(MT-getParamAttrs(0)));
 
 // Output the number of arguments to function (+1 if varargs):
@@ -226,9 +224,7 @@
 FunctionType::param_iterator I = MT-param_begin();
 unsigned Idx = 1;
 for (; I != MT-param_end(); ++I) {
-  Slot = Table.getTypeSlot(*I);
-  assert(Slot != -1  Type used but not available!!);
-  output_typeid((unsigned)Slot);
+  output_typeid(Table.getTypeSlot(*I));
   output_vbr(unsigned(MT-getParamAttrs(Idx)));
   Idx++;
 }
@@ -241,18 +237,14 @@
 
   case Type::ArrayTyID: {
 const ArrayType *AT = castArrayType(T);
-int Slot = Table.getTypeSlot(AT-getElementType());
-assert(Slot != -1  Type used but not available!!);
-output_typeid((unsigned)Slot);
+output_typeid(Table.getTypeSlot(AT-getElementType()));
 output_vbr(AT-getNumElements());
 break;
   }
 
  case Type::PackedTyID: {
 const PackedType *PT = castPackedType(T);
-int Slot = Table.getTypeSlot(PT-getElementType());
-assert(Slot != -1  Type used but not available!!);
-output_typeid((unsigned)Slot);
+output_typeid(Table.getTypeSlot(PT-getElementType()));
 output_vbr(PT-getNumElements());
 break;
   }
@@ -262,9 +254,7 @@
 // Output all of the element types...
 for (StructType::element_iterator I = ST-element_begin(),
E = ST-element_end(); I != E; ++I) {
-  int Slot = Table.getTypeSlot(*I);
-  assert(Slot != -1  Type used but not available!!);
-  output_typeid((unsigned)Slot);
+  output_typeid(Table.getTypeSlot(*I));
 }
 
 // Terminate list with VoidTy
@@ -272,13 +262,9 @@
 break;
   }
 
-  case Type::PointerTyID: {
-const PointerType *PT = castPointerType(T);
-int Slot = Table.getTypeSlot(PT-getElementType());
-assert(Slot != -1  Type used but not available!!);
-output_typeid((unsigned)Slot);
+  case Type::PointerTyID:
+output_typeid(Table.getTypeSlot(castPointerType(T)-getElementType()));
 break;
-  }
 
   case Type::OpaqueTyID:
 // No need to emit anything, just the count of opaque types is enough.
@@ -306,10 +292,8 @@
 output_vbr(CE-getOpcode());  // Put out the CE op code
 
 for (User::const_op_iterator OI = CE-op_begin(); OI != CE-op_end(); 
++OI){
-  unsigned Slot = Table.getSlot(*OI);
-  output_vbr(Slot);
-  Slot = Table.getTypeSlot((*OI)-getType());
-  output_typeid(Slot);
+  output_vbr(Table.getSlot(*OI));
+  output_typeid(Table.getTypeSlot((*OI)-getType()));
 }
 if (CE-isCompare())
   output_vbr((unsigned)CE-getPredicate());
@@ -408,9 +392,7 @@

[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.101 - 1.102
SlotCalculator.h updated: 1.42 - 1.43
---
Log message:

make getSlot/getTypeSlot inline


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

 SlotCalculator.cpp |   12 
 SlotCalculator.h   |   13 +++--
 2 files changed, 11 insertions(+), 14 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.101 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.102
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.101   Fri Feb  9 23:17:48 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:18:35 2007
@@ -278,18 +278,6 @@
   SC_DEBUG(end purgeFunction!\n);
 }
 
-unsigned SlotCalculator::getSlot(const Value *V) const {
-  std::mapconst Value*, unsigned::const_iterator I = NodeMap.find(V);
-  assert(I != NodeMap.end()  Value not in slotcalculator!);
-  return (int)I-second;
-}
-
-unsigned SlotCalculator::getTypeSlot(const Type*T) const {
-  std::mapconst Type*, unsigned::const_iterator I = TypeMap.find(T);
-  assert(I != TypeMap.end()  Type not in slotcalc!);
-  return I-second;
-}
-
 void SlotCalculator::CreateSlotIfNeeded(const Value *V) {
   // Check to see if it's already in!
   if (NodeMap.count(V)) return;


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.42 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.43
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.42  Fri Feb  9 23:17:48 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 23:18:35 2007
@@ -65,8 +65,17 @@
   /// getSlot - Return the slot number of the specified value in it's type
   /// plane.  This returns  0 on error!
   ///
-  unsigned getSlot(const Value *V) const;
-  unsigned getTypeSlot(const Type* T) const;
+  unsigned getSlot(const Value *V) const {
+std::mapconst Value*, unsigned::const_iterator I = NodeMap.find(V);
+assert(I != NodeMap.end()  Value not in slotcalculator!);
+return I-second;
+  }
+  
+  unsigned getTypeSlot(const Type* T) const {
+std::mapconst Type*, unsigned::const_iterator I = TypeMap.find(T);
+assert(I != TypeMap.end()  Type not in slotcalc!);
+return I-second;
+  }
 
   inline unsigned getNumPlanes() const { return Table.size(); }
   inline unsigned getNumTypes() const { return Types.size(); }



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.102 - 1.103
SlotCalculator.h updated: 1.43 - 1.44
---
Log message:

Clone and specialize CreateSlotIfNeeded into CreateFunctionValueSlot to handle
function-local values.  This speeds up bcwriting a small 2.2% (10.384-10.156s
on 447.dealII), but paves the way for more important changes.


---
Diffs of the changes:  (+101 -63)

 SlotCalculator.cpp |  163 -
 SlotCalculator.h   |1 
 2 files changed, 101 insertions(+), 63 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.102 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.103
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.102   Fri Feb  9 23:18:35 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:45:09 2007
@@ -201,34 +201,110 @@
 CreateSlotIfNeeded(VI-second);
 }
 
+void SlotCalculator::CreateSlotIfNeeded(const Value *V) {
+  // Check to see if it's already in!
+  if (NodeMap.count(V)) return;
+
+  const Type *Ty = V-getType();
+  assert(Ty != Type::VoidTy  Can't insert void values!);
+  
+  if (const Constant *C = dyn_castConstant(V)) {
+if (isaGlobalValue(C)) {
+  // Initializers for globals are handled explicitly elsewhere.
+} else if (isaConstantArray(C)  castConstantArray(C)-isString()) {
+  // Do not index the characters that make up constant strings.  We emit
+  // constant strings as special entities that don't require their
+  // individual characters to be emitted.
+  assert(ModuleLevel.empty() 
+ How can a constant string be directly accessed in a function?);
+  // Otherwise, this IS a string: remember it.
+  if (!C-isNullValue())
+ConstantStrings.push_back(castConstantArray(C));
+} else {
+  // This makes sure that if a constant has uses (for example an array of
+  // const ints), that they are inserted also.
+  for (User::const_op_iterator I = C-op_begin(), E = C-op_end();
+   I != E; ++I)
+CreateSlotIfNeeded(*I);
+}
+  }
+
+  unsigned TyPlane = getOrCreateTypeSlot(Ty);
+  if (Table.size() = TyPlane)// Make sure we have the type plane 
allocated.
+Table.resize(TyPlane+1, TypePlane());
+  
+  // If this is the first value to get inserted into the type plane, make sure
+  // to insert the implicit null value.
+  if (Table[TyPlane].empty()) {
+// Label's and opaque types can't have a null value.
+if (Ty != Type::LabelTy  !isaOpaqueType(Ty)) {
+  Value *ZeroInitializer = Constant::getNullValue(Ty);
+  
+  // If we are pushing zeroinit, it will be handled below.
+  if (V != ZeroInitializer) {
+Table[TyPlane].push_back(ZeroInitializer);
+NodeMap[ZeroInitializer] = 0;
+  }
+}
+  }
+  
+  // Insert node into table and NodeMap...
+  NodeMap[V] = Table[TyPlane].size();
+  Table[TyPlane].push_back(V);
+  
+  SC_DEBUG(  Inserting value [  TyPlane  ] =   *V   slot= 
+   NodeMap[V]  \n);
+}
+
+
+unsigned SlotCalculator::getOrCreateTypeSlot(const Type *Ty) {
+  std::mapconst Type*, unsigned::iterator TyIt = TypeMap.find(Ty);
+  if (TyIt != TypeMap.end()) return TyIt-second;
+
+  // Insert into TypeMap.
+  unsigned ResultSlot = TypeMap[Ty] = Types.size();
+  Types.push_back(Ty);
+  SC_DEBUG(  Inserting type [  ResultSlot  ] =   *Ty  \n );
+  
+  // Loop over any contained types in the definition, ensuring they are also
+  // inserted.
+  for (Type::subtype_iterator I = Ty-subtype_begin(), E = Ty-subtype_end();
+   I != E; ++I)
+getOrCreateTypeSlot(*I);
+
+  return ResultSlot;
+}
+
+
+
 void SlotCalculator::incorporateFunction(const Function *F) {
   assert((ModuleLevel.empty() ||
   ModuleTypeLevel == 0)  Module already incorporated!);
-
+  
   SC_DEBUG(begin processFunction!\n);
-
+  
   // Update the ModuleLevel entries to be accurate.
   ModuleLevel.resize(getNumPlanes());
   for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
 ModuleLevel[i] = getPlane(i).size();
   ModuleTypeLevel = Types.size();
-
+  
   // Iterate over function arguments, adding them to the value table...
   for(Function::const_arg_iterator I = F-arg_begin(), E = F-arg_end();
   I != E; ++I)
-CreateSlotIfNeeded(I);
-
+CreateFunctionValueSlot(I);
+  
   SC_DEBUG(Inserting Instructions:\n);
-
+  
   // Add all of the instructions to the type planes...
   for (Function::const_iterator BB = F-begin(), E = F-end(); BB != E; ++BB) {
-CreateSlotIfNeeded(BB);
+CreateFunctionValueSlot(BB);
 for (BasicBlock::const_iterator I = BB-begin(), E = BB-end(); I!=E; ++I) 
{
   if (I-getType() != Type::VoidTy)
-CreateSlotIfNeeded(I);
+CreateFunctionValueSlot(I);
 }
   }
-
+  
   SC_DEBUG(end processFunction!\n);
 }
 
@@ -236,17 +312,17 @@
   assert((ModuleLevel.size() != 0 ||
   ModuleTypeLevel != 0)  Module not incorporated!);
   unsigned 

[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.103 - 1.104
---
Log message:

Only compute the module levels info once per module, instead of once
per function.  This speeds up bcwriting on 447.dealII from 10.16s to 6.81s
(49%).


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

 SlotCalculator.cpp |   22 +++---
 1 files changed, 7 insertions(+), 15 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.103 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.104
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.103   Fri Feb  9 23:45:09 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 23:54:33 2007
@@ -181,6 +181,13 @@
   }
   }
 
+
+  // Compute the ModuleLevel entries.
+  ModuleLevel.resize(getNumPlanes());
+  for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
+ModuleLevel[i] = getPlane(i).size();
+  ModuleTypeLevel = Types.size();
+
   SC_DEBUG(end processModule!\n);
 }
 
@@ -278,17 +285,8 @@
 
 
 void SlotCalculator::incorporateFunction(const Function *F) {
-  assert((ModuleLevel.empty() ||
-  ModuleTypeLevel == 0)  Module already incorporated!);
-  
   SC_DEBUG(begin processFunction!\n);
   
-  // Update the ModuleLevel entries to be accurate.
-  ModuleLevel.resize(getNumPlanes());
-  for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
-ModuleLevel[i] = getPlane(i).size();
-  ModuleTypeLevel = Types.size();
-  
   // Iterate over function arguments, adding them to the value table...
   for(Function::const_arg_iterator I = F-arg_begin(), E = F-arg_end();
   I != E; ++I)
@@ -309,8 +307,6 @@
 }
 
 void SlotCalculator::purgeFunction() {
-  assert((ModuleLevel.size() != 0 ||
-  ModuleTypeLevel != 0)  Module not incorporated!);
   unsigned NumModuleTypes = ModuleLevel.size();
   
   SC_DEBUG(begin purgeFunction!\n);
@@ -332,10 +328,6 @@
 }
   }
   
-  // We don't need this state anymore, free it up.
-  ModuleLevel.clear();
-  ModuleTypeLevel = 0;
-  
   // Finally, remove any type planes defined by the function...
   while (Table.size()  NumModuleTypes) {
 TypePlane Plane = Table.back();



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.104 - 1.105
SlotCalculator.h updated: 1.44 - 1.45
---
Log message:

Make the ModuleLevel datastructure more sane.  When a function-local value
is inserted into the table, it remembers that the value needs to be popped
off.  This makes purgeFunction much faster, speeding up bcwriting of 447.dealII
from 6.8-4.6s (47%).


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

 SlotCalculator.cpp |   41 ++---
 SlotCalculator.h   |   11 +--
 2 files changed, 19 insertions(+), 33 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.104 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.105
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.104   Fri Feb  9 23:54:33 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Sat Feb 10 00:09:41 2007
@@ -64,7 +64,6 @@
 
 SlotCalculator::SlotCalculator(const Module *M) {
   assert(M);
-  ModuleTypeLevel = 0;
   TheModule = M;
 
   insertPrimitives();
@@ -182,11 +181,8 @@
   }
 
 
-  // Compute the ModuleLevel entries.
-  ModuleLevel.resize(getNumPlanes());
-  for (unsigned i = 0, e = getNumPlanes(); i != e; ++i)
-ModuleLevel[i] = getPlane(i).size();
-  ModuleTypeLevel = Types.size();
+  // Initialize the ModuleLevel entries.
+  ModuleLevel.resize(getNumPlanes(), -1);
 
   SC_DEBUG(end processModule!\n);
 }
@@ -222,9 +218,6 @@
   // Do not index the characters that make up constant strings.  We emit
   // constant strings as special entities that don't require their
   // individual characters to be emitted.
-  assert(ModuleLevel.empty() 
- How can a constant string be directly accessed in a function?);
-  // Otherwise, this IS a string: remember it.
   if (!C-isNullValue())
 ConstantStrings.push_back(castConstantArray(C));
 } else {
@@ -313,16 +306,16 @@
   
   // Next, remove values from existing type planes
   for (unsigned i = 0; i != NumModuleTypes; ++i) {
-// Size of plane before function came
-unsigned ModuleLev = getModuleLevel(i);
-assert(int(ModuleLev) = 0  BAD!);
+// If this type is not used by this function, ignore it.
+int ModuleLev = ModuleLevel[i];
+if (ModuleLev == -1) continue;
 
+ModuleLevel[i] = -1;  // Reset for next function.
+
+// Pop all function-local values in this type-plane off of Table.
 TypePlane Plane = getPlane(i);
-
-assert(ModuleLev = Plane.size()  module levels higher than elements?);
-while (Plane.size() != ModuleLev) {
-  assert(!isaGlobalValue(Plane.back()) 
- Functions cannot define globals!);
+assert(ModuleLev  Plane.size()  module levels higher than elements?);
+for (unsigned i = ModuleLev, e = Plane.size(); i != e; ++i) {
   NodeMap.erase(Plane.back());   // Erase from nodemap
   Plane.pop_back();  // Shrink plane
 }
@@ -333,12 +326,8 @@
 TypePlane Plane = Table.back();
 SC_DEBUG(Removing Plane   (Table.size()-1)   of size 
   Plane.size()  \n);
-while (Plane.size()) {
-  assert(!isaGlobalValue(Plane.back()) 
- Functions cannot define globals!);
-  NodeMap.erase(Plane.back());   // Erase from nodemap
-  Plane.pop_back();  // Shrink plane
-}
+for (unsigned i = 0, e = Plane.size(); i != e; ++i)
+  NodeMap.erase(Plane[i]);   // Erase from nodemap
 
 Table.pop_back();// Nuke the plane, we don't like it.
   }
@@ -357,6 +346,12 @@
   if (Table.size() = TyPlane)// Make sure we have the type plane 
allocated.
 Table.resize(TyPlane+1, TypePlane());
   
+  // If this is the first value noticed of this type within this function,
+  // remember the module level for this type plane in ModuleLevel.  This 
reminds
+  // us to remove the values in purgeFunction and tells us how many to remove.
+  if (TyPlane  ModuleLevel.size()  ModuleLevel[TyPlane] == -1)
+ModuleLevel[TyPlane] = Table[TyPlane].size();
+  
   // If this is the first value to get inserted into the type plane, make sure
   // to insert the implicit null value.
   if (Table[TyPlane].empty()) {


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.44 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.45
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.44  Fri Feb  9 23:45:09 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Sat Feb 10 00:09:41 2007
@@ -54,7 +54,7 @@
   /// ModuleLevel - Used to keep track of which values belong to the module,
   /// and which values belong to the currently incorporated function.
   ///
-  std::vectorunsigned ModuleLevel;
+  std::vectorint ModuleLevel;
   unsigned ModuleTypeLevel;
 
   SlotCalculator(const SlotCalculator );  // DO NOT IMPLEMENT
@@ -80,15 +80,6 @@
   inline unsigned getNumPlanes() const { return Table.size(); }
   inline unsigned getNumTypes() const { 

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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

DenseMap.h updated: 1.17 - 1.18
---
Log message:

Allow DenseMAp to take an explicit DenseMapKeyInfo


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

 DenseMap.h |   39 ---
 1 files changed, 20 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/ADT/DenseMap.h
diff -u llvm/include/llvm/ADT/DenseMap.h:1.17 
llvm/include/llvm/ADT/DenseMap.h:1.18
--- llvm/include/llvm/ADT/DenseMap.h:1.17   Tue Feb  6 18:55:59 2007
+++ llvm/include/llvm/ADT/DenseMap.hSat Feb 10 00:34:58 2007
@@ -40,12 +40,15 @@
   static bool isPod() { return true; }
 };
 
-templatetypename KeyT, typename ValueT
+templatetypename KeyT, typename ValueT, 
+ typename KeyInfoT = DenseMapKeyInfoKeyT 
 class DenseMapIterator;
-templatetypename KeyT, typename ValueT
+templatetypename KeyT, typename ValueT,
+ typename KeyInfoT = DenseMapKeyInfoKeyT 
 class DenseMapConstIterator;
 
-templatetypename KeyT, typename ValueT
+templatetypename KeyT, typename ValueT,
+ typename KeyInfoT = DenseMapKeyInfoKeyT 
 class DenseMap {
   typedef std::pairKeyT, ValueT BucketT;
   unsigned NumBuckets;
@@ -68,21 +71,19 @@
 delete[] (char*)Buckets;
   }
   
-  typedef DenseMapIteratorKeyT, ValueT iterator;
-  typedef DenseMapConstIteratorKeyT, ValueT const_iterator;
+  typedef DenseMapIteratorKeyT, ValueT, KeyInfoT iterator;
+  typedef DenseMapConstIteratorKeyT, ValueT, KeyInfoT const_iterator;
   inline iterator begin() {
- return DenseMapIteratorKeyT, ValueT(Buckets, Buckets+NumBuckets);
+ return iterator(Buckets, Buckets+NumBuckets);
   }
   inline iterator end() {
-return DenseMapIteratorKeyT, ValueT(Buckets+NumBuckets, 
-  Buckets+NumBuckets);
+return iterator(Buckets+NumBuckets, Buckets+NumBuckets);
   }
   inline const_iterator begin() const {
-return DenseMapConstIteratorKeyT, ValueT(Buckets, Buckets+NumBuckets);
+return const_iterator(Buckets, Buckets+NumBuckets);
   }
   inline const_iterator end() const {
-return DenseMapConstIteratorKeyT, ValueT(Buckets+NumBuckets, 
-   Buckets+NumBuckets);
+return const_iterator(Buckets+NumBuckets, Buckets+NumBuckets);
   }
   
   bool empty() const { return NumEntries == 0; }
@@ -181,13 +182,13 @@
   }
 
   static unsigned getHashValue(const KeyT Val) {
-return DenseMapKeyInfoKeyT::getHashValue(Val);
+return KeyInfoT::getHashValue(Val);
   }
   static const KeyT getEmptyKey() {
-return DenseMapKeyInfoKeyT::getEmptyKey();
+return KeyInfoT::getEmptyKey();
   }
   static const KeyT getTombstoneKey() {
-return DenseMapKeyInfoKeyT::getTombstoneKey();
+return KeyInfoT::getTombstoneKey();
   }
   
   /// LookupBucketFor - Lookup the appropriate bucket for Val, returning it in
@@ -285,7 +286,7 @@
   }
 };
 
-templatetypename KeyT, typename ValueT
+templatetypename KeyT, typename ValueT, typename KeyInfoT
 class DenseMapIterator {
   typedef std::pairKeyT, ValueT BucketT;
 protected:
@@ -320,16 +321,16 @@
   
 private:
   void AdvancePastEmptyBuckets() {
-const KeyT Empty = DenseMapKeyInfoKeyT::getEmptyKey();
-const KeyT Tombstone = DenseMapKeyInfoKeyT::getTombstoneKey();
+const KeyT Empty = KeyInfoT::getEmptyKey();
+const KeyT Tombstone = KeyInfoT::getTombstoneKey();
 
 while (Ptr != End  (Ptr-first == Empty || Ptr-first == Tombstone))
   ++Ptr;
   }
 };
 
-templatetypename KeyT, typename ValueT
-class DenseMapConstIterator : public DenseMapIteratorKeyT, ValueT {
+templatetypename KeyT, typename ValueT, typename KeyInfoT
+class DenseMapConstIterator : public DenseMapIteratorKeyT, ValueT, KeyInfoT {
 public:
   DenseMapConstIterator(const std::pairKeyT, ValueT *Pos,
 const std::pairKeyT, ValueT *E)



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.105 - 1.106
SlotCalculator.h updated: 1.45 - 1.46
---
Log message:

The ModuleLevel vector is often quite sparse.  Switch it to a DenseMap.  This
speeds up bcwriting of 447.dealII by 40%, from 4.63s to 3.32s.


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

 SlotCalculator.cpp |   29 +
 SlotCalculator.h   |   13 +++--
 2 files changed, 24 insertions(+), 18 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.105 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.106
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.105   Sat Feb 10 00:09:41 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Sat Feb 10 00:38:19 2007
@@ -179,11 +179,9 @@
 ++FirstNonValueTypeID;
   }
   }
-
-
-  // Initialize the ModuleLevel entries.
-  ModuleLevel.resize(getNumPlanes(), -1);
 
+  NumModuleTypes = getNumPlanes();
+
   SC_DEBUG(end processModule!\n);
 }
 
@@ -300,27 +298,26 @@
 }
 
 void SlotCalculator::purgeFunction() {
-  unsigned NumModuleTypes = ModuleLevel.size();
-  
   SC_DEBUG(begin purgeFunction!\n);
   
   // Next, remove values from existing type planes
-  for (unsigned i = 0; i != NumModuleTypes; ++i) {
-// If this type is not used by this function, ignore it.
-int ModuleLev = ModuleLevel[i];
-if (ModuleLev == -1) continue;
+  for (DenseMapunsigned,unsigned,
+  ModuleLevelDenseMapKeyInfo::iterator I = ModuleLevel.begin(),
+   E = ModuleLevel.end(); I != E; ++I) {
+unsigned PlaneNo = I-first;
+unsigned ModuleLev = I-second;
 
-ModuleLevel[i] = -1;  // Reset for next function.
-
 // Pop all function-local values in this type-plane off of Table.
-TypePlane Plane = getPlane(i);
+TypePlane Plane = getPlane(PlaneNo);
 assert(ModuleLev  Plane.size()  module levels higher than elements?);
 for (unsigned i = ModuleLev, e = Plane.size(); i != e; ++i) {
   NodeMap.erase(Plane.back());   // Erase from nodemap
   Plane.pop_back();  // Shrink plane
 }
   }
-  
+
+  ModuleLevel.clear();
+
   // Finally, remove any type planes defined by the function...
   while (Table.size()  NumModuleTypes) {
 TypePlane Plane = Table.back();
@@ -349,8 +346,8 @@
   // If this is the first value noticed of this type within this function,
   // remember the module level for this type plane in ModuleLevel.  This 
reminds
   // us to remove the values in purgeFunction and tells us how many to remove.
-  if (TyPlane  ModuleLevel.size()  ModuleLevel[TyPlane] == -1)
-ModuleLevel[TyPlane] = Table[TyPlane].size();
+  if (TyPlane  NumModuleTypes)
+ModuleLevel.insert(std::make_pair(TyPlane, Table[TyPlane].size()));
   
   // If this is the first value to get inserted into the type plane, make sure
   // to insert the implicit null value.


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.45 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.46
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.45  Sat Feb 10 00:09:41 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Sat Feb 10 00:38:19 2007
@@ -20,6 +20,7 @@
 #ifndef LLVM_ANALYSIS_SLOTCALCULATOR_H
 #define LLVM_ANALYSIS_SLOTCALCULATOR_H
 
+#include llvm/ADT/DenseMap.h
 #include vector
 #include map
 
@@ -34,6 +35,14 @@
 class ValueSymbolTable;
 class ConstantArray;
 
+struct ModuleLevelDenseMapKeyInfo {
+  static inline unsigned getEmptyKey() { return ~0U; }
+  static inline unsigned getTombstoneKey() { return ~1U; }
+  static unsigned getHashValue(unsigned Val) { return Val ^ Val  4; }
+  static bool isPod() { return true; }
+};
+
+
 class SlotCalculator {
   const Module *TheModule;
 
@@ -54,8 +63,8 @@
   /// ModuleLevel - Used to keep track of which values belong to the module,
   /// and which values belong to the currently incorporated function.
   ///
-  std::vectorint ModuleLevel;
-  unsigned ModuleTypeLevel;
+  DenseMapunsigned,unsigned,ModuleLevelDenseMapKeyInfo ModuleLevel;
+  unsigned NumModuleTypes;
 
   SlotCalculator(const SlotCalculator );  // DO NOT IMPLEMENT
   void operator=(const SlotCalculator );  // DO NOT IMPLEMENT



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


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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

DenseMap.h updated: 1.18 - 1.19
---
Log message:

Make find return the appropriate iterator/const_iterator


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

 DenseMap.h |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/ADT/DenseMap.h
diff -u llvm/include/llvm/ADT/DenseMap.h:1.18 
llvm/include/llvm/ADT/DenseMap.h:1.19
--- llvm/include/llvm/ADT/DenseMap.h:1.18   Sat Feb 10 00:34:58 2007
+++ llvm/include/llvm/ADT/DenseMap.hSat Feb 10 00:58:17 2007
@@ -108,12 +108,18 @@
 return LookupBucketFor(Val, TheBucket);
   }
   
-  iterator find(const KeyT Val) const {
+  iterator find(const KeyT Val) {
 BucketT *TheBucket;
 if (LookupBucketFor(Val, TheBucket))
   return iterator(TheBucket, Buckets+NumBuckets);
 return end();
   }
+  const_iterator find(const KeyT Val) const {
+BucketT *TheBucket;
+if (LookupBucketFor(Val, TheBucket))
+  return const_iterator(TheBucket, Buckets+NumBuckets);
+return end();
+  }
   
   bool insert(const std::pairKeyT, ValueT KV) {
 BucketT *TheBucket;
@@ -334,7 +340,7 @@
 public:
   DenseMapConstIterator(const std::pairKeyT, ValueT *Pos,
 const std::pairKeyT, ValueT *E)
-: DenseMapIteratorKeyT, ValueT(Pos, E) {
+: DenseMapIteratorKeyT, ValueT, KeyInfoT(Pos, E) {
   }
   const std::pairKeyT, ValueT operator*() const {
 return *this-Ptr;



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.h updated: 1.47 - 1.48
---
Log message:

Switch NodeMap from an std::map to a DenseMap.  This speeds up bcwriting
of 447.dealII from 3.3s to 1.8s (80% faster).


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

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


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.47 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.48
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.47  Sat Feb 10 00:42:23 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Sat Feb 10 01:01:05 2007
@@ -50,7 +50,7 @@
   typedef std::vectorconst Value* TypePlane;
   std::vectorTypePlane Table;
   TypeList Types;
-  typedef std::mapconst Value*, unsigned NodeMapType;
+  typedef DenseMapconst Value*, unsigned NodeMapType;
   NodeMapType NodeMap;
 
   typedef std::mapconst Type*, unsigned TypeMapType;



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.h updated: 1.48 - 1.49
---
Log message:

Switch typemap over to DenseMap.  No significant speedup.


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

 SlotCalculator.h |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.48 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.49
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.48  Sat Feb 10 01:01:05 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Sat Feb 10 01:06:46 2007
@@ -22,7 +22,6 @@
 
 #include llvm/ADT/DenseMap.h
 #include vector
-#include map
 
 namespace llvm {
 
@@ -53,7 +52,7 @@
   typedef DenseMapconst Value*, unsigned NodeMapType;
   NodeMapType NodeMap;
 
-  typedef std::mapconst Type*, unsigned TypeMapType;
+  typedef DenseMapconst Type*, unsigned TypeMapType;
   TypeMapType TypeMap;
 
   /// ConstantStrings - If we are indexing for a bytecode file, this keeps 
track



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


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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

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

make the datastructure used in BytecodeWriter::outputValueSymbolTable
*slightly* less abusive of memory.  This speeds up the bcwriter from
1.83s to 1.32s (39% faster) on 447.dealII.


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

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


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.162 
llvm/lib/Bytecode/Writer/Writer.cpp:1.163
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.162   Fri Feb  9 23:17:48 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Feb 10 01:11:51 2007
@@ -1086,14 +1086,14 @@
 true/*ElideIfEmpty*/);
 
   // Organize the symbol table by type
-  typedef std::pairstd::string, const Value* PlaneMapEntry;
+  typedef std::pairconst std::string*, const Value* PlaneMapEntry;
   typedef std::vectorPlaneMapEntry PlaneMapVector;
   typedef std::mapconst Type*, PlaneMapVector  PlaneMap;
   PlaneMap Planes;
   for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end();
SI != SE; ++SI) 
-Planes[SI-second-getType()].push_back(
-std::make_pair(SI-first,SI-second));
+Planes[SI-second-getType()]
+  .push_back(std::make_pair(SI-first, SI-second));
 
   for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end();
PI != PE; ++PI) {
@@ -1112,7 +1112,7 @@
 for (; I != End; ++I) {
   // Symtab entry: [def slot #][name]
   output_vbr(Table.getSlot(I-second));
-  output(I-first);
+  output(*I-first);
 }
   }
 }



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


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

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.163 - 1.164
---
Log message:

Make BytecodeWriter::outputValueSymbolTable *significantly* less abusive
of memory, through a combination of DenseMap and SmallVector.  This speeds
up bcwriter on 447.dealII from 1.31s to 0.82s (60% faster).


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

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


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.163 
llvm/lib/Bytecode/Writer/Writer.cpp:1.164
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.163   Sat Feb 10 01:11:51 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Feb 10 01:31:44 2007
@@ -33,6 +33,7 @@
 #include llvm/Support/MathExtras.h
 #include llvm/Support/Streams.h
 #include llvm/System/Program.h
+#include llvm/ADT/SmallVector.h
 #include llvm/ADT/STLExtras.h
 #include llvm/ADT/Statistic.h
 #include cstring
@@ -1087,15 +1088,15 @@
 
   // Organize the symbol table by type
   typedef std::pairconst std::string*, const Value* PlaneMapEntry;
-  typedef std::vectorPlaneMapEntry PlaneMapVector;
-  typedef std::mapconst Type*, PlaneMapVector  PlaneMap;
+  typedef SmallVectorPlaneMapEntry, 8 PlaneMapVector;
+  typedef DenseMapconst Type*, PlaneMapVector  PlaneMap;
   PlaneMap Planes;
   for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end();
SI != SE; ++SI) 
 Planes[SI-second-getType()]
   .push_back(std::make_pair(SI-first, SI-second));
 
-  for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end();
+  for (PlaneMap::iterator PI = Planes.begin(), PE = Planes.end();
PI != PE; ++PI) {
 PlaneMapVector::const_iterator I = PI-second.begin(); 
 PlaneMapVector::const_iterator End = PI-second.end(); 



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.h Writer.cpp WriterInternals.h

2007-02-09 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.h updated: 1.49 - 1.50
Writer.cpp updated: 1.164 - 1.165
WriterInternals.h updated: 1.31 - 1.32
---
Log message:

Change the table datastructure to be a vectorsmallvector, instead of
vectorvector to avoid allocations.  This speeds up bcwriting of 447.dealII
from 0.8276 to 0.7637s (8.4%).

This concludes this round of proding the bcwriter into submission.  Final
speedup from 24.4s to 0.7637s (32x).



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

 SlotCalculator.h  |6 --
 Writer.cpp|   17 +
 WriterInternals.h |7 +--
 3 files changed, 14 insertions(+), 16 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.49 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.50
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.49  Sat Feb 10 01:06:46 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Sat Feb 10 01:42:59 2007
@@ -21,6 +21,7 @@
 #define LLVM_ANALYSIS_SLOTCALCULATOR_H
 
 #include llvm/ADT/DenseMap.h
+#include llvm/ADT/SmallVector.h
 #include vector
 
 namespace llvm {
@@ -44,9 +45,10 @@
 
 class SlotCalculator {
   const Module *TheModule;
-
+public:
   typedef std::vectorconst Type* TypeList;
-  typedef std::vectorconst Value* TypePlane;
+  typedef SmallVectorconst Value*, 16 TypePlane;
+private:
   std::vectorTypePlane Table;
   TypeList Types;
   typedef DenseMapconst Value*, unsigned NodeMapType;


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.164 
llvm/lib/Bytecode/Writer/Writer.cpp:1.165
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.164   Sat Feb 10 01:31:44 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Feb 10 01:42:59 2007
@@ -812,21 +812,22 @@
 // Helper function for outputConstants().
 // Writes out all the constants in the plane Plane starting at entry StartNo.
 //
-void BytecodeWriter::outputConstantsInPlane(const std::vectorconst Value*
-Plane, unsigned StartNo) {
+void BytecodeWriter::outputConstantsInPlane(const Value *const *Plane,
+unsigned PlaneSize,
+unsigned StartNo) {
   unsigned ValNo = StartNo;
 
   // Scan through and ignore function arguments, global values, and constant
   // strings.
-  for (; ValNo  Plane.size() 
+  for (; ValNo  PlaneSize 
  (isaArgument(Plane[ValNo]) || isaGlobalValue(Plane[ValNo]) ||
   (isaConstantArray(Plane[ValNo]) 
castConstantArray(Plane[ValNo])-isString())); ValNo++)
 /*empty*/;
 
   unsigned NC = ValNo;  // Number of constants
-  for (; NC  Plane.size()  (isaConstant(Plane[NC]) || 
-   isaInlineAsm(Plane[NC])); NC++)
+  for (; NC  PlaneSize  (isaConstant(Plane[NC]) || 
+  isaInlineAsm(Plane[NC])); NC++)
 /*empty*/;
   NC -= ValNo;  // Convert from index into count
   if (NC == 0) return;  // Skip empty type planes...
@@ -839,7 +840,7 @@
   output_vbr(NC);
 
   // Put out the Type ID Number.
-  output_typeid(Table.getTypeSlot(Plane.front()-getType()));
+  output_typeid(Table.getTypeSlot(Plane[0]-getType()));
 
   for (unsigned i = ValNo; i  ValNo+NC; ++i) {
 const Value *V = Plane[i];
@@ -864,7 +865,7 @@
   outputConstantStrings();
 
   for (unsigned pno = 0; pno != NumPlanes; pno++) {
-const std::vectorconst Value* Plane = Table.getPlane(pno);
+const SlotCalculator::TypePlane Plane = Table.getPlane(pno);
 if (!Plane.empty()) {  // Skip empty type planes...
   unsigned ValNo = 0;
   if (hasNullValue(Plane[0]-getType())) {
@@ -873,7 +874,7 @@
   }
 
   // Write out constants in the plane
-  outputConstantsInPlane(Plane, ValNo);
+  outputConstantsInPlane(Plane[0], Plane.size(), ValNo);
 }
   }
 }


Index: llvm/lib/Bytecode/Writer/WriterInternals.h
diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.31 
llvm/lib/Bytecode/Writer/WriterInternals.h:1.32
--- llvm/lib/Bytecode/Writer/WriterInternals.h:1.31 Fri Feb  9 01:54:13 2007
+++ llvm/lib/Bytecode/Writer/WriterInternals.h  Sat Feb 10 01:42:59 2007
@@ -35,11 +35,6 @@
   void outputConstants();
   void outputConstantStrings();
   void outputFunction(const Function *F);
-  void outputCompactionTable();
-  void outputCompactionTypes(unsigned StartNo);
-  void outputCompactionTablePlane(unsigned PlaneNo,
-  const std::vectorconst Value* TypePlane,
-  unsigned StartNo);
   void outputInstructions(const Function *F);
   void outputInstruction(const Instruction I);
   void outputInstructionFormat0(const Instruction *I, unsigned Opcode,
@@ -66,7 +61,7 @@
   void outputTypeSymbolTable(const TypeSymbolTable TST);
   void outputValueSymbolTable(const ValueSymbolTable ST);
   void outputTypes(unsigned StartNo);
-  void