Skip to content

Commit 77da51e

Browse files
committed
[Rust] Add support for LLIL_SEPARATE_PARAM_LIST_SSA
1 parent 14215c8 commit 77da51e

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

rust/src/low_level_il/expression.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ where
280280
FcmpO(Operation<'func, M, F, operation::Condition>),
281281
FcmpUO(Operation<'func, M, F, operation::Condition>),
282282

283+
SeparateParamListSsa(Operation<'func, M, F, operation::SeparateParamListSsa>),
284+
283285
// TODO ADD_OVERFLOW
284286
Unimpl(Operation<'func, M, F, operation::NoArgs>),
285287
UnimplMem(Operation<'func, M, F, operation::UnimplMem>),
@@ -428,6 +430,10 @@ where
428430
LLIL_FCMP_O => LowLevelILExpressionKind::FcmpO(Operation::new(function, op, index)),
429431
LLIL_FCMP_UO => LowLevelILExpressionKind::FcmpUO(Operation::new(function, op, index)),
430432

433+
LLIL_SEPARATE_PARAM_LIST_SSA => {
434+
LowLevelILExpressionKind::SeparateParamListSsa(Operation::new(function, op, index))
435+
}
436+
431437
LLIL_UNIMPL => LowLevelILExpressionKind::Unimpl(Operation::new(function, op, index)),
432438
LLIL_UNIMPL_MEM => {
433439
LowLevelILExpressionKind::UnimplMem(Operation::new(function, op, index))
@@ -598,6 +604,11 @@ where
598604
visit!(param_expr);
599605
}
600606
}
607+
SeparateParamListSsa(ref op) => {
608+
for param_expr in op.param_exprs() {
609+
visit!(param_expr);
610+
}
611+
}
601612
// Do not have any sub expressions.
602613
Pop(_) | Reg(_) | RegSsa(_) | RegPartialSsa(_) | RegSplit(_) | RegSplitSsa(_)
603614
| Const(_) | ConstPtr(_) | Flag(_) | FlagBit(_) | ExternPtr(_) | FlagCond(_)
@@ -668,6 +679,8 @@ where
668679
| FloatToInt(ref op) | IntToFloat(ref op) | FloatConv(ref op) | RoundToInt(ref op)
669680
| Floor(ref op) | Ceil(ref op) | Ftrunc(ref op) => &op.op,
670681

682+
SeparateParamListSsa(ref op) => &op.op,
683+
671684
UnimplMem(ref op) => &op.op,
672685
//TestBit(Operation<'func, M, F, operation::TestBit>), // TODO
673686
}
@@ -738,6 +751,8 @@ impl LowLevelILExpressionKind<'_, Mutable, NonSSA> {
738751
| FloatToInt(ref op) | IntToFloat(ref op) | FloatConv(ref op) | RoundToInt(ref op)
739752
| Floor(ref op) | Ceil(ref op) | Ftrunc(ref op) => op.flag_write(),
740753

754+
SeparateParamListSsa(ref op) => op.flag_write(),
755+
741756
UnimplMem(ref op) => op.flag_write(),
742757
//TestBit(Operation<'func, M, F, operation::TestBit>), // TODO
743758
}

rust/src/low_level_il/operation.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,6 +2111,35 @@ where
21112111
}
21122112
}
21132113

2114+
// LLIL_SEPARATE_PARAM_LIST_SSA
2115+
pub struct SeparateParamListSsa;
2116+
2117+
impl<'func, M, F> Operation<'func, M, F, SeparateParamListSsa>
2118+
where
2119+
M: FunctionMutability,
2120+
F: FunctionForm,
2121+
{
2122+
pub fn param_exprs(&self) -> Vec<LowLevelILExpression<'func, M, F, ValueExpr>> {
2123+
self.get_operand_list(0)
2124+
.into_iter()
2125+
.map(|val| LowLevelExpressionIndex(val as usize))
2126+
.map(|expr_idx| LowLevelILExpression::new(self.function, expr_idx))
2127+
.collect()
2128+
}
2129+
}
2130+
2131+
impl<M, F> Debug for Operation<'_, M, F, SeparateParamListSsa>
2132+
where
2133+
M: FunctionMutability,
2134+
F: FunctionForm,
2135+
{
2136+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
2137+
f.debug_struct("SeparateParamListSsa")
2138+
.field("param_exprs", &self.param_exprs())
2139+
.finish()
2140+
}
2141+
}
2142+
21142143
// TODO TEST_BIT
21152144

21162145
pub trait OperationArguments: 'static {}
@@ -2168,3 +2197,4 @@ impl OperationArguments for Assert {}
21682197
impl OperationArguments for AssertSsa {}
21692198
impl OperationArguments for ForceVersion {}
21702199
impl OperationArguments for ForceVersionSsa {}
2200+
impl OperationArguments for SeparateParamListSsa {}

0 commit comments

Comments
 (0)