18 #ifndef __CPUI_ARCHITECTURE__ 19 #define __CPUI_ARCHITECTURE__ 34 #include "prefersplit.hh" 36 #ifdef CPUI_STATISTICS 50 void process_cast(
const Funcdata &data);
54 void countCast(
void) { castcount += 1; }
56 void printResults(ostream &s);
71 static const uint4 majorversion;
72 static const uint4 minorversion;
73 static vector<ArchitectureCapability *> thelist;
77 const string &
getName(
void)
const {
return name; }
78 virtual void initialize(
void);
88 virtual Architecture *buildArchitecture(
const string &filename,
const string &target,ostream *estream)=0;
94 virtual bool isFileMatch(
const string &filename)
const=0;
102 virtual bool isXmlMatch(
Document *doc)
const=0;
106 static void sortCapabilities(
void);
159 #ifdef CPUI_STATISTICS 162 #ifdef OPACTION_DEBUG 163 ostream *debugstream;
168 bool hasModel(
const string &nm)
const;
169 bool highPtrPossible(
const Address &loc,int4 size)
const;
172 int4 getMinimumLanedRegisterSize(
void)
const;
173 void setDefaultModel(
const string &nm);
175 void readLoaderSymbols(
void);
176 void collectBehaviors(vector<OpBehavior *> &behave)
const;
179 void setPrintLanguage(
const string &nm);
180 void globalify(
void);
181 void restoreFlowOverride(
const Element *el);
190 virtual void printMessage(
const string &message)
const=0;
191 virtual void saveXml(ostream &s)
const;
193 virtual void nameFunction(
const Address &addr,
string &name)
const;
194 #ifdef OPACTION_DEBUG 195 void setDebugStream(ostream *s) { debugstream = s; }
196 void printDebug(
const string &message)
const { *debugstream << message << endl; }
200 int4 truncSize,
bool isreversejustified,
bool stackGrowth);
201 void addNoHighPtr(
const Range &rng);
204 virtual Scope *buildGlobalScope(
void);
243 virtual void modifySpaces(
Translate *trans)=0;
245 virtual void postSpecFile(
void);
247 virtual void resolveArchitecture(
void)=0;
250 void fillinReadOnlyFromLoader(
void);
251 void initializeSegments();
252 void cacheAddrSpaceProperties(
void);
258 void parseDynamicRule(
const Element *el);
260 void parseProtoEval(
const Element *el);
261 void parseDefaultProto(
const Element *el);
262 void parseGlobal(
const Element *el);
263 void addOtherSpace(
void);
264 void parseReadOnly(
const Element *el);
265 void parseVolatile(
const Element *el);
266 void parseReturnAddress(
const Element *el);
267 void parseIncidentalCopy(
const Element *el);
268 void parseLaneSizes(
const Element *el);
269 void parseStackPointer(
const Element *el);
270 void parseDeadcodeDelay(
const Element *el);
271 void parseFuncPtrAlign(
const Element *el);
272 void parseSpacebase(
const Element *el);
273 void parseNoHighPtr(
const Element *el);
274 void parsePreferSplit(
const Element *el);
275 void parseAggressiveTrim(
const Element *el);
293 virtual Address resolve(uintb val,int4 sz,
const Address &point,uintb &fullEncoding);
306 return !nohighptr.inRange(loc,size);
A container for parsed XML documents.
Definition: xml.hh:249
bool highPtrPossible(const Address &loc, int4 size) const
Are pointers possible to the given location?
Definition: architecture.hh:304
LoadImage * loader
Method for loading portions of binary.
Definition: architecture.hh:145
A region where processor data is stored.
Definition: space.hh:73
Classes for managing p-code injection.
int4 trim_recurse_max
How many levels to let parameter trims recurse.
Definition: architecture.hh:122
A manager for different address spaces.
Definition: translate.hh:218
Abstract extension point for building Architecture objects.
Definition: architecture.hh:70
A collection of p-code injection payloads.
Definition: pcodeinject.hh:162
An interface into a particular binary executable image.
Definition: loadimage.hh:71
The segmented address operator.
Definition: userop.hh:199
Definitions for specifying functions prototypes.
Container for data structures associated with a single function.
Definition: funcdata.hh:45
vector< AddrSpace * > inferPtrSpaces
Set of address spaces in which a pointer constant is inferable.
Definition: architecture.hh:130
int4 max_implied_ref
Maximum number of references to an implied var.
Definition: architecture.hh:123
vector< TypeOp * > inst
Registered p-code instructions.
Definition: architecture.hh:153
A manager for symbol scopes for a whole executable.
Definition: database.hh:838
ProtoModel * evalfp_current
Function proto to use when evaluating current function.
Definition: architecture.hh:141
A contiguous range of bytes in some address space.
Definition: address.hh:161
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:615
OptionDatabase * options
Options that can be configured.
Definition: architecture.hh:152
const string & getName(void) const
Get the capability identifier.
Definition: architecture.hh:77
static uint4 getMinorVersion(void)
Get minor decompiler version.
Definition: architecture.hh:108
Infrastructure for discovering code extensions to the decompiler.
virtual string getDescription(void) const
Get a string describing this architecture.
Definition: architecture.hh:184
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
int4 max_basetype_size
Maximum size of an "integer" type before creating an array type.
Definition: architecture.hh:125
Raw components of a function prototype (obtained from parsing source code)
Definition: fspec.hh:1127
ConstantPool * cpool
Deferred constant values.
Definition: architecture.hh:149
Classes for processing architecture configuration options.
Database * symboltab
Memory map of global variables and functions.
Definition: architecture.hh:136
SegmentedResolver(Architecture *g, AddrSpace *sp, SegmentOp *sop)
Definition: architecture.hh:292
An interface to a database of disassembly/decompiler context information.
Definition: globalcontext.hh:108
spacetype getType(void) const
Get the type of space.
Definition: space.hh:289
Abstract class for converting native constants to addresses.
Definition: translate.hh:140
vector< PreferSplitRecord > splitrecords
registers that we would prefer to see split for this processor
Definition: architecture.hh:155
CommentDatabase * commentdb
Comments for this architecture.
Definition: architecture.hh:148
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
VarnodeData defaultReturnAddr
Default storage location of return address (for current function)
Definition: architecture.hh:140
Action, Rule, and other associates classes supporting transformations on function data-flow...
vector< LanedRegister > lanerecords
Vector registers that have preferred lane sizes.
Definition: architecture.hh:156
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
The interface to a translation engine for a processor.
Definition: translate.hh:293
static uint4 getMajorVersion(void)
Get major decompiler version.
Definition: architecture.hh:107
int4 min_funcsymbol_size
Minimum size of a function symbol.
Definition: architecture.hh:126
A Dispatcher for possible ArchOption commands.
Definition: options.hh:63
UserOpManage userops
Specifically registered user-defined p-code ops.
Definition: architecture.hh:154
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
Manager/container for description objects (UserPcodeOp) of user defined p-code ops.
Definition: userop.hh:250
An interface to the pool of constant objects for byte-code languages.
Definition: cpool.hh:94
map< string, ProtoModel * > protoModels
Parsed forms of possible prototypes.
Definition: architecture.hh:138
ProtoModel * defaultfp
Parsed form of default prototype.
Definition: architecture.hh:139
string archid
ID string uniquely describing this architecture.
Definition: architecture.hh:119
An XML element. A node in the DOM tree.
Definition: xml.hh:150
bool readonlypropagate
true if readonly values should be treated as constants
Definition: architecture.hh:128
A complete in-memory XML document.
Definition: xml.hh:206
RangeList nohighptr
Ranges for which high-level pointers are not possible.
Definition: architecture.hh:147
vector< Rule * > extra_pool_rules
Extra rules that go in the main pool (cpu specific, experimental)
Definition: architecture.hh:134
const Translate * translate
Translation method for this binary.
Definition: architecture.hh:144
PcodeInjectLibrary * pcodeinjectlib
Pcode injection manager.
Definition: architecture.hh:146
ContextDatabase * context
Map from addresses to context settings.
Definition: architecture.hh:137
Internally managed temporary space.
Definition: space.hh:32
Classes for more detailed definitions of user defined p-code operations.
bool aggressive_ext_trim
Aggressively trim inputs that look like they are sign extended.
Definition: architecture.hh:127
string name
Identifier for this capability.
Definition: architecture.hh:75
Symbol and Scope objects for the decompiler.
int4 funcptr_align
How many bits of alignment a function ptr has.
Definition: architecture.hh:131
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
int4 max_term_duplication
Max terms duplicated without a new variable.
Definition: architecture.hh:124
ProtoModel * evalfp_called
Function proto to use when evaluating called functions.
Definition: architecture.hh:142
Classes for keeping track of local variables and reconstructing stack layout.
ActionDatabase allacts
Actions that can be applied in this architecture.
Definition: architecture.hh:157
Class for automatically registering extension points to the decompiler.
Definition: capability.hh:36
Database of root Action objects that can be used to transform a function.
Definition: action.hh:294
uint4 flowoptions
options passed to flow following engine
Definition: architecture.hh:132
A resolver for segmented architectures.
Definition: architecture.hh:283
int4 alias_block_level
Aliases blocked by 0=none, 1=struct, 2=array, 3=all.
Definition: architecture.hh:133
bool loadersymbols_parsed
True if loader symbols have been read.
Definition: architecture.hh:158
vector< PrintLanguage * > printlist
List of high-level language printers supported.
Definition: architecture.hh:151
Utilities for getting address-based context to the disassembler and decompiler.
PrintLanguage * print
Current high-level language printer.
Definition: architecture.hh:150
bool infer_pointers
True if we should infer pointers from constants that are likely addresses.
Definition: architecture.hh:129
Classes for disassembly and pcode generation.
The base class API for emitting a high-level language.
Definition: printlanguage.hh:134
TypeFactory * types
List of types for this binary.
Definition: architecture.hh:143
Describes a (register) storage location and the ways it might be split into lanes.
Definition: transform.hh:88
Data defining a specific memory location.
Definition: pcoderaw.hh:33
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:413
Classes and API for accessing a binary load image.