[LLVMdev] where can I find out the documents of how to write a llvm regression test case?

陳韋任 (Wei-Ren Chen) chenwj at iis.sinica.edu.tw
Mon Aug 27 02:32:20 PDT 2012


> thaks for your explaining,after reading it i have a few problems more.
> 1.in the sentenses of "X32: subl     $-128, %eax" and "; X64: subl
> $-128," ,i do not know what means that in detail,these sentences were
> writen follow which language rules?

  Accroding to what backend developers expect from the backend he wrote
and architecture manual.

> 2.i want to write such a test:translate a *.ll(i.e:hello.ll) file to a
> *.c file(i.e:hello.c) with llc,then verify if the .c file contian a
> certain string(i.e:"abc:). so:
> i want to change the old sample to achieve my aim,but i failed.my old
> sample like this:
> 
> ; RUN: llc -march=c < %s | FileCheck %s
> ; ModuleID = 'hello.c'
> target datalayout =
> "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
> target triple = "x86_64-unknown-linux-gnu"
> 
> @.str = private unnamed_addr constant [12 x i8] c"helloworld\0A\00", align 1
> 
> define i32 @main() nounwind uwtable {
> entry:
>   %retval = alloca i32, align 4
>   store i32 0, i32* %retval
>   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12
> x i8]* @.str, i32 0, i32 0))
>   ret i32 0
> }
> 
> declare i32 @printf(i8*, ...)
> ;
> 
> ;CHECK: main
> ;CHECK: printf

  The first thing you should know is C backend had been removed from LLVM
since LLVM 3.1 [1], I don't know what you want is doable... Maybe you can
send a new mail or just reply this mail with a different subject like

  Subject: Writing test case for LLVM C backend

That will make your intension more explicit. If you're using a *work*
LLVM C backend, have you tried to run `llc -march=c hello.ll` manually
and see what the output is? Are you sure the C backend output is the
same under any enviroment? I mean maybe when you run this test case on
different OS/ISA, then result could be different. And have you tried
the following?

  ;CHECK: int main()
  define i32 @main() nounwind uwtable { 

    ... snip ...

  }

Regards,
chenwj

[1] http://llvm.org/releases/3.1/docs/ReleaseNotes.html

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj




More information about the llvm-dev mailing list