Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuir: Improved debugging code dump output #2692

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

fridis
Copy link
Member

@fridis fridis commented Mar 8, 2024

Now includes arguments and result types for Calls, proper labels for match, constant data for constants.

Also reduced noise by not printing code that is not needed (FUIR.clazzNeedsCode) and noice code block ids.

Here is an exmaple output:

         > ./build/bin/fz -XdumpFUIR -e "for a := 1, a+1 while a < 10 else say a" | tail -n 30
        Code for #loop0(outer universe#0, a i32) unit
        l3:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Const of type i32 00 00 00 04 0a 00 00 00
        	3: Call infix < i32(outer universe#0, a i32, b i32) bool
        	4: Match 0=>l1 1=>l2
        l1:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Const of type i32 00 00 00 04 01 00 00 00
        	3: Call i32.infix +(outer i32, other i32) i32
        	4: Current
        	5: Assign to #loop0.a
        	6: Current
        	7: Call #loop0.a(outer #loop0) i32
        	8: Call #loop0(outer universe#0, a i32) unit
        	9: Current
        	10: Assign to #loop0.#exprResult0
        	goto l3_4
        l2:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Box i32 => ref i32
        	3: Call say(outer universe#0, s Any) unit
        	4: Current
        	5: Assign to #loop0.#exprResult0
        	goto l3_4
        l3_4:
        	7: Current
        	8: Call #loop0.#exprResult0(outer #loop0) unit
        	9: Current
        	10: Assign to #loop0.#result

Now includes arguments and result types for Calls, proper labels for match,
constant data for constants.

Also reduced noise by not printing code that is not needed (FUIR.clazzNeedsCode)
and noice code block ids.

Here is an exmaple output:

         > ./build/bin/fz -XdumpFUIR -e "for a := 1, a+1 while a < 10 else say a" | tail -n 30
        Code for #loop0(outer universe#0, a i32) unit
        l3:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Const of type i32 00 00 00 04 0a 00 00 00
        	3: Call infix < i32(outer universe#0, a i32, b i32) bool
        	4: Match 0=>l1 1=>l2
        l1:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Const of type i32 00 00 00 04 01 00 00 00
        	3: Call i32.infix +(outer i32, other i32) i32
        	4: Current
        	5: Assign to #loop0.a
        	6: Current
        	7: Call #loop0.a(outer #loop0) i32
        	8: Call #loop0(outer universe#0, a i32) unit
        	9: Current
        	10: Assign to #loop0.#exprResult0
        	goto l3_4
        l2:	0: Current
        	1: Call #loop0.a(outer #loop0) i32
        	2: Box i32 => ref i32
        	3: Call say(outer universe#0, s Any) unit
        	4: Current
        	5: Assign to #loop0.#exprResult0
        	goto l3_4
        l3_4:
        	7: Current
        	8: Call #loop0.#exprResult0(outer #loop0) unit
        	9: Current
        	10: Assign to #loop0.#result
@michaellilltokiwa michaellilltokiwa merged commit c449d1f into main Mar 8, 2024
5 checks passed
@michaellilltokiwa michaellilltokiwa deleted the fuir_improved_FUIR_code_dump branch March 8, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants