Skip to content

Commit

Permalink
Remove duplicated code: ExtendReg
Browse files Browse the repository at this point in the history
  • Loading branch information
andorp committed Nov 15, 2018
1 parent fc6c7dc commit a376387
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
6 changes: 1 addition & 5 deletions grin/src/AbstractInterpretation/IR.hs
Expand Up @@ -48,11 +48,7 @@ data Instruction
, dstSelector :: Selector -- ^ the seleced tag must exist
, dstReg :: Reg
}
| ExtendReg -- ^ extends the destination register with the source register
{ srcReg :: Reg
, dstReg :: Reg
}
| Move
| Move -- ^ extends the destination register with the source register
{ srcReg :: Reg
, dstReg :: Reg
}
Expand Down
1 change: 0 additions & 1 deletion grin/src/AbstractInterpretation/PrettyIR.hs
Expand Up @@ -116,7 +116,6 @@ prettyInstruction mirm = \case
Store {..} -> keyword "store" <+> ppR srcReg <+> arr <+> pretty address
Update {..} -> keyword "update" <+> ppR srcReg <+> arr <+> ppR addressReg
Set {..} -> keyword "set" <+> prettyConstant mirm constant <+> arr <+> ppR dstReg
ExtendReg {..} -> keyword "extend-reg" <+> ppR srcReg <+> ppR dstReg
where
ppR = prettyReg mirm
ppS = prettySelector mirm
Expand Down
4 changes: 0 additions & 4 deletions grin/src/AbstractInterpretation/Reduce.hs
Expand Up @@ -125,10 +125,6 @@ evalInstruction = \case
let NodeItem tag itemIndex = dstSelector
register.ix (regIndex dstReg).nodeSet.nodeTagMap.at tag.non mempty.ix itemIndex %= (mappend value)

ExtendReg {..} -> do
value <- use $ register.ix (regIndex srcReg)
register . ix (regIndex dstReg) %= mappend value

Move {..} -> do
value <- use $ register.ix (regIndex srcReg)
register.ix (regIndex dstReg) %= (mappend value)
Expand Down
4 changes: 2 additions & 2 deletions grin/src/AbstractInterpretation/Sharing.hs
Expand Up @@ -64,12 +64,12 @@ sharingCodeGen s e = do
nonLinearVarReg <- getReg name
nonLinearVarLocReg <- newReg
emit $ IR.Project Locations nonLinearVarReg nonLinearVarLocReg
emit $ IR.ExtendReg nonLinearVarLocReg s
emit $ IR.Move nonLinearVarLocReg s

pointsToLocReg <- newReg
pointsToNodeReg <- newReg
emit $ IR.Fetch s pointsToNodeReg
emit $ IR.Project IR.NodeLocations pointsToNodeReg pointsToLocReg
emit $ IR.ExtendReg pointsToLocReg s
emit $ IR.Move pointsToLocReg s
where
nonLinearVars = calcNonLinearNonUpdateLocVariables e
2 changes: 0 additions & 2 deletions playground/hpt/hpt.cpp
Expand Up @@ -77,8 +77,6 @@ inline void union_value(value_t& src, value_t& dst) {
}

// data-flow instruction execution

// NOTE: Move == ExtendReg
void cmd_move(reg_t src, reg_t dst) {
union_value(_register[src], _register[dst]);
}
Expand Down

0 comments on commit a376387

Please sign in to comment.