diff options
| -rw-r--r-- | Documentation/IR.rst | 8 | ||||
| -rw-r--r-- | cse.c | 4 | ||||
| -rw-r--r-- | example.c | 3 | ||||
| -rw-r--r-- | linearize.c | 2 | ||||
| -rw-r--r-- | linearize.h | 4 | ||||
| -rw-r--r-- | simplify.c | 23 | ||||
| -rw-r--r-- | sparse-llvm.c | 24 |
7 files changed, 2 insertions, 66 deletions
diff --git a/Documentation/IR.rst b/Documentation/IR.rst index ff0ccdf2..0419ac41 100644 --- a/Documentation/IR.rst +++ b/Documentation/IR.rst @@ -125,14 +125,6 @@ They all follow the same signature: .. op:: OP_XOR Logical XOR -Boolean ops ------------ -.. op:: OP_AND_BOOL - Boolean AND - -.. op:: OP_OR_BOOL - Boolean OR - Integer compares ---------------- They all have the following signature: @@ -54,8 +54,7 @@ void cse_collect(struct instruction *insn) case OP_AND: case OP_OR: /* Binary logical */ - case OP_XOR: case OP_AND_BOOL: - case OP_OR_BOOL: + case OP_XOR: /* Binary comparison */ case OP_SET_EQ: case OP_SET_NE: @@ -175,7 +174,6 @@ static int insn_compare(const void *_i1, const void *_i2) /* commutative binop */ case OP_ADD: case OP_MUL: - case OP_AND_BOOL: case OP_OR_BOOL: case OP_AND: case OP_OR: case OP_XOR: case OP_SET_EQ: case OP_SET_NE: @@ -43,8 +43,6 @@ static const char *opcodes[] = { [OP_AND] = "and", [OP_OR] = "or", [OP_XOR] = "xor", - [OP_AND_BOOL] = "and-bool", - [OP_OR_BOOL] = "or-bool", /* Binary comparison */ [OP_SET_EQ] = "seteq", @@ -1402,7 +1400,6 @@ static void generate_one_insn(struct instruction *insn, struct bb_state *state) case OP_ADD: case OP_MUL: case OP_AND: case OP_OR: case OP_XOR: - case OP_AND_BOOL: case OP_OR_BOOL: generate_commutative_binop(state, insn); break; diff --git a/linearize.c b/linearize.c index bd991450..194afe66 100644 --- a/linearize.c +++ b/linearize.c @@ -213,8 +213,6 @@ static const char *opcodes[] = { [OP_AND] = "and", [OP_OR] = "or", [OP_XOR] = "xor", - [OP_AND_BOOL] = "and-bool", - [OP_OR_BOOL] = "or-bool", /* Binary comparison */ [OP_SET_EQ] = "seteq", diff --git a/linearize.h b/linearize.h index 242cefb8..092e1ac2 100644 --- a/linearize.h +++ b/linearize.h @@ -178,9 +178,7 @@ enum opcode { OP_AND, OP_OR, OP_XOR, - OP_AND_BOOL, - OP_OR_BOOL, - OP_BINARY_END = OP_OR_BOOL, + OP_BINARY_END = OP_XOR, /* floating-point comparison */ OP_FPCMP, @@ -489,12 +489,6 @@ static pseudo_t eval_insn(struct instruction *insn) case OP_XOR: res = left ^ right; break; - case OP_AND_BOOL: - res = left && right; - break; - case OP_OR_BOOL: - res = left || right; - break; /* Binary comparison */ case OP_SET_EQ: @@ -637,11 +631,6 @@ static int simplify_constant_rightside(struct instruction *insn) long long bits = sbit | (sbit - 1); switch (insn->opcode) { - case OP_OR_BOOL: - if (value == 1) - return replace_with_pseudo(insn, insn->src2); - goto case_neutral_zero; - case OP_OR: if ((value & bits) == bits) return replace_with_pseudo(insn, insn->src2); @@ -680,10 +669,6 @@ static int simplify_constant_rightside(struct instruction *insn) case OP_MUL: return simplify_mul_div(insn, value); - case OP_AND_BOOL: - if (value == 1) - return replace_with_pseudo(insn, insn->src1); - /* Fall through */ case OP_AND: if (!value) return replace_with_pseudo(insn, insn->src2); @@ -753,13 +738,6 @@ static int simplify_binop_same_args(struct instruction *insn, pseudo_t arg) case OP_OR: return replace_with_pseudo(insn, arg); - case OP_AND_BOOL: - case OP_OR_BOOL: - remove_usage(arg, &insn->src2); - insn->src2 = value_pseudo(0); - insn->opcode = OP_SET_NE; - return REPEAT_CSE; - default: break; } @@ -1197,7 +1175,6 @@ int simplify_instruction(struct instruction *insn) switch (insn->opcode) { case OP_ADD: case OP_MUL: case OP_AND: case OP_OR: case OP_XOR: - case OP_AND_BOOL: case OP_OR_BOOL: canonicalize_commutative(insn); if (simplify_binop(insn)) return REPEAT_CSE; diff --git a/sparse-llvm.c b/sparse-llvm.c index 937f4490..d28eb6e7 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -601,30 +601,6 @@ static void output_op_binary(struct function *fn, struct instruction *insn) assert(!is_float_type(insn->type)); target = LLVMBuildXor(fn->builder, lhs, rhs, target_name); break; - case OP_AND_BOOL: { - LLVMValueRef lhs_nz, rhs_nz; - LLVMTypeRef dst_type; - - lhs_nz = LLVMBuildIsNotNull(fn->builder, lhs, LLVMGetValueName(lhs)); - rhs_nz = LLVMBuildIsNotNull(fn->builder, rhs, LLVMGetValueName(rhs)); - target = LLVMBuildAnd(fn->builder, lhs_nz, rhs_nz, target_name); - - dst_type = insn_symbol_type(insn); - target = LLVMBuildZExt(fn->builder, target, dst_type, target_name); - break; - } - case OP_OR_BOOL: { - LLVMValueRef lhs_nz, rhs_nz; - LLVMTypeRef dst_type; - - lhs_nz = LLVMBuildIsNotNull(fn->builder, lhs, LLVMGetValueName(lhs)); - rhs_nz = LLVMBuildIsNotNull(fn->builder, rhs, LLVMGetValueName(rhs)); - target = LLVMBuildOr(fn->builder, lhs_nz, rhs_nz, target_name); - - dst_type = insn_symbol_type(insn); - target = LLVMBuildZExt(fn->builder, target, dst_type, target_name); - break; - } default: assert(0); break; |
