api_codegen.cc 689 Bytes
Newer Older
1 2 3 4 5 6 7 8
/*!
 *  Copyright (c) 2016 by Contributors
 *  Implementation of API functions related to Codegen
 * \file c_api_codegen.cc
 */
#include <tvm/expr.h>
#include <tvm/ir.h>
#include <tvm/codegen.h>
9
#include <tvm/lowered_func.h>
10 11 12 13 14
#include <tvm/api_registry.h>

namespace tvm {
namespace codegen {

15
TVM_REGISTER_API(_codegen_build)
16
.set_body([](TVMArgs args, TVMRetValue *ret) {
17 18
    if (args[0].IsNodeType<LoweredFunc>()) {
      *ret = Build({args[0]}, args[1]);
19
    } else {
20
      *ret = Build(args[0], args[1]);
21
    }
22 23
  });

24
TVM_REGISTER_API(_codegen_enabled)
25
.set_body([](TVMArgs args, TVMRetValue *ret) {
26
    *ret = TargetEnabled(args[0]);
27
  });
28 29
}  // namespace codegen
}  // namespace tvm