Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file define some types which define code generation concepts. For |
| 10 | // example, relocation model. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_SUPPORT_CODEGEN_H |
| 15 | #define LLVM_SUPPORT_CODEGEN_H |
| 16 | |
| 17 | namespace llvm { |
| 18 | |
| 19 | // Relocation model types. |
| 20 | namespace Reloc { |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 21 | // Cannot be named PIC due to collision with -DPIC |
| 22 | enum Model { Static, PIC_, DynamicNoPIC, ROPI, RWPI, ROPI_RWPI }; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | // Code model types. |
| 26 | namespace CodeModel { |
| 27 | // Sync changes with CodeGenCWrappers.h. |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 28 | enum Model { Tiny, Small, Kernel, Medium, Large }; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | namespace PICLevel { |
| 32 | // This is used to map -fpic/-fPIC. |
| 33 | enum Level { NotPIC=0, SmallPIC=1, BigPIC=2 }; |
| 34 | } |
| 35 | |
| 36 | namespace PIELevel { |
| 37 | enum Level { Default=0, Small=1, Large=2 }; |
| 38 | } |
| 39 | |
| 40 | // TLS models. |
| 41 | namespace TLSModel { |
| 42 | enum Model { |
| 43 | GeneralDynamic, |
| 44 | LocalDynamic, |
| 45 | InitialExec, |
| 46 | LocalExec |
| 47 | }; |
| 48 | } |
| 49 | |
| 50 | // Code generation optimization level. |
| 51 | namespace CodeGenOpt { |
| 52 | enum Level { |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 53 | None = 0, // -O0 |
| 54 | Less = 1, // -O1 |
| 55 | Default = 2, // -O2, -Os |
| 56 | Aggressive = 3 // -O3 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 57 | }; |
| 58 | } |
| 59 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 60 | /// These enums are meant to be passed into addPassesToEmitFile to indicate |
| 61 | /// what type of file to emit, and returned by it to indicate what type of |
| 62 | /// file could actually be made. |
| 63 | enum CodeGenFileType { |
| 64 | CGFT_AssemblyFile, |
| 65 | CGFT_ObjectFile, |
| 66 | CGFT_Null // Do not emit any output. |
| 67 | }; |
| 68 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 69 | // Specify effect of frame pointer elimination optimization. |
| 70 | namespace FramePointer { |
| 71 | enum FP {All, NonLeaf, None}; |
| 72 | } |
| 73 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 74 | } // end llvm namespace |
| 75 | |
| 76 | #endif |