[PATCH v2 13/27] llvm: add support for OP_SYMADDR

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

 



sparse-llvm don't yet support OP_SYMADDR instructions.

Fix this by add the needed support for it.

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 e3c8cafed..a3606a86e 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -895,9 +895,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, insn->symbol);
+		dtype = symbol_type(fn->module, insn->type);
+		pseudo_name(insn->target, name);
+		res = LLVMBuildBitCast(fn->builder, src, dtype, name);
+		insn->target->priv = res;
 		break;
+	}
 	case OP_SETVAL:
 		assert(0);
 		break;
-- 
2.11.1

--
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