[PATCH 3/5] symaddr: add support for OP_SYMADDR in sparse-llvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sparse-llvm don't yet support OP_SYMADDR instructions.

Fix this by teaching it how to handle those.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 sparse-llvm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index b34decda3..095ce4c7b 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -989,9 +989,18 @@ static void output_insn(struct function *fn, struct instruction *insn)
 	case OP_CBR:
 		output_op_cbr(fn, insn);
 		break;
-	case OP_SYMADDR:
-		assert(0);
+	case OP_SYMADDR: {
+		LLVMValueRef res, src;
+		LLVMTypeRef dtype;
+		char name[64];
+
+		src = pseudo_to_value(fn, insn->type, insn->symbol);
+		dtype = symbol_type(insn->type);
+		pseudo_name(insn->target, name);
+		res = LLVMBuildBitCast(fn->builder, src, dtype, name);
+		insn->target->priv = res;
 		break;
+	}
 	case OP_SETVAL:
 		output_op_setval(fn, insn);
 		break;
-- 
2.16.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux