Mark inline locations with annotation.#5150
Conversation
|
Currently the inlined locations are not well preserved: indeed inliners create a In DWARF we're having a dedicated Here we are doing something similar:
However, this might interfere with some midend passes, namely action synthesis. So, we add additional frontend policy to control the folding of |
|
Some fixes for source locations while there: somehow they were attached to arguments, that were dropped afterwards, not the variables created to hold parameter values. |
| return !( | ||
| a->name == IR::Annotation::nameAnnotation || | ||
| (a->name == IR::Annotation::noWarnAnnotation && a->getSingleString() == "unused")); | ||
| }); |
There was a problem hiding this comment.
Maybe should have a frontend policy here to control which annotations are preserved and which are removed?
There was a problem hiding this comment.
Yeah. Interesting enough, the filtering of annotations are only for actions and not for functions currently. Likely some uniformity would be great.
|
|
||
| /// Indicates whether control flow should fold blocks marked with @inlinedAt annotation | ||
| /// @returns Defaults to true | ||
| virtual bool foldInlinedAt() const { return true; } |
There was a problem hiding this comment.
perhaps this should be more generic, with a list of annotations to allow folding for?
| const cstring IR::Annotation::fieldListAnnotation = "field_list"_cs; | ||
| const cstring IR::Annotation::debugLoggingAnnotation = "__debug"_cs; | ||
| const cstring IR::Annotation::disableOptimizationAnnotation = "disable_optimization"_cs; | ||
| const cstring IR::Annotation::inlinedAtAnnotation = "inlinedAt"_cs; |
There was a problem hiding this comment.
nit: inlinedAt seems a bit of a misnomer here -- perhaps should be inlinedFrom?
There was a problem hiding this comment.
I reused the terminology from DWARF standard. inlinedAt marks the place. And from is an argument. But I do not have a strong preference, maybe because it is an annotation on the whole block, inlinedFrom would be better, yes.
There was a problem hiding this comment.
I was initially confused with inlinedAt so I also think inlinedFrom is a better term.
There was a problem hiding this comment.
Was renamed to inlinedFrom. It is more suitable for the version with the name (original version did not have name so marked essentially the inlined location)
a37bc41 to
847366c
Compare
| const cstring IR::Annotation::fieldListAnnotation = "field_list"_cs; | ||
| const cstring IR::Annotation::debugLoggingAnnotation = "__debug"_cs; | ||
| const cstring IR::Annotation::disableOptimizationAnnotation = "disable_optimization"_cs; | ||
| const cstring IR::Annotation::inlinedAtAnnotation = "inlinedAt"_cs; |
There was a problem hiding this comment.
I was initially confused with inlinedAt so I also think inlinedFrom is a better term.
…Flow to remove / not remove such marked blocks Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
Add policy for SimplifyControlFlow to remove / not remove such marked blocks