Skip to content

Commit

Permalink
refactor: codegen value store and load & add debug info for the entir…
Browse files Browse the repository at this point in the history
…e module (#1126)

Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Mar 12, 2024
1 parent 0d9c398 commit 61a05fe
Show file tree
Hide file tree
Showing 17 changed files with 484 additions and 422 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,5 @@ _a.out_*.*
# Compiler_base
.compiler_base

# LLVM
llvm*
llvm-*

# KCL mod lock file
!.mod.lock
25 changes: 25 additions & 0 deletions kclvm/compiler/src/codegen/llvm/backtrack.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright The KCL Authors. All rights reserved.

use super::context::LLVMCodeGenContext;
use crate::codegen::traits::BuilderMethods;
use inkwell::values::BasicValueEnum;

impl<'ctx> LLVMCodeGenContext<'ctx> {
pub(crate) fn update_backtrack_meta(
&self,
name: &str,
schema_value: BasicValueEnum<'ctx>,
) -> bool {
if let Some(backtrack_meta) = self.backtrack_meta.borrow_mut().as_mut() {
if name == backtrack_meta.target {
backtrack_meta.count += 1;
if backtrack_meta.count >= backtrack_meta.level {
backtrack_meta.stop = true;
self.ret(schema_value);
return true;
}
}
}
false
}
}
Loading

0 comments on commit 61a05fe

Please sign in to comment.