gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

HIR Dump

Open philberty opened this issue 4 years ago • 3 comments

Our HIR dump looks like this currently:

BlockExpr:
{
 outer attributes: none
 inner attributes: none
 statements: 
 ExprStmtWithoutBlock:
  MethodCallExpr: 
 Object (receiver) expr: ( t ([C: 0 Nid: 97 Hid: 77]))
 Method path segment: 
baz
 Call params:none
 final expression: none
}::[C: 0 Nid: 102 Hid: 81 Lid: 26]

Which is very messy and is a clone of our AST as_string methods which is fine for gdb sessions but bad for textural output.

  • [ ] Converge on an S-expression format, which is more extensible and easier to read
  • [x] Add command line switch https://github.com/Rust-GCC/gccrs/pull/222
  • [x] Add dump entry point https://github.com/Rust-GCC/gccrs/blob/28f527c9598339cf834a30b5ee1f14258b8ecbb2/gcc/rust/rust-session-manager.cc#L874-L888
  • [x] Dump to file
  • [ ] Print block statements
  • [ ] Print block tail expression if present
  • [ ] Print crate mapping attributes
  • [ ] Print function parameters
  • [ ] Visit function's definition block

philberty avatar Sep 28 '21 14:09 philberty

@YizhePKU ping ? I guess I'll base my work over your previous prototype. Maybe you also want to work on this ? If you don't, it's fine, just wanted to ask first before doing anything :)

dkm avatar Oct 16 '21 12:10 dkm

That's very nice of you. I don't have plans to return to this project anytime soon, so go ahead :)

yizhepku avatar Oct 17 '21 16:10 yizhepku

FTR, the proof-of-concept by @YizhePKU https://github.com/Rust-GCC/gccrs/pull/318

dkm avatar Oct 28 '21 19:10 dkm