Class: Comet::Rules::Codegen

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/rules/codegen.rb

Instance Method Summary collapse

Constructor Details

#initialize(linker, bitcode) ⇒ Codegen

Returns a new instance of Codegen.



4
5
6
7
# File 'lib/comet/rules/codegen.rb', line 4

def initialize(linker, bitcode)
  @linker = linker
  @bitcode = bitcode
end

Instance Method Details

#commandsObject



31
32
33
# File 'lib/comet/rules/codegen.rb', line 31

def commands
  { COMET_OPT: 'clang' }
end

#contentsObject



20
21
22
23
24
25
# File 'lib/comet/rules/codegen.rb', line 20

def contents
  [
    "#{target}: #{@bitcode.target} | #{Comet::TMPDIR}",
    "\t#{llvm_codegen} -o $@ $<"
  ]
end

#rulesObject



27
28
29
# File 'lib/comet/rules/codegen.rb', line 27

def rules
  @rules ||= [@bitcode]
end

#targetObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/comet/rules/codegen.rb', line 9

def target
  @target ||= Comet::Makefile.fingerprint Hash[
    command: clang_link_command,
    target: @bitcode.target,
    triple: @linker.triple,
    isa: @linker.isa,
    cpu: @linker.cpu,
    opt: @linker.opt
  ], extension: :s
end