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

Simplify instrumentation? #66

Open
thetheodor opened this issue Oct 6, 2023 · 0 comments
Open

Simplify instrumentation? #66

thetheodor opened this issue Oct 6, 2023 · 0 comments
Assignees

Comments

@thetheodor
Copy link
Member

thetheodor commented Oct 6, 2023

DCEMarkers

to avoid inserting curly braces everywhere, I could instrument like so:

if (C)
  STMT;
if (C && (Marker1(), 1)  || (Marker2(), 0) )
   STMT();

or

if ( C ? (Marker1(), 1) :  (Marker2(), 0))
   STMT();

loops can be handled similarly, except for range-based for loops and do while loops which must be instrumented via their bodies. It also doesn't work for if statement with a complex initializer (if (auto* X = expr())), for simple cases it would work: if (auto* X = ptr ? (Marker1(), ptr): (Marker2(), ptr)
.

The downside is that Marker() must be an expression, but I could implement is an always_inline function:

__attribute__((always_inline))
void Marker(){
 //...
}

VRMarkers

VRMarkers can be baked into expressions, e.g.:

T V = expr(x);
T V = (marker(x), expr(x));
@thetheodor thetheodor self-assigned this Oct 6, 2023
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

No branches or pull requests

1 participant