From 6cb12c6217f17facbc9dbd2a8151357f45651f7c Mon Sep 17 00:00:00 2001 From: Andrea Shepard <andrea@persephoneslair.org> Date: Mon, 21 Nov 2016 05:44:17 +0000 Subject: [PATCH] Add memoization note in h_llvm_make_charset_membership_test() --- src/backends/llvm/llvm_charset.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backends/llvm/llvm_charset.c b/src/backends/llvm/llvm_charset.c index 87dea54d..16b0550d 100644 --- a/src/backends/llvm/llvm_charset.c +++ b/src/backends/llvm/llvm_charset.c @@ -1001,6 +1001,18 @@ bool h_llvm_make_charset_membership_test(HAllocator* mm__, } #endif /* defined(HAMMER_LLVM_CHARSET_DEBUG) */ + /* + * XXX Note on memoization: + * + * How common is it for this to occur multiple times in a parser with the + * same charset? If so, we will end up emitting code which differs only in + * its yes and no output basic blocks each time. Does LLVM IR have an + * equivalent of MIPS jr? Is there a significant performance penalty vs. + * LLVMBuildBr()? If yes and no respectively, we should consider memoizing + * by charset using it and building a wrapper around it that just varies + * the output blocks to reduce emitted code size. + */ + /* Create input block */ LLVMBasicBlockRef start = LLVMAppendBasicBlock(func, "cs_start"); /* -- GitLab