[PATCH] Implement getNoopForMachoTarget for SPARC

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Sep 2 08:15:21 PDT 2014

On 2 September 2014 03:18, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
> On Mon, Sep 01, 2014 at 10:07:46PM -0700, Owen Anderson wrote:
>> Why are you using MachO on a SPARC target?
> See mail from me a bit ago -- because MC uses that function to ensure
> that an empty function gets at least one instruction.

Than logic looks broken. Maybe we should fix it instead? For example:

./bin/llc ~/llvm/llvm/test/CodeGen/PowerPC/empty-functions.ll -o


func:                                   # @func
# BB#0:                                 # %entry
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
nop                             # avoids zero-length function


the function is not empty.

For what it is worth, given

void f(void) {

gcc produces

pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6


More information about the llvm-commits mailing list