SDValue getValue(SDNode *node, int index) { return node->getOperand(index); }
for (SDNode *node : nodeList) { if (node->getOpcode() == ISD::ADD) { SDValue op1 = node->getOperand(0); SDValue op2 = node->getOperand(1); /* do something with the operands */ } }In this example, a for loop iterates through a list of SDNodes called "nodeList". If the current node's opcode is ADD, then the operands at index 0 and 1 are retrieved with getOperand and stored in variables "op1" and "op2" respectively. Overall, the examples demonstrate how to use the getOperand function to retrieve the values of operands in an SDNode. This function is part of the LLVM package library.