<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-28819356</atom:id><lastBuildDate>Tue, 05 Aug 2008 05:15:13 +0000</lastBuildDate><title>Programmingland</title><description/><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/</link><managingEditor>noreply@blogger.com (Fernando Magno Quintão Pereira)</managingEditor><generator>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-2366135098767411198</guid><pubDate>Sat, 10 May 2008 06:09:00 +0000</pubDate><atom:updated>2008-05-09T23:16:47.229-07:00</atom:updated><title>Java RMI without name server</title><description>You know, &lt;A href="http://java.sun.com/docs/books/tutorial/rmi/index.html" target="blank"&gt;Java RMI&lt;/A&gt; is cool, but sometimes that pesky name server just gets into the way. One starts the name server by typing something on the sorts of &lt;A href="http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/rmiregistry.html" target="blank"&gt;rmiregistry&lt;/A&gt;. Well, there are other ways, but that is very common.&lt;br /&gt;&lt;br /&gt;Today I decided to tinker a little bit with Java RMI. My idea was to code some sort of channel, that would give me direct access to a remote object, as long as I know its address in the distributed system. I want the client to be able to get the object without having to do a lookup before, by just typing:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;RemoteObjInterface roi = ImportChannel.imp(host, port);&lt;br /&gt;roi.remoteMethod();&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;Notice that there is no type cast on this code. Actually, the type cast happens in &lt;CODE&gt;ImportChannel&lt;/CODE&gt;, so, I am just sweeping the garbage under the carpet. The server, by its turn, should be very simple too. The code should be like:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;RemoteObjImpl ro = new RemoteObjImpl();&lt;br /&gt;ExportChannel ec = new ExportChannel(ro);&lt;br /&gt;ec.export();&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;The code is available below. I am using the example application from these &lt;A href="http://www.csc.liv.ac.uk/~konev/COMP212/04-java-rmi.pdf" target="blank"&gt;slides&lt;/A&gt;.&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/Server.java" target="blank"&gt;Server&lt;/A&gt;. The server application, that creates a remote object and exports it via the export channel given further below.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/TimeClient.java" target="blank"&gt;TimeClient&lt;/A&gt;. The client application. It uses an import channel to get a hold of the remote object, and then it calls a remote method on it.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/Second.java" target="blank"&gt;Second&lt;/A&gt;. The remote object's interface.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/SecondImpl.java" target="blank"&gt;SecondImpl&lt;/A&gt;. The implementation of the remote object.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/SecondImpl_Stub.java" target="blank"&gt;SecondImpl_Stub&lt;/A&gt;. This is the stub for the remote object. We need a stub to call a remote method, you know. Of course, we do not really need the source code, just the bytecodes, but I am given the source here just for fun. To produce an stub, one can use &lt;A href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/rmic.html" target="blank"&gt;rmic&lt;/A&gt;. This tool erases the source code, after generating the bytecodes. To keep the source, use the option &lt;CODE&gt;-keep&lt;/CODE&gt;.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/ServerThread.java" target="blank"&gt;ServerThread&lt;/A&gt;. The server uses this thread to handle clients looking for the remote object.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/ExportChannel.java" target="blank"&gt;ExportChannel&lt;/A&gt;. This is the interface that a server must use to make an object available to receive remote calls.&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;A href="../src/rmi/ImportChannel.java" target="blank"&gt;ImportChannel&lt;/A&gt;. This is the interface that the client must use to get a hold of a remote object.&lt;br /&gt;&lt;/UL&gt;&lt;br /&gt;&lt;br /&gt;If you download all files above, then running this example application is very easy. You will need two terminals. In the first, initialized the server by typing &lt;CODE&gt;java Server&lt;/CODE&gt;. It will print the port in which the object is listening. To  use the client, go to the other terminal and type &lt;CODE&gt;java TimeClient port&lt;/CODE&gt;, where port is the port where the server is listening. In this example, I have set the server to start listening at port 20000.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2008/05/java-rmi-without-name-server.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-8437208693779860812</guid><pubDate>Tue, 29 Apr 2008 18:24:00 +0000</pubDate><atom:updated>2008-05-04T12:41:06.044-07:00</atom:updated><title>Fortran plus MPI in OSX Tiger</title><description>Finally I've got the fortran/mpi stuff running in my macstation. The installation process is very complicated, and so I will be describing it here. First of all, the physics software that we must execute is &lt;A href="../../downloads/OpenPIC2.tar.gz"&gt;OpenPIC2&lt;/A&gt;, and it must be installed once the running environment is set up.&lt;br /&gt;&lt;br /&gt;We need a couple of things in order to run &lt;A href="../../downloads/OpenPIC2.tar.gz"&gt;OpenPIC2&lt;/A&gt;: we need the &lt;A href="http://en.wikipedia.org/wiki/Fortran" target="blank"&gt;fortran&lt;/A&gt; compilers up and running, and also an implementation of &lt;A href="http://www-unix.mcs.anl.gov/mpi/" target="blank"&gt;MPI&lt;/A&gt; (the official documents about MPI are available &lt;A href="http://www.mpi-forum.org/" target="blank"&gt;here&lt;/A&gt;). To install all that stuff, we'd better use some package installation manager. I recommend two packaging tools: &lt;A href="http://www.macports.org/" target="blank"&gt;MacPort&lt;/A&gt; and &lt;A href="http://www.finkproject.org/" target="blank"&gt;Fink&lt;/A&gt;. I had to install both, as I need fink to get g77, and I need port to get g95. You can download fink &lt;A href="http://www.finkproject.org/download/index.php?phpLang=en" target="blank"&gt;here&lt;/A&gt;, and Mac Ports &lt;A href="http://www.macports.org/install.php" target="blank"&gt;here&lt;/A&gt;. Installing these programs in an apple computer is very simple.&lt;br /&gt;&lt;br /&gt;Ok, now that we have the package managers up and running, it is time to install the compilers. Let's start with g95:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;sudo port -v selfupdate&lt;br /&gt;port -d install g95&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;This should install g95 in your machine. Actually, there is some other stuff that is pretty useful, and I guess we should install it right now. The first software is &lt;A href="http://www.rpm.org/" target="blank"&gt;rpm&lt;/A&gt;, to compile the sources of openmpi, and the second is &lt;A href="http://www.gnu.org/software/stow/" target="blank"&gt;stow&lt;/A&gt;, which helps to organize the software installed.&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;sudo port -d install rpm&lt;br /&gt;sudo port -d install stow&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;That should do with the port part of the installation routine. Now, let's get g77, and to do this, we use fink:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;fink install g77&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;It is as easy as this. Now, you probably have two different compilers running in your machine. Fink puts stuff in &lt;CODE&gt;/sw/bin&lt;/CODE&gt;. You'd better add it to your path. To add it permanently to your path, you can edit &lt;CODE&gt;/etc/profile&lt;/CODE&gt;.&lt;br /&gt;Good, good. Now comes the turing test for the faint of heart: installing openmpi from source. Actually, you can install it using port, but them it will not enable mpif90, which we need to compile stuff. You can get the source rpm from the &lt;A href="http://www.open-mpi.org/software/ompi/v1.2/" target="blank"&gt;openmpi site&lt;/A&gt;. I chose &lt;CODE&gt;openmpi-1.2.6-1.src.rpm&lt;/CODE&gt;. Anyway, download it to your machine, and then do&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;rpm -i openmpi-1.2.6-1.src.rpm&lt;br /&gt;cd /opt/local/src/macports/SOURCES&lt;br /&gt;sudo tar -jxf openmpi-1.2.6.tar.bz2&lt;br /&gt;cd openmpi-1.2.6&lt;br /&gt;export CXX=g++&lt;br /&gt;export CC=gcc&lt;br /&gt;export F77=g77&lt;br /&gt;export FC=g95&lt;br /&gt;./configure&lt;br /&gt;sudo make&lt;br /&gt;sudo make install prefix=/usr/local/stow/openmpi-1.2.6&lt;br /&gt;cd /usr/local/stow/&lt;br /&gt;sudo stow openmpi-1.2.6&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;These commands should get openmpi running in your system. To test it, type &lt;CODE&gt;mpif90&lt;/CODE&gt; in your command prompt. If this does not report any error message, you can just throw some fireworks; otherwise, I recommending sitting and crying.&lt;br /&gt;&lt;br /&gt;To compile the physics software, download this &lt;A href="../../downloads/OpenPIC2.tar.gz"&gt;tar ball&lt;/A&gt;, and open it somewhere in your machine. You might have to edit your &lt;CODE&gt;LAM.make&lt;/CODE&gt; file. The one that I have uses the following options:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;MPIFC = mpif90&lt;br /&gt;FC90 = g95&lt;br /&gt;FC77 = g77&lt;br /&gt;OPTS90 = -O3 -fno-second-underscore&lt;br /&gt;OPTS77 = -O3 -fno-second-underscore&lt;br /&gt;MOPTS =&lt;br /&gt;LOPTS =&lt;br /&gt;LEGACY =&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;In order to compile the first example, try:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;make -f LAM.make lesopenpic2f77.out&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;You will probably get a lot of warnings, but do not let them scary you away. To run the program, try:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;mpirun -n 2 esopenpic2&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;You will get a bunch or numbers. Do not ask me what are they about, but it looks right from my 600m distance.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2008/04/fortran-plus-mpi-in-osx-tiger.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-2157164322261802849</guid><pubDate>Sat, 19 Apr 2008 23:04:00 +0000</pubDate><atom:updated>2008-04-19T16:15:03.224-07:00</atom:updated><title>A little of Erlang</title><description>I have started doing some toy programs with &lt;A href="http://www.erlang.org/" target="blank"&gt;Erlang&lt;/A&gt;. That is a functional, dynamically typed language that provides support for implementing parallel and distributed systems. It is very simple to write a small distributed application running on the same machine; however, I had problems to find information about this on the web. Thus, I decided to write this little tutorial which uses examples from the book &lt;A href="http://www.erlang.org/download/erlang-book-part1.pdf" target="blank"&gt;Concurrent Programming in Erlang&lt;/A&gt; by Joe Armstrong.&lt;br /&gt;&lt;br /&gt;This is the &lt;A href="../src/bank_server.erl"&gt;code&lt;/A&gt; of a server application, that allows users to make deposits, withdraws and enquires. The client application is given &lt;A href="../src/bank_client.erl"&gt;here&lt;/A&gt;. I tested these programs in a &lt;A href="http://www.centos.org/", target="blank"&gt;CentOS&lt;/A&gt; linux kernel 2.6.18-53.1.14.el5 running on a 64 bit Intel(R) Xeon(R) CPU. My interpreter is Erlang (BEAM) emulator version 5.5.2 [source] [64-bit] [async-threads:0].&lt;br /&gt;&lt;br /&gt;To run these examples, open two command shells, that I shall call &lt;I&gt;server shell&lt;/I&gt; and &lt;I&gt;client shell&lt;/I&gt;. In the server shell, change to the directory that contains &lt;A href="../src/bank_server.erl"&gt;bank_server&lt;/A&gt; and start the erlang prompt:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;erl -sname bank&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;Once in the erlang prompt, type the following commands:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;c(bank_server.erl).&lt;br /&gt;bank_server:start().&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;Likewise, start the command prompt in the client shell:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;erl&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;In order to test if the server is reachable, in the client shell you can ping the server erlang node:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;net:ping(bank@Tuvalu).&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;If you get &lt;I&gt;pong&lt;/I&gt; as answer, then everything is fine. But, if there is any error, you will get the atom &lt;I&gt;pang&lt;/I&gt; instead. I really think this is a bad interface for reporting errors, but, Alas, it is not my decision... Anyway, here, &lt;I&gt;Tuvalu&lt;/I&gt; is the short name of the machine where I was running this example, and &lt;I&gt;bank&lt;/I&gt; is the node name, determined in the command prompt when starting erlang in the server shell. Once in the erlang prompt, one can access the bank server using the interface provided by the &lt;A href="../src/bank_client.erl"&gt;client&lt;/A&gt; application. A simple example section is:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;bank_client:deposit(fernando, 100).&lt;br /&gt;bank_client:ask(fernando).&lt;br /&gt;bank_client:withdraw(fernando, 50).&lt;br /&gt;bank_client:ask(fernando).&lt;br /&gt;&lt;/PRE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2008/04/little-of-erlang.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-135762811546296962</guid><pubDate>Sat, 26 Jan 2008 22:56:00 +0000</pubDate><atom:updated>2008-01-26T14:57:48.013-08:00</atom:updated><title>LLVM 2.2</title><description>Today I installed LLVM 2.2. The first test, compiling SPEC2000 using the extended linear scan algorithm produced &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/2501_orig_ln_22_1.html" target="blank"&gt;this&lt;/A&gt; result, with &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/2501_passes.txt" target="blank"&gt;this&lt;/A&gt; sequence of passes. Now, I will try to install the puzzle solver in this new version.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2008/01/llvm-22.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-3530921544869004598</guid><pubDate>Mon, 10 Dec 2007 00:45:00 +0000</pubDate><atom:updated>2007-12-09T16:50:50.740-08:00</atom:updated><title>LLVM 2.1</title><description>I will be trying to deploy the puzzle solver on LLVM 2.1. I checked the code, and it does not seem to be a very easy task. It has changed a lot since 1.9. After that, I will have to add instruction folding, and then comes the really difficult part: to make the puzzle solver retargetable... don't cry for me Argentina... just to warm up, &lt;A href="../output/1209_pass_list_ELS.txt" target="blank"&gt;here&lt;/A&gt; is the list of passes invoked by the original LLVM 2.1 with linear scan, and &lt;A href="../output/1209_pass_list_Simple.txt" target="blank"&gt;here&lt;/A&gt; a list of the passes invoked with the simple register allocator.&lt;br /&gt;&lt;br /&gt;The classes of registers in x86, and the new register numbering, as defined by LLVM 2.1 is given &lt;A href="../output/1209_reg_classes_2_1.html" target="blank"&gt;here&lt;/A&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/12/llvm-21.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-1711800152237123497</guid><pubDate>Tue, 25 Sep 2007 19:05:00 +0000</pubDate><atom:updated>2007-09-25T12:05:39.884-07:00</atom:updated><title>Profiling LLVM</title><description>It is possible to use &lt;A href="http://www.cs.utah.edu/dept/old/texinfo/as/gprof_toc.html" target="blank"&gt;gprof&lt;/A&gt; to profile the LLVM tools such as llc and such. It is necessary to build LLVM with the profiling functions enabled. To do this, go to the LLVM root and type:&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;make -j2 ENABLE_PROFILING=1&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;That will build a 'Profile' directory containing all the binaries of LLVM tools. Now, every time you run llc it will produce the &lt;CODE&gt;gmon.out&lt;/CODE&gt; file containing profiling information. This file can be read with gprof using the command line:&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;gprof $PATH_TO_LLC/llc &gt; out.prof&lt;br /&gt;&lt;/CODE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/profiling-llvm.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-8014046026051777400</guid><pubDate>Mon, 24 Sep 2007 06:07:00 +0000</pubDate><atom:updated>2007-09-23T23:10:29.361-07:00</atom:updated><title>Jump tables</title><description>&lt;A href="http://en.wikipedia.org/wiki/Jump_table"&gt;Jump tables&lt;/A&gt; are a nice idea, but the way that LLVM is producing them is hurting the pass to break critical edges. My solution, not quite democratic, was to forbid jump tables altogether. To do this, I had to edit the file &lt;CODE&gt;SelectionDAG/SelectionDAGISel.cpp&lt;/CODE&gt;. The method &lt;CODE&gt;visitSwitch&lt;/CODE&gt; is responsible for creating jump tables. I simply commented that code out.&lt;br /&gt;Now, my &lt;CODE&gt;SelectionDAGISel.cpp&lt;/CODE&gt; looks like &lt;A href="../src/SelectionDAGISel.cpp"&gt;this&lt;/A&gt;.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/jump-tables.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-3604179766487997295</guid><pubDate>Mon, 17 Sep 2007 17:31:00 +0000</pubDate><atom:updated>2007-12-12T13:21:07.292-08:00</atom:updated><title>Four little things</title><description>Four things. First, this &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/src/rebuild_from_scratch"&gt;script&lt;/A&gt; from Lang Hames happens to be very useful when building LLVM. It unpacks the downloaded files and compiles everything, including the sources.&lt;br /&gt;&lt;br /&gt;Second, enabling spec 2000 in LLVM 2.0 is different from 1.9. For the latter, just use the command in the post below. For the former, use:&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;./configure --enable=spec=/project/fernando --with-spec=/project/fernando --with-externals=/project/fernando&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;Third, to run llvm 2.0 is a little different from 1.9. In order to produce .bc files, the following can be used:&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;llvm-gcc -o XXXX.bc XXXX.c -c -emit-llvm -O1&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;Finally, when using the test suite that comes with LLVM, if you want, say, to enable the beta llc, and disable the C-back end:&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;make TEST=nightly report.html DISABLE_JIT=1 ENABLE_LLCBETA=1&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;To specify the beta-options, change &lt;CODE&gt;Makefile.program&lt;/CODE&gt; under the platform that you are running.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/four-little-things.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-2391597326142019113</guid><pubDate>Fri, 14 Sep 2007 23:05:00 +0000</pubDate><atom:updated>2007-09-14T16:06:38.639-07:00</atom:updated><title>Teste Suite 1.9</title><description>I have just finished installing the test suite of LLVM v1.9. The whole process is not that difficult, but I had to directly download the test files. The version in svn was made for the most recent version of LLVM. Additionally, I had to create a symbolic link pointing to the location of the spec files, e.g: &lt;CODE&gt;ln -s $SPEC_LOCATION/spec2000 speccpu2000&lt;/CODE&gt;. This speccpu2000 is the name that the LLVM configuration file expects. This done, I had to go to &lt;CODE&gt;$LLVM_SRC/projects/llvm-tests&lt;/CODE&gt; and type:&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;./configure --enable-spec2000 --with-externals=/misc/project/fernando&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;That was it! To run tests, I can just use the same old command line:&lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;make TEST=nightly report.html DISABLE_JIT=1&lt;br /&gt;&lt;/CODE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/teste-suite-19.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-90759228546089964</guid><pubDate>Thu, 13 Sep 2007 03:03:00 +0000</pubDate><atom:updated>2007-09-12T20:10:57.122-07:00</atom:updated><title>Bank of register v1.9</title><description>This is the register list for the x86 architecture in LLVM 1.9:&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;1: AH, 2: AL, 3: AX, 4: BH, 5: BL, 6: BP, 7: BPL, 8: BX, 9: CH, 10: CL, 11: CX, 12: DH, 13: DI, 14: DIL, 15: DL, 16: DX, 17: EAX, 18: EBP, 19: EBX, 20: ECX, 21: EDI, 22: EDX, 23: ESI, 24: ESP, 25: FP0, 26: FP1, 27: FP2, 28: FP3, 29: FP4, 30: FP5, 31: FP6, 32: MM0, 33: MM1, 34: MM2, 35: MM3, 36: MM4, 37: MM5, 38: MM6, 39: MM7, 40: R10, 41: R10B, 42: R10D, 43: R10W, 44: R11, 45: R11B, 46: R11D, 47: R11W, 48: R12, 49: R12B, 50: R12D, 51: R12W, 52: R13, 53: R13B, 54: R13D, 55: R13W, 56: R14, 57: R14B, 58: R14D, 59: R14W, 60: R15, 61: R15B, 62: R15D, 63: R15W, 64: R8, 65: R8B, 66: R8D, 67: R8W, 68: R9, 69: R9B, 70: R9D, 71: R9W, 72: RAX, 73: RBP, 74: RBX, 75: RCX, 76: RDI, 77: RDX, 78: RSI, 79: RSP, 80: SI, 81: SIL, 82: SP, 83: SPL, 84: ST(0), 85: ST(1), 86: ST(2), 87: ST(3), 88: ST(4), 89: ST(5), 90: ST(6), 91: ST(7), 92: XMM0, 93: XMM1, 94: XMM10, 95: XMM11, 96: XMM12, 97: XMM13, 98: XMM14, 99: XMM15, 100: XMM2, 101: XMM3, 102: XMM4, 103: XMM5, 104: XMM6, 105: XMM7, 106: XMM8, 107: XMM9.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;And these are the classes of registers:&lt;br /&gt;&lt;br /&gt;&lt;TABLE&gt;&lt;br /&gt;&lt;br /&gt;&lt;TH align="left"&gt;&lt;br /&gt;Class ID&lt;br /&gt;&lt;/TH&gt;&lt;br /&gt;&lt;TH align="left"&gt;&lt;br /&gt;Number of regs&lt;br /&gt;&lt;/TH&gt;&lt;br /&gt;&lt;TH align="left"&gt;&lt;br /&gt;Reg size&lt;br /&gt;&lt;/TH&gt;&lt;br /&gt;&lt;TH align="left"&gt;&lt;br /&gt;Alignment&lt;br /&gt;&lt;/TH&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;1&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;2&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;3&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;2&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;2&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;2&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;2&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;5&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;6&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;7&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;20&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;1&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;1&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;9&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;7&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;10&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;4&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;11&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;16&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD align="center"&gt;12&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;TD align="center"&gt;8&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/bank-of-register-v19.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-4831971246605112409</guid><pubDate>Fri, 07 Sep 2007 22:23:00 +0000</pubDate><atom:updated>2007-09-07T15:27:07.960-07:00</atom:updated><title>AMPL</title><description>Today I used ampl for the first time. To use it, follow the following steps:&lt;br /&gt;&lt;br /&gt;&lt;OL&gt;&lt;br /&gt;&lt;LI&gt;&lt;br /&gt;specify a license file: &lt;CODE&gt;setenv ILOG_LICENSE_FILE "/usr/share/ilog/ilm/access.ilm"&lt;/CODE&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;br /&gt;start the daemon process: &lt;CODE&gt;./ilmd &amp;&lt;/CODE&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;br /&gt;run the ampl command: &lt;CODE&gt;./ampl&lt;/CODE&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;br /&gt;in the command prompt, it may be necessary to specify the solver to use:&lt;br /&gt;&lt;CODE&gt;option solver '/usr/share/ilog/ampl20021038.cplex91/cplexamp' ;&lt;/CODE&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;/OL&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/09/ampl.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-1779837131953134484</guid><pubDate>Tue, 27 Feb 2007 19:50:00 +0000</pubDate><atom:updated>2007-02-27T11:59:05.537-08:00</atom:updated><title>Command tags for SPEC2000</title><description>By the way, I found the following list of parameters to run SPEC2000. I took it from &lt;I&gt;Design and Implementation of a Lightweight Dynamic Optimization System&lt;/I&gt;, a paper by Jiwei Lu, Howard Chen, Pen-Chung Yew and Wei-Chung Hsu. Thanks for writing the paper, guys :)&lt;br /&gt;&lt;br /&gt;&lt;TABLE&gt;&lt;br /&gt;&lt;TH&gt;Benchmark&lt;/TH&gt;&lt;br /&gt;&lt;TH&gt;Command Line Input&lt;/TH&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;ammp&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; ammp.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;applu&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; applu.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;art&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; -scanfile c756hel.in -trainfile1 a10.img -trainfile2 hc.img -stride 2 -startx 470 -starty 140 -endx 520 -endy 180 -objects 10&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;bzip2&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; input.program 58&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;equake&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; inp.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;facerec&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; ref.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;fma3d&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; fma3d.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;gap&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; -l ./ -q -m 192M &lt; ref.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;gcc&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; 200.i -o 200.s&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;gzip&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; input.source 60&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;lucas&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; lucas2.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;mcf&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; inp.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;mesa&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; -frames 1000 -meshfile mesa.in -ppmfile mesa.ppm&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;parser&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; 2.1.dict -batch &lt; ref.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;sixtrack&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; inp.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;swim&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; &lt; swim.in&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;vortex&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; lendian1.raw&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD&gt;vpr&lt;/TD&gt;&lt;br /&gt;&lt;TD&gt;&lt;CODE&gt; net.in arch.in place.in route.out -nodisp -route only -route chan width 15 -pres fac mult 2 -acc fac 1 -first iter pres fac 4 -initial pres fac 8&lt;/CODE&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TABLE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/02/command-tags-for-spec2000.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-5993257794346855657</guid><pubDate>Mon, 26 Feb 2007 05:37:00 +0000</pubDate><atom:updated>2007-02-25T22:00:05.928-08:00</atom:updated><title>Scripts for SPEC2000</title><description>I did some scripts to compile the spec programs. They are in this &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/scripts/"&gt;directory&lt;/A&gt;. About the new stuff, to add/remove the new analysis:&lt;br /&gt;&lt;br /&gt;in &lt;CODE&gt;PhiDeconstruction_Fer::insert_memory_transfer&lt;/CODE&gt;, remove the memory transfers.&lt;br /&gt;in &lt;CODE&gt;ChordalAlloc_Fernando::spill&lt;/CODE&gt;, remove the slot mapping.&lt;br /&gt;in &lt;CODE&gt;SplitPhiGroups_Fer::runOnMachineFunction&lt;/CODE&gt;, comment the body, but let return false.&lt;br /&gt;&lt;br /&gt;To disable all the LLVM optimizations, just use this command:&lt;br /&gt;&lt;CODE&gt;llvm-gcc -Wa,-disable-opt v1.c -o executable&lt;/CODE&gt;.&lt;br /&gt;&lt;br /&gt;The vpr benchmark (one of SPEC2000), uses X window capabilities. It produces a very cool window. How to compile an X11 application?&lt;br /&gt;&lt;CODE&gt;gcc main.c -L/usr/X11r6/lib/ -lX11&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;Check the &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/scripts/vpr_comp.txt"&gt;script&lt;/A&gt; to see how to compile 175.vpr.&lt;br /&gt;&lt;br /&gt;By the way, I would like to thank Dale J. for helping with the command line for the gap benchmark. Some of the SPEC2000 benchmarks need some special flags when being compiled. You can find those flags in the configuration files of spec2000. In my system, they are in &lt;CODE&gt;project/fernando/spec2000/config&lt;/CODE&gt;.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/02/scripts-for-spec2000.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-116892645017788557</guid><pubDate>Tue, 16 Jan 2007 05:47:00 +0000</pubDate><atom:updated>2007-01-15T21:48:05.140-08:00</atom:updated><title>Bug solved :)</title><description>The bug from January 13 has been solved. The problem was that I was using a value to small as the maximum spilling factor of any register. Result: it happened that all the registers had bigger spilling factors, and no register could be spilled. Silly. Now the spilling factor is 2147483647, the biggest &lt;CODE&gt;unsigned int&lt;/CODE&gt; in my mac.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/01/bug-solved.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-116873610185106302</guid><pubDate>Sun, 14 Jan 2007 00:54:00 +0000</pubDate><atom:updated>2007-01-13T16:55:01.890-08:00</atom:updated><title>Bugs</title><description>There is a bug when compiling the benchmark cdecl. To compile the program with LLVM's linear scan, follow these steps:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;llvm-gcc cdecl.c -o cdecl&lt;br /&gt;llc -f -regalloc=linearscan cdecl.bc -o ln.s&lt;br /&gt;gcc ln.s -o exec&lt;br /&gt;./exec cdlex.l.in&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;To compile the program with the SSA-based allocator, do as follow:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;llvm-gcc cdecl.c -o cdecl&lt;br /&gt;llc -f -regalloc=chordal cdecl.bc -o ch.s&lt;br /&gt;gcc ch.s -o exec&lt;br /&gt;./exec cdlex.l.in&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;The output produced by the different allocators is not the same.&lt;br /&gt;&lt;br /&gt;Another problem that I am having is in the compilation of sim.c (llvm/projects/llvm-test/MultiSource/Benchmarks/sim). The compilation/execution of this file is a little tricky because of the input tag in the llvm line:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;llvm-gcc -DUNIX sim.c -o sim&lt;br /&gt;llc -f -regalloc=linearscan sim.bc -o ln.s&lt;br /&gt;gcc ln.s -o exec&lt;br /&gt;./exec&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;The bug happens during compilation. When I invoke &lt;CODE&gt;llc -f -regalloc=chordal sim.bc -o ch.s&lt;/CODE&gt; I get a compilation error.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2007/01/bugs.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115967526613986397</guid><pubDate>Sun, 01 Oct 2006 04:00:00 +0000</pubDate><atom:updated>2006-09-30T21:39:24.703-07:00</atom:updated><title>SPECtations</title><description>Today I installed SPEC2000 on the PowerPC. It was quite painful, but&lt;br /&gt;finally it worked. I had to log in as administrator, and then I had&lt;br /&gt;to add these two lines to &lt;CODE&gt;install.sh&lt;/CODE&gt;:&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;VERBOSE=1&lt;br /&gt;SPECTARGET=/local/admin/spec2000&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;Also, I gave the user permission to write everything on the top of the&lt;br /&gt;spec installation directory. The rest is only to follow on&lt;br /&gt;&lt;A href="http://www.spec.org/cpu2000/docs/install_guide_unix.html" target="blank"&gt;documentation&lt;/A&gt;. When it asks to run spec, try this&lt;br /&gt;&lt;CODE&gt;runspec --action=build --tune=base gzip&lt;/CODE&gt;, e.g, don't give&lt;br /&gt;a &lt;CODE&gt;--confing&lt;/CODE&gt; option. Anyways, I could not make LLVM to find&lt;br /&gt;the spec :( But I can compile the sources. I just compile gzip, and it&lt;br /&gt;worked fine. Compile all the sources, and give one of the input files to&lt;br /&gt;the executable, for instance, &lt;CODE&gt;combine.inpute&lt;/CODE&gt;.&lt;br /&gt;&lt;br /&gt;Also, I've updated my LLVM version. Well, to install a new register&lt;br /&gt;allocator is different. I knew this before, but I decided to summarize&lt;br /&gt;the steps to help me in the future. It goes like this:&lt;br /&gt;&lt;br /&gt;In your register allocator .cpp file add the following include; &lt;br /&gt;&lt;br /&gt;&lt;CODE&gt;#include "llvm/CodeGen/RegAllocRegistry.h"&lt;/CODE&gt;&lt;br /&gt;&lt;br /&gt;In your register allocator .cpp file define a create function in the   &lt;br /&gt;form; &lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;   FunctionPass *createMyRegisterAllocator() { &lt;br /&gt;     return new MyRegisterAllocator(); &lt;br /&gt;   } &lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;and the "installing" static constructor declaration, in the form; &lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;   static RegisterRegAlloc myRegAlloc("myregalloc", &lt;br /&gt;     "  my register allocator help string", &lt;br /&gt;     createMyRegisterAllocator); &lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;To force the load/linking of your register allocator into the llc/lli   &lt;br /&gt;tools, add your create function's global declaration to &lt;CODE&gt;"Passes.h"&lt;/CODE&gt;.&lt;br /&gt;&lt;br /&gt;Add a "pseudo" call line to &lt;BR&gt;&lt;CODE&gt;"llvm/Codegen/LinkAllCodegenComponents.h"&lt;/CODE&gt;.&lt;br /&gt;&lt;br /&gt;Apropos, when testing the llc tool, it is better to disable the jit compiler, so the test runs faster:&lt;BR&gt;&lt;br /&gt;&lt;CODE&gt;make TEST=nightly report.html DISABLE_JIT=1&lt;/CODE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/09/spectations.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115773575311460834</guid><pubDate>Fri, 08 Sep 2006 17:15:00 +0000</pubDate><atom:updated>2006-09-08T10:16:58.576-07:00</atom:updated><title>SPEC 2000</title><description>I finally got SPEC 2000, and I run the tests on it. For some reason, in my first attempt the compiler produced more than 12Giga of data. Well, this made my co-workers to burst into laugh, and made me to burst into tears. I've  updated my llvm, just in case, and after the updating, I got 'only' 1.3 G of data, what is better, even though it is still quite a lot of output. I wonder how the old people should test SPEC on the old times. Anyways, I've got a table &lt;A HREF="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0908_report.html"&gt;here&lt;/A&gt;.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/09/spec-2000.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115756238455596075</guid><pubDate>Wed, 06 Sep 2006 17:06:00 +0000</pubDate><atom:updated>2006-09-06T10:06:24.566-07:00</atom:updated><title>More experiments</title><description>I could get some more time improvement in my register allocation algorithm. I will be now trying to implement a conversion of three address code instructions to two address code for the X86 port. It worked quite well with PowerPC. The problem is that X86 has much more two address instructions. Annoying architecture... By the way, the new &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0906_report.html"&gt;table&lt;/A&gt; contains some improvements.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/09/more-experiments.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115716494396543705</guid><pubDate>Sat, 02 Sep 2006 02:41:00 +0000</pubDate><atom:updated>2006-09-01T19:42:23.973-07:00</atom:updated><title>First data checked in!</title><description>Hey, I've got some documentation checked on the official LLVM web page!&lt;br /&gt;Thank you for the honor, Chris :)&lt;br /&gt;    Hum... I think some more people had the same question as I did, when&lt;br /&gt;testing the register allocation. Here goes the explanation:&lt;br /&gt;    In TEST.llc.Makefile, you can set the type of register allocator that&lt;br /&gt;you want:&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;LLC_OPTS = -f -o=/dev/null -stats -time-passes -regalloc=linearscan&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;to compare against your allocator, open "Makefile.program", and set&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;LLCBETAOPTION := -regalloc=your_allocator -fast&lt;br /&gt;&lt;/CODE&gt;&lt;br /&gt;After that, you just have to type make&lt;br /&gt;&lt;CODE&gt;TEST=nightly report.html&lt;/CODE&gt; on &lt;CODE&gt;project/llvm-test/&lt;/CODE&gt;&lt;br /&gt;An '*' on the report means that your test failed. The report will give you&lt;br /&gt;your compile time, and the running time of the compiled file.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/09/first-data-checked-in.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115700266627177388</guid><pubDate>Thu, 31 Aug 2006 05:37:00 +0000</pubDate><atom:updated>2006-08-30T22:37:46.283-07:00</atom:updated><title>Documentation</title><description>I am back working on LLVM. This time I decided to write some documentation about the infrastructure that LLVM provides for register allocation. Check the &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/llvm_doc/regAlloc.html"&gt;html&lt;/A&gt;.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/documentation.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115646256770947070</guid><pubDate>Thu, 24 Aug 2006 23:34:00 +0000</pubDate><atom:updated>2006-08-24T16:36:07.716-07:00</atom:updated><title>Short break</title><description>I will not be working on the Summer of Code project on the next four days, i.e, there will not be any posting on this period. On this Tuesday night I return working on the project. I have many ideas of how to optimize the code that is been produced.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/short-break_24.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115629608901048121</guid><pubDate>Wed, 23 Aug 2006 01:20:00 +0000</pubDate><atom:updated>2006-08-22T18:22:17.263-07:00</atom:updated><title>post X pre deconstruction</title><description>I finished compiling one comparison between my algorithm, and LLVM's linear scan algorithm. The results are not very good yet. But I plan to improve them. I already have some ideas of how to do this. Check the comparative table &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0822_report.txt"&gt;here&lt;/A&gt;. In this table, linear scan is the &lt;I&gt;beta&lt;/I&gt; compiler, which is producing (unfortunately for me) faster code. By the way, I hope the window of your browser is big, otherwise it will be a bit painful to see all the results nicely aligned into columns.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/post-x-pre-deconstruction.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115618080449386080</guid><pubDate>Mon, 21 Aug 2006 17:19:00 +0000</pubDate><atom:updated>2006-08-21T10:21:37.410-07:00</atom:updated><title>Final code</title><description>With the new C sources, my compiler could pass all the expected tests on C files. I could not find all the C++ libraries, so, it is not compiling all the .cpp files. But the &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0821_report.html"&gt;new&lt;/A&gt; table is much better than the &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0818_report.html"&gt;old&lt;/A&gt; one. The final code is &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/src/0821_SoC.tar.gz"&gt;here&lt;/A&gt;. I still plan to carry on many optimizations on this code, but I think the post-deconstruction of phi-functions will not add any benefits to the register allocator. What should be done is a graph based algorithm that uses maximum cardinality search to find a good coloring. This is my next step, and my project for this September.</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/final-code.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115604997158270434</guid><pubDate>Sun, 20 Aug 2006 04:58:00 +0000</pubDate><atom:updated>2006-08-19T21:59:31.593-07:00</atom:updated><title>stdlib.h</title><description>I've discovered why so many tests were failing: my cfrontend was wrong. My version of LLVM does not compile anything that imports stdlib.h. I sort of fixed this by copying the sources from the gcc compiler in my OS (gcc 4.0.1) to &lt;CODE&gt;&lt;br /&gt;cfrontend/ ppc/ llvm-gcc/ lib/gcc/ powerpc-apple-darwin8.5.0/ 3.4-llvm/ old_include/ stdlib.h&lt;/CODE&gt;. It seems that it solved this problem, but there are some other problems when compiling &lt;CODE&gt;cpp&lt;/CODE&gt; files. I tried many tests by hand, using this &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/src/sh_exec.txt"&gt;script&lt;/A&gt;. My compiler passed all of them, with the new gcc front end. Also, I discovered another bug: I am not handling the translation of two address instructions. Now I think I am handling it, at least for the Power PC architecture. I implemented a small pass to make this conversion, after register allocation has been performed. The code is here: &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/src/0819_ThreeAddr2TwoAddr_Fer.cpp"&gt;.cpp&lt;/A&gt; and &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/src/0819_ThreeAddr2TwoAddr_Fer.h"&gt;.h&lt;/A&gt;. Actually, my compiler did not pass these tests: &lt;CODE&gt;2006-01-23-InitializedBitField.c, 2006-01-23-UnionInit.c&lt;/CODE&gt;, but linear scan failed too, so I will assume that it is a bug in the platform.&lt;br /&gt;&lt;br /&gt;I just remember that this may be important: besides my own source code, I am changing the following files from LLVM:&lt;br /&gt;&lt;CODE&gt;&lt;br /&gt;include/llvm/Passes.h&lt;br /&gt;include/llvm/Target/MRegisterInfo.h&lt;br /&gt;lib/Target/X86/X86RegisterInfo.h&lt;br /&gt;lib/Target/X86/X86RegisterInfo.h&lt;br /&gt;lib/Target/PPC/PPCRegisterInfo.h&lt;br /&gt;lib/Target/PPC/PPCRegisterInfo.h&lt;br /&gt;lib/Target/PowerPC/PPCTargetMachine.cpp&lt;br /&gt;lib/CodeGen/Passes.cpp&lt;br /&gt;&lt;/CODE&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/stdlibh.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-28819356.post-115596330053982599</guid><pubDate>Sat, 19 Aug 2006 04:53:00 +0000</pubDate><atom:updated>2006-08-18T21:55:00.546-07:00</atom:updated><title>Night tests</title><description>Yesterday I tried to run the night test, but something went quite wrong, and it end up stuffing 2 giga of data into my university account. Well, the computer complained all right, and it did not worked out. Anyways, it produced &lt;A href="http://compilers.cs.ucla.edu/fernando/projects/soc/output/0818_report.html"&gt;this&lt;/A&gt; table. I decided to upgrade my version of LLVM, and tried the whole thing again. The tests are running in this very moment, while I am writing this report. My command line was:&lt;BR&gt; &lt;CODE&gt;$HOME/Programs/ppc_llvm/utils/NewNightlyTest.pl -parallel -nickname pronesto :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm $HOME/Programs/ppc_llvm/projects/fer_tests $HOME/Programs/ppc_llvm/projects/fer_results&lt;/CODE&gt;.&lt;BR&gt;</description><link>http://compilers.cs.ucla.edu/fernando/projects/soc/blog/2006/08/night-tests.html</link><author>noreply@blogger.com (Fernando Magno Quintão Pereira)</author></item></channel></rss>