Commit 56f5be95 authored by Julian Kranz's avatar Julian Kranz

X86 RREIL Translator

- Started to implement the "temp list"
parent 9b28a174
......@@ -109,11 +109,30 @@ val var x = SEM_LIN_VAR x
val lin sz l = SEM_LIN {size=sz, opnd1=l}
val address sz addr = {size=sz, address=addr}
type temp_list =
TLIST_CONS of {hd:sem_var, tl:temp_list}
| TLIST_NIL
val temp_id x =
case x of
VIRT_T v: v
end
val mktemp = do
t <- query $tmp;
t' <- return (t + 1);
update @{tmp=t'};
return {id=VIRT_T t,offset=0}
#t <- query $tmp;
#t' <- return (t + 1);
#update @{tmp=t'};
#return {id=VIRT_T t,offset=0}
l <- query $tmp;
t' <- return (
case l of
TLIST_CONS x: _var (VIRT_T ((temp_id x.hd.id) + 1))
| TLIST_NIL: _var (VIRT_T 0)
end
);
l' <- return (TLIST_CONS {hd=t', tl=l});
update @{tmp=l'};
return t'
end
val mklabel = do
......
......@@ -922,8 +922,6 @@ val sem-pmcombine-opnd avx-encoded element-size combiner mover1 mover2 opnd1 opn
src2 <- read size opnd3;
dst <- lval size opnd1;
println mover1;
temp-src1 <- mktemp;
mov size temp-src1 src1;
temp-src2 <- mktemp;
......
......@@ -2256,14 +2256,14 @@ val semantics insn =
#s/\(.*\)| \(\S*\):.*/\1| \2 x: sem-undef-arity0 x/g
val translate insn =
do update@{stack=SEM_NIL,tmp=0,lab=0,mode64='1'};
do update@{stack=SEM_NIL,tmp=TLIST_NIL,lab=0,mode64='1'};
semantics insn;
stack <- query $stack;
return (rreil-stmts-rev stack)
end
val translate-bottom-up insn =
do update@{stack=SEM_NIL,tmp=0,lab=0};
do update@{stack=SEM_NIL,tmp=TLIST_NIL,lab=0};
semantics insn;
stack <- query $stack;
return stack
......@@ -2271,7 +2271,7 @@ val translate-bottom-up insn =
val transInstr = do
ic <- query $ins_count;
update@{tmp=0,ins_count=ic+1};
update@{tmp=TLIST_NIL,ins_count=ic+1};
insn <- decode;
semantics insn
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment