Scroll to navigation

LDC(1) User Commands LDC(1)


LDC - manual page for the LLVM D Compiler


OVERVIEW: LLVM-based D Compiler

USAGE: ldc [options] files --run program args...


-D - Generate documentation

-Dd=<docdir> - Write documentation file to <docdir> directory

-Df=<filename> - Write documentation file to <filename>

-H - Generate 'header' file

-Hd=<hdrdir> - Write 'header' file to <hdrdir> directory

-Hf=<filename> - Write 'header' file to <filename>

-I=<path> - Where to look for imports

-J=<path> - Where to look for string imports

-L=<linkerflag> - Pass <linkerflag> to the linker

Setting the optimization level:

-O - Equivalent to -O2

-O0 - No optimizations (default)

-O1 - Simple optimizations

-O2 - Good optimizations

-O3 - Aggressive optimizations

-O4 - Link-time optimization

-O5 - Link-time optimization

-annotate - Annotate the bitcode with human readable source code

-asm-verbose - Add comments to directives.

-c - Do not link

-check-printf-calls - Validate printf call format strings against arguments

-code-model - Choose code model

- Target default code model
- Small code model
- Kernel code model
- Medium code model
- Large code model

-d - Allow deprecated language features

-d-debug=<level/idents> - Compile in debug code >= <level> or identified by <idents>.

-d-version=<level/idents> - Compile in version code >= <level> or identified by <idents>

-debuglib=<lib,...> - Set default libraries for debug build

-defaultlib=<lib,...> - Set default libraries for non-debug build

-deps=<filename> - Write module dependencies to filename

-enable-asserts - (*) Enable assertions

-enable-boundscheck - (*) Enable array bounds checks

-enable-contracts - (*) Enable function pre- and post-conditions

-disable-d-passes - Disable D-specific passes in -O<N>

-disable-excess-fp-precision - Disable optimizations that may increase FP precision

-disable-fp-elim - Disable frame pointer elimination optimization

-disable-gc2stack - Disable promotion of GC allocations to stack memory in -O<N>

-enable-inlining - (*) Enable function inlining in -O<N>

-enable-invariants - (*) Enable invariants

-disable-post-RA-scheduler - Disable scheduling after register allocation

-enable-postconditions - (*) Enable function postconditions

-enable-preconditions - (*) Enable function preconditions

-disable-simplify-drtcalls - Disable simplification of runtime calls in -O<N>

-disable-spill-fusing - Disable fusing of spill code into instructions

-enable-correct-eh-support - Make the -lowerinvoke pass insert expensive, but correct, EH code

-enable-eh - Emit DWARF exception handling (default if target supports)

-enable-finite-only-fp-math - Enable optimizations that assumes non- NaNs / +-Infs

-enable-fp-mad - Enable less precise MAD instructions to be generated

-enable-load-pre -

-enable-sjlj-eh - Emit SJLJ exception handling (default if target supports)

-enable-unsafe-fp-math - Enable optimizations that may decrease FP precision

-float-abi - Choose float ABI type

- Target default float ABI type
- Soft float ABI (implied by -soft-float)
- Hard float ABI (uses FP registers)
Generating debug information:

-g - Generate debug information

-gc - Same as -g, but pretend to be C

-help - Display available options (--help-hidden for more)

-ignore - Ignore unsupported pragmas

-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

-m32 - 32 bit target

-m64 - 64 bit target

-march=<string> - Architecture to generate code for:

-mattr=<a1,+a2,-a3,...> - Target specific attributes (-mattr=help for details)

-mcpu=<cpu-name> - Target a specific cpu type (-mcpu=help for details)

-mtriple=<string> - Override target triple

-nested-ctx - How to construct a nested function's context:

- Array of pointers to variables (including multi-level)
- List of pointers to structs of variables, one per level.

-noasm - Disallow use of inline assembler

-nodefaultlib - Don't add a default library for linking implicitly

-noruntime - Do not allow code that generates implicit runtime calls

-noverify - Do not run the validation pass before writing bitcode

-nozero-initialized-in-bss - Don't place zero-initialized symbols into bss section

-o- - Do not write object file

-od=<objdir> - Write object files to directory <objdir>

-of=<filename> - Use <filename> as output file name

-op - Do not strip paths from source file

-oq - Write object files with fully qualified names

-output-bc - Write LLVM bitcode

-output-ll - Write LLVM IR

-output-o - Write native object

-output-s - Write native assembly

-pre-RA-sched - Instruction schedulers available (before register allocation):

- Fast suboptimal list scheduling
- Top-down list scheduler
- Top-down register reduction list scheduling
- Bottom-up register reduction list scheduling
- Best scheduler for the target

-print-machineinstrs - Print generated machine code

-profile-estimator-loop-weight=<loop-weight> - Number of loop executions used for profile-estimator

-profile-info-file=<filename> - Profile file loaded by -profile-loader

-profile-randomness - How to randomly choose to profile:

- global counter
- register allocated global counter
- cycle counter

-realign-stack - Realign stack if needed

-regalloc - Register allocator to use: (default = linearscan)

- linear scan register allocator

-release - Disables asserts, invariants, contracts and boundscheck

-relocation-model - Choose relocation model

- Target default relocation model
- Non-relocatable code
- Fully relocatable, position independent code
- Relocatable external references, non-relocatable code

-rewriter - Rewriter to use: (default: local)

- local rewriter
- trivial rewriter

-run=<string> - program args...

-schedule-livein-copies - Schedule copies of livein registers

-schedule-spills - Schedule spill code

-shrink-wrap - Shrink wrap callee-saved register spills/restores

-singleobj - Create only a single output object file

-soft-float - Generate software floating point library calls

-stack-alignment=<uint> - Override default stack alignment

-stack-protector-buffer-size=<uint> - Lower bound for a buffer to be considered for stack protection

-stats - Enable statistics output from program

-tailcallopt - Turn on tail call optimization.

-time-passes - Time each pass, printing elapsed time for each on exit

-unittest - Compile in unit tests

-unwind-tables - Generate unwinding tables for all functions

-v - Verbose

-v-cg - Verbose codegen

-verify-dom-info - Verify dominator info (time consuming)

-version - Display the version of this program

-vv - Very verbose

-w - Enable warnings

-x86-asm-syntax - Choose style of code to emit from X86 backend:

- Emit AT&T-style assembly
- Emit Intel-style assembly

-d-debug can also be specified without options, in which case it enables all debug checks (i.e. (asserts, boundchecks, contracts and invariants) as well as acting as -d-debug=1

Options marked with (*) also have a -disable-FOO variant with inverted meaning.

based on DMD v1.051 and llvm 2.6 (Wed Dec 2 17:39:53 2009) Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen written by Walter Bright and Tomas Lindquist Olsen D Language Documentation: LDC Homepage:


The full documentation for LLVM is maintained as a Texinfo manual. If the info and LLVM programs are properly installed at your site, the command

info LLVM

should give you access to the complete manual.

December 2009 LLVM D Compiler