diff options
| author | Pekka Enberg <penberg@kernel.org> | 2011-11-22 19:54:16 +0200 |
|---|---|---|
| committer | Pekka Enberg <penberg@kernel.org> | 2011-11-22 22:06:29 +0200 |
| commit | 58f7c712b643db22fe46ecfb9fa39a93a57ddfa9 (patch) | |
| tree | c8c6503e260b801aaebb0822705425749c0c4381 /validation/backend | |
| parent | b08efe9f3e4513b3418dce040340e9fffa42bc15 (diff) | |
| download | sparse-dev-58f7c712b643db22fe46ecfb9fa39a93a57ddfa9.tar.gz | |
sparse, llvm: Simplify comparison op code generation
Linus writes:
On Tue, Nov 22, 2011 at 9:40 AM, Pekka Enberg <penberg@kernel.org> wrote:
> This patch implements LLVM code generation for OP_SET_LE, OP_SET_GE, OP_SET_BE,
> and OP_SET_AE.
Ugh.
Can't you just do it with a single statement like
target = LLVMBuildICmp(fn->builder, translate_op(op), lhs, rhs,
target_name);
instead of having that case-statement where every case does the same thing?
The translate_op() thing should be trivial too, just something like
static int translate_op(int sparse_op)
{
static const int trans_tbl[] = {
.[OP_SET_LE] = LLVMIntSLE,
...
};
return trans_tbl[sparse_op];
}
or whatever. No?
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'validation/backend')
0 files changed, 0 insertions, 0 deletions
