[M3commit] [modula3/cm3] 004d0f: Initial integration of llvm back end into cm3's bu...

Rodney Bates rodney.m.bates at acm.org
Fri Jul 31 22:38:09 CEST 2015


  Branch: refs/heads/master
  Home:   https://github.com/modula3/cm3
  Commit: 004d0f687b912e65fb810dc6ca38917208beacd1
      https://github.com/modula3/cm3/commit/004d0f687b912e65fb810dc6ca38917208beacd1
  Author: Rodney Bates <rodney.m.bates at acm.org>
  Date:   2015-07-31 (Fri, 31 Jul 2015)

  Changed paths:
    M m3-sys/cm3/src/Builder.m3
    M m3-sys/cm3/src/M3Backend.m3
    M m3-sys/cm3/src/M3Build.m3
    M m3-sys/cm3/src/Makefile.m3
    M m3-sys/cm3/src/m3makefile
    M m3-sys/cm3/src/version.quake
    M m3-sys/cminstall/src/config-no-install/Unix.common
    M m3-sys/m3middle/src/Target.i3
    M m3-sys/m3middle/src/Target.m3
    M m3-sys/m3quake/src/M3Path.i3
    M m3-sys/m3quake/src/M3Path.m3

  Log Message:
  -----------
  Initial integration of llvm back end into cm3's build system.

Add four new backend modes, the last four of:

    IntegratedObject,   (* "0"  -- don't call m3_backend,
                             M3CG produces object code *)
    IntegratedAssembly, (* "1"  -- don't call m3_backend,
                             M3CG produces assembly code, run asm. *)
    ExternalObject,     (* "2"  -- call m3_backend, it produces object code *)
    ExternalAssembly,   (* "3"  -- call m3_backend, it produces assembly code, run asm *)
    C,                  (* "4"  -- don't call m3_backend, call compile_c,
                             M3CG produces C *)
    IntLlvmObj,         (* "5"  -- M3CG uses llvm to directly produce object code. *)
    IntLlvmAsm,         (* "6"  -- M3CG uses llvm to directly produce assembly code,
                             run asm. *)
    ExtLlvmObj,         (* "7"  -- M3CG produces llvm bitcode.  call compile_llvm.
                             It produces object code. *)
    ExtLlvmAsm          (* "8"  -- M3CG produces llvm bitcode.  call compile_llvm.
                             It produces assembly code, run asm. *)

m3_backend is a quake script that runs the gcc-derived back end.
compile_c is a quake script that runs a C compiler, usually gcc.
compile_llvm is a quake script that calls an llvm IR compiler, currently llc.

All of these new modes expect a M3CG.T  that directly produces llvm IR,
assembly code, or object code.  Even for llvm IR, such a code generator
would probably need to link in major portions of llvm code.  That is very
large and very slow to compile.  Right now, there is a do-nothing M3CG.T
found in m3-sys/cm3/cm3/src/llvmdummy

 Changes to be committed:

	modified:   m3-sys/cm3/src/Builder.m3
	modified:   m3-sys/cm3/src/M3Backend.m3
	modified:   m3-sys/cm3/src/M3Build.m3
	modified:   m3-sys/cm3/src/Makefile.m3
	modified:   m3-sys/cm3/src/m3makefile
	modified:   m3-sys/cm3/src/version.quake
	modified:   m3-sys/cminstall/src/config-no-install/Unix.common
	modified:   m3-sys/m3middle/src/Target.i3
	modified:   m3-sys/m3middle/src/Target.m3
	modified:   m3-sys/m3quake/src/M3Path.i3
	modified:   m3-sys/m3quake/src/M3Path.m3


  Commit: 9ac6ecd619179882ed37988526008defc0b3d054
      https://github.com/modula3/cm3/commit/9ac6ecd619179882ed37988526008defc0b3d054
  Author: Rodney Bates <rodney.m.bates at acm.org>
  Date:   2015-07-31 (Fri, 31 Jul 2015)

  Changed paths:
    A m3-sys/cm3/src/llvmdummy/LLGen.i3
    A m3-sys/cm3/src/llvmdummy/LLGen.m3
    A m3-sys/cm3/src/llvmdummy/README
    A m3-sys/cm3/src/llvmdummy/m3makefile

  Log Message:
  -----------
  Initial integration of llvm back end into cm3's build system. (2nd try)

(* The parent of this commit belongs with this one.)

This should not affect anyone, without extra effor.

 Changes to be committed:

	new file:   m3-sys/cm3/src/llvmdummy/LLGen.i3
	new file:   m3-sys/cm3/src/llvmdummy/LLGen.m3
	new file:   m3-sys/cm3/src/llvmdummy/README
	new file:   m3-sys/cm3/src/llvmdummy/m3makefile
Add four new backend modes, the last four of:

    IntegratedObject,   (* "0"  -- don't call m3_backend,
                             M3CG produces object code *)
    IntegratedAssembly, (* "1"  -- don't call m3_backend,
                             M3CG produces assembly code, run asm. *)
    ExternalObject,     (* "2"  -- call m3_backend, it produces object code *)
    ExternalAssembly,   (* "3"  -- call m3_backend, it produces assembly code, run asm *)
    C,                  (* "4"  -- don't call m3_backend, call compile_c,
                             M3CG produces C *)
    IntLlvmObj,         (* "5"  -- M3CG uses llvm to directly produce object code. *)
    IntLlvmAsm,         (* "6"  -- M3CG uses llvm to directly produce assembly code,
                             run asm. *)
    ExtLlvmObj,         (* "7"  -- M3CG produces llvm bitcode.  call compile_llvm.
                             It produces object code. *)
    ExtLlvmAsm          (* "8"  -- M3CG produces llvm bitcode.  call compile_llvm.
                             It produces assembly code, run asm. *)

m3_backend is a quake script that runs the gcc-derived back end.
compile_c is a quake script that runs a C compiler, usually gcc.
compile_llvm is a quake script that calls an llvm IR compiler, currently llc.

All of these new modes expect a M3CG.T  that directly produces llvm IR,
assembly code, or object code.  Even for llvm IR, such a code generator
would probably need to link in major portions of llvm code.  That is very
large and very slow to compile.  Right now, there is a do-nothing M3CG.T
found in m3-sys/cm3/src/llvmdummy, which has no need to link in any
of llvm.  See m3-sys/cm3/src/m3makefile.

This change does not add a mode for emitting cm3 IR and running a separate
executable to take it into llvm, which is the form of llvm backend we have
now.


Compare: https://github.com/modula3/cm3/compare/67b3bbaa038a...9ac6ecd61917


More information about the M3commit mailing list