SgUnsignedCharList Assembler::assembleBlock(SgAsmBlock *bb) { std::vector<SgAsmInstruction*> ivec; std::vector<SgNode*> nvec = NodeQuery::querySubTree(bb, V_SgAsmInstruction); for (std::vector<SgNode*>::iterator i=nvec.begin(); i!=nvec.end(); ++i) { SgAsmInstruction *insn = isSgAsmInstruction(*i); ROSE_ASSERT(insn!=NULL); ivec.push_back(insn); } if (0==ivec.size()) return SgUnsignedCharList(); return assembleBlock(ivec, ivec.front()->get_address()); }
valueType * evaluateOperand(operandType *operand) { valueType *result; bool saveExpansion; expressionType *expression; nullEvaluate(operand); if (operand->kindOfOperand != EXPRESSION_OPND) newFixupAddressMode = operand->kindOfOperand; switch (operand->kindOfOperand) { case EXPRESSION_OPND: case IMMEDIATE_OPND: case INDIRECT_OPND: case POST_INDEXED_Y_OPND: case PRE_INDEXED_X_OPND: case X_INDEXED_OPND: case Y_INDEXED_OPND: result = evaluateExpression(operand->theOperand.expressionUnion, performingFixups ? NO_FIXUP : OPERAND_FIXUP); nullEvaluate(result); if (operand->kindOfOperand != EXPRESSION_OPND) { if (result->addressMode != EXPRESSION_OPND) { error(BAD_ADDRESS_MODE_ERROR); result->kindOfValue = FAIL; } else { result->addressMode = operand->kindOfOperand; } } break; case A_REGISTER_OPND: case X_REGISTER_OPND: case Y_REGISTER_OPND: result = newValue(UNDEFINED_VALUE, 0, operand-> kindOfOperand); break; case X_SELECTED_OPND: case Y_SELECTED_OPND: case PRE_SELECTED_X_OPND: result = evaluateSelectionList(operand->theOperand.xSelectedUnion); if (result->addressMode != EXPRESSION_OPND) { error(BAD_ADDRESS_MODE_ERROR); result->kindOfValue = FAIL; } else { result->addressMode = operand->kindOfOperand; } break; case STRING_OPND: result = newValue(STRING_VALUE, operand->theOperand.stringUnion, STRING_OPND); break; case BLOCK_OPND: if (standaloneExpansionFlag) forceExpansion(); sideEffectFlag = TRUE; assembleBlock(operand->theOperand.blockUnion); expansionOn(); result = newValue(FAIL, 0, BLOCK_OPND); break; default: botch("bad operand kind in evaluateOperand %d\n", operand->kindOfOperand); break; } return(result); }