//===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file define some types which define code generation concepts. For // example, relocation model. // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_CODEGEN_H #define LLVM_SUPPORT_CODEGEN_H #include <cstdint> #include <optional> namespace llvm { // Relocation model types. namespace Reloc { // Cannot be named PIC due to collision with -DPIC enum Model { … }; } // Code model types. namespace CodeModel { // Sync changes with CodeGenCWrappers.h. enum Model { … }; } namespace PICLevel { // This is used to map -fpic/-fPIC. enum Level { … }; } namespace PIELevel { enum Level { … }; } // TLS models. namespace TLSModel { enum Model { … }; } /// Code generation optimization level. enum class CodeGenOptLevel { … }; namespace CodeGenOpt { /// Get the \c Level identified by the integer \p OL. /// /// Returns std::nullopt if \p OL is invalid. inline std::optional<CodeGenOptLevel> getLevel(int OL) { … } /// Parse \p C as a single digit integer and get matching \c CodeGenLevel. /// /// Returns std::nullopt if the input is not a valid optimization level. inline std::optional<CodeGenOptLevel> parseLevel(char C) { … } } // namespace CodeGenOpt /// These enums are meant to be passed into addPassesToEmitFile to indicate /// what type of file to emit, and returned by it to indicate what type of /// file could actually be made. enum class CodeGenFileType { … }; // Specify what functions should keep the frame pointer. enum class FramePointerKind { … }; // Specify what type of zeroing callee-used registers. namespace ZeroCallUsedRegs { const unsigned ONLY_USED = …; const unsigned ONLY_GPR = …; const unsigned ONLY_ARG = …; enum class ZeroCallUsedRegsKind : unsigned int { … }; } // namespace ZeroCallUsedRegs enum class UWTableKind { … }; enum class FunctionReturnThunksKind : unsigned int { … }; } // namespace llvm #endif