//===--- LoweringOptions.def - Lowering options database ---------- 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file defines the lowering options. Users of this file must define
/// LOWERINGOPT macro to make use of this information.
///
//===----------------------------------------------------------------------===//

#ifndef LOWERINGOPT
#  error Define the LOWERINGOPT macro to handle lowering options
#endif

#ifndef ENUM_LOWERINGOPT
#  define ENUM_LOWERINGOPT(Name, Type, Bits, Default) \
LOWERINGOPT(Name, Bits, Default)
#endif

/// If true, lower transpose without a runtime call.
ENUM_LOWERINGOPT(OptimizeTranspose, unsigned, 1, 1)

/// If true, lower to High level FIR before lowering to FIR. On by default.
ENUM_LOWERINGOPT(LowerToHighLevelFIR, unsigned, 1, 1)

/// If true, reverse PowerPC native vector element order.
ENUM_LOWERINGOPT(NoPPCNativeVecElemOrder, unsigned, 1, 0)

/// If true, assume external names will be suffixed with an underscore.
/// On by default.
ENUM_LOWERINGOPT(Underscoring, unsigned, 1, 1)

/// If true, assume the behavior of integer overflow is defined
/// (i.e. wraps around as two's complement). Off by default.
ENUM_LOWERINGOPT(IntegerWrapAround, unsigned, 1, 0)

/// If true (default), follow Fortran 2003 rules for (re)allocating
/// the allocatable on the left side of the intrinsic assignment,
/// if LHS and RHS have mismatching shapes/types.
/// If false, assume that the shapes/types/allocation-status match.
ENUM_LOWERINGOPT(ReallocateLHS, unsigned, 1, 1)

/// If true, initialize globals without initialization to zero.
/// On by default.
ENUM_LOWERINGOPT(InitGlobalZero, unsigned, 1, 1)

/// If true, the dummy assumed shape arrays are conditionally
/// packed into contiguous memory.
ENUM_LOWERINGOPT(RepackArrays, unsigned, 1, 0)

/// If true, the temporary arrays created under RepackArrays
/// control will be allocated in stack memory. If false,
/// they will be allocated in heap memory.
ENUM_LOWERINGOPT(StackRepackArrays, unsigned, 1, 0)

/// If true, the repacking (RepackArrays option above)
/// will be done for arrays non-contiguous in any dimension,
/// otherwise, it will be done only for arrays non-contiguous
/// in the leading dimension.
ENUM_LOWERINGOPT(RepackArraysWhole, unsigned, 1, 0)

/// If true, CUDA Fortran runtime check is inserted.
ENUM_LOWERINGOPT(CUDARuntimeCheck, unsigned, 1, 0)

/// If true, do not generate definition for runtime type info global objects of
/// derived types defined in other compilation units.
ENUM_LOWERINGOPT(SkipExternalRttiDefinition, unsigned, 1, 0)

/// If true, convert complex number division to runtime on the frontend.
/// If false, lower to the complex dialect of MLIR.
/// On by default.
ENUM_LOWERINGOPT(ComplexDivisionToRuntime, unsigned, 1, 1)

/// When true, it registers MLIRDiagnosticsHandler for the duration
/// of the lowering pipeline.
ENUM_LOWERINGOPT(RegisterMLIRDiagnosticsHandler, unsigned, 1, 1)

#undef LOWERINGOPT
#undef ENUM_LOWERINGOPT
