[LLVMbugs] [Bug 13436] New: regparm is lost for struct arguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 23 06:20:46 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13436

             Bug #: 13436
           Summary: regparm is lost for struct arguments
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


on X86 clang compiles

struct foobar {
  int x;
};
__attribute__((regparm(3))) void f(int a, struct foobar b, int c);
void g() {
  struct foobar y;
  y.x = 2;
  f(1, y, 3);
}

to

define void @g() nounwind optsize {
entry:
  tail call void @f(i32 inreg 1, i32 2, i32 inreg 3) nounwind optsize
  ret void
}
declare void @f(i32 inreg, i32, i32 inreg) optsize

and llc then produces

    subl    $12, %esp
    movl    $2, (%esp)
    movl    $1, %eax
    movl    $3, %edx
    calll    f
    addl    $12, %esp
    ret

gcc produces

    subl    $12, %esp
    movl    $3, %ecx
    movl    $2, %edx
    movl    $1, %eax
    call    f
    addl    $12, %esp

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list