|
| 1 | +#ifndef LIB_DIALECT_DEBUG_IR_DEBUGOPS_TD_ |
| 2 | +#define LIB_DIALECT_DEBUG_IR_DEBUGOPS_TD_ |
| 3 | + |
| 4 | +include "DebugDialect.td" |
| 5 | + |
| 6 | +include "mlir/IR/OpBase.td" |
| 7 | +include "mlir/Interfaces/SideEffectInterfaces.td" |
| 8 | + |
| 9 | +class Debug_Op<string mnemonic, list<Trait> traits = []> : |
| 10 | + Op<Debug_Dialect, mnemonic, traits> { |
| 11 | + let cppNamespace = "::mlir::heir::debug"; |
| 12 | +} |
| 13 | + |
| 14 | +def Debug_ValidateOp : Debug_Op<"validate", []> { |
| 15 | + let summary = "Validates an SSA value."; |
| 16 | + let description = [{ |
| 17 | + The `debug.validate` operation is a high-level placeholder for validating |
| 18 | + an SSA value. This is transformed via `*-add-debug-port` passes to a function |
| 19 | + call to an externally defined function that may then decrypt and validate |
| 20 | + the operand. |
| 21 | + |
| 22 | + The mandatory `name` attribute gives a unique identifier for the validation |
| 23 | + instance, and this is used to connect intermediate values of a plaintext |
| 24 | + execution of a program to the corresponding program points of the |
| 25 | + HEIR-compiled program. |
| 26 | + |
| 27 | + An optional `metadata` attribute may contain an arbitrary JSON blob, to |
| 28 | + be passed to the function call, which is intended to contain metadata like |
| 29 | + the plaintext execution result that the called function can use to compare |
| 30 | + with the decrypted ciphertext. |
| 31 | + }]; |
| 32 | + |
| 33 | + let arguments = (ins |
| 34 | + AnyType:$input, |
| 35 | + StrAttr:$name, |
| 36 | + OptionalAttr<StrAttr>:$metadata |
| 37 | + ); |
| 38 | + |
| 39 | + let assemblyFormat = "$input attr-dict `:` type($input)"; |
| 40 | +} |
| 41 | + |
| 42 | +#endif // LIB_DIALECT_DEBUG_IR_DEBUGOPS_TD_ |
0 commit comments