[M3devel] llvm backend integration
Rodney M. Bates
rodney_bates at lcwb.coop
Fri Aug 28 21:45:16 CEST 2015
The llvm back end now has an initial degree of integration into cm3. To get it, add
M3_BACKEND_MODE="StAloneLlvmAsm"
near the front of the m3makefile, or elsewhere in quake code that will get interpreted.
It does the following:
Runs the M3 front end, producing cm3 IR in a *.mc or *.mi file.
Runs the stand-alone program 'm3llvm', compiled by package m3-sys/llvm, to produce llvm
bitcode IR, in file *.mb or *.ib.
Runs 'llc' (a main program that is part of llvm), to produce assembly code, in file *.ms or *.is.
Runs 'as' to assemble to object code, in file *.mo or *.io.
Prerequisites:
llc on the path.
m3llvm on the path.
as on the path.
In turn, building m3llvm will require llvm 3.5.0 headers and compiled libraries,
see the m3makefile of llvm, which must give their locations.
'cm3 -keep' will retain all the intermediate files. Only binary forms of the cm3 IR
and llvm IR are created, but you can get human-readable versions of them with
'm3cgcat' and 'llvm-dis'.
Look in m3-sys/cminstall/src/config-no-install/Unix.common, (which is installed to
/usr/local/cm3/bin/config/Unix.common) to make simple alterations to the command-line
parameters to m3llvm. (Other targets are not supported).
--
Rodney Bates
rodney.m.bates at acm.org
More information about the M3devel
mailing list