[RISCV][NFC] Remove Redundant Inline Asm Logic (#124202)
[llvm-project.git] / flang / lib / Frontend / FrontendOptions.cpp
blob2141dacc6df7d8e75c745eb452e242ae8897927d
1 //===- FrontendOptions.cpp ------------------------------------------------===//
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 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
11 //===----------------------------------------------------------------------===//
13 #include "flang/Frontend/FrontendOptions.h"
15 using namespace Fortran::frontend;
17 bool Fortran::frontend::isFixedFormSuffix(llvm::StringRef suffix) {
18 // Note: Keep this list in-sync with flang/test/lit.cfg.py
19 return suffix == "f77" || suffix == "f" || suffix == "F" || suffix == "ff" ||
20 suffix == "for" || suffix == "FOR" || suffix == "fpp" ||
21 suffix == "FPP";
24 bool Fortran::frontend::isFreeFormSuffix(llvm::StringRef suffix) {
25 // Note: Keep this list in-sync with flang/test/lit.cfg.py
26 return suffix == "f90" || suffix == "F90" || suffix == "ff90" ||
27 suffix == "f95" || suffix == "F95" || suffix == "ff95" ||
28 suffix == "f03" || suffix == "F03" || suffix == "f08" ||
29 suffix == "F08" || suffix == "f18" || suffix == "F18" ||
30 suffix == "cuf" || suffix == "CUF";
33 bool Fortran::frontend::isToBePreprocessed(llvm::StringRef suffix) {
34 return suffix == "F" || suffix == "FOR" || suffix == "fpp" ||
35 suffix == "FPP" || suffix == "F90" || suffix == "F95" ||
36 suffix == "F03" || suffix == "F08" || suffix == "F18" ||
37 suffix == "CUF";
40 bool Fortran::frontend::isCUDAFortranSuffix(llvm::StringRef suffix) {
41 return suffix == "cuf" || suffix == "CUF";
44 InputKind FrontendOptions::getInputKindForExtension(llvm::StringRef extension) {
45 if (isFixedFormSuffix(extension) || isFreeFormSuffix(extension)) {
46 return Language::Fortran;
49 if (extension == "bc" || extension == "ll")
50 return Language::LLVM_IR;
51 if (extension == "fir" || extension == "mlir")
52 return Language::MLIR;
54 return Language::Unknown;