[RFC] A PNaCl target machine for LLVM

53 views
Skip to first unread message

wic...@vitalitystudios.com

unread,
Oct 1, 2015, 6:37:13 PM10/1/15
to Native-Client-Discuss
Hello all,

I'd like to create a target machine for pnacl-llvm so PNaCl can give LLVM correct information about PNaCl as a target. This also applies to Emscripten. It is based on my work upstreaming my Rust PNaCl cross into Rust proper, part of which you can find here.

I propose adding a fairly bare bones TargetMachine to LLVM for the following reasons:
  • Make it easier for new languages to target PNaCl.
  • Abstract PNaCl-specific details from frontends and ensure consistency across PNaCl compilers.
  • Properly give PNaCl a codegen backend so compiler frontends don't require hacks so they emit bitcode.
Details
  • TargetMachine -- Specializing addPassesToEmitFile
  • TargetLibraryInfo -- for libcall info
  • TargetLoweringInfo -- this one will be mostly unused, but it's still needed so the gold linker plugin can properly emit references to libm for the math intrinsics.
  • Add a few minor passes to do things like emit bitcode or ll.
  • Will mimic `arm7v-none-nacl-gnu` for optimizing, as is currently done.
  • Rewrite math intrinsics to use libm.
  • Otherwise (unless I missing something), all other target specific infrastructure will be left unimplemented.
This won't replace the post-link simplification passes currently employed.

In the future, some of the PNaCl IR passes could be moving into this target machine and run on an object by object basis (lowering the amount of time needed to link).
Reply all
Reply to author
Forward
0 new messages