#includellvm::PHINode* phi = ... // create a PHI node llvm::Value* incoming = phi->getIncomingValue(0); // get the value for the first incoming block
#includeThis code retrieves the number of incoming values for a PHINode object and then iterates over all of the incoming values to perform some operation on each of them. The PHINode class is part of the LLVM Core library.llvm::PHINode* phi = ... // create a PHI node unsigned int numIncoming = phi->getNumIncomingValues(); // get the number of incoming values for (unsigned int i = 0; i < numIncoming; ++i) { llvm::Value* incoming = phi->getIncomingValue(i); // do something with the incoming value }