1 /*
2  * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
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 
18 #ifndef LL_WRITE_H_
19 #define LL_WRITE_H_
20 
21 #include <stdio.h>
22 #include "ll_structure.h"
23 
24 /**
25    \brief ...
26  */
27 void ll_write_basicblock(FILE *out, LL_Function *function, LL_BasicBlock *block,
28                          LL_Module *module, int no_return);
29 
30 /**
31    \brief ...
32  */
33 void ll_write_function(FILE *out, LL_Function *function, LL_Module *module,
34                        bool no_return, const char *prefix);
35 
36 /**
37    \brief ...
38  */
39 void ll_write_function_signature(FILE *out, struct LL_Function_ *function);
40 
41 /**
42    \brief ...
43  */
44 void ll_write_global_objects(FILE *out, LLVMModuleRef module);
45 
46 /**
47    \brief ...
48  */
49 void ll_write_global_var_signature(FILE *out, LL_Value *variable);
50 
51 /**
52    \brief ...
53  */
54 void ll_write_instruction(FILE *out, struct LL_Instruction_ *inst,
55                           LL_Module *module, int no_return);
56 
57 /**
58    \brief ...
59  */
60 void ll_write_llvm_used(FILE *out, LLVMModuleRef module);
61 
62 /**
63    \brief ...
64  */
65 void ll_write_local_objects(FILE *out, LL_Function *function);
66 
67 /**
68    \brief ...
69  */
70 void ll_write_metadata(FILE *out, LLVMModuleRef module);
71 
72 /**
73    \brief ...
74  */
75 void ll_write_module(FILE *out, LL_Module *module, int no_return,
76                      const char *no_return_prefix);
77 
78 /**
79    \brief ...
80  */
81 void ll_write_module_header(FILE *out, LLVMModuleRef module);
82 
83 /**
84    \brief ...
85  */
86 void ll_write_object_dbg_references(FILE *out, LL_Module *m,
87                                     LL_ObjToDbgList *ods);
88 
89 /**
90    \brief ...
91  */
92 void ll_write_user_structs(FILE *out, LLVMModuleRef module);
93 
94 /**
95    \brief ...
96  */
97 void write_mdref(FILE *out, LL_Module *module, LL_MDRef rmdref,
98                  int omit_metadata_type);
99 
100 /**
101    \brief Build llvm metadata information specificly for llvm nvptx backend.
102  */
103 void ll_build_metadata_device(FILE *out, LLVMModuleRef module);
104 
105 #endif
106