Skip to content

Commit

Permalink
[RTG] Add InstructionOpInterface (#7979)
Browse files Browse the repository at this point in the history
  • Loading branch information
maerhart authored Jan 16, 2025
1 parent db847ef commit f52477c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions include/circt/Dialect/RTG/IR/RTGISAAssemblyInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,30 @@ def RegisterOpInterface : OpInterface<"RegisterOpInterface"> {
];
}

def InstructionOpInterface : OpInterface<"InstructionOpInterface"> {
let description = [{
This interface should be implemented by operations that represent
ISA instructions.
}];
let cppNamespace = "::circt::rtg";

let methods = [
StaticInterfaceMethod<[{
Emits a binary representation of the instruction compatible with the
ISA specification.
}],
"void", "printInstructionBinary",
(ins "llvm::raw_ostream &":$os,
"llvm::ArrayRef<mlir::Attribute>":$operands)>,
StaticInterfaceMethod<[{
Emits the ISA assembly representation of the instruction to the provided
stream. The format should be the one understood by common assembler
tools.
}],
"void", "printInstructionAssembly",
(ins "llvm::raw_ostream &":$os,
"llvm::ArrayRef<mlir::Attribute>":$operands)>,
];
}

#endif // CIRCT_DIALECT_RTG_IR_RTGISAASSEMBLYINTERFACES_TD

0 comments on commit f52477c

Please sign in to comment.