All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH v5 01/51] llvm: remove unneeded arg 'module'
Date: Sat, 25 Mar 2017 00:20:07 +0100	[thread overview]
Message-ID: <20170324232057.15033-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170324232057.15033-1-luc.vanoostenryck@gmail.com>

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 sparse-llvm.c | 74 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index ecc4f032f..9b702863d 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -34,14 +34,14 @@ static inline bool symbol_is_fp_type(struct symbol *sym)
 	return sym->ctype.base_type == &fp_type;
 }
 
-static LLVMTypeRef symbol_type(LLVMModuleRef module, struct symbol *sym);
+static LLVMTypeRef symbol_type(struct symbol *sym);
 
-static LLVMTypeRef func_return_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef func_return_type(struct symbol *sym)
 {
-	return symbol_type(module, sym->ctype.base_type);
+	return symbol_type(sym->ctype.base_type);
 }
 
-static LLVMTypeRef sym_func_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef sym_func_type(struct symbol *sym)
 {
 	LLVMTypeRef *arg_type;
 	LLVMTypeRef func_type;
@@ -55,7 +55,7 @@ static LLVMTypeRef sym_func_type(LLVMModuleRef module, struct symbol *sym)
 	 * symbol declaration info.
 	 */
 
-	ret_type = func_return_type(module, sym);
+	ret_type = func_return_type(sym);
 
 	/* count args, build argument type information */
 	FOR_EACH_PTR(sym->arguments, arg) {
@@ -68,7 +68,7 @@ static LLVMTypeRef sym_func_type(LLVMModuleRef module, struct symbol *sym)
 	FOR_EACH_PTR(sym->arguments, arg) {
 		struct symbol *arg_sym = arg->ctype.base_type;
 
-		arg_type[idx++] = symbol_type(module, arg_sym);
+		arg_type[idx++] = symbol_type(arg_sym);
 	} END_FOR_EACH_PTR(arg);
 	func_type = LLVMFunctionType(ret_type, arg_type, n_arg,
 				     sym->variadic);
@@ -76,7 +76,7 @@ static LLVMTypeRef sym_func_type(LLVMModuleRef module, struct symbol *sym)
 	return func_type;
 }
 
-static LLVMTypeRef sym_array_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef sym_array_type(struct symbol *sym)
 {
 	LLVMTypeRef elem_type;
 	struct symbol *base_type;
@@ -85,7 +85,7 @@ static LLVMTypeRef sym_array_type(LLVMModuleRef module, struct symbol *sym)
 	/* empty struct is undefined [6.7.2.1(8)] */
 	assert(base_type->bit_size > 0);
 
-	elem_type = symbol_type(module, base_type);
+	elem_type = symbol_type(base_type);
 	if (!elem_type)
 		return NULL;
 
@@ -94,7 +94,7 @@ static LLVMTypeRef sym_array_type(LLVMModuleRef module, struct symbol *sym)
 
 #define MAX_STRUCT_MEMBERS 64
 
-static LLVMTypeRef sym_struct_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef sym_struct_type(struct symbol *sym)
 {
 	LLVMTypeRef elem_types[MAX_STRUCT_MEMBERS];
 	struct symbol *member;
@@ -112,7 +112,7 @@ static LLVMTypeRef sym_struct_type(LLVMModuleRef module, struct symbol *sym)
 
 		assert(nr < MAX_STRUCT_MEMBERS);
 
-		member_type = symbol_type(module, member);
+		member_type = symbol_type(member);
 
 		elem_types[nr++] = member_type; 
 	} END_FOR_EACH_PTR(member);
@@ -121,7 +121,7 @@ static LLVMTypeRef sym_struct_type(LLVMModuleRef module, struct symbol *sym)
 	return ret;
 }
 
-static LLVMTypeRef sym_union_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef sym_union_type(struct symbol *sym)
 {
 	LLVMTypeRef elements;
 	unsigned union_size;
@@ -138,7 +138,7 @@ static LLVMTypeRef sym_union_type(LLVMModuleRef module, struct symbol *sym)
 	return LLVMStructType(&elements, 1, 0 /* packed? */);
 }
 
-static LLVMTypeRef sym_ptr_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef sym_ptr_type(struct symbol *sym)
 {
 	LLVMTypeRef type;
 
@@ -146,7 +146,7 @@ static LLVMTypeRef sym_ptr_type(LLVMModuleRef module, struct symbol *sym)
 	if (is_void_type(sym->ctype.base_type))
 		type = LLVMInt8Type();
 	else
-		type = symbol_type(module, sym->ctype.base_type);
+		type = symbol_type(sym->ctype.base_type);
 
 	return LLVMPointerType(type, 0);
 }
@@ -199,13 +199,13 @@ static LLVMTypeRef sym_basetype_type(struct symbol *sym)
 	return ret;
 }
 
