[llvm-commits] [llvm] r135786 - /llvm/trunk/tools/llvm-objdump/MCFunction.cpp

Chris Lattner clattner at apple.com
Fri Jul 22 13:33:53 PDT 2011


On Jul 22, 2011, at 11:35 AM, Benjamin Kramer wrote:

> Author: d0k
> Date: Fri Jul 22 13:35:09 2011
> New Revision: 135786
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=135786&view=rev
> Log:
> llvm-objdump: Skip branches that leave the current function.
> 
> In "normal" code these only happen when disassembling data, so we
> won't lose anything if we just drop them.

Does this handle tail calls (which get compiled into a jump) properly?

-Chris

> 
> Modified:
>    llvm/trunk/tools/llvm-objdump/MCFunction.cpp
> 
> Modified: llvm/trunk/tools/llvm-objdump/MCFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MCFunction.cpp?rev=135786&r1=135785&r2=135786&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-objdump/MCFunction.cpp (original)
> +++ llvm/trunk/tools/llvm-objdump/MCFunction.cpp Fri Jul 22 13:35:09 2011
> @@ -46,7 +46,10 @@
>           int64_t Imm = Inst.getOperand(0).getImm();
>           // FIXME: Distinguish relocations from nop jumps.
>           if (Imm != 0) {
> -            assert(Index+Imm+Size < End && "Branch out of function.");
> +            if (Index+Imm+Size >= End) {
> +              Instructions.push_back(MCDecodedInst(Index, Size, Inst));
> +              continue; // Skip branches that leave the function.
> +            }
>             Splits.insert(Index+Imm+Size);
>           }
>         }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list