| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // |
| 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 |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "CodeGenOptions.h" |
| 10 | #include "llvm/CodeGen/MachineFunction.h" |
| 11 | #include "llvm/IR/Function.h" |
| 12 | #include "llvm/IR/LLVMContext.h" |
| 13 | #include "llvm/IR/Module.h" |
| 14 | #include "llvm/Option/LibraryOptions.h" |
| 15 | |
| 16 | #define OPTIONS_STRUCT_DEFS |
| 17 | #include "CodeGenOptions.inc" |
| 18 | |
| 19 | using namespace llvm; |
| 20 | |
| 21 | LLVM_REGISTER_LIBRARY_OPTIONS(llvm::CodeGenOptions) |
| 22 | |
| 23 | const CodeGenOptions &llvm::getCodeGenOptions(const LLVMContext &C) { |
| 24 | return C.getLibraryOptions().get<CodeGenOptions>(); |
| 25 | } |
| 26 | |
| 27 | const CodeGenOptions &llvm::getCodeGenOptions(const Function &F) { |
| 28 | return getCodeGenOptions(C: F.getContext()); |
| 29 | } |
| 30 | |
| 31 | const CodeGenOptions &llvm::getCodeGenOptions(const Module &M) { |
| 32 | return getCodeGenOptions(C: M.getContext()); |
| 33 | } |
| 34 | |
| 35 | const CodeGenOptions &llvm::getCodeGenOptions(const MachineFunction &MF) { |
| 36 | return getCodeGenOptions(C: MF.getFunction().getContext()); |
| 37 | } |
| 38 |