summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/llvmtranslate/libllvmtranslate.hh
blob: cf431e95b631c7c27c04ebd761a67a990b88d339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 ** \file llvmtranslate/libllvmtranslate.hh
 ** \brief Public llvmtranslate module interface declaration.
 */

#pragma once

#include <memory>
#include <utility>

#include <llvm/IR/LLVMContext.h>

#include <ast/fwd.hh>
#include <llvmtranslate/fwd.hh>

/// Translation from ast::Ast to llvm::Value.
namespace llvmtranslate
{
  /// Translate the file into a llvm::Module.
  std::pair<std::unique_ptr<llvm::LLVMContext>, std::unique_ptr<llvm::Module>>
  translate(const ast::Ast& the_program);

  /// Load the runtime as a llvm::Module.
  std::unique_ptr<llvm::Module> runtime_get(llvm::LLVMContext& ctx);

  /// The LLVM runtime as a string, loaded from the generated file.
  /// This function is implemented in $(build_dir)/src/llvmtranslate/runtime.cc
  /// For more information take a look at `local.am`.
  const char* runtime_string();

} // namespace llvmtranslate