[llvm-commits] [www] r102895 - in /www/trunk/demo: DemoInfo.html index.cgi

Nick Lewycky nicholas at mxc.ca
Sun May 2 18:59:39 PDT 2010


Author: nicholas
Date: Sun May  2 20:59:39 2010
New Revision: 102895

URL: http://llvm.org/viewvc/llvm-project?rev=102895&view=rev
Log:
Revert r102894. Someone will have to look at the server logs and let me know
what went wrong.

Modified:
    www/trunk/demo/DemoInfo.html
    www/trunk/demo/index.cgi

Modified: www/trunk/demo/DemoInfo.html
URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/DemoInfo.html?rev=102895&r1=102894&r2=102895&view=diff
==============================================================================
--- www/trunk/demo/DemoInfo.html (original)
+++ www/trunk/demo/DemoInfo.html Sun May  2 20:59:39 2010
@@ -30,27 +30,14 @@
 </ul>
 
 
-<h2><a name="compiler">Compiler</a></h2>
-
-<p>
-Select the front-end compiler you want to use.
-<a href="http://clang.llvm.org/">Clang</a> is an LLVM front-end for the C, C++,
-and Objective-C languages. Clang aims to provide a better user experience
-through expressive diagnostics, a high level of conformance to language
-standards, fast compilation, and low memory use. Like LLVM, Clang provides a
-modular, library-based architecture that makes it suitable for creating or
-integrating with other development tools. Clang is considered a
-production-quality compiler for C and Objective-C on x86 (32- and 64-bit). </p>
-
-
-<h2><a name="language">Source language</a></h2>
+<h2><a name="demangle">Demangle C++ names with C++ filt</a></h2>
 
 <p>
-Select the type of source code you want to compile. If you upload a file you
-don't need this as the language is detected from the file type. Note that clang
-does not support Fortran and llvm-gcc does not support the Objective-C
-languages. </p>
-
+Select this option if you want to run the output LLVM IR through "c++filt", 
+which converts 'mangled' C++ names to their unmangled version. 
+Note that LLVM code produced will not be lexically valid, but it will 
+be easier to understand.
+</p>
 
 <h2><a name="optlevel">Optimization level</a></h2>
 
@@ -87,44 +74,6 @@
 optimizers.</p>
 
 
-<h2><a name="demangle">Demangle C++ names with C++ filt</a></h2>
-
-<p>
-Select this option if you want to run the target output code through "c++filt", 
-which converts 'mangled' C++ names to their unmangled version. 
-Note that target code produced will not be lexically valid, but it will 
-be easier to understand.
-</p>
-
-
-<h2><a name="target">Target</a></h2>
-
-<p>
-Select the target you want to output code for. Generally a target uses the
-<a href="http://llvm.org/cmds/llc.html">llc</a> tool to output machine assembly
-code. However, a few special targets exists: </p>
-<dl>
-
-  <dt><tt><b>LLVM assembly</b></tt>: </dt>
-<dd>
-Select this option to run the LLVM dissambler
-(<a href="http://llvm.org/cmds/llvm-dis.html">llvm-dis</a> tool) to show the LLVM IR.
-</dd>
-
-  <dt><tt><b>LLVM C++ API code</b></tt>: </dt>
-<dd>
-Select this option to auto generate the C++ API calls that could be used to
-create the .bc file.
-</dd>
-
-  <dt><tt><b>C backend</b></tt>: </dt>
-<dd>
-Select this option to compile the resulting bitcode to low-level C code. Note that the
-<a href="http://llvm.org/PR1658">C code violates the ABI of common C++ programs</a>.
-</dd>
-</dl>
-
-
 <h2><a name="bcanalyzer">Analyze generated bytecode</a></h2>
 
 <p>
@@ -133,6 +82,16 @@
 on the generated bytecode, which introspects into the format of the .bc file
 itself.  </p>
 
