From: Borja F. <bor...@gm...> - 2012-01-20 18:58:32
|
Hello, first thank both of you for working into this. As Joshua suggested I would start by working with simple very tests, I haven't checked other backends but I'm sure they have to check simple things like arith instructions and calling conventions as Sherard did. However I would start with arith instructions because they are easier and shorter to write, and very important, testing all datatypes (from i8 to i64). Also testing both regs, and imm instruction operands. Ideally we should test that each instruction for every datatype produces the correct asm output. Note on this, for now don't write tests on multiplications and shifts, the first is not implemented yet, and for the second they require special treatment that we will discuss later. Then, move on to testing calling conventions, so check if the right registers are being read as input arguments of a function, check if the right registers are being passed in function calls etc. Some info about calling conventions, I haven't tested passing big structs byval or returning them so I wouldn't add tests for this for now, maybe make a note on this to check in it the future when it's done. Ah, and don't test varargs, they are a bit tricky to implement, and they arent high priority for now. One note about Joshua's test, i dont know if CHECK is case sensitive, but all instructions are lowercase in our backend, so please careful with this. Another thing, i have a patched version of clang that doesn't emit the "signext" argument attribute in functions, we dont want to signext an i8 to i16 beause the upper reg is not used, so we may be able to use it for other purposes. I can't remember now if the patch in svn addresses this or not, but it was something easy to do in clang, so you may want to add it to your code. For these simple tests you can use GCC to check the produced asm because we should produce exactly the same code, and check the generated IR that LLVM produces like Joshua showed, that way you can write directly tests in C instead of IR. |