Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: llvm/circt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8343afdc677a1f8cb99e8a760a7c71b3b20d0fc8
Choose a base ref
..
head repository: llvm/circt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a0999d67b0ec4c7cde7f87c1f838c1aaa30f8f4b
Choose a head ref
Showing with 18 additions and 5 deletions.
  1. +2 −2 include/circt-c/Dialect/RTG.h
  2. +3 −0 include/circt-c/RtgTool.h
  3. +1 −0 lib/CAPI/Dialect/CMakeLists.txt
  4. +5 −2 lib/CAPI/Dialect/RTG.cpp
  5. +6 −0 lib/CAPI/RtgTool/RtgTool.cpp
  6. +1 −1 test/CAPI/rtg.c
4 changes: 2 additions & 2 deletions include/circt-c/Dialect/RTG.h
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ extern "C" {
//===----------------------------------------------------------------------===//

MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(RTG, rtg);
MLIR_CAPI_EXPORTED void registerRTGPasses(void);

//===----------------------------------------------------------------------===//
// Type API.
@@ -35,8 +36,7 @@ MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGet(MlirContext ctxt);
MLIR_CAPI_EXPORTED bool rtgTypeIsASet(MlirType type);

/// Creates an RTG set type in the context.
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirContext ctxt,
MlirType elementType);
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirType elementType);

/// If the type is an RTG dict.
MLIR_CAPI_EXPORTED bool rtgTypeIsADict(MlirType type);
3 changes: 3 additions & 0 deletions include/circt-c/RtgTool.h
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ MLIR_CAPI_EXPORTED void circtRtgToolOptionsSetUnsupportedInstructions(
CirctRtgToolOptions options, unsigned numInstr,
const char **unsupportedInstructions);

MLIR_CAPI_EXPORTED void circtRtgToolOptionsAddUnsupportedInstruction(
CirctRtgToolOptions options, const char *unsupportedInstruction);

MLIR_CAPI_EXPORTED void
circtRtgToolOptionsSetUnsupportedInstructionsFile(CirctRtgToolOptions options,
const char *filename);
1 change: 1 addition & 0 deletions lib/CAPI/Dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -127,6 +127,7 @@ add_circt_public_c_api_library(CIRCTCAPIRTG
LINK_LIBS PUBLIC
MLIRCAPIIR
CIRCTRTGDialect
CIRCTRTGTransforms
)

if(CIRCT_INCLUDE_TESTS)
7 changes: 5 additions & 2 deletions lib/CAPI/Dialect/RTG.cpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#include "circt/Dialect/RTG/IR/RTGDialect.h"
#include "circt/Dialect/RTG/IR/RTGTypes.h"

#include "circt/Dialect/RTG/Transforms/RTGPasses.h"
#include "mlir/CAPI/Registration.h"

using namespace circt;
@@ -20,6 +21,7 @@ using namespace circt::rtg;
//===----------------------------------------------------------------------===//

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(RTG, rtg, RTGDialect)
void registerRTGPasses() { registerPasses(); }

//===----------------------------------------------------------------------===//
// Type API.
@@ -41,8 +43,9 @@ MlirType rtgSequenceTypeGet(MlirContext ctxt) {

bool rtgTypeIsASet(MlirType type) { return isa<SetType>(unwrap(type)); }

MlirType rtgSetTypeGet(MlirContext ctxt, MlirType elementType) {
return wrap(SetType::get(unwrap(ctxt), unwrap(elementType)));
MlirType rtgSetTypeGet(MlirType elementType) {
auto ty = unwrap(elementType);
return wrap(SetType::get(ty.getContext(), ty));
}

// DictType
6 changes: 6 additions & 0 deletions lib/CAPI/RtgTool/RtgTool.cpp
Original file line number Diff line number Diff line change
@@ -79,6 +79,12 @@ void circtRtgToolOptionsSetUnsupportedInstructions(
unwrap(options)->setUnsupportedInstructions(std::move(instr));
}

void circtRtgToolOptionsAddUnsupportedInstruction(
CirctRtgToolOptions options, const char *unsupportedInstruction) {
unwrap(options)->addUnsupportedInstruction(
std::string(unsupportedInstruction));
}

void circtRtgToolOptionsSetUnsupportedInstructionsFile(
CirctRtgToolOptions options, const char *filename) {
unwrap(options)->setUnsupportedInstructionsFile(std::string(filename));
2 changes: 1 addition & 1 deletion test/CAPI/rtg.c
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ static void testSequenceType(MlirContext ctx) {

static void testSetType(MlirContext ctx) {
MlirType elTy = mlirIntegerTypeGet(ctx, 32);
MlirType setTy = rtgSetTypeGet(ctx, elTy);
MlirType setTy = rtgSetTypeGet(elTy);

// CHECK: is_set
fprintf(stderr, rtgTypeIsASet(setTy) ? "is_set\n" : "isnot_set\n");