Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/circt/Analysis/DependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

namespace mlir {
struct DependenceComponent;
namespace func {
class FuncOp;
} // namespace func
} // namespace mlir

namespace circt {
Expand Down
2 changes: 2 additions & 0 deletions include/circt/Analysis/SchedulingAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

namespace mlir {
class AnalysisManager;
namespace func {
class FuncOp;
} // namespace func
} // namespace mlir

using namespace mlir;
Expand Down
4 changes: 2 additions & 2 deletions include/circt/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include "mlir/Pass/PassBase.td"
// AffineToStaticLogic
//===----------------------------------------------------------------------===//

def AffineToStaticLogic : Pass<"convert-affine-to-staticlogic", "mlir::FuncOp"> {
def AffineToStaticLogic : Pass<"convert-affine-to-staticlogic", "mlir::func::FuncOp"> {
let summary = "Convert Affine dialect to StaticLogic pipelines";
let description = [{
This pass analyzes Affine loops and control flow, creates a Scheduling
Expand Down Expand Up @@ -227,7 +227,7 @@ def HandshakeRemoveBlock : Pass<"handshake-remove-block-structure", "handshake::
// StandardToStaticLogic
//===----------------------------------------------------------------------===//

def CreatePipeline : Pass<"create-pipeline", "mlir::FuncOp"> {
def CreatePipeline : Pass<"create-pipeline", "mlir::func::FuncOp"> {
let summary = "Create StaticLogic pipeline operations";
let constructor = "circt::createCreatePipelinePass()";
let dependentDialects = ["staticlogic::StaticLogicDialect"];
Expand Down
1 change: 1 addition & 0 deletions include/circt/Dialect/Calyx/CalyxPrimitives.td
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,5 @@ def PadLibOp : UnaryLibraryOp<"pad"> {
def SliceLibOp : UnaryLibraryOp<"slice"> {
let hasVerifier = 1;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unrelated whitespace change.

def NotLibOp : UnaryLibraryOp<"not"> {}
10 changes: 5 additions & 5 deletions include/circt/Dialect/Calyx/CalyxStructure.td
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ def ComponentOp : CalyxOp<"component", [
using mlir::detail::FunctionOpInterfaceTrait<ComponentOp>::getBody;

/// Returns the type of this function.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
FunctionType getFunctionType() {
return getFunctionTypeAttr().getValue().cast<FunctionType>();
}

/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getType().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }

/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getType().getResults(); }
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }

/// Verify the type attribute of this function. Returns failure and emits
/// an error if the attribute is invalid.
LogicalResult verifyType() {
auto type = getTypeAttr().getValue();
auto type = getFunctionTypeAttr().getValue();
if (!type.isa<FunctionType>())
return emitOpError("requires '" + getTypeAttrName() +
"' attribute of function type");
Expand Down
1 change: 1 addition & 0 deletions include/circt/Dialect/ESI/ESI.td
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef ESI_TD
#define ESI_TD

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"

Expand Down
2 changes: 2 additions & 0 deletions include/circt/Dialect/ESI/ESIPorts.td
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def Channel : ESI_Port<"Channel"> {

let mnemonic = "channel";
let parameters = (ins "Type":$inner);

let assemblyFormat = "`<` $inner `>`";
}

def ChannelType :
Expand Down
2 changes: 2 additions & 0 deletions include/circt/Dialect/FIRRTL/CHIRRTL.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef CHIRRTL_TD
#define CHIRRTL_TD

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/OpAsmInterface.td"
include "circt/Dialect/FIRRTL/FIRRTLDialect.td"
Expand Down Expand Up @@ -69,6 +70,7 @@ def CMemoryType : TypeDef<CHIRRTLDialect, "CMemory"> {
];

let genVerifyDecl = 1;
let hasCustomAssemblyFormat = 1;
}

def CMemoryPortType : TypeDef<CHIRRTLDialect, "CMemoryPort"> {
Expand Down
2 changes: 2 additions & 0 deletions include/circt/Dialect/FIRRTL/FIRRTL.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#ifndef FIRRTL_TD
#define FIRRTL_TD

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/OpAsmInterface.td"
include "mlir/IR/PatternBase.td"
include "mlir/IR/SymbolInterfaces.td"
include "mlir/IR/RegionKindInterface.td"
include "mlir/IR/FunctionInterfaces.td"
Expand Down
6 changes: 6 additions & 0 deletions include/circt/Dialect/FIRRTL/FIRRTLAttributes.td
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def SubAnnotationAttr : AttrDef<FIRRTLDialect, "SubAnnotation"> {
}];
let mnemonic = "subAnno";
let parameters = (ins "int64_t":$fieldID, "DictionaryAttr":$annotations);

let assemblyFormat = "`<` `fieldID` `=` $fieldID `,` $annotations `>`";
}

def PortAnnotationsAttr : ArrayAttrBase<
Expand All @@ -62,6 +64,8 @@ def InvalidValueAttr : AttrDef<FIRRTLDialect, "InvalidValue"> {
let mnemonic = "invalidvalue";
let parameters = (ins AttributeSelfTypeParameter<"">:$type);

let assemblyFormat = "`<` $type `>`";

let builders = [
AttrBuilderWithInferredContext<(ins "Type":$type),
"return $_get(type.getContext(), type);">
Expand Down Expand Up @@ -157,6 +161,8 @@ def ParamDeclAttr : AttrDef<FIRRTLDialect, "ParamDecl"> {
"::mlir::Attribute":$value);
let mnemonic = "param.decl";

let hasCustomAssemblyFormat = 1;

let builders = [
AttrBuilderWithInferredContext<(ins "::mlir::StringAttr":$name,
"::mlir::Type":$type),
Expand Down
1 change: 1 addition & 0 deletions include/circt/Dialect/FSM/FSM.td
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef CIRCT_DIALECT_FSM_TD
#define CIRCT_DIALECT_FSM_TD

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/FunctionInterfaces.td"

Expand Down
16 changes: 9 additions & 7 deletions include/circt/Dialect/FSM/FSMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ def MachineOp : FSMOp<"machine", [HasParent<"mlir::ModuleOp">, FunctionOpInterfa
includes a `$body` region that contains internal variables and states.
}];

let arguments = (ins StrAttr:$sym_name, TypeAttr:$stateType, TypeAttr:$type);
let arguments = (ins StrAttr:$sym_name, TypeAttr:$stateType,
TypeAttrOf<FunctionType>:$function_type);
let regions = (region SizedRegion<1>:$body);

let builders = [
OpBuilder<(ins "StringRef":$name, "Type":$stateType, "FunctionType":$type,
OpBuilder<(ins "StringRef":$name, "Type":$stateType,
"FunctionType":$function_type,
CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs,
CArg<"ArrayRef<DictionaryAttr>", "{}">:$argAttrs)>
];
Expand All @@ -41,20 +43,20 @@ def MachineOp : FSMOp<"machine", [HasParent<"mlir::ModuleOp">, FunctionOpInterfa
void getHWPortInfo(SmallVectorImpl<hw::PortInfo> &);

/// Returns the type of this function.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
FunctionType getFunctionType() {
return getFunctionTypeAttr().getValue().cast<FunctionType>();
}

/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getType().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }

/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getType().getResults(); }
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }

/// Verify the type attribute of this function. Returns failure and emits
/// an error if the attribute is invalid.
LogicalResult verifyType() {
auto type = getTypeAttr().getValue();
auto type = getFunctionTypeAttr().getValue();
if (!type.isa<FunctionType>())
return emitOpError("requires '" + getTypeAttrName() +
"' attribute of function type");
Expand Down
1 change: 1 addition & 0 deletions include/circt/Dialect/HW/HW.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef HW_TD
#define HW_TD

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/OpAsmInterface.td"
include "mlir/IR/SymbolInterfaces.td"
Expand Down
1 change: 1 addition & 0 deletions include/circt/Dialect/HW/HWAggregates.td
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def ArraySliceOp : HWOp<"array_slice", [NoSideEffect]> {

let arguments = (ins ArrayType:$input, HWIntegerType:$lowIndex);
let results = (outs ArrayType:$dst);

let hasVerifier = 1;

let assemblyFormat = [{
Expand Down
12 changes: 12 additions & 0 deletions include/circt/Dialect/HW/HWAttributes.td
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def OutputFileAttr : AttrDef<HWDialect, "OutputFile"> {
}]>,
];

let hasCustomAssemblyFormat = 1;

let extraClassDeclaration = [{
/// Get an OutputFileAttr from a string filename, canonicalizing the
/// filename.
Expand Down Expand Up @@ -110,6 +112,8 @@ def FileListAttr : AttrDef<HWDialect, "FileList"> {
}]>,
];

let assemblyFormat = "`<` $filename `>`";

let extraClassDeclaration = [{
/// Get an OutputFileAttr from a string filename, canonicalizing the
/// filename.
Expand All @@ -134,6 +138,8 @@ def ParamDeclAttr : AttrDef<HWDialect, "ParamDecl"> {
"::mlir::Attribute":$value);
let mnemonic = "param.decl";

let hasCustomAssemblyFormat = 1;

let builders = [
AttrBuilderWithInferredContext<(ins "::mlir::StringAttr":$name,
"::mlir::Type":$type),
Expand Down Expand Up @@ -181,6 +187,8 @@ def ParamDeclRefAttr : AttrDef<HWDialect, "ParamDeclRef"> {
return get(name.getContext(), name, type);
}]>
];

let hasCustomAssemblyFormat = 1;
}

def ParamVerbatimAttr : AttrDef<HWDialect, "ParamVerbatim"> {
Expand All @@ -189,6 +197,8 @@ def ParamVerbatimAttr : AttrDef<HWDialect, "ParamVerbatim"> {
let parameters = (ins "::mlir::StringAttr":$value,
AttributeSelfTypeParameter<"">:$type);
let mnemonic = "param.verbatim";

let hasCustomAssemblyFormat = 1;
}


Expand Down Expand Up @@ -243,6 +253,8 @@ def ParamExprAttr : AttrDef<HWDialect, "ParamExpr"> {
return get(opcode, operands);
}
}];

let hasCustomAssemblyFormat = 1;
}


Expand Down
5 changes: 5 additions & 0 deletions include/circt/Dialect/HW/HWAttributesNaming.td
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def InnerRefAttr : AttrDef<HWDialect, "InnerRef"> {
return get(module.getContext(), module, name);
}]>,
];

let hasCustomAssemblyFormat = 1;

let extraClassDeclaration = [{
/// Get the InnerRefAttr for an operation and add the sym on it.
static InnerRefAttr getFromOperation(mlir::Operation *op,
Expand All @@ -43,6 +46,8 @@ def GlobalRefAttr : AttrDef<HWDialect, "GlobalRef"> {
}]>,
];

let assemblyFormat = "`<` $glblSym `>`";

let extraClassDeclaration = [{
static constexpr char DialectAttrName[] = "circt.globalRef";
}];
Expand Down
43 changes: 21 additions & 22 deletions include/circt/Dialect/HW/HWStructure.td
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,28 @@ def HWModuleOp : HWModuleOpBase<"module",
mlir::OpAsmSetValueNameFn setNameFn);

/// Returns the type of this function.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
FunctionType getFunctionType() {
return getFunctionTypeAttr().getValue().cast<FunctionType>();
}

/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getType().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }

/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getType().getResults(); }
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }

/// Verify the type attribute of this function. Returns failure and emits
/// an error if the attribute is invalid.
LogicalResult verifyType() {
auto type = getTypeAttr().getValue();
auto type = getFunctionTypeAttr().getValue();
if (!type.isa<FunctionType>())
return emitOpError("requires '" + getTypeAttrName() +
"' attribute of function type");
return success();
}

/// Verifies the body of the function.
LogicalResult verifyBody();
}];

