src/passmanager.cc
/**
     * @brief   Applies the sequence of compiler passes to the given program
     * @param   program   Object reference to the program to be compiled
     */
@brief   Applies the sequence of compiler passes to the given program
@param   program   Object reference to the program to be compiled
@brief Applies the sequence of compiler passes to the given program @param program Object reference to the program to be compiled
void PassManager::compile(ql::quantum_program *program)
{
   DOUT("In PassManager::compile ... ");
   for(auto pass : passes)
    {
        if(!program->qubit_count)
            program->qubit_count = (size_t)(std::stoi(pass->getPassOptions()->getOption("nqubits")));
        assert(program->qubit_count);
        if(!program->platformInitialized)
        {
            std::string hwconfig = pass->getPassOptions()->getOption("hwconfig");   
            program->platform = *(new ql::quantum_platform("testPlatform",hwconfig));
        }
        if(!pass->getSkip())
        {
            DOUT(" Calling pass: " << pass->getPassName());
            pass->initPass(program);
            pass->runOnProgram(program);
            pass->finalizePass(program);
        }
    }
        ql::write_sweep_points(program, program->platform, "write_sweep_points");
}
void PassManager :: compile ( ql :: quantum_program * program ) { DOUT ( " " ) ; for ( auto pass : passes ) { if ( ! program -> qubit_count ) program -> qubit_count = ( size_t ) ( std :: stoi ( pass -> getPassOptions ( ) -> getOption ( " " ) ) ) ; assert ( program -> qubit_count ) ; if ( ! program -> platformInitialized ) { std :: string hwconfig = pass -> getPassOptions ( ) -> getOption ( " " ) ; program -> platform = * ( new ql :: quantum_platform ( " " , hwconfig ) ) ; } if ( ! pass -> getSkip ( ) ) { DOUT ( " " << pass -> getPassName ( ) ) ; pass -> initPass ( program ) ; pass -> runOnProgram ( program ) ; pass -> finalizePass ( program ) ; } } ql :: write_sweep_points ( program , program -> platform , " " ) ; }
@brief   Applies the sequence of compiler passes to the given program
 @param   program   Object reference to the program to be compiled
@brief Applies the sequence of compiler passes to the given program @param program Object reference to the program to be compiled
///@todo-rn: implement option to check if following options are actually needed for a pass ///@note-rn: currently(0.8.1.dev), all passes require platform as API parameter, and some passes depend on the nqubits internally. Therefore, these are passed through by setting the program with these fields here. However, this should change in the future since compiling for a simulator might not require a platform, and the number of qubits could be optional. //If the old interface is used, platform is already set, so it is not needed to look for platform option and configure the platform from there //assert(program->platform); JvS: program->platform is not a pointer and cannot be cast to a bool, so this line broke when I turned optimizations off // generate sweep_points file ==> TOOD: delete?