最終更新:2013-09-21 (土) 06:28:03 (3868d)  

opt
Top / opt

LLVM optimizer

http://llvm.org/docs/CommandGuide/opt.html

--help

OVERVIEW: llvm .bc -> .bc modular optimizer and analysis printer

USAGE: opt [options] <input bitcode file>

OPTIONS:
  -O1                                          - Optimization level 1. Similar to clang -O1
  -O2                                          - Optimization level 2. Similar to clang -O2
  -O3                                          - Optimization level 3. Similar to clang -O3
  -Os                                          - Like -O2 with extra optimizations for size. Similar to clang -Os
  -Oz                                          - Like -Os but reduces code size further. Similar to clang -Oz
  -S                                           - Write output as LLVM assembly
  -analyze                                     - Only perform analysis, no optimization
  -asm-verbose                                 - Add comments to directives.
  -bounds-checking-single-trap                 - Use one trap block per function
  -code-model                                  - Choose code model
    =default                                   -   Target default code model
    =small                                     -   Small code model
    =kernel                                    -   Kernel code model
    =medium                                    -   Medium code model
    =large                                     -   Large code model
  -cppfname=<function name>                    - Specify the name of the generated function
  -cppfor=<string>                             - Specify the name of the thing to generate
  -cppgen                                      - Choose what kind of output to generate
    =program                                   -   Generate a complete program
    =module                                    -   Generate a module definition
    =contents                                  -   Generate contents of a module
    =function                                  -   Generate a function definition
    =functions                                 -   Generate all function definitions
    =inline                                    -   Generate an inline function
    =variable                                  -   Generate a variable definition
    =type                                      -   Generate a type definition
  -default-data-layout=<layout-string>         - data layout string to use if not specified by module
  -disable-fp-elim                             - Disable frame pointer elimination optimization
  -disable-inlining                            - Do not run the inliner pass
  -disable-internalize                         - Do not mark all symbols as internal
  -disable-non-leaf-fp-elim                    - Disable frame pointer elimination optimization for non-leaf funcs
  -disable-opt                                 - Do not run any optimization passes
  -disable-red-zone                            - Do not emit code that uses the red zone.
  -disable-simplify-libcalls                   - Disable simplify-libcalls
  -disable-spill-fusing                        - Disable fusing of spill code into instructions
  -disable-tail-calls                          - Never emit tail calls
  Choose driver interface:
    -drvnvcl                                   - Nvidia OpenCL driver
    -drvcuda                                   - Nvidia CUDA driver
    -drvtest                                   - Plain Test
  -enable-correct-eh-support                   - Make the -lowerinvoke pass insert expensive, but correct, EH code
  -enable-fp-mad                               - Enable less precise MAD instructions to be generated
  -enable-load-pre                             - 
  -enable-no-infs-fp-math                      - Enable FP math optimizations that assume no +-Infs
  -enable-no-nans-fp-math                      - Enable FP math optimizations that assume no NaNs
  -enable-objc-arc-opts                        - 
  -enable-pie                                  - Assume the creation of a position independent executable.
  -enable-tbaa                                 - 
  -enable-unsafe-fp-math                       - Enable optimizations that may decrease FP precision
  -f                                           - Enable binary output on terminals
  -fatal-assembler-warnings                    - Consider warnings as error
  -fdata-sections                              - Emit data into separate sections
  -ffunction-sections                          - Emit functions into separate sections
  -filetype                                    - Choose a file type (not all types are supported by all targets):
    =asm                                       -   Emit an assembly ('.s') file
    =obj                                       -   Emit a native object ('.o') file
    =null                                      -   Emit nothing, for performance testing
  -float-abi                                   - Choose float ABI type
    =default                                   -   Target default float ABI type
    =soft                                      -   Soft float ABI (implied by -soft-float)
    =hard                                      -   Hard float ABI (uses FP registers)
  -fp-contract                                 - Enable aggresive formation of fused FP ops
    =fast                                      -   Fuse FP ops whenever profitable
    =on                                        -   Only fuse 'blessed' FP ops.
    =off                                       -   Only fuse FP ops when the result won't be effected.
  -funit-at-a-time                             - Enable IPO. This is same as llvm-gcc's -funit-at-a-time
  -help                                        - Display available options (-help-hidden for more)
  -internalize-public-api-file=<filename>      - A file containing list of symbol names to preserve
  -internalize-public-api-list=<list>          - A list of symbol names to preserve
  -join-liveintervals                          - Coalesce copies (default=true)
  -limit-float-precision=<uint>                - Generate low-precision inline sequences for some float libcalls
  -load=<pluginfilename>                       - Load the specified plugin
  -march=<string>                              - Architecture to generate code for (see --version)
  -mattr=<a1,+a2,-a3,...>                      - Target specific attributes (-mattr=help for details)
  -mc-relax-all                                - When used with filetype=obj, relax all fixups in the emitted object file
  -mc-x86-disable-arith-relaxation             - Disable relaxation of arithmetic instruction for X86
  -mcpu=<cpu-name>                             - Target a specific cpu type (-mcpu=help for details)
  -msp430-hwmult-mode                          - Hardware multiplier use mode
    =no                                        -   Do not use hardware multiplier
    =interrupts                                -   Assume hardware multiplier can be used inside interrupts
    =use                                       -   Assume hardware multiplier cannot be used inside interrupts
  -mtriple=<string>                            - Override target triple for module
  Optimizations available:
    -aa-eval                                   - Exhaustive Alias Analysis Precision Evaluator
    -adce                                      - Aggressive Dead Code Elimination
    -alloca-hoisting                           - Hoisting alloca instructions in non-entry blocks to the entry block
    -always-inline                             - Inliner for always_inline functions
    -argpromotion                              - Promote 'by reference' arguments to scalars
    -asan                                      - AddressSanitizer: detects use-after-free and out-of-bounds bugs.
    -basicaa                                   - Basic Alias Analysis (stateless AA impl)
    -basiccg                                   - Basic CallGraph Construction
    -bb-vectorize                              - Basic-Block Vectorization
    -block-freq                                - Block Frequency Analysis
    -block-placement                           - Profile Guided Basic Block Placement
    -bounds-checking                           - Run-time bounds checking
    -branch-prob                               - Branch Probability Analysis
    -break-crit-edges                          - Break critical edges in CFG
    -codegenprepare                            - Optimize for code generation
    -constmerge                                - Merge Duplicate Global Constants
    -constprop                                 - Simple constant propagation
    -correlated-propagation                    - Value Propagation
    -cost-model                                - Cost Model Analysis
    -count-aa                                  - Count Alias Analysis Query Responses
    -da                                        - Dependence Analysis
    -datalayout                                - Data Layout
    -dce                                       - Dead Code Elimination
    -deadargelim                               - Dead Argument Elimination
    -deadarghaX0r                              - Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)
    -debug-aa                                  - AA use debugger
    -die                                       - Dead Instruction Elimination
    -domfrontier                               - Dominance Frontier Construction
    -domtree                                   - Dominator Tree Construction
    -dot-callgraph                             - Print Call Graph to 'dot' file
    -dot-cfg                                   - Print CFG of function to 'dot' file
    -dot-cfg-only                              - Print CFG of function to 'dot' file (with no function bodies)
    -dot-dom                                   - Print dominance tree of function to 'dot' file
    -dot-dom-only                              - Print dominance tree of function to 'dot' file (with no function bodies)
    -dot-postdom                               - Print postdominance tree of function to 'dot' file
    -dot-postdom-only                          - Print postdominance tree of function to 'dot' file (with no function bodies)
    -dot-regions                               - Print regions of function to 'dot' file
    -dot-regions-only                          - Print regions of function to 'dot' file (with no function bodies)
    -dse                                       - Dead Store Elimination
    -early-cse                                 - Early CSE
    -extract-blocks                            - Extract Basic Blocks From Module (for bugpoint use)
    -functionattrs                             - Deduce function attributes
    -globaldce                                 - Dead Global Elimination
    -globalopt                                 - Global Variable Optimizer
    -globalsmodref-aa                          - Simple mod/ref analysis for globals
    -gvn                                       - Global Value Numbering
    -indvars                                   - Induction Variable Simplification
    -inline                                    - Function Integration/Inlining
    -insert-edge-profiling                     - Insert instrumentation for edge profiling
    -insert-gcov-profiling                     - Insert instrumentation for GCOV profiling
    -insert-optimal-edge-profiling             - Insert optimal instrumentation for edge profiling
    -insert-path-profiling                     - Insert instrumentation for Ball-Larus path profiling
    -instcombine                               - Combine redundant instructions
    -instcount                                 - Counts the various types of Instructions
    -instnamer                                 - Assign names to anonymous instructions
    -instsimplify                              - Remove redundant instructions
    -internalize                               - Internalize Global Symbols
    -intervals                                 - Interval Partition Construction
    -ipconstprop                               - Interprocedural constant propagation
    -ipsccp                                    - Interprocedural Sparse Conditional Constant Propagation
    -iv-users                                  - Induction Variable Users
    -jump-threading                            - Jump Threading
    -lazy-value-info                           - Lazy Value Information Analysis
    -lcssa                                     - Loop-Closed SSA Form Pass
    -libcall-aa                                - LibCall Alias Analysis
    -licm                                      - Loop Invariant Code Motion
    -lint                                      - Statically lint-checks LLVM IR
    -loop-deletion                             - Delete dead loops
    -loop-extract                              - Extract loops into new functions
    -loop-extract-single                       - Extract at most one loop into a new function
    -loop-idiom                                - Recognize loop idioms
    -loop-instsimplify                         - Simplify instructions in loops
    -loop-reduce                               - Loop Strength Reduction
    -loop-rotate                               - Rotate Loops
    -loop-simplify                             - Canonicalize natural loops
    -loop-unroll                               - Unroll loops
    -loop-unswitch                             - Unswitch loops
    -loop-vectorize                            - Loop Vectorization
    -loops                                     - Natural Loop Information
    -lower-expect                              - Lower 'expect' Intrinsics
    -loweratomic                               - Lower atomic intrinsics to non-atomic form
    -lowerinvoke                               - Lower invoke and unwind, for unwindless code generators
    -lowerswitch                               - Lower SwitchInst's to branches
    -mem2reg                                   - Promote Memory to Register
    -memcpyopt                                 - MemCpy Optimization
    -memdep                                    - Memory Dependence Analysis
    -mergefunc                                 - Merge Functions
    -mergereturn                               - Unify function exit nodes
    -metarenamer                               - Assign new names to everything
    -module-debuginfo                          - Decodes module-level debug info
    -no-aa                                     - No Alias Analysis (always returns 'may' alias)
    -no-path-profile                           - No Path Profile Information
    -no-profile                                - No Profile Information
    -objc-arc                                  - ObjC ARC optimization
    -objc-arc-aa                               - ObjC-ARC-Based Alias Analysis
    -objc-arc-apelim                           - ObjC ARC autorelease pool elimination
    -objc-arc-contract                         - ObjC ARC contraction
    -objc-arc-expand                           - ObjC ARC expansion
    -partial-inliner                           - Partial Inliner
    -path-profile-loader                       - Load path profile information from file
    -path-profile-verifier                     - Compare the path profile derived edge profile against the edge profile.
    -postdomtree                               - Post-Dominator Tree Construction
    -preverify                                 - Preliminary module verification
    -print-alias-sets                          - Alias Set Printer
    -print-callgraph                           - Print a call graph
    -print-callgraph-sccs                      - Print SCCs of the Call Graph
    -print-cfg-sccs                            - Print SCCs of each function CFG
    -print-dbginfo                             - Print debug info in human readable form
    -print-dom-info                            - Dominator Info Printer
    -print-externalfnconstants                 - Print external fn callsites passed constants
    -print-function                            - Print function to stderr
    -print-memdeps                             - Print MemDeps of function
    -print-module                              - Print module to stderr
    -print-used-types                          - Find Used Types
    -profile-estimator                         - Estimate profiling information
    -profile-loader                            - Load profile information from llvmprof.out
    -profile-metadata-loader                   - Load profile information from llvmprof.out
    -profile-verifier                          - Verify profiling information
    -prune-eh                                  - Remove unused exception handling info
    -reargs                                    - Remove Sign and Zero Extends for Args
    -reassociate                               - Reassociate expressions
    -reg2mem                                   - Demote all values to stack slots
    -regions                                   - Detect single entry single exit regions
    -scalar-evolution                          - Scalar Evolution Analysis
    -scalarrepl                                - Scalar Replacement of Aggregates (DT)
    -scalarrepl-ssa                            - Scalar Replacement of Aggregates (SSAUp)
    -sccp                                      - Sparse Conditional Constant Propagation
    -scev-aa                                   - ScalarEvolution-based Alias Analysis
    -simplify-libcalls                         - Simplify well-known library calls
    -simplifycfg                               - Simplify the CFG
    -sink                                      - Code sinking
    -sroa                                      - Scalar Replacement Of Aggregates
    -strip                                     - Strip all symbols from a module
    -strip-dead-debug-info                     - Strip debug info for unused symbols
    -strip-dead-prototypes                     - Strip Unused Function Prototypes
    -strip-debug-declare                       - Strip all llvm.dbg.declare intrinsics
    -strip-nondebug                            - Strip all symbols, except dbg symbols, from a module
    -tailcallelim                              - Tail Call Elimination
    -targetlibinfo                             - Target Library Information
    -targettransforminfo                       - Target Transform Info
    -tbaa                                      - Type-Based Alias Analysis
    -tsan                                      - ThreadSanitizer: detects data races.
    -verify                                    - Module Verifier
    -view-cfg                                  - View CFG of function
    -view-cfg-only                             - View CFG of function (with no function bodies)
    -view-dom                                  - View dominance tree of function
    -view-dom-only                             - View dominance tree of function (with no function bodies)
    -view-postdom                              - View postdominance tree of function
    -view-postdom-only                         - View postdominance tree of function (with no function bodies)
    -view-regions                              - View regions of function
    -view-regions-only                         - View regions of function (with no function bodies)
  -nozero-initialized-in-bss                   - Don't place zero-initialized symbols into bss section
  -nvptx-codegen-vectors                       - NVPTX Specific: Retain LLVM's vectors and generate PTX vectors
  -nvptx-emit-line-numbers                     - NVPTX Specific: Emit Line numbers even without -G
  -nvptx-emit-src                              - NVPTX Specific: Emit source line in ptx file
  -nvptx-fma-level=<int>                       - NVPTX Specific: FMA contraction (0: don't do it 1: do it  2: do it aggressively
  -nvptx-mad-enable                            - NVPTX Specific: Enable generating FMAD instructions
  -nvptx-prec-divf32=<int>                     - NVPTX Specifies: 0 use div.approx, 1 use div.full, 2 use IEEE Compliant F32 div.rnd if avaiable.
  -nvptx-remove-redundant-moves                - NVPTX: Remove redundant moves introduced by vector lowering
  -nvptx-sched4reg                             - NVPTX Specific: schedule for register pressue
  -o=<filename>                                - Override output filename
  -p                                           - Print module after each transformation
  -pre-RA-sched                                - Instruction schedulers available (before register allocation):
    =vliw-td                                   -   VLIW scheduler
    =list-ilp                                  -   Bottom-up register pressure aware list scheduling which tries to balance ILP and register pressure
    =list-hybrid                               -   Bottom-up register pressure aware list scheduling which tries to balance latency and register pressure
    =source                                    -   Similar to list-burr but schedules in source order when possible
    =list-burr                                 -   Bottom-up register reduction list scheduling
    =linearize                                 -   Linearize DAG, no scheduling
    =fast                                      -   Fast suboptimal list scheduling
    =default                                   -   Best scheduler for the target
  -print-after-all                             - Print IR after each pass
  -print-before-all                            - Print IR before each pass
  -print-breakpoints-for-testing               - Print select breakpoints location for testing
  -print-machineinstrs=<pass-name>             - Print machine instrs
  -profile-estimator-loop-weight=<loop-weight> - Number of loop executions used for profile-estimator
  -profile-file=<filename>                     - Profile file loaded by -profile-metadata-loader
  -profile-info-file=<filename>                - Profile file loaded by -profile-loader
  -profile-verifier-noassert                   - Disable assertions
  -realign-stack                               - Realign stack if needed
  -regalloc                                    - Register allocator to use
    =default                                   -   pick register allocator based on -O option
    =basic                                     -   basic register allocator
    =fast                                      -   fast register allocator
    =greedy                                    -   greedy register allocator
    =pbqp                                      -   PBQP register allocator
  -relocation-model                            - Choose relocation model
    =default                                   -   Target default relocation model
    =static                                    -   Non-relocatable code
    =pic                                       -   Fully relocatable, position independent code
    =dynamic-no-pic                            -   Relocatable external references, non-relocatable code
  -segmented-stacks                            - Use segmented stacks if possible.
  -shrink-wrap                                 - Shrink wrap callee-saved register spills/restores
  -soft-float                                  - Generate software floating point library calls
  -spiller                                     - Spiller to use: (default: standard)
    =trivial                                   -   trivial spiller
    =inline                                    -   inline spiller
  -stack-alignment=<uint>                      - Override default stack alignment
  -stack-protector-buffer-size=<uint>          - Lower bound for a buffer to be considered for stack protection
  -start-after=<pass-name>                     - Resume compilation after a specific pass
  -stats                                       - Enable statistics output from program
  -std-compile-opts                            - Include the standard compile time optimizations
  -std-link-opts                               - Include the standard link time optimizations
  -stop-after=<pass-name>                      - Stop compilation after a specific pass
  -strip-debug                                 - Strip debugger symbol info from translation unit
  -tailcallopt                                 - Turn fastcc calls into tail calls by (potentially) changing ABI.
  -time-passes                                 - Time each pass, printing elapsed time for each on exit
  -use-init-array                              - Use .init_array instead of .ctors.
  -vectorize                                   - Run the BB vectorization passes
  -vectorize-loops                             - Run the Loop vectorization passes
  -verify-dom-info                             - Verify dominator info (time consuming)
  -verify-each                                 - Verify after each transform
  -verify-loop-info                            - Verify loop info (time consuming)
  -verify-regalloc                             - Verify during register allocation
  -verify-region-info                          - Verify region info (time consuming)
  -verify-scev                                 - Verify ScalarEvolution's backedge taken counts (slow)
  -version                                     - Display the version of this program
  -x86-asm-syntax                              - Choose style of code to emit from X86 backend:
    =att                                       -   Emit AT&T-style assembly
    =intel                                     -   Emit Intel-style assembly
  -x86-early-ifcvt                             - Enable early if-conversion on X86
  -x86-use-vzeroupper                          - Minimize AVX to SSE transition penalty