To himself. He meant he was willing to die.To be a little fair...
"Megatron must be stopped! No matter the cost!"
Kill yes, murder no. Optimus went in assuming that they would fight to the death."One shall stand, one shall fall!"
"Why throw away your life so recklessly?"
"That's a question you should ask yourself, Megatron!"
"You, who are without mercy, now plead for it?! I thought you were made of sterner stuff!"
In that part of the movie, Prime was willing to kill for the greater good.
Not that there'd be a situation in which pulling the trigger would be more execution than battle.
Of course he would have fired if Megatron had charged at him, or if he noticed Megatron reaching for that gun.
But he also would have captured Megatron alive if Megatron had surrendered. The idea that he wouldn't is something I literally never heard anyone say until Bayverse fans said it to pretend their Optimus wasn't the worst by that big a margin.