[mips] Fix the position of the .loc prologue_end directive in cases when the generated code contains DBG_VALUE instruction.
According to findPrologueEndLoc(), the source location from the first non-DBG_VALUE instruction without the FrameSetup flag and with a known source location gets the prologue_end marker. I've had a quick look through the other targets and there seems to be two ways that targets influence this. PowerPC and NVPTX simply uses an unknown location in their prologue (via DebugLoc()), while ARM and AArch64 annotate some (but not all) instructions with the MachineInstr::FrameSetup flag. X86 seems to do both. Other targets didn't seem to do anything about it.
I think we could safely use an unknown DebugLoc() in all cases since the line number shouldn't change until the end of the prologue. Does anyone know of any benefits to using the FrameSetup flag? It seems preferable to use it so that prologue instructions have the location of the start of the function but I doubt that it has a real effect on the output.
Does anyone know of any benefits to using the FrameSetup flag? It seems preferable to use it so that prologue instructions have the location of the start of the function but I doubt that it has a real effect on the output.
It seems the only part of LLVM that uses FrameSetup flag is the function calculateDbgValueHistory that calculates the history for local variables. I did quick check by changing Mips backend to add FrameSetup flag to some (but not all) of the instructions in the prologue, and the generated debug info in .s files was as before the change.
Rebased the patch. Created new method MipsInstrInfo::getDebugLoc().
This seems to be a bit of a cut and paste conditional. I haven't had much of a chance to look, but is there something else that can be done here?
I moved the logic that creates DebugLoc to a new method.