Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for enum, struct, tuple in llbc backend #3721

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

thanhnguyen-aws
Copy link

This pull request added some more features to Stable-mir to Ullbc translation:

  1. Added support for translation of enum, struct, tuple and the projection associated with them.
  2. Edited 3 Binops translation.
  3. Added 4 simple tests for enum, struct, tuple and the projection .
  4. If you had to perform any manual test, please describe them.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@thanhnguyen-aws thanhnguyen-aws requested a review from a team as a code owner November 15, 2024 18:09
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Nov 15, 2024
@celinval
Copy link
Contributor

Can you please provide a better title to this PR? Something like "Add support for enum, struct, tuple in the llbc backend".

@thanhnguyen-aws thanhnguyen-aws changed the title add support for enum, struct, tuple in mod.rs, add some tests add support for enum, struct, tuple in llbc backend Nov 15, 2024
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -0,0 +1,24 @@
-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete all the .lean files.

@@ -5,4 +5,4 @@ fn test::is_zero(@1: i32) -> bool\

@0 := copy (i@1) == const (0 : i32)\
return\
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? You might want to update your VSCode settings to insert a new line at the end of file. See https://stackoverflow.com/questions/44704968/visual-studio-code-insert-newline-at-the-end-of-files

@@ -7,66 +7,96 @@
//! unstructured low-level borrow calculus (ULLBC)

use core::panic;
//use std::any::Any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments.

};
use charon_lib::{error_assert, error_or_panic};
use rustc_data_structures::fx::FxHashMap;
//use rustc_data_structures::stable_hasher::HashStable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comments.

};

use stable_mir::ty::{GenericArgKind, GenericArgs};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge with the previous use stable_mir::ty.

use stable_mir::{CrateDef, DefId};
//use syn::token::Default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment.

@@ -152,31 +187,192 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
tid.try_into().unwrap()
}

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented function.

tid.try_into().unwrap()
}

fn find_type_decl_id(&self, def_id: DefId) -> CharonTypeDeclId {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the previous function (register_type_decl_id) sufficient? Or is this used in cases where the decl_id is guaranteed to be created previously?

CharonSpan { span: rspan, generated_from_span: None }
}

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code.

@@ -409,54 +710,150 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
instance_internal.def.requires_caller_location(self.tcx())
}

fn translate_ty(&self, ty: Ty) -> CharonTy {
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants