[LLVMdev] Testcase for OS kernel

Keun Soo Yim yim6 at illinois.edu
Thu Jan 15 14:36:41 PST 2009


 

 Hi,

 

 The source attached at the bottom is a testcase which causes a back-end
error in LLVM 2.4.

 These types of assembly routines are mainly used in OS kernels. 

 I checked that GCC 4.3 works for this routine.

 

 The error messsage is ...

         Couldn't allocate output reg for constraint 'A'!

 

 I just need help or comments so that I could analyze and fix this bug.

 My question is how can we efficiently debug this type of bug?

 

 1. Typically we have a large size of testcase source code. 

 Thus we need to locate the specific location of bug in the testcase source
code.

 Is there any debugging message that LLVM gives to make it easy to identify
this information?

 I don't except that information in source code because that is belong to
GCC front-end

 but what about in terms of LLVM asm code, e.g., line # of LLVM asm code
that generate this error.

 

 2. Then we need to find a code in LLVM that generates this error message.

 But how can I efficiently find that buggy routine in LLVM pass or backend?

 

 Thanks,

 Keun Soo

 

-----

 

/*

 * @title   A Testcase for LLVM

 * 

 * @about   This faces an error with LLVM 2.4 (but not with GCCC)

 *          The error messsage is ...

 *              Couldn't allocate output reg for constraint 'A'!

 * 

 * @author  Keun Soo Yim

 */

 

struct a_struct{

    unsigned int a,b;

};

 

void x()

{

    long err;

    struct a_struct a;

    struct a_struct *pa;

 

    __asm__ __volatile__(

            "1: movl 0(%2),%%eax\n"

            "2: movl 4(%2),%%edx\n"

            "3:\n" ".section .fixup,\"ax\"\n"

            "4: movl %3,%0\n"

            "   xorl %%eax,%%eax\n"

            "   xorl %%edx,%%edx\n"

            "   jmp 3b\n" ".previous\n"

            ".section __ex_table,\"a\"\n"

            "   .align 4\n"

            "   .long 1b,4b\n"

            "   .long 2b,4b\n"

            ".previous" :   "=r" (err),

                            "=&A" (((a)))

                        :   "r" (((pa))),

                            "i"(-14),

                            "0"(err));

}

                                         

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090115/4ee901bf/attachment.html>


More information about the llvm-dev mailing list