diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-04-02 11:09:47 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-08 14:04:43 +0100 |
| commit | 030473b77d72bd6edcf9fb37e1fe8c12f96deab7 (patch) | |
| tree | be8cafa3e8305465959db2241244774586bc3632 /sparse-llvm.c | |
| parent | 1277d44553d34510a333632add6e75c759bd6dbd (diff) | |
| download | sparse-dev-030473b77d72bd6edcf9fb37e1fe8c12f96deab7.tar.gz | |
add OP_SETFVAL
OP_SETVAL is used to create floating-point and string
as well as labels-as-values. This multi-purpose aspect
sometimes make things a bit more complicated.
Change this by using a new instruction for the direct
creation of floating-point literals without needing
to have an intermediate EXPR_FVALUE.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'sparse-llvm.c')
| -rw-r--r-- | sparse-llvm.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c index 7a44833a..3a177808 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -971,13 +971,9 @@ static void output_op_fpcast(struct function *fn, struct instruction *insn) static void output_op_setval(struct function *fn, struct instruction *insn) { struct expression *val = insn->val; - LLVMTypeRef dtype = symbol_type(insn->type); LLVMValueRef target; switch (val->type) { - case EXPR_FVALUE: - target = LLVMConstReal(dtype, val->fvalue); - break; case EXPR_LABEL: target = LLVMBlockAddress(fn->fn, val->symbol->bb_target->priv); break; @@ -988,6 +984,15 @@ static void output_op_setval(struct function *fn, struct instruction *insn) insn->target->priv = target; } +static void output_op_setfval(struct function *fn, struct instruction *insn) +{ + LLVMTypeRef dtype = symbol_type(insn->type); + LLVMValueRef target; + + target = LLVMConstReal(dtype, insn->fvalue); + insn->target->priv = target; +} + static void output_insn(struct function *fn, struct instruction *insn) { switch (insn->opcode) { @@ -1006,6 +1011,9 @@ static void output_insn(struct function *fn, struct instruction *insn) case OP_SETVAL: output_op_setval(fn, insn); break; + case OP_SETFVAL: + output_op_setfval(fn, insn); + break; case OP_SWITCH: output_op_switch(fn, insn); break; |
