Esempio n. 1
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VariableAnalysis::ComputeScalarAddressTaken(Function* function) {
    funct_ = function;

    for(Block* block = funct_->FirstBlock(); block; block = block->NextBlock()) {
		for(auto instr = block->FirstInstruction(); instr; 
            instr = instr->NextInstruction()) {
			MarkAddressTaken(instr);
        }
    }
}
Esempio n. 2
0
void VariableAnalysis::ComputeAddressTakenAndDefinitions(Function* function) {
    DebugValidator::IsNotNull(function);

	// We consider that the variable has it's address taken
	// if it's used in any instruction that depends on it's address.
	// This includes storing the address, passing it as a parameter to a function,
	// converting it to an integer or another pointer type, etc.
    funct_ = function;

    // Initialize the map from block-id to block.
    for(auto block = function->FirstBlock(); block; block = block->NextBlock()) {
        idToBlock_.Add(block->Id(), block);
    }

	for(Block* block = funct_->FirstBlock(); block; block = block->NextBlock()) {
		for(auto instr = block->FirstInstruction(); instr;
            instr = instr->NextInstruction()) {
			MarkAddressTaken(instr);
			MarkDefinition(instr);
		}
	}
}