[LLVMbugs] [Bug 4785] New: msp430 backend: interrupt handing attributes ignored

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Aug 25 19:26:54 PDT 2009


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

           Summary: msp430 backend: interrupt handing attributes ignored
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: asl at math.spbu.ru, llvmbugs at cs.uiuc.edu


Given this sort of code:

extern void foo (void);

__attribute((wakeup)) __attribute((interrupt(10))) void sig_TIMERA1_VECTOR
(void)
{
  foo();
}

int main (void)
{
  while (1);
}

LLVM gives us this:

regehr at john-home:~/z/tinyos-2.x/apps/Blink/build/telosb$ clang -ccc-host-triple
msp430-generic-generic -ccc-clang-archs msp430 -x c -S -w -O irq.c -o -
        .file   "irq.c"


        .text
        .align  4
        .globl  sig_TIMERA1_VECTOR
        .type   sig_TIMERA1_VECTOR, at function
sig_TIMERA1_VECTOR:
        push.w  r4
        mov.w   r1, r4
        call    #foo
        pop.w   r4
        ret
        .size   sig_TIMERA1_VECTOR, .-sig_TIMERA1_VECTOR


        .align  4
        .globl  main
        .type   main, at function
main:
        push.w  r4
        mov.w   r1, r4
.BB2_1:
        jmp     .BB2_1                                      # %while.body
        .size   main, .-main

But it should be more like this:

regehr at john-home:~/z/tinyos-2.x/apps/Blink/build/telosb$ msp430-gcc -O irq.c -S
-o -
vector_ffea:
sig_TIMERA1_VECTOR:
        push    r15
        push    r14
        push    r13
        push    r12
        call    #foo
        pop     r12
        pop     r13
        pop     r14
        pop     r15
        bic     #0xf0,0(r1)
        reti
main:
        mov     #(__stack-0), r1
.L3:
        jmp     .L3
        br      #__stop_progExec__


A quick and easy solution would be to generate canned IRQ stub code that pushes
the caller-saved part of the context, then use the standard calling convention
to get into the user-supplied interrupt handler.


-- 
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