1//===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- C++ -*-===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//===----------------------------------------------------------------------===//
9// This file define some types which define code generation concepts. For
10// example, relocation model.
12//===----------------------------------------------------------------------===//
14#ifndef LLVM_SUPPORT_CODEGEN_H
15#define LLVM_SUPPORT_CODEGEN_H
22 // Relocation model types.
24 // Cannot be named PIC due to collision with -DPIC
30 // Sync changes with CodeGenCWrappers.h.
35 // This is used to map -fpic/-fPIC.
54 None,
///< No exception support
55 DwarfCFI,
///< DWARF-like instruction based exceptions
56 SjLj,
///< setjmp/longjmp based exceptions
58 WinEH,
///< Windows Exception Handling
59 Wasm,
///< WebAssembly Exception Handling
60 AIX,
///< AIX Exception Handling
61 ZOS,
///< z/OS MVS Exception Handling. Very similar to DwarfCFI, but the
62 ///< PPA1 is used instead of an .eh_frame section.
67 Default,
// Target-specific (either soft or hard depending on triple, etc).
76 EABI4,
// Target-specific (either 4, 5 or gnu depending on triple).
81 /// Code generation optimization level.
90 /// Get the \c Level identified by the integer \p OL.
92 /// Returns std::nullopt if \p OL is invalid.
93 inline std::optional<CodeGenOptLevel>
getLevel(
int OL) {
98 /// Parse \p C as a single digit integer and get matching \c CodeGenLevel.
100 /// Returns std::nullopt if the input is not a valid optimization level.
104 return getLevel(
static_cast<int>(
C -
'0'));
106 }
// namespace CodeGenOpt
108 /// These enums are meant to be passed into addPassesToEmitFile to indicate
109 /// what type of file to emit, and returned by it to indicate what type of
110 /// file could actually be made.
114 Null // Do not emit any output.
117 // Specify what functions should keep the frame pointer.
120 // Specify what type of zeroing callee-used registers.
127 // Don't zero any call-used regs.
129 // Only zeros call-used GPRs used in the fn and pass args.
131 // Only zeros call-used GPRs used in the fn.
133 // Only zeros call-used regs used in the fn and pass args.
135 // Only zeros call-used regs used in the fn.
137 // Zeros all call-used GPRs that pass args.
139 // Zeros all call-used GPRs.
141 // Zeros all call-used regs that pass args.
143 // Zeros all call-used regs.
146 }
// namespace ZeroCallUsedRegs
149 None = 0,
///< No unwind table requested
150 Sync = 1,
///< "Synchronous" unwind tables
151 Async = 2,
///< "Asynchronous" unwind tables (instr precise)
156 Keep = 0,
///< No function return thunk.
157 Extern = 1,
///< Replace returns with jump to thunk, don't emit thunk.
162 // Don't use unwind v2 (i.e., use v1).
164 // Use unwind v2 here possible, otherwise fallback to v1.
166 // Use unwind v2 everywhere, otherwise raise an error.
This class is the base class for all object file types.
Define some predicates that are used for node matching.
@ C
The default llvm calling convention, compatible with C.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
std::optional< CodeGenOptLevel > parseLevel(char C)
Parse C as a single digit integer and get matching CodeGenLevel.
This is an optimization pass for GlobalISel generic memory operations.
@ SjLj
setjmp/longjmp based exceptions
@ ZOS
z/OS MVS Exception Handling.
@ AIX
AIX Exception Handling.
@ DwarfCFI
DWARF-like instruction based exceptions.
@ Wasm
WebAssembly Exception Handling.
@ Async
"Asynchronous" unwind tables (instr precise)
@ Sync
"Synchronous" unwind tables
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
CodeGenOptLevel
Code generation optimization level.
@ Default
The result values are uniform if and only if all operands are uniform.
@ Keep
No function return thunk.
@ Extern
Replace returns with jump to thunk, don't emit thunk.