Executor/Execution.cpp
/// Pop the last stack frame off of ECStack and then copy the result
/// back into the result variable if we are not returning void. The
/// result variable may be the ExitValue, or the Value of the calling
/// CallInst if there was a previous stack frame. This method may
/// invalidate any ECStack iterators you have. This method also takes
/// care of switching to the normal destination BB, if we are returning
/// from an invoke.
///
Pop the last stack frame off of ECStack and then copy the result
back into the result variable if we are not returning void. The
result variable may be the ExitValue, or the Value of the calling
CallInst if there was a previous stack frame. This method may
invalidate any ECStack iterators you have. This method also takes
care of switching to the normal destination BB, if we are returning
from an invoke.
Pop the last stack frame off of ECStack and then copy the result back into the result variable if we are not returning void . The result variable may be the ExitValue or the Value of the calling CallInst if there was a previous stack frame . This method may invalidate any ECStack iterators you have . This method also takes care of switching to the normal destination BB if we are returning from an invoke .
void borealis::ExecutionEngine::popStackAndReturnValueToCaller(llvm::Type *RetTy,
    GenericValue Result) {
    TRACE_FUNC;
    ECStack.pop_back();
    if (ECStack.empty()) {  
        if (RetTy && !RetTy->isVoidTy()) {          
            ExitValue = Result;   
        } else {
            memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
        }
    } else {
        ExecutorContext &CallingSF = ECStack.back();
        if (Instruction *I = CallingSF.Caller.getInstruction()) {
            if (RetTy && !CallingSF.Caller.getType()->isVoidTy())
                SetValue(I, Result, CallingSF);
            if (InvokeInst *II = dyn_cast<InvokeInst> (I))
                SwitchToNewBasicBlock (II->getNormalDest (), CallingSF);
            CallingSF.Caller = CallSite();          
        }
    }
}
void borealis :: ExecutionEngine :: popStackAndReturnValueToCaller ( llvm :: Type * RetTy , GenericValue Result ) { TRACE_FUNC ; ECStack . pop_back ( ) ; if ( ECStack . empty ( ) ) { if ( RetTy && ! RetTy -> isVoidTy ( ) ) { ExitValue = Result ; } else { memset ( & ExitValue . Untyped , 0 , sizeof ( ExitValue . Untyped ) ) ; } } else { ExecutorContext & CallingSF = ECStack . back ( ) ; if ( Instruction * I = CallingSF . Caller . getInstruction ( ) ) { if ( RetTy && ! CallingSF . Caller . getType ( ) -> isVoidTy ( ) ) SetValue ( I , Result , CallingSF ) ; if ( InvokeInst * II = dyn_cast < InvokeInst > ( I ) ) SwitchToNewBasicBlock ( II -> getNormalDest ( ) , CallingSF ) ; CallingSF . Caller = CallSite ( ) ; } } }
Pop the last stack frame off of ECStack and then copy the result
back into the result variable if we are not returning void.
Pop the last stack frame off of ECStack and then copy the result back into the result variable if we are not returning void .
// Pop the current stack frame. // Finished main.  Put result into exit code... // Nonvoid return llvm::Type? // Capture the exit value of the program // If we have a previous stack frame, and we have a previous call, // fill in the return value... // Save result... // We returned from the call...