1 /*
2  * Copyright (c) 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 LLASSEM_COMMON_H_
19 #define LLASSEM_COMMON_H_
20 
21 #include "gbldefs.h"
22 #include "global.h"
23 #include "symtab.h"
24 #include "ll_structure.h"
25 
26 /**
27    \brief ...
28  */
29 ISZ_T put_skip(ISZ_T old, ISZ_T New);
30 
31 /**
32    \brief ...
33  */
34 char *put_next_member(char *ptr);
35 
36 /**
37    \brief ...
38  */
39 int add_member_for_llvm(SPTR sym, int prev, DTYPE dtype, ISZ_T size);
40 
41 /**
42    \brief ...
43  */
44 DTYPE mk_struct_for_llvm_init(const char *name, int size);
45 
46 /**
47    \brief ...
48  */
49 LL_Value *gen_ptr_offset_val(int offset, LL_Type *ret_type, char *ptr_nm);
50 
51 /**
52    \brief ...
53  */
54 void add_init_routine(char *initroutine);
55 
56 /**
57    \brief ...
58  */
59 void emit_init(DTYPE tdtype, ISZ_T tconval, ISZ_T *addr, ISZ_T *repeat_cnt,
60                ISZ_T loc_base, ISZ_T *i8cnt, int *ptrcnt, char **cptr);
61 
62 /**
63    \brief ...
64  */
65 void init_daz(void);
66 
67 /**
68    \brief ...
69  */
70 void init_flushz(void);
71 
72 /**
73    \brief ...
74  */
75 void init_huge_tlb(void);
76 
77 /**
78    \brief ...
79  */
80 void init_ktrap(void);
81 
82 /**
83    \brief ...
84  */
85 void init_Mcuda_compiled(void);
86 
87 /**
88    \brief ...
89  */
90 void put_addr(SPTR sptr, ISZ_T off, DTYPE dtype);
91 
92 /**
93    \brief ...
94  */
95 void put_i32(int val);
96 
97 /**
98    \brief ...
99  */
100 void put_int4(int val);
101 
102 /**
103    \brief ...
104  */
105 void put_short(int val);
106 
107 /**
108    \brief ...
109  */
110 void put_string_n(char *p, ISZ_T len, int size);
111 
112 #endif // LLASSEM_COMMON_H_
113