Skip to content

Commit

Permalink
[RTG] Add InstructionOpInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
maerhart committed Jan 7, 2025
1 parent a2a9567 commit ded1276
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 ded1276

Please sign in to comment.