llvm.org GIT mirror llvm / 05fe4b0
Changes docs for llvm.cs.uiuc.edu -> llvm.org git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26746 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
30 changed file(s) with 95 addition(s) and 95 deletion(s). Raw diff Collapse all Expand all
7474 same object, or are known to never point to the same object.

7575
7676

The LLVM

77 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
77 href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
7878 class is the primary interface used by clients and implementations of alias
7979 analyses in the LLVM system. This class is the common interface between clients
8080 of alias analysis information and the implementations providing it, and is
101101
102102
103103

The

104 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
104 href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
105105 class defines the interface that the various alias analysis implementations
106106 should support. This class exports two important enums: AliasResult
107107 and ModRefResult which represent the result of an alias query or a
950950 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
951951
952952 Chris Lattner
953 LLVM Compiler Infrastructure
953 LLVM Compiler Infrastructure
954954 Last modified: $Date$
955955
956956
229229 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
230230
231231 Chris Lattner
232 LLVM Compiler Infrastructure
232 LLVM Compiler Infrastructure
233233 Last modified: $Date$
234234
235235
746746
747747

Note that we plan to eventually expand the target description

748748 capabilities
749 of bytecode files to target
749 of bytecode files to target
750750 triples.
751751

752752
15521552

Instructions encode an opcode that identifies the kind of instruction.

15531553 Opcodes are an enumerated integer value. The specific values used depend on
15541554 the version of LLVM you're using. The opcode values are defined in the
1555
1555
15561556 include/llvm/Instruction.def file. You should check there for the
15571557 most recent definitions. The table below provides the opcodes defined as of
15581558 the writing of this document. The table associates each opcode mnemonic with
21462146 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
21472147 Reid Spencer and
21482148 href="mailto:sabre@nondot.org">Chris Lattner
2149 The LLVM Compiler Infrastructure
2149 The LLVM Compiler Infrastructure
21502150 Last modified: $Date$
21512151
21522152
183183 shown below. Also,
184184 note that Solaris has trouble with various wide (multibyte) character
185185 functions from C as referenced from C++, so we typically configure with
186 --disable-c-mbchar (cf. Bug 206).
186 --disable-c-mbchar (cf. Bug 206).
187187

188188
189189

                  
                
311311
312312 University of Illinois at Urbana-Champaign
313313
314 http://llvm.cs.uiuc.edu
314 http://llvm.org
315315
316316 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
317317 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
355355 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
356356
357357 Brian Gaeke
358 LLVM Compiler Infrastructure
358 LLVM Compiler Infrastructure
359359 Last modified: $Date$
360360
361361
12951295 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
12961296
12971297 Chris Lattner
1298 The LLVM Compiler Infrastructure
1298 The LLVM Compiler Infrastructure
12991299 Last modified: $Date$
13001300
13011301
652652 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
653653
654654 Chris Lattner
655 LLVM Compiler Infrastructure
655 LLVM Compiler Infrastructure
656656 Last modified: $Date$
657657
658658
18981898 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
18991899
19001900 Chris Lattner
1901 LLVM Compiler Infrastructure
1901 LLVM Compiler Infrastructure
19021902 Last modified: $Date$
19031903
19041904
813813 href="http://validator.w3.org/check/referer">
814814 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
815815 href="mailto:rspencer@x10sys.com">Reid Spencer
816 The LLVM Compiler Infrastructure
816 The LLVM Compiler Infrastructure
817817 Last modified: $Date$
818818
819819
323323
324324
325

See bug 351

325

See bug 351

326326 for further details on the progress of this work

327327
328328
336336 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
337337
338338 Reid Spencer
339 LLVM Compiler Infrastructure
339 LLVM Compiler Infrastructure
340340 Last modified: $Date$
341341
342342
558558 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
559559
560560 Chris Lattner
561 LLVM Compiler Infrastructure
561 LLVM Compiler Infrastructure
562562 Last modified: $Date$
563563
564564
415415
416416
  • cd into the llvm/projects directory
  • 417417
  • check out the llvm-test module with:
  • 418 cvs -d :pserver:anon@llvm.cs.uiuc.edu:/var/cvs/llvm co -PR llvm-test
    418 cvs -d :pserver:anon@llvm.org:/var/cvs/llvm co -PR llvm-test
    419419 This will get the test suite into llvm/projects/llvm-test
    420420
  • configure the test suite. You can do this one of two ways:
  • 421421
    467467
    468468
    469469

    470 The LLVM Nightly Testers
    470 The LLVM Nightly Testers
    471471 automatically check out an LLVM tree, build it, run the "nightly"
    472472 program test (described above), run all of the feature and regression tests,
    473473 and then delete the checked out tree. This tester is designed to ensure that
    491491
    
                      
                    
    492492 #!/bin/bash
    493493 BASE=/proj/work/llvm/nightlytest
    494 export CVSROOT=:pserver:anon@llvm.cs.uiuc.edu:/var/cvs/llvm
    494 export CVSROOT=:pserver:anon@llvm.org:/var/cvs/llvm
    495495 export BUILDDIR=$BASE/build
    496496 export WEBDIR=$BASE/testresults
    497497 export LLVMGCCDIR=/proj/work/llvm/cfrontend/install
    520520 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
    521521
    522522 John T. Criswell, Reid Spencer, and Tanya Lattner
    523 The LLVM Compiler Infrastructure
    523 The LLVM Compiler Infrastructure
    524524 Last modified: $Date$
    525525
    526526
    495495 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
    496496 Reid Spencer
    497497
    498 The LLVM Compiler Infrastructure
    498 The LLVM Compiler Infrastructure
    499499
    Last modified: $Date$
    500500
    501501
    249249 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
    250250
    251251 Misha Brukman
    252 The LLVM Compiler Infrastructure
    252 The LLVM Compiler Infrastructure
    253253
    254254 Last modified: $Date$
    255255
    114114 above all, a structuring technique for compiler code.

    115115
    116116

    All LLVM passes are subclasses of the

    117 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1Pass.html">Pass
    117 href="http://llvm.org/doxygen/classllvm_1_1Pass.html">Pass
    118118 class, which implement functionality by overriding virtual methods inherited
    119119 from Pass. Depending on how your pass works, you should inherit from
    120120 the ModulePass,
    205205 Start out with:

    206206
    207207
    
                      
                    
    208 #include "llvm/Pass.h"
    209 #include "llvm/Function.h"
    208 #include "llvm/Pass.h"
    209 #include "llvm/Function.h"
    210210
    211211
    212212

    Which are needed because we are writing a

    213 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1Pass.html">Pass, and
    213 href="http://llvm.org/doxygen/classllvm_1_1Pass.html">Pass, and
    214214 we are operating on
    215 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1Function.html">Function's.

    215 href="http://llvm.org/doxygen/classllvm_1_1Function.html">Function's.

    216216
    217217

    Next we have:

    218218
    
                      
                    
    241241

    242242
    243243

    This declares a "Hello" class that is a subclass of

    244 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1FunctionPass.html">FunctionPass.
    244 href="http://llvm.org/doxygen/classllvm_1_1FunctionPass.html">FunctionPass.
    245245 The different builtin pass subclasses are described in detail
    246246 href="#passtype">later, but for now, know that
    247247 href="#FunctionPass">FunctionPass's operate a function at a
    275275

    As a whole, the .cpp file looks like:

    276276
    277277
    
                      
                    
    278 #include "llvm/Pass.h"
    279 #include "llvm/Function.h"
    278 #include "llvm/Pass.h"
    279 #include "llvm/Function.h"
    280280
    281281 using namespace llvm;
    282282
    423423
    424424
    425425

    The most plain and boring type of pass is the "

    426 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1ImmutablePass.html">ImmutablePass"
    426 href="http://llvm.org/doxygen/classllvm_1_1ImmutablePass.html">ImmutablePass"
    427427 class. This pass type is used for passes that do not have to be run, do not
    428428 change state, and never need to be updated. This is not a normal type of
    429429 transformation or analysis, but can provide information about the current
    446446
    447447
    448448

    The "

    449 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1ModulePass.html">ModulePass"
    449 href="http://llvm.org/doxygen/classllvm_1_1ModulePass.html">ModulePass"
    450450 class is the most general of all superclasses that you can use. Deriving from
    451451 ModulePass indicates that your pass uses the entire program as a unit,
    452452 refering to function bodies in no predictable order, or adding and removing
    484484
    485485
    486486

    The "

    487 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass"
    487 href="http://llvm.org/doxygen/classllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass"
    488488 is used by passes that need to traverse the program bottom-up on the call graph
    489489 (callees before callers). Deriving from CallGraphSCCPass provides some
    490490 mechanics for building and traversing the CallGraph, but also allows the system
    592592
    593593
    594594

    In contrast to ModulePass subclasses,

    595 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1Pass.html">FunctionPass
    595 href="http://llvm.org/doxygen/classllvm_1_1Pass.html">FunctionPass
    596596 subclasses do have a predictable, local behavior that can be expected by the
    597597 system. All FunctionPass execute on each function in the program
    598598 independent of all of the other functions in the program.
    637637 fast).

    638638
    639639

    A good example of how this method should be used is the

    640 href="http://llvm.cs.uiuc.edu/doxygen/LowerAllocations_8cpp-source.html">LowerAllocations
    640 href="http://llvm.org/doxygen/LowerAllocations_8cpp-source.html">LowerAllocations
    641641 pass. This pass converts malloc and free instructions into
    642642 platform dependent malloc() and free() function calls. It
    643643 uses the doInitialization method to get a reference to the malloc and
    852852 Register* templates that should be used if you want your pass listed by
    853853 multiple or no utilities. This template takes an extra third argument that
    854854 specifies which tools it should be listed in. See the
    855 href="http://llvm.cs.uiuc.edu/doxygen/PassSupport_8h-source.html">PassSupport.h
    855 href="http://llvm.org/doxygen/PassSupport_8h-source.html">PassSupport.h
    856856 file for more information.
    857857
    858858
    933933

    By implementing the getAnalysisUsage method, the required and

    934934 invalidated sets may be specified for your transformation. The implementation
    935935 should fill in the
    936 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AnalysisUsage.html">AnalysisUsage
    936 href="http://llvm.org/doxygen/classllvm_1_1AnalysisUsage.html">AnalysisUsage
    937937 object with information about which passes are required and not invalidated. To
    938938 do this, a pass may call any of the following methods on the AnalysisUsage
    939939 object:

    10101010
    
                      
                    
    10111011 // This is an example implementation from an analysis, which does not modify
    10121012 // the program at all, yet has a prerequisite.
    1013 void PostDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
    1013 void PostDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
    10141014 AU.setPreservesAll();
    1015 AU.addRequired<PostDominatorTree>();
    1015 AU.addRequired<PostDominatorTree>();
    10161016 }
    10171017
    10181018
    10201020
    10211021
    
                      
                    
    10221022 // This example modifies the program, but does not modify the CFG
    1023 void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
    1023 void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
    10241024 AU.setPreservesCFG();
    1025 AU.addRequired<LoopInfo>();
    1025 AU.addRequired<LoopInfo>();
    10261026 }
    10271027
    10281028
    11271127 href="#registerag">RegisterAnalysisGroup.

    11281128
    11291129

    As a concrete example of an Analysis Group in action, consider the

    1130 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    1130 href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    11311131 analysis group. The default implementation of the alias analysis interface (the
    11321132
    1133 href="http://llvm.cs.uiuc.edu/doxygen/structBasicAliasAnalysis.html">basicaa
    1133 href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">basicaa
    11341134 pass) just does a few simple checks that don't require significant analysis to
    11351135 compute (such as: two different globals can never alias each other, etc).
    11361136 Passes that use the
    1137 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    1137 href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    11381138 interface (for example the
    1139 href="http://llvm.cs.uiuc.edu/doxygen/structGCSE.html">gcse pass), do
    1139 href="http://llvm.org/doxygen/structGCSE.html">gcse pass), do
    11401140 not care which implementation of alias analysis is actually provided, they just
    11411141 use the designated interface.

    11421142
    11631163 for the Analysis Group Interface itself, because it is "abstract":

    11641164
    11651165
    
                      
                    
    1166 static RegisterAnalysisGroup<AliasAnalysis> A("Alias Analysis");
    1166 static RegisterAnalysisGroup<AliasAnalysis> A("Alias Analysis");
    11671167
    11681168
    11691169

    Once the analysis is registered, passes can declare that they are valid

    11761176 B("somefancyaa", "A more complex alias analysis implementation");
    11771177
    11781178 // Declare that we implement the AliasAnalysis interface
    1179 RegisterAnalysisGroup<AliasAnalysis, FancyAA> C;
    1179 RegisterAnalysisGroup<AliasAnalysis, FancyAA> C;
    11801180 }
    11811181
    11821182
    11831183

    This just shows a class FancyAA that is registered normally, then

    11841184 uses the RegisterAnalysisGroup template to "join" the
    1185 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    1185 href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis
    11861186 analysis group. Every implementation of an analysis group should join using
    11871187 this template. A single pass may join multiple different analysis groups with
    11881188 no problem.

    11901190
    
                      
                    
    11911191 namespace {
    11921192 // Analysis Group implementations must be registered normally...
    1193 RegisterOpt<BasicAliasAnalysis>
    1193 RegisterOpt<BasicAliasAnalysis>
    11941194 D("basicaa", "Basic Alias Analysis (default AA impl)");
    11951195
    11961196 // Declare that we implement the AliasAnalysis interface
    1197 RegisterAnalysisGroup<AliasAnalysis, BasicAliasAnalysis, true> E;
    1197 RegisterAnalysisGroup<AliasAnalysis, BasicAliasAnalysis, true> E;
    11981198 }
    11991199
    12001200
    12021202 argument to the RegisterAnalysisGroup template). There must be exactly
    12031203 one default implementation available at all times for an Analysis Group to be
    12041204 used. Here we declare that the
    1205 href="http://llvm.cs.uiuc.edu/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis
    1205 href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis
    12061206 pass is the default implementation for the interface.

    12071207
    12081208
    12151215
    12161216
    12171217

    The

    1218 href="http://llvm.cs.uiuc.edu/doxygen/Statistic_8h-source.html">Statistic
    1218 href="http://llvm.org/doxygen/Statistic_8h-source.html">Statistic
    12191219 class is designed to be an easy way to expose various success
    12201220 metrics from passes. These statistics are printed at the end of a
    12211221 run, when the -stats command line option is enabled on the command
    12331233
    12341234
    12351235

    The

    1236 href="http://llvm.cs.uiuc.edu/doxygen/PassManager_8h-source.html">PassManager
    1236 href="http://llvm.org/doxygen/PassManager_8h-source.html">PassManager
    12371237
    1238 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1PassManager.html">class
    1238 href="http://llvm.org/doxygen/classllvm_1_1PassManager.html">class
    12391239 takes a list of passes, ensures their prerequisites
    12401240 are set up correctly, and then schedules passes to run efficiently. All of the
    12411241 LLVM tools that run passes use the PassManager for execution of these
    12661266 the LLVM program representation for a single function at a time, instead of
    12671267 traversing the entire program. It reduces the memory consumption of compiler,
    12681268 because, for example, only one
    1269 href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1DominatorSet.html">DominatorSet
    1269 href="http://llvm.org/doxygen/classllvm_1_1DominatorSet.html">DominatorSet
    12701270 needs to be calculated at a time. This also makes it possible some
    12711271 href="#SMP">interesting enhancements in the future.

    12721272
    15911591 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" />
    15921592
    15931593 Chris Lattner
    1594 The LLVM Compiler Infrastructure
    1594 The LLVM Compiler Infrastructure
    15951595 Last modified: $Date$
    15961596
    15971597
    1919
    2020
    2121
    22
    22
    2323
    2424
    2525
    2727
    2828
    2929
    30

    Written by The LLVM Team

    30

    Written by The LLVM Team

    3131
    3232
    3333
    3535
    3636
    3737
    38
  • LLVM: A
  • 38
  • LLVM: A
  • 3939 Compilation Framework for Lifelong Program Analysis & Transformation: -
    4040 Describes the LLVM instruction set and compilation strategy. This should be the
    4141 first document you read to get an overview of LLVM.
    145145
  • Using LLVM Libraries - Look here to
  • 146146 understand how to use the libraries produced when LLVM is compiled.
    147147
    148
  • Doxygen generated
  • 148
  • Doxygen generated
  • 149149 documentation (
    150 href="http://llvm.cs.uiuc.edu/doxygen/inherits.html">classes)
    151
    152 (tarball)
    150 href="http://llvm.org/doxygen/inherits.html">classes)
    151
    152 (tarball)
    153153
    154154
    155
  • CVSWeb CVS Tree
  • 155
  • CVSWeb CVS Tree
  • 156156 Browser
    157157
    158158
    248248
    249249 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    250250
    251 LLVM Compiler Infrastructure
    251 LLVM Compiler Infrastructure
    252252 Last modified: $Date$
    253253
    254254