NFC: Use #ifndef in various .td files instead of #ifdef and #else

Upstream LLVM gained support for #ifndef with https://reviews.llvm.org/D61888

This is changed mechanically via the following command:

find . -name "*.td" -exec sed -i -e ':a' -e 'N' -e '$!ba' -e 's/#ifdef \([A-Z_]*\)\n#else/#ifndef \1/g' {} \;

PiperOrigin-RevId: 277789427
This commit is contained in:
Lei Zhang 2019-10-31 13:29:14 -07:00 committed by A. Unique TensorFlower
parent ce9477934a
commit 7432234f3c
42 changed files with 93 additions and 186 deletions

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef TOY_OPS
#else
#ifndef TOY_OPS
#define TOY_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef TOY_OPS
#else
#ifndef TOY_OPS
#define TOY_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef TOY_OPS
#else
#ifndef TOY_OPS
#define TOY_OPS
#ifdef MLIR_CALLINTERFACES
#else
#ifndef MLIR_CALLINTERFACES
include "mlir/Analysis/CallInterfaces.td"
#endif // MLIR_CALLINTERFACES
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
include "toy/ShapeInferenceInterface.td"
#endif // SHAPE_INFERENCE_INTERFACE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
#define SHAPE_INFERENCE_INTERFACE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef TOY_OPS
#else
#ifndef TOY_OPS
#define TOY_OPS
#ifdef MLIR_CALLINTERFACES
#else
#ifndef MLIR_CALLINTERFACES
include "mlir/Analysis/CallInterfaces.td"
#endif // MLIR_CALLINTERFACES
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
include "toy/ShapeInferenceInterface.td"
#endif // SHAPE_INFERENCE_INTERFACE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
#define SHAPE_INFERENCE_INTERFACE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef TOY_OPS
#else
#ifndef TOY_OPS
#define TOY_OPS
#ifdef MLIR_CALLINTERFACES
#else
#ifndef MLIR_CALLINTERFACES
include "mlir/Analysis/CallInterfaces.td"
#endif // MLIR_CALLINTERFACES
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
include "toy/ShapeInferenceInterface.td"
#endif // SHAPE_INFERENCE_INTERFACE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SHAPE_INFERENCE_INTERFACE
#else
#ifndef SHAPE_INFERENCE_INTERFACE
#define SHAPE_INFERENCE_INTERFACE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -21,12 +21,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef MLIR_CALLINTERFACES
#else
#ifndef MLIR_CALLINTERFACES
#define MLIR_CALLINTERFACES
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef MLIR_INFERTYPEOPINTERFACE
#else
#ifndef MLIR_INFERTYPEOPINTERFACE
#define MLIR_INFERTYPEOPINTERFACE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef AFFINE_OPS
#else
#ifndef AFFINE_OPS
#define AFFINE_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE
#ifdef MLIR_LOOPLIKEINTERFACE
#else
#ifndef MLIR_LOOPLIKEINTERFACE
include "mlir/Transforms/LoopLikeInterface.td"
#endif

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef AFFINE_OPS_BASE
#else
#ifndef AFFINE_OPS_BASE
#define AFFINE_OPS_BASE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -20,11 +20,9 @@
//
//===----------------------------------------------------------------------===//
#ifdef DIALECT_FXPMATHOPS_FXPMATH_OPS_
#else
#ifndef DIALECT_FXPMATHOPS_FXPMATH_OPS_
#define DIALECT_FXPMATHOPS_FXPMATH_OPS_
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef GPU_OPS
#else
#ifndef GPU_OPS
#define GPU_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef LLVMIR_OP_BASE
#else
#ifndef LLVMIR_OP_BASE
#define LLVMIR_OP_BASE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef LLVMIR_OPS
#else
#ifndef LLVMIR_OPS
#define LLVMIR_OPS
include "mlir/Dialect/LLVMIR/LLVMOpBase.td"

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef NVVMIR_OPS
#else
#ifndef NVVMIR_OPS
#define NVVMIR_OPS
include "mlir/Dialect/LLVMIR/LLVMOpBase.td"

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef ROCDLIR_OPS
#else
#ifndef ROCDLIR_OPS
#define ROCDLIR_OPS
include "mlir/Dialect/LLVMIR/LLVMOpBase.td"

View File

@ -19,13 +19,11 @@
//
//===----------------------------------------------------------------------===//
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE
#ifdef LINALG_BASE
#else
#ifndef LINALG_BASE
#define LINALG_BASE
def Linalg_Dialect : Dialect {

View File

@ -20,17 +20,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef LINALG_LIBRARY_OPS
#else
#ifndef LINALG_LIBRARY_OPS
#define LINALG_LIBRARY_OPS
#ifdef AFFINE_OPS_BASE
#else
#ifndef AFFINE_OPS_BASE
include "mlir/Dialect/AffineOps/AffineOpsBase.td"
#endif // AFFINE_OPS_BASE
#ifdef LINALG_BASE
#else
#ifndef LINALG_BASE
include "mlir/Dialect/Linalg/IR/LinalgBase.td"
#endif // LINALG_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef LINALG_OPS
#else
#ifndef LINALG_OPS
#define LINALG_OPS
#ifdef AFFINE_OPS_BASE
#else
#ifndef AFFINE_OPS_BASE
include "mlir/Dialect/AffineOps/AffineOpsBase.td"
#endif // AFFINE_OPS_BASE
#ifdef LINALG_BASE
#else
#ifndef LINALG_BASE
include "mlir/Dialect/Linalg/IR/LinalgBase.td"
#endif // LINALG_BASE

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef LINALG_TRANSFORMS
#else
#ifndef LINALG_TRANSFORMS
#define LINALG_TRANSFORMS
include "mlir/Dialect/Linalg/IR/LinalgOps.td"

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef LOOP_OPS
#else
#ifndef LOOP_OPS
#define LOOP_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE
#ifdef MLIR_LOOPLIKEINTERFACE
#else
#ifndef MLIR_LOOPLIKEINTERFACE
include "mlir/Transforms/LoopLikeInterface.td"
#endif

View File

@ -19,11 +19,9 @@
//
//===----------------------------------------------------------------------===//
#ifdef DIALECT_QUANTOPS_QUANT_OPS_
#else
#ifndef DIALECT_QUANTOPS_QUANT_OPS_
#define DIALECT_QUANTOPS_QUANT_OPS_
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
include "mlir/Dialect/QuantOps/QuantPredicates.td"
#endif // OP_BASE

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef DIALECT_QUANTOPS_QUANT_PREDICATES_
#else
#ifndef DIALECT_QUANTOPS_QUANT_PREDICATES_
#define DIALECT_QUANTOPS_QUANT_PREDICATES_
//===----------------------------------------------------------------------===//

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_ARITHMETIC_OPS
#else
#ifndef SPIRV_ARITHMETIC_OPS
#define SPIRV_ARITHMETIC_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -21,12 +21,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
#define SPIRV_BASE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_BIT_OPS
#else
#ifndef SPIRV_BIT_OPS
#define SPIRV_BIT_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_CAST_OPS
#else
#ifndef SPIRV_CAST_OPS
#define SPIRV_CAST_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -20,17 +20,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_CONTROLFLOW_OPS
#else
#ifndef SPIRV_CONTROLFLOW_OPS
#define SPIRV_CONTROLFLOW_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE
#ifdef MLIR_CALLINTERFACES
#else
#ifndef MLIR_CALLINTERFACES
include "mlir/Analysis/CallInterfaces.td"
#endif // MLIR_CALLINTERFACES

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_GLSL_OPS
#else
#ifndef SPIRV_GLSL_OPS
#define SPIRV_GLSL_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/Dialect/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -20,12 +20,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_LOGICAL_OPS
#else
#ifndef SPIRV_LOGICAL_OPS
#define SPIRV_LOGICAL_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -26,48 +26,39 @@
// op traits, arguments, results, and sections after the results are retained.
// Besides, ops in this file must be separated via the '// -----' marker.
#ifdef SPIRV_OPS
#else
#ifndef SPIRV_OPS
#define SPIRV_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/Dialect/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE
#ifdef SPIRV_ARITHMETIC_OPS
#else
#ifndef SPIRV_ARITHMETIC_OPS
include "mlir/Dialect/SPIRV/SPIRVArithmeticOps.td"
#endif // SPIRV_ARITHMETIC_OPS
#ifdef SPIRV_BIT_OPS
#else
#ifndef SPIRV_BIT_OPS
include "mlir/Dialect/SPIRV/SPIRVBitOps.td"
#endif // SPIRV_BIT_OPS
#ifdef SPIRV_CAST_OPS
#else
#ifndef SPIRV_CAST_OPS
include "mlir/Dialect/SPIRV/SPIRVCastOps.td"
#endif // SPIRV_CAST_OPS
#ifdef SPIRV_CONTROLFLOW_OPS
#else
#ifndef SPIRV_CONTROLFLOW_OPS
include "mlir/Dialect/SPIRV/SPIRVControlFlowOps.td"
#endif // SPIRV_CONTROLFLOW_OPS
#ifdef SPIRV_LOGICAL_OPS
#else
#ifndef SPIRV_LOGICAL_OPS
include "mlir/Dialect/SPIRV/SPIRVLogicalOps.td"
#endif // SPIRV_LOGICAL_OPS
#ifdef SPIRV_STRUCTURE_OPS
#else
#ifndef SPIRV_STRUCTURE_OPS
// Pull in ops for defining the SPIR-V module structure
include "mlir/Dialect/SPIRV/SPIRVStructureOps.td"
#endif // SPIRV_STRUCTURE_OPS
#ifdef SPIRV_GLSL_OPS
#else
#ifndef SPIRV_GLSL_OPS
// Pull in ops for extended instruction set for GLSL
include "mlir/Dialect/SPIRV/SPIRVGLSLOps.td"
#endif // SPIRV_GLSL_OPS

View File

@ -21,12 +21,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef SPIRV_STRUCTURE_OPS
#else
#ifndef SPIRV_STRUCTURE_OPS
#define SPIRV_STRUCTURE_OPS
#ifdef SPIRV_BASE
#else
#ifndef SPIRV_BASE
include "mlir/SPIRV/SPIRVBase.td"
#endif // SPIRV_BASE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef STANDARD_OPS
#else
#ifndef STANDARD_OPS
#define STANDARD_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef VECTOR_OPS
#else
#ifndef VECTOR_OPS
#define VECTOR_OPS
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//
#ifdef OP_BASE
#else
#ifndef OP_BASE
#define OP_BASE
//===----------------------------------------------------------------------===//

View File

@ -19,12 +19,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef MLIR_LOOPLIKEINTERFACE
#else
#ifndef MLIR_LOOPLIKEINTERFACE
#define MLIR_LOOPLIKEINTERFACE
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE

View File

@ -19,17 +19,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef MLIR_CONVERSION_GPUTONVVM_TD
#else
#ifndef MLIR_CONVERSION_GPUTONVVM_TD
#define MLIR_CONVERSION_GPUTONVVM_TD
#ifdef GPU_OPS
#else
#ifndef GPU_OPS
include "mlir/Dialect/GPU/GPUOps.td"
#endif // GPU_OPS
#ifdef NVVMIR_OPS
#else
#ifndef NVVMIR_OPS
include "mlir/Dialect/LLVMIR/NVVMOps.td"
#endif // NVVMIR_OPS

View File

@ -10,17 +10,14 @@
//
//===----------------------------------------------------------------------===//
#ifdef MLIR_CONVERSION_STANDARDTOSPIRV_TD
#else
#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_TD
#define MLIR_CONVERSION_STANDARDTOSPIRV_TD
#ifdef STANDARD_OPS
#else
#ifndef STANDARD_OPS
include "mlir/Dialect/StandardOps/Ops.td"
#endif // STANDARD_OPS
#ifdef SPIRV_OPS
#else
#ifndef SPIRV_OPS
include "mlir/Dialect/SPIRV/SPIRVOps.td"
#endif // SPIRV_OPS

View File

@ -15,8 +15,7 @@
// limitations under the License.
// =============================================================================
#ifdef TEST_OPS
#else
#ifndef TEST_OPS
#define TEST_OPS
include "mlir/IR/OpBase.td"

View File

@ -1,7 +1,6 @@
// RUN: mlir-tblgen -gen-reference-implementations -I %S/../../include %s | FileCheck %s
#ifdef OP_BASE
#else
#ifndef OP_BASE
include "mlir/IR/OpBase.td"
#endif // OP_BASE