+
+<h2><a name="llvm2cpp">Show C++ API code</a></h2>
+
+<p>
+Select this option to run the <a 
+href="http://llvm.org/cmds/llvm2cpp.html">llvm2cpp</a> tool
+on the generated bytecode, which auto generates the C++ API calls that could
+be used to create the .bc file.
+</p>
+
 </body>
 </html>
 

Modified: www/trunk/demo/index.cgi
URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/index.cgi?rev=102895&r1=102894&r2=102895&view=diff
==============================================================================
--- www/trunk/demo/index.cgi (original)
+++ www/trunk/demo/index.cgi Sun May  2 20:59:39 2010
@@ -15,46 +15,18 @@
 
 if ( !-d $ROOT ) { mkdir( $ROOT, 0777 ); }
 
-# Automatically update shown llvm version.
-sub llvmVersion {
-    my $version = `llvm-config --version 2>&1`;
-    if ( $version =~ /^(\w+\.\w+)\s*$/ ) {
-      return $1;
-    } else {
-      return ""; # don't show any version if unknown
-    }
-}
-
 my $LOGFILE         = "$ROOT/log.txt";
 my $FORM_URL        = 'index.cgi';
 my $MAILADDR        = 'sabre at nondot.org';
 my $CONTACT_ADDRESS = 'Questions or comments?  Email the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev mailing list</a>.';
-my $LOGO_IMAGE_URL  = '/img/DragonSmall.png';
+my $LOGO_IMAGE_URL  = 'cathead.png';
 my $TIMEOUTAMOUNT   = 20;
-my $LLVM_VERSION    = llvmVersion();
 
 my @PREPENDPATHDIRS =
   (  
     '/opt/llvm-gcc-releases/llvm-gcc/bin',
     '/opt/clang-releases/llvm/bin');
 
-my %COMPILER_LANGUAGE_COMBINATIONS =
-  (
-    'clang' =>
-      {
-        'C' => 1,
-        'C++' => 1,
-        'Objective-C' => 1,
-        'Objective-C++' => 1
-      },
-    'llvm-gcc' =>
-      {
-        'C' => 1,
-        'C++' => 1,
-        'Fortran' => 1
-      }
-  );
-
 my $defaultsrc = "#include <stdio.h>\n#include <stdlib.h>\n\n" .
                  "int factorial(int X) {\n  if (X == 0) return 1;\n" .
                  "  return X*factorial(X-1);\n}\n\n" .
@@ -119,33 +91,6 @@
     }
 }
 
-sub llvmTargets {
-    my %targets = ();
-    my $isReadingTargets = 0;
-    # Read list of available targets from llc tool.
-    open( LLC, 'llc -version 2>&1|' ) or barf("Can't read llc output: $!");
-    while ( <LLC> ) {
-        chomp;
-        if ( /Registered Targets:/ ) {
-            $isReadingTargets = 1;
-            next;
-        }
-        if ( $isReadingTargets and /^\s*(\S+)\s+- ([^[]+)( \[experimental\])?$/ ) {
-            $targets{$1} = { label => $2, experimental => $3 };
-        }
-    }
-    close( LLC );
-    # Fail to user if we didn't get a list. Possible error: The list format of
-    # targets from `llc -version` changed. If so, update the above code.
-    barf(
-      "This page is currently unavailable. The llc tool failed sanity check: Didn't return any list of available targets."
-    ) unless %targets;
-    # Insert standard targets.
-    $targets{'llvm'} = { label => 'LLVM assembly', experimental => 0 };
-    $targets{'cpp'}  = { label => 'LLVM C++ API code', experimental => 0 };
-    return %targets;
-}
-
 sub syntaxHighlightLLVM {
   my ($input) = @_;
   $input =~ s@\b(void|i\d+|float|double|x86_fp80|fp128|ppc_fp128|type|label|opaque)\b@<span class="llvm_type">$1</span>@g;
@@ -182,12 +127,12 @@
 <body leftmargin="10" marginwidth="10">
 
 <div class="www_sectiontitle">
-  Try out LLVM $LLVM_VERSION in your browser!
+  Try out LLVM 2.7 in your browser!
 </div>
 
 <table border=0><tr><td>
-<img src="$LOGO_IMAGE_URL" alt="small dragon logo" width="136" height="136">
-</td><td style="padding-left: 10px">
+<img align=right width=100 height=111 src="$LOGO_IMAGE_URL">
+</td><td>
 EOF
 
 if ( -f "$ROOT/locked" ) {
@@ -196,7 +141,7 @@
   my $currtime = time();
   if ($locktime + 60 > $currtime) {
     print "This page is already in use by someone else at this ";
-    print "time, try reloading in a second or two.  Rarh!</td></tr></table>'\n";
+    print "time, try reloading in a second or two.  Meow!</td></tr></table>'\n";
     exit 0;
   }
 }
@@ -204,27 +149,11 @@
 system("touch $ROOT/locked");
 
 print <<END;
-The mighty LLVM dragon says, paste a C/Obj-C/C++/Fortran program in the text
-box or upload one from your computer, and you can see LLVM compile it, rarh!!
+Bitter Melon the cat says, paste a C/C++/Fortran program in the text box or
+upload one from your computer, and you can see LLVM compile it, meow!!
 </td></tr></table><p>
 END
 
-# Load list of available targets, before we output the rest of the page. If it
-# fails, an error message will be displayed.
-my %llvmTargets = llvmTargets();
-my %targetLabels = map { $_ => $llvmTargets{$_}->{'label'} } keys %llvmTargets;
-
-sub llvmTargetsSortedByLabel {
-  $llvmTargets{$a}->{'label'} cmp $llvmTargets{$b}->{'label'};
-}
-
-my @experimentalTargets = sort llvmTargetsSortedByLabel grep {     $llvmTargets{$_}->{'experimental'} } keys %llvmTargets;
-my @stableTargets       = sort llvmTargetsSortedByLabel grep { not $llvmTargets{$_}->{'experimental'} } keys %llvmTargets;
-# Show llvm and cpp targets first in list as they're kind of special.
- at stableTargets = grep { $_ ne 'llvm' and $_ ne 'cpp' } @stableTargets;
- at stableTargets = ('llvm', 'cpp', @stableTargets);
-
-
 print $c->start_multipart_form( 'POST', $FORM_URL );
 
 my $source = $c->param('source');
@@ -240,7 +169,7 @@
 
 print $c->textarea(
     -name    => "source",
-    -rows    => 20,
+    -rows    => 16,
     -columns => 60,
     -default => $source
 ), "<br>";
@@ -255,19 +184,12 @@
 
 print "<center><h3>General Options</h3></center>";
 
-print "Compiler: ",
-  $c->radio_group(
-    -name    => 'compiler',
-    -values  => [ 'clang', 'llvm-gcc' ],
-    -default => 'clang'
-  ), ' <a href="DemoInfo.html#compiler">?</a><p>';
-
 print "Source language: ",
   $c->radio_group(
     -name    => 'language',
-    -values  => [ 'C', 'C++', 'Objective-C', 'Objective-C++', 'Fortran' ],
+    -values  => [ 'C', 'C++', 'Fortran' ],
     -default => 'C'
-  ), ' <a href="DemoInfo.html#language">?</a><p>';
+  ), "<p>";
 
 print "Optimization level: ",
   $c->radio_group(
@@ -289,27 +211,16 @@
 
 print "<center><h3>Output Options</h3></center>";
 
-print "Target: ",
-  $c->popup_menu(
-    -name    => 'target',
-    -default => 'llvm',
-    -values  => [
-      $c->optgroup(
-        -name   => 'Stable targets',
-        -values => \@stableTargets,
-        -labels => \%targetLabels
-      ), $c->optgroup(
-        -name   => 'Experimental targets',
-        -values => \@experimentalTargets,
-        -labels => \%targetLabels
-      )]
-  ), ' <a href="DemoInfo.html#target">?</a><p>';
-
 print $c->checkbox(
     -name => 'showbcanalysis',
     -label => 'Show detailed bytecode analysis'
   ),' <a href="DemoInfo.html#bcanalyzer">?</a><br>';
 
+print $c->checkbox(
+    -name => 'showllvm2cpp',
+    -label => 'Show LLVM C++ API code'
+  ), ' <a href="DemoInfo.html#llvm2cpp">?</a>';
+
 print "</td></tr></table>";
 
 print "<center>", $c->submit(-value=> 'Compile Source Code'), 
@@ -332,15 +243,9 @@
     $sanitycheckfail .= ' llvm-gcc'
       if ( `llvm-gcc --version 2>&1` !~ /Free Software Foundation/ );
 
-    $sanitycheckfail .= ' clang'
-      if `clang --help 2>&1` !~ /clang "gcc-compatible" driver/;
-
     $sanitycheckfail .= ' llvm-ld'
       if `llvm-ld --help 2>&1` !~ /llvm linker/;
 
-    $sanitycheckfail .= ' llc'
-      if `llc --help 2>&1` !~ /llvm system compiler/;
-
     $sanitycheckfail .= ' llvm-bcanalyzer'
       if `llvm-bcanalyzer --help 2>&1` !~ /bcanalyzer/;
 
@@ -390,8 +295,6 @@
     'C'                => '.c',
     'C++'              => '.cc',
     'Fortran'          => '.f90',
-    'Objective-C'      => '.m',
-    'Objective-C++'    => '.mm',
     'preprocessed C'   => '.i',
     'preprocessed C++' => '.ii'
 );
@@ -403,19 +306,15 @@
     '.ii'   => 'preprocessed C++',
     '.cc'   => 'C++',
     '.cpp'  => 'C++',
-    '.m'    => 'Objective-C',
-    '.mm'   => 'Objective-C++',
     '.f'    => 'Fortran',
     '.f90'  => 'Fortran'
 );
