[LLVMdev] RFC: llvm-shlib-test (Was: [llvm] r191029 - llvm-c: Make LLVMGetFirstTarget a proper prototype)

Anders Waldenborg
Tue, 24 Sep 2013 11:11:01 -0000

On Mon, Sep 23, 2013 at 07:48:45PM -0400, Sean Silva
wrote:
> I like the idea, but I find the name confusing; I think it should have
> `llvm-c` or `c-api` somewhere in the name. This could also serve as a
> simple example of using the API.

I had it as llvm-c-test first, then noticed that the shared library's
directory was named "llvm-shlib".

Yes, making sure it serves as a good example of using the API is a
good idea. Not sure all tests would be that, but it is a good goal.

The tests I have in mind are:

 * --dump-module
     basically just llvm-dis, tests memorybuffer/bitreader
     already implemented in patch, uncertain about protability as it
     does dup2 tricks to dump to stdout

 * --list-module-functions
     tests basic iteration over stuff in module
     implemented in patch, want to extend it to iterate over
     instructions too

 * --list-module-globals
     ditto

 * --disassemble
     Test llvm-c/Disassebler.h. Not sure about input format,
     lines of cpu name + hexdumped asm maybe is easiest for FileCheck

 * --objdump
     Test llvm-c/Object.h. List sections and symbols of an object file.

 * --list-targets
     LLVMGetFirstTarget/LLVMGetNextTarget and whatever can be extracted
     from them

 * --calc
     Test Core.h irbuilding and possibly executionengine. Create a module
     with a function evaluating the specified aritmetic expression.
     Possibly generating machinecode and executing.

 anders