let hasCustomAssemblyFormat = 1;
Expand Down Expand Up @@ -233,20 +236,20 @@ def HWModuleExternOp : HWModuleOpBase<"module.extern",
mlir::OpAsmSetValueNameFn setNameFn);

/// Returns the type of this function.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
FunctionType getFunctionType() {
return getFunctionTypeAttr().getValue().cast<FunctionType>();
}

/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getType().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }

/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getType().getResults(); }
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }

/// Verify the type attribute of this function. Returns failure and emits
/// an error if the attribute is invalid.
LogicalResult verifyType() {
auto type = getTypeAttr().getValue();
auto type = getFunctionTypeAttr().getValue();
if (!type.isa<FunctionType>())
return emitOpError("requires '" + getTypeAttrName() +
"' attribute of function type");
Expand Down Expand Up @@ -345,25 +348,27 @@ def HWModuleGeneratedOp : HWModuleOpBase<"module.generated",
mlir::OpAsmSetValueNameFn setNameFn);

/// Returns the type of this function.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
FunctionType getFunctionType() {
return getFunctionTypeAttr().getValue().cast<FunctionType>();
}

/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return getType().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); }

/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return getType().getResults(); }
ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); }

/// Verify the type attribute of this function. Returns failure and emits
/// an error if the attribute is invalid.
LogicalResult verifyType() {
auto type = getTypeAttr().getValue();
auto type = getFunctionTypeAttr().getValue();
if (!type.isa<FunctionType>())
return emitOpError("requires '" + getTypeAttrName() +
"' attribute of function type");
return success();
}

TypeAttr getTypeAttr();
}];

let hasCustomAssemblyFormat = 1;
Expand Down Expand Up @@ -446,8 +451,6 @@ def InstanceOp : HWOp<"instance", [
instanceNameAttr(name);
}

LogicalResult verifyCustom();

//===------------------------------------------------------------------===//
// SymbolOpInterface Methods
//===------------------------------------------------------------------===//
Expand Down Expand Up @@ -489,13 +492,9 @@ def GlobalRefOp : HWOp<"globalRef", [IsolatedFromAbove, Symbol]> {
This also lets components of the path point to a common entity.
}];

let extraClassDeclaration = [{
LogicalResult verifyGlobalRef();
}];

let arguments = (ins SymbolNameAttr:$sym_name, NameRefArrayAttr:$namepath);

let assemblyFormat = [{ $sym_name $namepath attr-dict}];
let assemblyFormat = [{ $sym_name $namepath attr-dict }];

let hasVerifier = 1;
}
Expand Down
Loading