Package ghidra.pcode.emu.jit.gen.var
Interface LocalVarGen<V extends JitVarnodeVar>
- Type Parameters:
V- the class of p-code variable node in the use-def graph
- All Known Subinterfaces:
InputVarGen,LocalOutVarGen,SubLocalVarGen<V>
- All Known Implementing Classes:
SubInputVarGen,SubLocalOutVarGen,WholeInputVarGen,WholeLocalOutVarGen
The generator for local variable access.
These variables are presumed to be allocated as JVM locals. The generator emits
iload and istore and or depending on the assigned
type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.pcode.emu.jit.gen.var.VarGen
VarGen.BlockTransition<THIS extends JitCompiledPassage> -
Method Summary
Modifier and TypeMethodDescriptiondefault <THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genReadLegToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, int leg, Opnd.Ext ext) Emit code to read a leg of the value onto the stackdefault <THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TRef<int[]>>> genReadToArray(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Emit code to read the value into an arraydefault <THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genReadToBool(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v) Emit code to read the value onto the stack as a booleandefault <THIS extends JitCompiledPassage,N extends Emitter.Next>
Opnd.OpndEm<JitType.MpIntJitType, N> genReadToOpnd(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Emit code to read the value into local variablesdefault <THIS extends JitCompiledPassage,T extends Types.BPrim<?>, JT extends JitType.SimpleJitType<T, JT>, N extends Emitter.Next>
Emitter<Emitter.Ent<N, T>> genReadToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JT type, Opnd.Ext ext) Emit code to read the value onto the stackdefault <THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<N> genValInit(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v) Emit code to prepare any class-level items required to use this variabledefault VarHandlergetHandler(JitCodeGenerator<?> gen, V v) Get the handler for a given p-code variableMethods inherited from interface ghidra.pcode.emu.jit.gen.var.VarGen
genWriteFromArray, genWriteFromOpnd, genWriteFromStack
-
Method Details
-
getHandler
Get the handler for a given p-code variableThis is made to be overridden for the implementation of subpiece handlers.
- Parameters:
gen- the code generatorv- the value- Returns:
- the handler
-
genValInit
default <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<N> genValInit(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v) Description copied from interface:ValGenEmit code to prepare any class-level items required to use this variableFor example, if this represents a direct memory variable, then this can prepare a reference to the portion of the state involved, allowing it to access it readily.
This should be used to emit code into the constructor.
- Specified by:
genValInitin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the value- Returns:
- the emitter with ...
-
genReadToStack
default <THIS extends JitCompiledPassage,T extends Types.BPrim<?>, Emitter<Emitter.Ent<N,JT extends JitType.SimpleJitType<T, JT>, N extends Emitter.Next> T>> genReadToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JT type, Opnd.Ext ext) Description copied from interface:ValGenEmit code to read the value onto the stack- Specified by:
genReadToStackin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classT- the desired JVM typeJT- the desired p-code typeN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to apply- Returns:
- the emitter with ..., result
-
genReadToOpnd
default <THIS extends JitCompiledPassage,N extends Emitter.Next> Opnd.OpndEm<JitType.MpIntJitType,N> genReadToOpnd(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Description copied from interface:ValGenEmit code to read the value into local variablesNOTE: In some cases, this may not emit any code at all. It may simple compose the operand from locals already allocated for a variable being "read."
- Specified by:
genReadToOpndin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to applyscope- a scope for generated temporary variables- Returns:
- the operand and emitter with ...
-
genReadLegToStack
default <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadLegToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, int leg, Opnd.Ext ext) Description copied from interface:ValGenEmit code to read a leg of the value onto the stack- Specified by:
genReadLegToStackin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeleg- the leg index, 0 being the least significantext- the kind of extension to apply- Returns:
- the emitter with ..., result
-
genReadToArray
default <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<int[]>>> genReadToArray(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Description copied from interface:ValGenEmit code to read the value into an array- Specified by:
genReadToArrayin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to applyscope- a scope for generated temporary variablesslack- the number of extra (more significant) elements to allocate in the array- Returns:
- the operand and emitter with ..., arrayref
-
genReadToBool
default <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadToBool(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v) Description copied from interface:ValGenEmit code to read the value onto the stack as a boolean- Specified by:
genReadToBoolin interfaceValGen<V extends JitVarnodeVar>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the value- Returns:
- the emitter with ..., result
-