Conversation
Signed-off-by: Doomsk <eduardo.maschio@theqube.io>
|
@Doomsk Thanks for the new IR design you mentioned. It clarifies how to implement the upcoming functions for my side as well. Maybe we could also add test covering |
| args: IRArgs, | ||
| *options: tuple[IROption, ...] | ||
| ): | ||
| super().__init__(caller, args, *options, name=IRFlag.CALL_WITH_BODY) |
There was a problem hiding this comment.
Maybe name=IRFlag.CALL_WITH_BODY should be name=IRFlag.CALL_WITH_OPTION?
| name: str | ||
|
|
||
| def __init__(self, *instrs: Any): | ||
| self.name = str(hash(instrs)) |
There was a problem hiding this comment.
Just question. I think Python hash output varies between interpreter sessions, so the same code may produce different block names on each run. Could a stable naming scheme make comparing IR instances and serialization the IR easier?
There was a problem hiding this comment.
I thought of using uuid.uuid5 at first, but seemed too much for the job. Now that you mentioned it, makes sense to replace to uuid5 indeed
|
Thanks @q-inho ! Indeed, there are things to improve. While I was playing with it, I realized "why not trying to write from source code to IR directly?" |
Previous
IRstructure and logic were lacking essential working pieces for most of the non-trivial simple instructions. Now it should work to represent all the possible expressions, such as declare, assign, call, call with body, any combination of the previous ones and more.work in progress.
@q-inho we discuss about this PR later. You can check the code at the new IR file.
I also placed a test so we can check how it looks like and have proper ideas, comments, suggestions, critiques, etc. The test is basically as follows:
hhat_lang/python/tests/dialects/heather/code/simple_ir/test_ir.py
Lines 14 to 42 in 1a23ff9