LLVM 19.0.0git

Combination generator. More...
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallVector.h"
#include <cassert>
#include <cstring>
Go to the source code of this file.
Classes  
class  llvm::CombinationGenerator< choice_type, choices_storage_type, variable_smallsize > 
Namespaces  
namespace  llvm 
This is an optimization pass for GlobalISel generic memory operations.  
Combination generator.
Example: given input {{0, 1}, {2}, {3, 4}} it will produce the following combinations: {0, 2, 3}, {0, 2, 4}, {1, 2, 3}, {1, 2, 4}.
It is useful to think of input as vectorofvectors, where the outer vector is the variable space, and inner vector is choice space. The number of choices for each variable can be different.
As for implementation, it is useful to think of this as a weird number, where each digit (==variable) may have different base (==number of choices). Thus modelling of 'produce next combination' is exactly analogous to the incrementing of an number  increment lowest digit (pick next choice for the variable), and if it wrapped to the beginning then increment next digit.
Definition in file CombinationGenerator.h.