1249423Sdim//===-- CommandFlags.h - Command Line Flags Interface -----------*- C++ -*-===// 2243789Sdim// 3243789Sdim// The LLVM Compiler Infrastructure 4243789Sdim// 5243789Sdim// This file is distributed under the University of Illinois Open Source 6243789Sdim// License. See LICENSE.TXT for details. 7243789Sdim// 8243789Sdim//===----------------------------------------------------------------------===// 9243789Sdim// 10243789Sdim// This file contains codegen-specific flags that are shared between different 11243789Sdim// command line tools. The tools "llc" and "opt" both use this file to prevent 12243789Sdim// flag duplication. 13243789Sdim// 14243789Sdim//===----------------------------------------------------------------------===// 15243789Sdim 16249423Sdim#ifndef LLVM_CODEGEN_COMMANDFLAGS_H 17249423Sdim#define LLVM_CODEGEN_COMMANDFLAGS_H 18243789Sdim 19249423Sdim#include "llvm/Support/CodeGen.h" 20243789Sdim#include "llvm/Support/CommandLine.h" 21243789Sdim#include "llvm/Target/TargetMachine.h" 22243789Sdim#include <string> 23243789Sdimusing namespace llvm; 24243789Sdim 25243789Sdimcl::opt<std::string> 26243789SdimMArch("march", cl::desc("Architecture to generate code for (see --version)")); 27243789Sdim 28243789Sdimcl::opt<std::string> 29243789SdimMCPU("mcpu", 30243789Sdim cl::desc("Target a specific cpu type (-mcpu=help for details)"), 31243789Sdim cl::value_desc("cpu-name"), 32243789Sdim cl::init("")); 33243789Sdim 34243789Sdimcl::list<std::string> 35243789SdimMAttrs("mattr", 36243789Sdim cl::CommaSeparated, 37243789Sdim cl::desc("Target specific attributes (-mattr=help for details)"), 38243789Sdim cl::value_desc("a1,+a2,-a3,...")); 39243789Sdim 40243789Sdimcl::opt<Reloc::Model> 41243789SdimRelocModel("relocation-model", 42243789Sdim cl::desc("Choose relocation model"), 43243789Sdim cl::init(Reloc::Default), 44243789Sdim cl::values( 45243789Sdim clEnumValN(Reloc::Default, "default", 46243789Sdim "Target default relocation model"), 47243789Sdim clEnumValN(Reloc::Static, "static", 48243789Sdim "Non-relocatable code"), 49243789Sdim clEnumValN(Reloc::PIC_, "pic", 50243789Sdim "Fully relocatable, position independent code"), 51243789Sdim clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", 52243789Sdim "Relocatable external references, non-relocatable code"), 53243789Sdim clEnumValEnd)); 54243789Sdim 55243789Sdimcl::opt<llvm::CodeModel::Model> 56243789SdimCMModel("code-model", 57243789Sdim cl::desc("Choose code model"), 58243789Sdim cl::init(CodeModel::Default), 59243789Sdim cl::values(clEnumValN(CodeModel::Default, "default", 60243789Sdim "Target default code model"), 61243789Sdim clEnumValN(CodeModel::Small, "small", 62243789Sdim "Small code model"), 63243789Sdim clEnumValN(CodeModel::Kernel, "kernel", 64243789Sdim "Kernel code model"), 65243789Sdim clEnumValN(CodeModel::Medium, "medium", 66243789Sdim "Medium code model"), 67243789Sdim clEnumValN(CodeModel::Large, "large", 68243789Sdim "Large code model"), 69243789Sdim clEnumValEnd)); 70243789Sdim 71243789Sdimcl::opt<bool> 72243789SdimRelaxAll("mc-relax-all", 73243789Sdim cl::desc("When used with filetype=obj, " 74243789Sdim "relax all fixups in the emitted object file")); 75243789Sdim 76243789Sdimcl::opt<TargetMachine::CodeGenFileType> 77243789SdimFileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile), 78243789Sdim cl::desc("Choose a file type (not all types are supported by all targets):"), 79243789Sdim cl::values( 80243789Sdim clEnumValN(TargetMachine::CGFT_AssemblyFile, "asm", 81243789Sdim "Emit an assembly ('.s') file"), 82243789Sdim clEnumValN(TargetMachine::CGFT_ObjectFile, "obj", 83243789Sdim "Emit a native object ('.o') file"), 84243789Sdim clEnumValN(TargetMachine::CGFT_Null, "null", 85243789Sdim "Emit nothing, for performance testing"), 86243789Sdim clEnumValEnd)); 87243789Sdim 88243789Sdimcl::opt<bool> DisableDotLoc("disable-dot-loc", cl::Hidden, 89243789Sdim cl::desc("Do not use .loc entries")); 90243789Sdim 91243789Sdimcl::opt<bool> DisableCFI("disable-cfi", cl::Hidden, 92243789Sdim cl::desc("Do not use .cfi_* directives")); 93243789Sdim 94243789Sdimcl::opt<bool> EnableDwarfDirectory("enable-dwarf-directory", cl::Hidden, 95243789Sdim cl::desc("Use .file directives with an explicit directory.")); 96243789Sdim 97243789Sdimcl::opt<bool> 98243789SdimDisableRedZone("disable-red-zone", 99243789Sdim cl::desc("Do not emit code that uses the red zone."), 100243789Sdim cl::init(false)); 101243789Sdim 102243789Sdimcl::opt<bool> 103243789SdimEnableFPMAD("enable-fp-mad", 104243789Sdim cl::desc("Enable less precise MAD instructions to be generated"), 105243789Sdim cl::init(false)); 106243789Sdim 107243789Sdimcl::opt<bool> 108243789SdimDisableFPElim("disable-fp-elim", 109243789Sdim cl::desc("Disable frame pointer elimination optimization"), 110243789Sdim cl::init(false)); 111243789Sdim 112243789Sdimcl::opt<bool> 113243789SdimEnableUnsafeFPMath("enable-unsafe-fp-math", 114243789Sdim cl::desc("Enable optimizations that may decrease FP precision"), 115243789Sdim cl::init(false)); 116243789Sdim 117243789Sdimcl::opt<bool> 118243789SdimEnableNoInfsFPMath("enable-no-infs-fp-math", 119243789Sdim cl::desc("Enable FP math optimizations that assume no +-Infs"), 120243789Sdim cl::init(false)); 121243789Sdim 122243789Sdimcl::opt<bool> 123243789SdimEnableNoNaNsFPMath("enable-no-nans-fp-math", 124243789Sdim cl::desc("Enable FP math optimizations that assume no NaNs"), 125243789Sdim cl::init(false)); 126243789Sdim 127243789Sdimcl::opt<bool> 128243789SdimEnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math", 129243789Sdim cl::Hidden, 130243789Sdim cl::desc("Force codegen to assume rounding mode can change dynamically"), 131243789Sdim cl::init(false)); 132243789Sdim 133243789Sdimcl::opt<bool> 134243789SdimGenerateSoftFloatCalls("soft-float", 135243789Sdim cl::desc("Generate software floating point library calls"), 136243789Sdim cl::init(false)); 137243789Sdim 138243789Sdimcl::opt<llvm::FloatABI::ABIType> 139243789SdimFloatABIForCalls("float-abi", 140243789Sdim cl::desc("Choose float ABI type"), 141243789Sdim cl::init(FloatABI::Default), 142243789Sdim cl::values( 143243789Sdim clEnumValN(FloatABI::Default, "default", 144243789Sdim "Target default float ABI type"), 145243789Sdim clEnumValN(FloatABI::Soft, "soft", 146243789Sdim "Soft float ABI (implied by -soft-float)"), 147243789Sdim clEnumValN(FloatABI::Hard, "hard", 148243789Sdim "Hard float ABI (uses FP registers)"), 149243789Sdim clEnumValEnd)); 150243789Sdim 151243789Sdimcl::opt<llvm::FPOpFusion::FPOpFusionMode> 152243789SdimFuseFPOps("fp-contract", 153263508Sdim cl::desc("Enable aggressive formation of fused FP ops"), 154243789Sdim cl::init(FPOpFusion::Standard), 155243789Sdim cl::values( 156243789Sdim clEnumValN(FPOpFusion::Fast, "fast", 157243789Sdim "Fuse FP ops whenever profitable"), 158243789Sdim clEnumValN(FPOpFusion::Standard, "on", 159243789Sdim "Only fuse 'blessed' FP ops."), 160243789Sdim clEnumValN(FPOpFusion::Strict, "off", 161243789Sdim "Only fuse FP ops when the result won't be effected."), 162243789Sdim clEnumValEnd)); 163243789Sdim 164243789Sdimcl::opt<bool> 165243789SdimDontPlaceZerosInBSS("nozero-initialized-in-bss", 166243789Sdim cl::desc("Don't place zero-initialized symbols into bss section"), 167243789Sdim cl::init(false)); 168243789Sdim 169243789Sdimcl::opt<bool> 170243789SdimEnableGuaranteedTailCallOpt("tailcallopt", 171243789Sdim cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."), 172243789Sdim cl::init(false)); 173243789Sdim 174243789Sdimcl::opt<bool> 175243789SdimDisableTailCalls("disable-tail-calls", 176243789Sdim cl::desc("Never emit tail calls"), 177243789Sdim cl::init(false)); 178243789Sdim 179243789Sdimcl::opt<unsigned> 180243789SdimOverrideStackAlignment("stack-alignment", 181243789Sdim cl::desc("Override default stack alignment"), 182243789Sdim cl::init(0)); 183243789Sdim 184243789Sdimcl::opt<std::string> 185243789SdimTrapFuncName("trap-func", cl::Hidden, 186243789Sdim cl::desc("Emit a call to trap function rather than a trap instruction"), 187243789Sdim cl::init("")); 188243789Sdim 189243789Sdimcl::opt<bool> 190243789SdimEnablePIE("enable-pie", 191243789Sdim cl::desc("Assume the creation of a position independent executable."), 192243789Sdim cl::init(false)); 193243789Sdim 194243789Sdimcl::opt<bool> 195243789SdimSegmentedStacks("segmented-stacks", 196243789Sdim cl::desc("Use segmented stacks if possible."), 197243789Sdim cl::init(false)); 198243789Sdim 199243789Sdimcl::opt<bool> 200243789SdimUseInitArray("use-init-array", 201243789Sdim cl::desc("Use .init_array instead of .ctors."), 202243789Sdim cl::init(false)); 203243789Sdim 204243789Sdimcl::opt<std::string> StopAfter("stop-after", 205243789Sdim cl::desc("Stop compilation after a specific pass"), 206243789Sdim cl::value_desc("pass-name"), 207243789Sdim cl::init("")); 208243789Sdimcl::opt<std::string> StartAfter("start-after", 209243789Sdim cl::desc("Resume compilation after a specific pass"), 210243789Sdim cl::value_desc("pass-name"), 211243789Sdim cl::init("")); 212243789Sdim 213243789Sdim#endif 214