Skip to content

Commit

Permalink
NFC: Use #ifndef in various .td files instead of #ifdef and #else
Browse files Browse the repository at this point in the history
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
  • Loading branch information
antiagainst authored and tensorflower-gardener committed Oct 31, 2019
1 parent ce94779 commit 7432234
Show file tree
Hide file tree
Showing 42 changed files with 93 additions and 186 deletions.
6 changes: 2 additions & 4 deletions mlir/examples/toy/Ch2/include/toy/Ops.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/examples/toy/Ch3/include/toy/Ops.td
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions mlir/examples/toy/Ch4/include/toy/Ops.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/examples/toy/Ch4/include/toy/ShapeInferenceInterface.td
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions mlir/examples/toy/Ch5/include/toy/Ops.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/examples/toy/Ch5/include/toy/ShapeInferenceInterface.td
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions mlir/examples/toy/Ch6/include/toy/Ops.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/examples/toy/Ch6/include/toy/ShapeInferenceInterface.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Analysis/CallInterfaces.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Analysis/InferTypeOpInterface.td
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions mlir/include/mlir/Dialect/AffineOps/AffineOps.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/AffineOps/AffineOpsBase.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/FxpMathOps/FxpMathOps.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/GPU/GPUOps.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Expand Up @@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef LLVMIR_OPS
#else
#ifndef LLVMIR_OPS
#define LLVMIR_OPS

include "mlir/Dialect/LLVMIR/LLVMOpBase.td"
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
Expand Up @@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef NVVMIR_OPS
#else
#ifndef NVVMIR_OPS
#define NVVMIR_OPS

include "mlir/Dialect/LLVMIR/LLVMOpBase.td"
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
Expand Up @@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef ROCDLIR_OPS
#else
#ifndef ROCDLIR_OPS
#define ROCDLIR_OPS

include "mlir/Dialect/LLVMIR/LLVMOpBase.td"
Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
Expand Up @@ -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 {
Expand Down
9 changes: 3 additions & 6 deletions mlir/include/mlir/Dialect/Linalg/IR/LinalgLibraryOps.td
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
Expand Up @@ -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

Expand Down
Expand Up @@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef LINALG_TRANSFORMS
#else
#ifndef LINALG_TRANSFORMS
#define LINALG_TRANSFORMS

include "mlir/Dialect/Linalg/IR/LinalgOps.td"
Expand Down
9 changes: 3 additions & 6 deletions mlir/include/mlir/Dialect/LoopOps/LoopOps.td
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions mlir/include/mlir/Dialect/QuantOps/QuantOps.td
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/QuantOps/QuantPredicates.td
Expand Up @@ -19,8 +19,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef DIALECT_QUANTOPS_QUANT_PREDICATES_
#else
#ifndef DIALECT_QUANTOPS_QUANT_PREDICATES_
#define DIALECT_QUANTOPS_QUANT_PREDICATES_

//===----------------------------------------------------------------------===//
Expand Down

0 comments on commit 7432234

Please sign in to comment.