Fix a lot of confusion around inserting nops on empty functions.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 15 Sep 2014 18:32:58 +0000 (18:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 15 Sep 2014 18:32:58 +0000 (18:32 +0000)
commit3f0ce4fa1860be10dd9aef4ce0bbb09d0c482963
treede9512abf20952543d46bbcb23ce0091bf890ef6
parent49e423ca30f4746949bbad734b8a6152d792d8bb
Fix a lot of confusion around inserting nops on empty functions.

On MachO, and MachO only, we cannot have a truly empty function since that
breaks the linker logic for atomizing the section.

When we are emitting a frame pointer, the presence of an unreachable will
create a cfi instruction pointing past the last instruction. This is perfectly
fine. The FDE information encodes the pc range it applies to. If some tool
cannot handle this, we should explicitly say which bug we are working around
and only work around it when it is actually relevant (not for ELF for example).

Given the unreachable we could omit the .cfi_def_cfa_register, but then
again, we could also omit the entire function prologue if we wanted to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217801 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/TargetInstrInfo.cpp
lib/Target/Sparc/SparcInstrInfo.cpp
lib/Target/Sparc/SparcInstrInfo.h
test/CodeGen/PowerPC/empty-functions.ll [deleted file]
test/CodeGen/SPARC/empty-functions.ll [deleted file]
test/CodeGen/X86/empty-functions.ll