charon_lib/ast/
ullbc_ast.rspub use super::ullbc_ast_utils::*;
pub use crate::ast::*;
use crate::ids::Vector;
use derive_visitor::{Drive, DriveMut};
use macros::{EnumAsGetters, EnumIsA, VariantIndexArity, VariantName};
use serde::{Deserialize, Serialize};
generate_index_type!(BlockId, "Block");
pub static START_BLOCK_ID: BlockId = BlockId::ZERO;
#[charon::rename("Blocks")]
pub type BodyContents = Vector<BlockId, BlockData>;
pub type ExprBody = GExprBody<BodyContents>;
#[derive(
Debug, Clone, EnumIsA, EnumAsGetters, VariantName, Serialize, Deserialize, Drive, DriveMut,
)]
pub enum RawStatement {
Assign(Place, Rvalue),
Call(Call),
FakeRead(Place),
SetDiscriminant(Place, VariantId),
StorageDead(VarId),
Deinit(Place),
Drop(Place),
Assert(Assert),
Nop,
#[charon::opaque]
Error(String),
}
#[derive(Debug, Clone, Serialize, Deserialize, Drive, DriveMut)]
pub struct Statement {
pub span: Span,
pub content: RawStatement,
}
#[derive(
Debug,
Clone,
EnumIsA,
EnumAsGetters,
VariantName,
VariantIndexArity,
Serialize,
Deserialize,
Drive,
DriveMut,
)]
#[charon::rename("Switch")]
pub enum SwitchTargets {
If(BlockId, BlockId),
SwitchInt(IntegerTy, Vec<(ScalarValue, BlockId)>, BlockId),
}
#[derive(Debug, Clone, EnumIsA, EnumAsGetters, Serialize, Deserialize, Drive, DriveMut)]
pub enum RawTerminator {
Goto {
target: BlockId,
},
Switch {
discr: Operand,
targets: SwitchTargets,
},
Abort(AbortKind),
Return,
}
#[derive(Debug, Clone, Serialize, Deserialize, Drive, DriveMut)]
pub struct Terminator {
pub span: Span,
pub content: RawTerminator,
}
#[derive(Debug, Clone, Serialize, Deserialize, Drive, DriveMut)]
#[charon::rename("Block")]
pub struct BlockData {
pub statements: Vec<Statement>,
pub terminator: Terminator,
}