NFC: Move CPATypeInference to Typing directory.

pull/1/head
Stella Laurenzo 2020-07-04 16:56:09 -07:00
parent 051d088161
commit 48a0b0ec7f
12 changed files with 106 additions and 10 deletions

View File

@ -20,9 +20,4 @@ def FunctionTypeInference : Pass<"basicpy-type-inference", "FuncOp"> {
let constructor = "mlir::NPCOMP::Basicpy::createFunctionTypeInferencePass()";
}
def CPAFunctionTypeInference : Pass<"basicpy-cpa-type-inference", "FuncOp"> {
let summary = "Performs CPA function level type inference";
let constructor = "mlir::NPCOMP::Basicpy::createCPAFunctionTypeInferencePass()";
}
#endif // NPCOMP_BASICPY_PASSES

View File

@ -1 +1,2 @@
add_subdirectory(Analysis)
add_subdirectory(Transforms)

View File

@ -0,0 +1,5 @@
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls)
add_public_tablegen_target(NPCOMPTypingTransformsPassIncGen)
#add_mlir_doc(Passes -gen-pass-doc Transforms ./)

View File

@ -0,0 +1,26 @@
//===------------------------------------------------------------*- 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
//
//===----------------------------------------------------------------------===//
#ifndef NPCOMP_TYPING_TRANSFORMS_PASSES_H
#define NPCOMP_TYPING_TRANSFORMS_PASSES_H
#include "mlir/Pass/Pass.h"
#include <memory>
namespace mlir {
namespace NPCOMP {
namespace Typing {
std::unique_ptr<OperationPass<FuncOp>> createCPAFunctionTypeInferencePass();
} // namespace Typing
} // namespace NPCOMP
} // namespace mlir
#endif // NPCOMP_TYPING_TRANSFORMS_PASSES_H

View File

@ -0,0 +1,23 @@
//===-- Passes.td - Pass definition file -------------------*- tablegen -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef NPCOMP_TYPING_TRANSFORMS_PASSES
#define NPCOMP_TYPING_TRANSFORMS_PASSES
include "mlir/Pass/PassBase.td"
//===----------------------------------------------------------------------===//
// TypeInference
//===----------------------------------------------------------------------===//
def CPAFunctionTypeInference : Pass<"npcomp-cpa-type-inference", "FuncOp"> {
let summary = "Performs CPA function level type inference";
let constructor = "mlir::NPCOMP::Typing::createCPAFunctionTypeInferencePass()";
}
#endif // NPCOMP_TYPING_TRANSFORMS_PASSES

View File

@ -38,6 +38,7 @@ add_mlir_library(NPCOMPInitAll
NPCOMPBasicpyDialect
NPCOMPBasicpyPasses
NPCOMPNumpyDialect
NPCOMPTypingPasses
${ALL_DEPENDS}
)

View File

@ -1,5 +1,4 @@
add_mlir_conversion_library(NPCOMPBasicpyPasses
CPATypeInference.cpp
TypeInference.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -14,6 +14,7 @@
#include "npcomp/Dialect/Numpy/IR/NumpyDialect.h"
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
#include "npcomp/Typing/Transforms/Passes.h"
#include "npcomp/Conversion/BasicpyToStd/Passes.h"
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
@ -90,5 +91,7 @@ void mlir::NPCOMP::registerAllPasses() {
#include "npcomp/Conversion/Passes.h.inc"
#define GEN_PASS_REGISTRATION
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h.inc"
#define GEN_PASS_REGISTRATION
#include "npcomp/Typing/Transforms/Passes.h.inc"
registerDependencyPasses();
}

View File

@ -1 +1,2 @@
add_subdirectory(Analysis)
add_subdirectory(Transforms)

View File

@ -0,0 +1,17 @@
add_mlir_conversion_library(NPCOMPTypingPasses
CPATypeInference.cpp
ADDITIONAL_HEADER_DIRS
${PROJECT_SOURCE_DIR}/include/npcomp/Typing/Transforms
DEPENDS
NPCOMPTypingTransformsPassIncGen
LINK_COMPONENTS
Core
LINK_LIBS PUBLIC
MLIRIR
MLIRPass
NPCOMPTypingCPA
)

View File

@ -1,4 +1,4 @@
//===- TypeInference.cpp - Type inference passes -----------------*- C++-*-===//
//===- CPATypeInference.cpp - Type inference passes -----------------*- C++-*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -13,13 +13,13 @@
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h"
#include "npcomp/Dialect/Basicpy/IR/BasicpyOps.h"
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h"
#include "npcomp/Typing/Analysis/CPA/Algorithm.h"
#include "npcomp/Typing/Analysis/CPA/Interfaces.h"
#include "npcomp/Typing/Analysis/CPA/Support.h"
#include "npcomp/Typing/Transforms/Passes.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "basicpy-type-inference"
#define DEBUG_TYPE "cpa-type-inference"
using namespace llvm;
using namespace mlir;
@ -234,6 +234,6 @@ public:
} // namespace
std::unique_ptr<OperationPass<FuncOp>>
mlir::NPCOMP::Basicpy::createCPAFunctionTypeInferencePass() {
mlir::NPCOMP::Typing::createCPAFunctionTypeInferencePass() {
return std::make_unique<CPAFunctionTypeInferencePass>();
}

View File

@ -0,0 +1,25 @@
//===- PassDetail.h - Pass details ------------------------------*- 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
//
//===----------------------------------------------------------------------===//
#ifndef NPCOMP_TYPING_TRANSFORMS_PASSDETAIL_H
#define NPCOMP_TYPING_TRANSFORMS_PASSDETAIL_H
#include "mlir/Pass/Pass.h"
namespace mlir {
namespace NPCOMP {
namespace Typing {
#define GEN_PASS_CLASSES
#include "npcomp/Typing/Transforms/Passes.h.inc"
} // namespace Typing
} // namespace NPCOMP
} // end namespace mlir
#endif // NPCOMP_TYPING_TRANSFORMS_PASSDETAIL_H