1/*
2 * Copyright 2017, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "builder.h"
18
19#include "module.h"
20
21namespace android {
22namespace spirit {
23
24Module *Builder::MakeModule() {
25  Module *ret = new Module(this);
26  ret->initialize();
27  return ret;
28}
29
30EntryPointDefinition *
31Builder::MakeEntryPointDefinition(ExecutionModel execModel,
32                                  FunctionDefinition *func, const char *name) {
33  return new EntryPointDefinition(this, execModel, func, name);
34}
35
36DebugInfoSection *Builder::MakeDebugInfoSection() {
37  return new DebugInfoSection(this);
38}
39
40FunctionDefinition *
41Builder::MakeFunctionDefinition(Instruction *retType, FunctionControl ctrl,
42                                TypeFunctionInst *funcType) {
43  FunctionInst *func = MakeFunction(retType, ctrl, funcType);
44  FunctionEndInst *end = MakeFunctionEnd();
45  return new FunctionDefinition(this, func, end);
46}
47
48Block *Builder::MakeBlock() { return new Block(this); }
49
50} // namespace spirit
51} // namespace android
52