Skip to content

Improve the logic of Target::instruction_supported. #15322

@raynelfss

Description

@raynelfss

Based on @eliarbel's comment in #15039 :

I was also thinking about the following while going over the code:
The flow of the checking logic inside instruction_supported could probably be refactored to something along the lines of:

  • If name not in in _gate_name_map - return false
  • If non-global instructions and mismatched qargs - return false
  • If parameters don't match - return false
  • Return true

This seems like a more natural flow that will simplify the code a bit, including I think eliminating one of the qargs checks for the TargetOperation::Variadic case.

Originally posted by @eliarbel in #15039 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RustThis PR or issue is related to Rust code in the repositorymod: transpilerIssues and PRs related to Transpiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions