bscarlet / llvm-general

Rich LLVM bindings for Haskell (with transfer of LLVM IR to and from C++, detailed compilation pass control, etc.)
http://hackage.haskell.org/package/llvm-general
132 stars 38 forks source link

cross compilation? #92

Closed tmcdonell closed 10 years ago

tmcdonell commented 10 years ago

This may be the same as #91, or I may just be using the library incorrectly, but thought it was easier to create a new ticket either way.

I'm using llvm-general to generate code for a non-host target. Example, this code is targeting the nvptx backend (generated, please ignore any errors). If, on the command line, I run it through llc, I get this ptx.

So:

$ cabal sandbox hc-pkg list "llvm*"
<snip>
   llvm-general-3.4.1.0
   llvm-general-pure-3.4.1.0

$ llc -version
LLVM (http://llvm.org/):
  LLVM version 3.4
  Optimized build with assertions.
  Built Mar  3 2014 (19:18:39).
  Default target: x86_64-apple-darwin13.1.0
  Host CPU: corei7

  Registered Targets:
    aarch64  - AArch64 (ARM 64-bit target)
    arm      - ARM
    cpp      - C++ backend
    hexagon  - Hexagon
    mips     - Mips
    mips64   - Mips64 [experimental]
    mips64el - Mips64el [experimental]
    mipsel   - Mipsel
    msp430   - MSP430 [experimental]
    nvptx    - NVIDIA PTX 32-bit
    nvptx64  - NVIDIA PTX 64-bit
    ppc32    - PowerPC 32
    ppc64    - PowerPC 64
    ppc64le  - PowerPC 64 LE
    r600     - AMD GPUs HD2XXX-HD6XXX
    sparc    - Sparc
    sparcv9  - Sparc V9
    systemz  - SystemZ
    thumb    - Thumb
    x86      - 32-bit X86: Pentium-Pro and above
    x86-64   - 64-bit X86: EM64T and AMD64
    xcore    - XCore
tmcdonell commented 10 years ago

AH! I have found moduleTargetAssembly which works.

But, can we get it to output something sane instead of a String? (ping #93)