Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #3528
Closed
Open
Issue created Apr 09, 2019 by Derek Bruening@derekbrueningContributor

Switch from guaranteed-contiguous DR_REG_ enum ranges to function interfaces

Xref various discussions in PR #3497 such as https://github.com/DynamoRIO/dynamorio/pull/3497#discussion_r273321446

Having a public, exposed DR_REG_ enum list and trying to guarantee that classes of registers remain single, contiguous blocks throughout ISA extensions simply does not work. E.g., with AVX-512 we have 16 more XMM and YMM registers added. Placing them adjacent to the existing XMM and YMM enum values breaks compatibility: this is an interface num, not a private one that can be freely reordered.

The clean solution is to remove the START and STOP range values and replace them with function accessors for the count of registers in each class and for the integer offset of a particular register within a class.

So we'd change this drreg code:

#define GPR_IDX(reg) ((reg)-DR_REG_START_GPR)
...
    reg_id_t reg = opnd_get_reg_used(opnd, i);
    pt->reg[GPR_IDX(reg)].app_uses++;
...
    for (reg = DR_REG_START_GPR; reg <= DR_REG_STOP_GPR; reg++) {
        if (pt->reg[GPR_IDX(reg)].in_use) {

into something like this, removing the macro which was only there because of the kind of ugly method of computing the index:

    reg_id_t reg = opnd_get_reg_used(opnd, i);
    pt->reg[reg_index(reg)].app_uses++;
...
    for (idx = 0; idx <= reg_count_gpr(); idx++) {
        if (pt->reg[idx].in_use) {

We'd also need a function to go from a 0-based index to a reg_Id_t value.

This divorces the register classes from the enum, which becomes simply a list where all that's important is to have an entry somewhere: where does not matter, letting us append to the end on ISA extensions.

Assignee
Assign to
Time tracking