Riscv func
riscv_func
RISCV_Func = Dialect('riscv_func', [SyscallOp, CallOp, FuncOp, ReturnOp], [])
module-attribute
RiscvFunctionCallMemoryEffect
dataclass
Bases: MemoryEffect
An assembly operation that corresponds to a function call in the RISC-V ABI, overwwriting the A, T, FA, and FT registers.
Source code in xdsl/dialects/riscv_func.py
63 64 65 66 67 68 69 70 71 | |
get_effects(op: Operation) -> frozenset[EffectInstance]
classmethod
Source code in xdsl/dialects/riscv_func.py
69 70 71 | |
SyscallOp
Bases: IRDLOperation
Source code in xdsl/dialects/riscv_func.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
name = 'riscv_func.syscall'
class-attribute
instance-attribute
args = var_operand_def(riscv.IntRegisterType)
class-attribute
instance-attribute
syscall_num = attr_def(IntegerAttr[I32])
class-attribute
instance-attribute
result = opt_result_def(riscv.IntRegisterType)
class-attribute
instance-attribute
traits = traits_def(MemoryAllocEffect(), MemoryFreeEffect(), MemoryReadEffect(), MemoryWriteEffect(), RiscvFunctionCallMemoryEffect())
class-attribute
instance-attribute
__init__(num: int | IntegerAttr[I32], has_result: bool = False, operands: list[SSAValue | Operation] = [])
Source code in xdsl/dialects/riscv_func.py
91 92 93 94 95 96 97 98 99 100 101 102 103 | |
verify_()
Source code in xdsl/dialects/riscv_func.py
105 106 107 108 109 110 111 112 113 | |
CallOp
Bases: RISCVInstruction
RISC-V function call operation
Source code in xdsl/dialects/riscv_func.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
name = 'riscv_func.call'
class-attribute
instance-attribute
args = var_operand_def(riscv.RISCVRegisterType)
class-attribute
instance-attribute
callee = attr_def(SymbolRefAttr)
class-attribute
instance-attribute
ress = var_result_def(riscv.RISCVRegisterType)
class-attribute
instance-attribute
assembly_format = '$callee `(` $args `)` attr-dict `:` functional-type($args, $ress)'
class-attribute
instance-attribute
traits = traits_def(MemoryAllocEffect(), MemoryFreeEffect(), MemoryReadEffect(), MemoryWriteEffect(), RiscvFunctionCallMemoryEffect())
class-attribute
instance-attribute
__init__(callee: SymbolRefAttr, args: Sequence[Operation | SSAValue], result_types: Sequence[riscv.RISCVRegisterType], comment: StringAttr | None = None)
Source code in xdsl/dialects/riscv_func.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
verify_()
Source code in xdsl/dialects/riscv_func.py
155 156 157 158 159 160 161 162 163 164 | |
assembly_instruction_name() -> str
Source code in xdsl/dialects/riscv_func.py
166 167 | |
assembly_line_args() -> tuple[riscv.AssemblyInstructionArg | None, ...]
Source code in xdsl/dialects/riscv_func.py
169 170 | |
FuncOpCallableInterface
dataclass
Bases: CallableOpInterface
Source code in xdsl/dialects/riscv_func.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
get_callable_region(op: Operation) -> Region
classmethod
Source code in xdsl/dialects/riscv_func.py
174 175 176 177 | |
get_argument_types(op: Operation) -> tuple[Attribute, ...]
classmethod
Source code in xdsl/dialects/riscv_func.py
179 180 181 182 | |
get_result_types(op: Operation) -> tuple[Attribute, ...]
classmethod
Source code in xdsl/dialects/riscv_func.py
184 185 186 187 | |
FuncOp
Bases: IRDLOperation, AssemblyPrintable
RISC-V function definition operation
Source code in xdsl/dialects/riscv_func.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
name = 'riscv_func.func'
class-attribute
instance-attribute
sym_name = attr_def(SymbolNameConstraint())
class-attribute
instance-attribute
body = region_def()
class-attribute
instance-attribute
function_type = attr_def(FunctionType)
class-attribute
instance-attribute
sym_visibility = opt_attr_def(StringAttr)
class-attribute
instance-attribute
p2align = opt_attr_def(IntegerAttr[I8])
class-attribute
instance-attribute
traits = traits_def(SymbolOpInterface(), FuncOpCallableInterface(), IsolatedFromAbove())
class-attribute
instance-attribute
__init__(name: str, region: Region, function_type: FunctionType | tuple[Sequence[Attribute], Sequence[Attribute]], visibility: StringAttr | str | None = None, p2align: int | IntegerAttr[I8] | None = None)
Source code in xdsl/dialects/riscv_func.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
parse(parser: Parser) -> FuncOp
classmethod
Source code in xdsl/dialects/riscv_func.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
print(printer: Printer)
Source code in xdsl/dialects/riscv_func.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
print_assembly(printer: AssemblyPrinter) -> None
Source code in xdsl/dialects/riscv_func.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
ReturnOp
Bases: RISCVInstruction
RISC-V function return operation
Source code in xdsl/dialects/riscv_func.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
name = 'riscv_func.return'
class-attribute
instance-attribute
values = var_operand_def(riscv.RISCVRegisterType)
class-attribute
instance-attribute
comment = opt_attr_def(StringAttr)
class-attribute
instance-attribute
traits = traits_def(IsTerminator(), HasParent(FuncOp), ReturnLike())
class-attribute
instance-attribute
assembly_format = 'attr-dict ($values^ `:` type($values))?'
class-attribute
instance-attribute
__init__(*values: Operation | SSAValue, comment: str | StringAttr | None = None)
Source code in xdsl/dialects/riscv_func.py
303 304 305 306 307 308 309 310 311 312 313 314 315 | |
verify_()
Source code in xdsl/dialects/riscv_func.py
317 318 319 320 321 | |
assembly_instruction_name() -> str
Source code in xdsl/dialects/riscv_func.py
323 324 | |
assembly_line_args() -> tuple[riscv.AssemblyInstructionArg | None, ...]
Source code in xdsl/dialects/riscv_func.py
326 327 | |