Skip to content

Commit 2b492f4

Browse files
committed
Refine variable names
1 parent 6ab5812 commit 2b492f4

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/t2c.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ FORCE_INLINE void t2c_gen_call_io_func(LLVMValueRef start,
135135
&io_param, 1, "");
136136
}
137137

138-
static LLVMTypeRef t2c_cache_func_proto;
139-
static LLVMTypeRef jit_cache_ty;
138+
static LLVMTypeRef t2c_jit_cache_func_type;
139+
static LLVMTypeRef t2c_jit_cache_struct_type;
140140

141141
#include "t2c_template.c"
142142
#undef T2C_OP
@@ -260,12 +260,13 @@ void t2c_compile(riscv_t *rv, block_t *block)
260260
module, "start", LLVMFunctionType(LLVMVoidType(), param_types, 1, 0));
261261

262262
LLVMTypeRef t2c_args[1] = {LLVMInt64Type()};
263-
t2c_cache_func_proto = LLVMFunctionType(LLVMVoidType(), t2c_args, 1, false);
263+
t2c_jit_cache_func_type =
264+
LLVMFunctionType(LLVMVoidType(), t2c_args, 1, false);
264265

265266
/* Notice to the alignment */
266267
LLVMTypeRef jit_cache_memb[2] = {LLVMInt64Type(),
267268
LLVMPointerType(LLVMVoidType(), 0)};
268-
jit_cache_ty = LLVMStructType(jit_cache_memb, 2, false);
269+
t2c_jit_cache_struct_type = LLVMStructType(jit_cache_memb, 2, false);
269270

270271
LLVMBasicBlockRef first_block = LLVMAppendBasicBlock(start, "first_block");
271272
LLVMBuilderRef first_builder = LLVMCreateBuilder();

src/t2c_template.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ FORCE_INLINE void t2c_jit_cache_helper(LLVMBuilderRef *builder,
4949
/* get jit-cache base address */
5050
LLVMValueRef base = LLVMConstIntToPtr(
5151
LLVMConstInt(LLVMInt64Type(), (long) rv->jit_cache, false),
52-
LLVMPointerType(jit_cache_ty, 0));
52+
LLVMPointerType(t2c_jit_cache_struct_type, 0));
5353

5454
/* get index */
5555
LLVMValueRef hash = LLVMBuildAnd(
@@ -59,10 +59,10 @@ FORCE_INLINE void t2c_jit_cache_helper(LLVMBuilderRef *builder,
5959
/* get jit_cache_t::pc */
6060
LLVMValueRef cast =
6161
LLVMBuildIntCast2(*builder, hash, LLVMInt64Type(), false, "");
62-
LLVMValueRef element_ptr =
63-
LLVMBuildInBoundsGEP2(*builder, jit_cache_ty, base, &cast, 1, "");
64-
LLVMValueRef pc_ptr =
65-
LLVMBuildStructGEP2(*builder, jit_cache_ty, element_ptr, 0, "");
62+
LLVMValueRef element_ptr = LLVMBuildInBoundsGEP2(
63+
*builder, t2c_jit_cache_struct_type, base, &cast, 1, "");
64+
LLVMValueRef pc_ptr = LLVMBuildStructGEP2(
65+
*builder, t2c_jit_cache_struct_type, element_ptr, 0, "");
6666
LLVMValueRef pc = LLVMBuildLoad2(*builder, LLVMInt32Type(), pc_ptr, "");
6767

6868
/* compare with calculated destination */
@@ -71,14 +71,14 @@ FORCE_INLINE void t2c_jit_cache_helper(LLVMBuilderRef *builder,
7171
LLVMBuildCondBr(*builder, cmp, true_path, false_path);
7272

7373
/* get jit_cache_t::entry */
74-
LLVMValueRef entry_ptr =
75-
LLVMBuildStructGEP2(true_builder, jit_cache_ty, element_ptr, 1, "");
74+
LLVMValueRef entry_ptr = LLVMBuildStructGEP2(
75+
true_builder, t2c_jit_cache_struct_type, element_ptr, 1, "");
7676

7777
/* invoke T2C JIT-ed code */
7878
LLVMValueRef t2c_args[1] = {
7979
LLVMConstInt(LLVMInt64Type(), (long) rv, false)};
8080

81-
LLVMBuildCall2(true_builder, t2c_cache_func_proto,
81+
LLVMBuildCall2(true_builder, t2c_jit_cache_func_type,
8282
LLVMBuildLoad2(true_builder, LLVMInt64Type(), entry_ptr, ""),
8383
t2c_args, 1, "");
8484
LLVMBuildRetVoid(true_builder);

0 commit comments

Comments
 (0)