Documentation for microsoft::quantum::RuleSet
microsoft::quantum::RuleSet
#include <Rules/RuleSet.hpp>
Public Types
| Name | |
|---|---|
| enum | ReplaceDirection { ReplaceForwards, ReplaceBackwards} |
| using std::shared_ptr< ReplacementRule > | ReplacementRulePtr |
| using std::vector< ReplacementRulePtr > | Rules |
| using ReplacementRule::Replacements | Replacements |
| using IOperandPrototype::Captures | Captures |
| using llvm::Instruction | Instruction |
| using llvm::Value | Value |
| using ReplacementRule::Builder | Builder |
| using IAllocationManager::AllocationManagerPtr | AllocationManagerPtr |
Public Functions
| Name | |
|---|---|
| RuleSet() =default | |
| RuleSet(RuleSet const & ) =default | |
| RuleSet(RuleSet && ) =default | |
| ~RuleSet() =default | |
| RuleSet & | operator=(RuleSet const & ) =default |
| RuleSet & | operator=(RuleSet && ) =default |
| bool | matchAndReplace(Instruction * value, Replacements & replacements, ReplaceDirection const & dir =ReplaceForwards) |
| void | addRule(ReplacementRulePtr const & rule, ReplaceDirection const & dir =ReplaceForwards) Adds a new replacement rule to the set. |
| void | addRule(ReplacementRule && rule, ReplaceDirection const & dir =ReplaceForwards) |
| void | clear() Clears the rule set for all rules. |
| uint64_t | size() const Returns the size of the rule set. |
Detailed Description
class microsoft::quantum::RuleSet;
RuleSet contains a set of replacement rules and the corresponding logic to apply the rules. The class allows one to apply the rules by which each rule is tested one-by-one until a successful attempt at performing a replace has happened, or the list was exhausted.
Public Types Documentation
enum ReplaceDirection
| Enumerator | Value | Description |
|---|---|---|
| ReplaceForwards | ||
| ReplaceBackwards |
using ReplacementRulePtr
using microsoft::quantum::RuleSet::ReplacementRulePtr = std::shared_ptr<ReplacementRule>;
using Rules
using microsoft::quantum::RuleSet::Rules = std::vector<ReplacementRulePtr>;
using Replacements
using microsoft::quantum::RuleSet::Replacements = ReplacementRule::Replacements;
using Captures
using microsoft::quantum::RuleSet::Captures = IOperandPrototype::Captures;
using Instruction
using microsoft::quantum::RuleSet::Instruction = llvm::Instruction;
using Value
using microsoft::quantum::RuleSet::Value = llvm::Value;
using Builder
using microsoft::quantum::RuleSet::Builder = ReplacementRule::Builder;
using AllocationManagerPtr
using microsoft::quantum::RuleSet::AllocationManagerPtr = IAllocationManager::AllocationManagerPtr;
Public Functions Documentation
function RuleSet
RuleSet() =default
function RuleSet
RuleSet(
RuleSet const &
) =default
function RuleSet
RuleSet(
RuleSet &&
) =default
function ~RuleSet
~RuleSet() =default
function operator=
RuleSet & operator=(
RuleSet const &
) =default
function operator=
RuleSet & operator=(
RuleSet &&
) =default
function matchAndReplace
bool matchAndReplace(
Instruction * value,
Replacements & replacements,
ReplaceDirection const & dir =ReplaceForwards
)
Matches patterns and runs the replacement routines if a match is found. The function returns true if a pattern is matched and and the replacement was a success. In all other cases, it returns false.
function addRule
void addRule(
ReplacementRulePtr const & rule,
ReplaceDirection const & dir =ReplaceForwards
)
Adds a new replacement rule to the set.
function addRule
void addRule(
ReplacementRule && rule,
ReplaceDirection const & dir =ReplaceForwards
)
function clear
void clear()
Clears the rule set for all rules.
function size
uint64_t size() const
Returns the size of the rule set.
Updated on 1 August 2023 at 16:25:10 UTC