Changes between Version 4 and Version 5 of LLVM_ToolDemo


Ignore:
Timestamp:
Mar 12, 2014, 1:57:58 AM (6 years ago)
Author:
cameron
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LLVM_ToolDemo

    v4 v5  
    55We demonstrate the tools on some prototype Parabix code for regular expression matching.
    66
     7== Check It Out ==
    78First get yourself a copy of what you need, installed on a Ubuntu 64-bit machine.
    89
     
    1415svn co http://parabix.costar.sfu.ca/svn/proto/RE
    1516}}}
     17
     18== A Regular Expression Demo ==
    1619
    1720Now let's compile code for matching the regular expression: {{{([^ @]+)@([^ @]+)}}}.
     
    6063Well egrep found the same number of matches, but a lot slower!
    6164
     65
     66== Using LLVM Tools ==
     67
    6268Now let's look at using the LLVM tools.
     69
     70=== Clang Is An Alternative to GCC ===
    6371
    6472{{{
     
    8391Even better than gcc!
    8492
     93=== Getting to LLVM IR ===
     94
    8595Now let's try breaking it down in steps, using LLVM tools.
    8696First, we use clang to make LLVM bitcode.
     
    94104llvm-dis-3.4 llvm-re.bc
    95105}}}
     106
     107==== LLVM IR and SIMD ====
    96108
    97109If we look through the generated IR file, we see all sorts of
     
    113125are used extensively.   Also note that we can directly use SSE2
    114126intrinsics from LLVM.
     127
     128=== LLC Static Optimizer ===
    115129
    116130We can now use llc to generate object code for our
     
    140154though the original command line argument was {{{-msse2}}}.
    141155
     156=== Generating Assembly ===
     157
    142158We can prove this by using llc to generate assembly instead of object code.
    143159{{{
     
    148164are replaced by vpxor, throughout.
    149165
     166If we want to force llc to use an older architecture, we can name it.
     167{{{
     168llc-3.4 -mcpu=core2 -filetype=asm  llvm-re.bc  -o  opt-re-core2.s
     169}}}
     170
     171Now only the SSE2 pxor appears.
     172
     173=== Generating C++ ===
     174
     175Another interesting option is generating C++ code.
     176{{{
     177llc-3.4 -march=cpp llvm-re.bc  -o  opt-re.cpp
     178}}}
     179The output is a program that regenerates the given IR.