-static LLVMTypeRef symbol_type(LLVMModuleRef module, struct symbol *sym)
+static LLVMTypeRef symbol_type(struct symbol *sym)
 {
 	LLVMTypeRef ret = NULL;
 
 	/* don't cache the result for SYM_NODE */
 	if (sym->type == SYM_NODE)
-		return symbol_type(module, sym->ctype.base_type);
+		return symbol_type(sym->ctype.base_type);
 
 	if (sym->aux)
 		return sym->aux;
@@ -213,25 +213,25 @@ static LLVMTypeRef symbol_type(LLVMModuleRef module, struct symbol *sym)
 	switch (sym->type) {
 	case SYM_BITFIELD:
 	case SYM_ENUM:
-		ret = symbol_type(module, sym->ctype.base_type);
+		ret = symbol_type(sym->ctype.base_type);
 		break;
 	case SYM_BASETYPE:
 		ret = sym_basetype_type(sym);
 		break;
 	case SYM_PTR:
-		ret = sym_ptr_type(module, sym);
+		ret = sym_ptr_type(sym);
 		break;
 	case SYM_UNION:
-		ret = sym_union_type(module, sym);
+		ret = sym_union_type(sym);
 		break;
 	case SYM_STRUCT:
-		ret = sym_struct_type(module, sym);
+		ret = sym_struct_type(sym);
 		break;
 	case SYM_ARRAY:
-		ret = sym_array_type(module, sym);
+		ret = sym_array_type(sym);
 		break;
 	case SYM_FN:
-		ret = sym_func_type(module, sym);
+		ret = sym_func_type(sym);
 		break;
 	default:
 		assert(0);
@@ -242,10 +242,10 @@ static LLVMTypeRef symbol_type(LLVMModuleRef module, struct symbol *sym)
 	return ret;
 }
 
-static LLVMTypeRef insn_symbol_type(LLVMModuleRef module, struct instruction *insn)
+static LLVMTypeRef insn_symbol_type(struct instruction *insn)
 {
 	if (insn->type)
-		return symbol_type(module, insn->type);
+		return symbol_type(insn->type);
 
 	switch (insn->size) {
 		case 8:		return LLVMInt8Type();
@@ -345,7 +345,7 @@ static LLVMValueRef pseudo_to_value(struct function *fn, struct instruction *ins
 			}
 		} else {
 			const char *name = show_ident(sym->ident);
-			LLVMTypeRef type = symbol_type(fn->module, sym);
+			LLVMTypeRef type = symbol_type(sym);
 
 			if (LLVMGetTypeKind(type) == LLVMFunctionTypeKind) {
 				result = LLVMGetNamedFunction(fn->module, name);
@@ -360,7 +360,7 @@ static LLVMValueRef pseudo_to_value(struct function *fn, struct instruction *ins
 		break;
 	}
 	case PSEUDO_VAL:
-		result = LLVMConstInt(insn_symbol_type(fn->module, insn), pseudo->value, 1);
+		result = LLVMConstInt(insn_symbol_type(insn), pseudo->value, 1);
 		break;
 	case PSEUDO_ARG: {
 		result = LLVMGetParam(fn->fn, pseudo->nr - 1);
@@ -519,7 +519,7 @@ static void output_op_binary(struct function *fn, struct instruction *insn)
 		rhs_nz = LLVMBuildIsNotNull(fn->builder, rhs, "");
 		target = LLVMBuildAnd(fn->builder, lhs_nz, rhs_nz, target_name);
 
-		dst_type = insn_symbol_type(fn->module, insn);
+		dst_type = insn_symbol_type(insn);
 		target = LLVMBuildZExt(fn->builder, target, dst_type, target_name);
 		break;
 	}
@@ -531,7 +531,7 @@ static void output_op_binary(struct function *fn, struct instruction *insn)
 		rhs_nz = LLVMBuildIsNotNull(fn->builder, rhs, "");
 		target = LLVMBuildOr(fn->builder, lhs_nz, rhs_nz, target_name);
 
-		dst_type = insn_symbol_type(fn->module, insn);
+		dst_type = insn_symbol_type(insn);
 		target = LLVMBuildZExt(fn->builder, target, dst_type, target_name);
 		break;
 	}
@@ -557,7 +557,7 @@ static void output_op_compare(struct function *fn, struct instruction *insn)
 
 	pseudo_name(insn->target, target_name);
 
-	LLVMTypeRef dst_type = insn_symbol_type(fn->module, insn);
+	LLVMTypeRef dst_type = insn_symbol_type(insn);
 
 	if (LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMIntegerTypeKind) {
 		LLVMIntPredicate op = translate_op(insn->opcode);
@@ -599,7 +599,7 @@ static LLVMValueRef calc_memop_addr(struct function *fn, struct instruction *ins
 	/* convert src to the effective pointer type */
 	src = pseudo_to_value(fn, insn, insn->src);
 	as = LLVMGetPointerAddressSpace(LLVMTypeOf(src));
-	addr_type = LLVMPointerType(insn_symbol_type(fn->module, insn), as);
+	addr_type = LLVMPointerType(insn_symbol_type(insn), as);
 	src = LLVMBuildPointerCast(fn->builder, src, addr_type, "");
 
 	/* addr = src + off */
@@ -775,7 +775,7 @@ static void output_op_ptrcast(struct function *fn, struct instruction *insn)
 
 	assert(!symbol_is_fp_type(insn->type));
 
-	target = LLVMBuildBitCast(fn->builder, src, insn_symbol_type(fn->module, insn), target_name);
+	target = LLVMBuildBitCast(fn->builder, src, insn_symbol_type(insn), target_name);
 
 	insn->target->priv = target;
 }
@@ -794,9 +794,9 @@ static void output_op_cast(struct function *fn, struct instruction *insn, LLVMOp
 	assert(!symbol_is_fp_type(insn->type));
 
 	if (insn->size < LLVMGetIntTypeWidth(LLVMTypeOf(src)))
-		target = LLVMBuildTrunc(fn->builder, src, insn_symbol_type(fn->module, insn), target_name);
+		target = LLVMBuildTrunc(fn->builder, src, insn_symbol_type(insn), target_name);
 	else
-		target = LLVMBuildCast(fn->builder, op, src, insn_symbol_type(fn->module, insn), target_name);
+		target = LLVMBuildCast(fn->builder, op, src, insn_symbol_type(insn), target_name);
 
 	insn->target->priv = target;
 }
@@ -945,12 +945,12 @@ static void output_fn(LLVMModuleRef module, struct entrypoint *ep)
 	FOR_EACH_PTR(base_type->arguments, arg) {
 		struct symbol *arg_base_type = arg->ctype.base_type;
 
-		arg_types[nr_args++] = symbol_type(module, arg_base_type);
+		arg_types[nr_args++] = symbol_type(arg_base_type);
 	} END_FOR_EACH_PTR(arg);
 
 	name = show_ident(sym->ident);
 
-	return_type = symbol_type(module, ret_type);
+	return_type = symbol_type(ret_type);
 
 	function.type = LLVMFunctionType(return_type, arg_types, nr_args, 0);
 
@@ -987,7 +987,7 @@ static void output_fn(LLVMModuleRef module, struct entrypoint *ep)
 			/* insert alloca into entry block */
 			entrybbr = LLVMGetEntryBasicBlock(function.fn);
 			LLVMPositionBuilderAtEnd(function.builder, entrybbr);
-			phi_type = insn_symbol_type(module, insn);
+			phi_type = insn_symbol_type(insn);
 			ptr = LLVMBuildAlloca(function.builder, phi_type, "");
 			/* emit forward load for phi */
 			LLVMClearInsertionPosition(function.builder);
@@ -1017,7 +1017,7 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
 	if (initializer) {
 		switch (initializer->type) {
 		case EXPR_VALUE:
-			initial_value = LLVMConstInt(symbol_type(module, sym), initializer->value, 1);
+			initial_value = LLVMConstInt(symbol_type(sym), initializer->value, 1);
 			break;
 		case EXPR_SYMBOL: {
 			struct symbol *sym = initializer->symbol;
@@ -1037,7 +1037,7 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
 			assert(0);
 		}
 	} else {
-		LLVMTypeRef type = symbol_type(module, sym);
+		LLVMTypeRef type = symbol_type(sym);
 
 		initial_value = LLVMConstNull(type);
 	}
-- 
2.12.0


  reply	other threads:[~2017-03-24 23:23 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 23:20 [PATCH v5 00/51] LLVM fixes Luc Van Oostenryck
2017-03-24 23:20 ` Luc Van Oostenryck [this message]
2017-03-24 23:20 ` [PATCH v5 02/51] llvm: remove unneeded 'generation' Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 03/51] llvm: remove unneeded function::type Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 04/51] llvm: reduce scope of 'bb_nr' Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 05/51] llvm: use pseudo_list_size() instead of open coding it Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 06/51] llvm: give arguments a name Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 07/51] llvm: give a name to call's return values Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 08/51] llvm: avoid useless temp variable Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 09/51] llvm: extract get_sym_value() from pseudo_to_value() Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 10/51] llvm: fix test of floating-point type Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 11/51] llvm: fix translation of PSEUDO_VALs into a ValueRefs Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 12/51] llvm: fix output_op_store() which modify its operand Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 13/51] llvm: fix output_op_[ptr]cast() Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 14/51] llvm: take care of degenerated rvalues Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 15/51] llvm: add test cases for symbol's address Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 16/51] llvm: add test cases for pointers passed as argument Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 17/51] llvm: add test cases for arrays " Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 18/51] llvm: add test cases for degenerated pointers Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 19/51] llvm: add support for OP_NEG Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 20/51] llvm: add support for OP_SETVAL with floats Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 21/51] llvm: add support for OP_SETVAL with labels Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 22/51] llvm: ignore OP_INLINED_CALL Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 23/51] llvm: fix pointer/float mixup in comparisons Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 24/51] llvm: fix type in comparison with an address constant Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 25/51] llvm: give correct type to binops Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 26/51] llvm: adjust OP_RET's type Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 27/51] llvm: variadic functions are not being marked as such Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 28/51] llvm: fix type of switch constants Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 29/51] llvm: make pseudo_name() more flexible Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 30/51] llvm: give a name to all values Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 31/51] llvm: add support for OP_SWITCH with a range Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 32/51] llvm: fix OP_SWITCH has no target Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 33/51] llvm: make value_to_pvalue() more flexible Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 34/51] llvm: make value_to_ivalue() " Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 35/51] llvm: add test case pointer compare with cast Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 36/51] llvm: let pseudo_to_value() directly use the type Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 37/51] llvm: remove unneeded pseudo_to_value() unneeded argument Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 38/51] llvm: introduce get_ioperand() Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 39/51] llvm: fix mutating function pointer Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 40/51] llvm: fix mutated OP_RET Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 41/51] llvm: fix mutated OP_SEL Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 42/51] llvm: fix mutated OP_SWITCH Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 43/51] llvm: fix mutated OP_PHISOURCE Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 44/51] llvm: fix mutated OP_[PTR]CAST Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 45/51] llvm: add support for restricted types Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 46/51] llvm: fix get value from initialized symbol Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 47/51] llvm: fix get value from non-anonymous symbol Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 48/51] llvm: fix type of bitfields Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 49/51] llvm: add support for OP_FPCAST Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 50/51] llvm: add support for cast from floats Luc Van Oostenryck
2017-03-24 23:20 ` [PATCH v5 51/51] llvm: cleanup of output_[ptr]cast() Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170324232057.15033-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.