-my %gcc_options = (
+my %language_options = (
     'Java'             => '',
     'JO99'             => '',
     'C'                => '-fnested-functions',
     'C++'              => '',
     'Fortran'          => '',
-    'Objective-C'      => '',
-    'Objective-C++'    => '',
     'preprocessed C'   => '-fnested-functions',
     'preprocessed C++' => ''
 );
@@ -442,27 +341,6 @@
     close $fh;
 }
 
-# Sanity checks on input.
-if ($c->param) {
-
-    # Ensure that the combination of compiler and language is valid.
-    my $compiler = $c->param('compiler');
-    my $language = $c->param('language');
-    my $compilerHTML = $c->escapeHTML($compiler);
-    my $languageHTML = $c->escapeHTML($language);
-    barf(
-      "The $compilerHTML compiler does not support $languageHTML code. Please choose another compiler."
-    ) unless exists $COMPILER_LANGUAGE_COMBINATIONS{$compiler}{$language};
-
-    # Since we inject target name in command line tool (llc), we need to
-    # validate it properly. Check if chosen target is an known valid target.
-    my $target = $c->param('target');
-    my $targetHTML = $c->escapeHTML($target);
-    barf(
-      "Unknown target $targetHTML. Please choose another one."
-    ) unless exists $llvmTargets{$target};
-}
-
 if ($c->param && $source) {
     print $c->hr;
     my $extension = $suffixes{ $c->param('language') };
@@ -487,23 +365,12 @@
     $stats = "-ftime-report"
 	if ( $c->param('showstats') );
 
-    my $compiler = $c->param('compiler');
-    if ( $compiler eq 'clang' ) {
-        my $options = ( $c->param('optlevel') eq "None" ) ? "-O0" : "-O3";
-        try_run( "llvm C/C++/Objective-C/Objective-C++ front-end (clang)",
-          "clang -emit-llvm -msse3 -W -Wall $options $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1",
-          $outputFile );
-    } elsif ( $compiler eq 'llvm-gcc' ) {
-        my $options = $gcc_options{ $c->param('language') };
-        $options .= " -O3" if $c->param('optlevel') ne "None";
-        try_run( "llvm C/C++/Fortran front-end (llvm-gcc)",
-          "llvm-gcc -emit-llvm -msse3 -W -Wall $options $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1",
-          $outputFile );
-    } else {
-        # This shouldn't happen as we already checked whether the compiler/
-        # language combination is valid, which implies the compiler is known.
-        barf("Unknown compiler.");
-    }
+    my $options = $language_options{ $c->param('language') };
+    $options .= " -O3" if $c->param('optlevel') ne "None";
+
+    try_run( "llvm C/C++/Fortran front-end (llvm-gcc)",
+	"llvm-gcc -emit-llvm -msse3 -W -Wall $options $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1",
+      $outputFile );
 
     if ( $c->param('showstats') && -s $timerFile ) {
         my ( $UnhilightedResult, $HtmlResult ) =
@@ -535,25 +402,13 @@
 
     print " Bytecode size is ", -s $bytecodeFile, " bytes.\n";
 
-    my $target = $c->param('target');
-    my $targetLabel = $llvmTargets{$target}->{'label'};
-
-    my $disassemblyFile;
-    if ( $target eq 'llvm' ) {
-        $disassemblyFile = getname(".ll");
-        try_run( "llvm-dis",
-            "llvm-dis -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1",
-            $outputFile );
-    } else {
-        $disassemblyFile = getname(".s");
-        my $options = ( $c->param('optlevel') eq "None" ) ? "-O0" : "-O3";
-        try_run( "llc",
-            "llc -march=$target -asm-verbose $options -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1",
-            $outputFile );
-    }
+    my $disassemblyFile = getname(".ll");
+    try_run( "llvm-dis",
+        "llvm-dis -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1",
+        $outputFile );
 
     if ( $c->param('cxxdemangle') ) {
-        print " Demangling target output.\n";
+        print " Demangling disassembler output.\n";
         my $tmpFile = getname(".ll");
         system("c++filt < $disassemblyFile > $tmpFile 2>&1");
         system("mv $tmpFile $disassemblyFile");
@@ -561,17 +416,12 @@
 
     my ( $UnhilightedResult, $HtmlResult );
     if ( -s $disassemblyFile ) {
-        my $programName = ( $target eq 'llvm' ) ? 'disassembler' : 'static compiler';
         ( $UnhilightedResult, $HtmlResult ) =
-          dumpFile( "Output from llvm $programName targeting $targetLabel", $disassemblyFile );
-        if ( $target eq 'llvm' ) {
-            $HtmlResult = syntaxHighlightLLVM($HtmlResult);
-        }
-        # It would be nice to support highlighting of other assembly files.
-        print $HtmlResult;
+          dumpFile( "Output from LLVM disassembler", $disassemblyFile );
+        print syntaxHighlightLLVM($HtmlResult);
     }
     else {
-        print "<p>Hmm, that's weird, llvm-dis/llc didn't produce any output.</p>\n";
+        print "<p>Hmm, that's weird, llvm-dis didn't produce any output.</p>\n";
     }
 
     if ( $c->param('showbcanalysis') ) {
@@ -579,6 +429,11 @@
       try_run( "llvm-bcanalyzer", "llvm-bcanalyzer $bytecodeFile > $analFile 2>&1", 
         $analFile);
     }
+    if ($c->param('showllvm2cpp') ) {
+      my $l2cppFile = getname(".l2cpp");
+      try_run("llvm2cpp","llc -march=cpp $bytecodeFile -o $l2cppFile 2>&1",
+        $l2cppFile);
+    }
 
     # Get the source presented by the user to CGI, convert newline sequences to simple \n.
     my $actualsrc = $c->param('source');





More information about the llvm-commits mailing list