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

add operand alias to operators #47

Closed
mei-ye opened this issue Aug 31, 2018 · 2 comments
Closed

add operand alias to operators #47

mei-ye opened this issue Aug 31, 2018 · 2 comments
Assignees

Comments

@mei-ye
Copy link
Contributor

mei-ye commented Aug 31, 2018

need to find a way to annotate operand-alias in operators/operations/instructions so that program analysis does not need to add specialized checks for each operators.

@pfultz2
Copy link
Collaborator

pfultz2 commented Sep 1, 2018

The operator need an optional method to get which argument it aliases on output, and return a negative number if it doesn't alias any input argument. Until then, we can write a function to use a basic heuristic:

int get_alias_output(instruction_ref x)
{
    // Nothing to alias
    if(x->arguments.empty())
        return -1;
    // Assume functions that use an allocation as the last parameter is aliased
    if(x->arguments.back()->op.name() == "hip::allocate")
        return x->arguments.size() - 1;
    return -1;
}

Then replace the function with a call to the operation class when it gets implemented.

@pfultz2
Copy link
Collaborator

pfultz2 commented Sep 11, 2018

This is actually a duplicate of #23.

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

2 participants