Package ghidra.pcodeCPort.slgh_compile
Class PcodeParser
- java.lang.Object
-
- ghidra.pcodeCPort.slgh_compile.PcodeCompile
-
- ghidra.pcodeCPort.slgh_compile.PcodeParser
-
public class PcodeParser extends PcodeCompile
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.logging.log4j.Logger
log
-
Fields inherited from class ghidra.pcodeCPort.slgh_compile.PcodeCompile
noplist
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PcodeParser(SleighBase sleigh)
PcodeParser(java.lang.String sleighSpec)
Build parser from a translator string
-
Method Summary
-
Methods inherited from class ghidra.pcodeCPort.slgh_compile.PcodeCompile
addressOf, appendOp, assignBitRange, buildTemporary, buildTruncatedVarnode, createBitRange, createLoad, createOp, createOp, createOpConst, createOpNoOut, createOpNoOut, createOpOut, createOpOutUnary, createStore, createUserOp, createUserOpNoOut, createVariadic, defineLabel, entry, fillinZero, findInternalFunction, getErrors, getWarnings, isInternalFunction, matchSize, newLocalDefinition, newLocalDefinition, newOutput, newOutput, placeLabel, propagateSize, reportError, reportWarning, resetLabelCount, setEnforceLocalKey, setResultStarVarnode, setResultVarnode
-
-
-
-
Constructor Detail
-
PcodeParser
protected PcodeParser(SleighBase sleigh)
-
PcodeParser
public PcodeParser(java.lang.String sleighSpec) throws org.jdom.JDOMException
Build parser from a translator string- Parameters:
sleighSpec
- sleigh translator spec including address-spaces and register definitions, seeSleighLanguage#buildTranslatorTag(ghidra.program.model.address.AddressFactory, long, ghidra.app.plugin.processors.sleigh.symbol.SymbolTable, boolean)
- Throws:
org.jdom.JDOMException
-
-
Method Detail
-
addOperand
public void addOperand(Location loc, java.lang.String name, int index)
Inject a symbol representing an "operand" to the pcode snippet. This puts a placeholder in the resulting template, which gets filled in with the context specific storage locations when final p-code is generated- Parameters:
name
- of operand symbolindex
- to use for the placeholder
-
addSymbol
public void addSymbol(SleighSymbol sym)
- Specified by:
addSymbol
in classPcodeCompile
-
clearSymbols
public void clearSymbols()
-
allocateTemp
public long allocateTemp()
- Specified by:
allocateTemp
in classPcodeCompile
-
createMacroUse
public VectorSTL<OpTpl> createMacroUse(Location location, MacroSymbol sym, VectorSTL<ExprTree> param)
- Specified by:
createMacroUse
in classPcodeCompile
sym
- MacroSymbol- Returns:
-
findSymbol
public SleighSymbol findSymbol(java.lang.String nm)
- Specified by:
findSymbol
in classPcodeCompile
-
getConstantSpace
public AddrSpace getConstantSpace()
- Specified by:
getConstantSpace
in classPcodeCompile
-
getDefaultSpace
public AddrSpace getDefaultSpace()
- Specified by:
getDefaultSpace
in classPcodeCompile
-
getUniqueSpace
public AddrSpace getUniqueSpace()
- Specified by:
getUniqueSpace
in classPcodeCompile
-
recordNop
public void recordNop(Location location)
- Specified by:
recordNop
in classPcodeCompile
-
stringifyTemplate
public static java.lang.String stringifyTemplate(ConstructTpl ctl)
-
compilePcode
public ConstructTpl compilePcode(java.lang.String pcodeStatements, java.lang.String srcFile, int srcLine) throws SleighException
Compile pcode semantic statements.- Parameters:
pcodeStatements
-srcFile
- source filename from which pcodeStatements came (srcLine
- line number in srcFile corresponding to pcodeStatements- Returns:
- ConstructTpl. A null may be returned or an exception thrown if parsing/compiling fails (see application log for errors).
- Throws:
SleighException
- pcode compile error
-
newSectionSymbol
public SectionSymbol newSectionSymbol(Location where, java.lang.String text)
- Specified by:
newSectionSymbol
in classPcodeCompile
-
createCrossBuild
public VectorSTL<OpTpl> createCrossBuild(Location where, VarnodeTpl v, SectionSymbol second)
- Specified by:
createCrossBuild
in classPcodeCompile
-
standaloneSection
public SectionVector standaloneSection(ConstructTpl main)
- Specified by:
standaloneSection
in classPcodeCompile
-
firstNamedSection
public SectionVector firstNamedSection(ConstructTpl main, SectionSymbol sym)
- Specified by:
firstNamedSection
in classPcodeCompile
-
nextNamedSection
public SectionVector nextNamedSection(SectionVector vec, ConstructTpl section, SectionSymbol sym)
- Specified by:
nextNamedSection
in classPcodeCompile
-
finalNamedSection
public SectionVector finalNamedSection(SectionVector vec, ConstructTpl section)
- Specified by:
finalNamedSection
in classPcodeCompile
-
-