|
| CHLLWriter (llvm::raw_ostream &out, const std::string &outputFormat="") |
| Constructs a new C writer. More...
|
|
virtual std::string | getCommentPrefix () override |
| Returns the prefix of comments in the given language. More...
|
|
virtual bool | emitFileHeader () override |
| Emits the file header. More...
|
|
virtual bool | emitGlobalVariables () override |
| Emits all global variables in the module. More...
|
|
virtual bool | emitFunctionPrototypesHeader () override |
| Emits the header of the function prototypes block. More...
|
|
virtual bool | emitFunctionPrototypes () override |
| Emits function prototypes. More...
|
|
virtual bool | emitExternalFunction (ShPtr< Function > func) override |
| Emits the given linked function, including the ending newline. More...
|
|
virtual bool | emitTargetCode (ShPtr< Module > module) override |
| Emits the code from the given module. More...
|
|
bool | shouldEmitFunctionPrototypesHeader () const |
| Returns true if we should emit the Function Prototypes header, false otherwise. More...
|
|
bool | emitFunctionPrototypes (const FuncSet &funcs) |
| Emits prototypes of the given functions. More...
|
|
bool | emitStandardFunctionPrototypes () |
| Emits standard function prototypes. More...
|
|
bool | emitFunctionPrototypesForNonLibraryFuncs () |
| Emits prototypes for functions which do not have any associated header file. More...
|
|
bool | emitFunctionPrototype (ShPtr< Function > func) |
| Emits a prototype of the given function, including the ending newline. More...
|
|
void | emitFunctionDefinition (ShPtr< Function > func) |
| Emits the given function definition. More...
|
|
void | emitFunctionHeader (ShPtr< Function > func) |
| Emits the header of the given function. More...
|
|
void | emitHeaderOfFuncReturningPointerToFunc (ShPtr< Function > func) |
| A specialization of emitFunctionHeader() for functions returning a pointer to a function. More...
|
|
void | emitHeaderOfFuncReturningPointerToArray (ShPtr< Function > func) |
| A specialization of emitFunctionHeader() for functions returning a pointer to an array. More...
|
|
void | emitFunctionParameters (ShPtr< Function > func) |
| Emits the parameters of the given function. More...
|
|
void | emitVarWithType (ShPtr< Variable > var) |
| Emits the given variable alongside with its type. More...
|
|
void | emitPointerToFunc (ShPtr< PointerType > pointerToFuncType, ShPtr< Variable > var=nullptr) |
| Emits a pointer to the given function, possibly with the given variable. More...
|
|
void | emitArrayOfFuncPointers (ShPtr< ArrayType > arrayType, ShPtr< Variable > var=nullptr) |
| Emits the given array of function pointers, possibly with the given variable. More...
|
|
void | emitPointerToArray (ShPtr< PointerType > pointerToArrayType, ShPtr< Variable > var=nullptr) |
| Emits a pointer to the given array, possibly with the given variable. More...
|
|
void | emitArrayDimensions (ShPtr< ArrayType > arrayType) |
| Emits the dimensions of the given array. More...
|
|
void | emitArrayDimension (std::size_t size) |
| Emits the given array dimension. More...
|
|
void | emitInitializedConstArray (ShPtr< ConstArray > array) |
| Emits the given initialized array. More...
|
|
void | emitInitializedConstArrayInline (ShPtr< ConstArray > array) |
| Emits the given array inline. More...
|
|
void | emitInitializedConstArrayInStructuredWay (ShPtr< ConstArray > array) |
| Emits the given array in a structured way (may span over multiple lines). More...
|
|
void | emitUninitializedConstArray (ShPtr< ConstArray > array) |
| Emits the given uninitialized array. More...
|
|
void | emitTypeOfElementsInArray (ShPtr< ArrayType > arrayType) |
| Emits the type of elements in the given array. More...
|
|
void | emitCastInStandardWay (ShPtr< CastExpr > expr) |
| Emits the given cast in the standard way. More...
|
|
void | emitStarsBeforePointedValue (ShPtr< PointerType > ptrType) |
| Emits '*'s before the pointed value (there can be more than one). More...
|
|
void | emitFunctionParameters (ShPtr< FunctionType > funcType) |
| Emits parameters of the given function. More...
|
|
void | emitReturnType (ShPtr< FunctionType > funcType) |
| Emits the return type of the given function. More...
|
|
void | emitNameOfVarIfExists (ShPtr< Variable > var) |
| Emits the name of var if it is a non-null pointer. More...
|
|
void | emitAssignment (ShPtr< Expression > lhs, ShPtr< Expression > rhs) |
| Emits the given assignment (without leading or trailing whitespace). More...
|
|
void | emitInitVarDefWhenNeeded (ShPtr< UForLoopStmt > loop) |
| Emits the definition of the initialization variable of the given loop when it is needed. More...
|
|
void | emitConstStruct (ShPtr< ConstStruct > constant, bool emitCast=true) |
| Emits the given structure literal. More...
|
|
void | emitStructDeclaration (ShPtr< StructType > structType, bool emitInline=false) |
| Emits a declaration of the given structure. More...
|
|
void | emitBlock (ShPtr< Statement > stmt) |
| Recursively emits the given block. More...
|
|
void | emitGlobalDirectives (ShPtr< Function > func) |
|
void | emitDebugComment (std::string comment, bool indent=true) |
| Emits the given debug comment. More...
|
|
void | emitGotoLabelIfNeeded (ShPtr< Statement > stmt) |
| Emits a label of stmt if it is needed. More...
|
|
std::string | getConstFloatSuffixIfNeeded (ShPtr< ConstFloat > constant) |
|
std::string | genNameForUnnamedStruct (const StructTypeVector &usedStructTypes) |
| Generates a new name for an unnamed structure. More...
|
|
|
virtual void | visit (ShPtr< GlobalVarDef > varDef) override |
|
virtual void | visit (ShPtr< Function > func) override |
|
virtual void | visit (ShPtr< Variable > var) override |
|
virtual void | visit (ShPtr< AddressOpExpr > expr) override |
|
virtual void | visit (ShPtr< AssignOpExpr > expr) override |
|
virtual void | visit (ShPtr< ArrayIndexOpExpr > expr) override |
|
virtual void | visit (ShPtr< StructIndexOpExpr > expr) override |
|
virtual void | visit (ShPtr< DerefOpExpr > expr) override |
|
virtual void | visit (ShPtr< NotOpExpr > expr) override |
|
virtual void | visit (ShPtr< NegOpExpr > expr) override |
|
virtual void | visit (ShPtr< EqOpExpr > expr) override |
|
virtual void | visit (ShPtr< NeqOpExpr > expr) override |
|
virtual void | visit (ShPtr< LtEqOpExpr > expr) override |
|
virtual void | visit (ShPtr< GtEqOpExpr > expr) override |
|
virtual void | visit (ShPtr< LtOpExpr > expr) override |
|
virtual void | visit (ShPtr< GtOpExpr > expr) override |
|
virtual void | visit (ShPtr< AddOpExpr > expr) override |
|
virtual void | visit (ShPtr< SubOpExpr > expr) override |
|
virtual void | visit (ShPtr< MulOpExpr > expr) override |
|
virtual void | visit (ShPtr< ModOpExpr > expr) override |
|
virtual void | visit (ShPtr< DivOpExpr > expr) override |
|
virtual void | visit (ShPtr< AndOpExpr > expr) override |
|
virtual void | visit (ShPtr< OrOpExpr > expr) override |
|
virtual void | visit (ShPtr< BitAndOpExpr > expr) override |
|
virtual void | visit (ShPtr< BitOrOpExpr > expr) override |
|
virtual void | visit (ShPtr< BitXorOpExpr > expr) override |
|
virtual void | visit (ShPtr< BitShlOpExpr > expr) override |
|
virtual void | visit (ShPtr< BitShrOpExpr > expr) override |
|
virtual void | visit (ShPtr< TernaryOpExpr > expr) override |
|
virtual void | visit (ShPtr< CallExpr > expr) override |
|
virtual void | visit (ShPtr< CommaOpExpr > expr) override |
|
virtual void | visit (ShPtr< ConstBool > constant) override |
|
virtual void | visit (ShPtr< ConstFloat > constant) override |
|
virtual void | visit (ShPtr< ConstInt > constant) override |
|
virtual void | visit (ShPtr< ConstNullPointer > constant) override |
|
virtual void | visit (ShPtr< ConstString > constant) override |
|
virtual void | visit (ShPtr< ConstArray > constant) override |
|
virtual void | visit (ShPtr< ConstStruct > constant) override |
|
virtual void | visit (ShPtr< ConstSymbol > constant) override |
|
virtual void | visit (ShPtr< AssignStmt > stmt) override |
|
virtual void | visit (ShPtr< VarDefStmt > stmt) override |
|
virtual void | visit (ShPtr< CallStmt > stmt) override |
|
virtual void | visit (ShPtr< ReturnStmt > stmt) override |
|
virtual void | visit (ShPtr< EmptyStmt > stmt) override |
|
virtual void | visit (ShPtr< IfStmt > stmt) override |
|
virtual void | visit (ShPtr< SwitchStmt > stmt) override |
|
virtual void | visit (ShPtr< WhileLoopStmt > stmt) override |
|
virtual void | visit (ShPtr< ForLoopStmt > stmt) override |
|
virtual void | visit (ShPtr< UForLoopStmt > stmt) override |
|
virtual void | visit (ShPtr< BreakStmt > stmt) override |
|
virtual void | visit (ShPtr< ContinueStmt > stmt) override |
|
virtual void | visit (ShPtr< GotoStmt > stmt) override |
|
virtual void | visit (ShPtr< UnreachableStmt > stmt) override |
|
virtual void | visit (ShPtr< FloatType > type) override |
|
virtual void | visit (ShPtr< IntType > type) override |
|
virtual void | visit (ShPtr< PointerType > type) override |
|
virtual void | visit (ShPtr< StringType > type) override |
|
virtual void | visit (ShPtr< ArrayType > type) override |
|
virtual void | visit (ShPtr< StructType > type) override |
|
virtual void | visit (ShPtr< FunctionType > type) override |
|
virtual void | visit (ShPtr< VoidType > type) override |
|
virtual void | visit (ShPtr< UnknownType > type) override |
|
virtual void | visit (ShPtr< BitCastExpr > expr) override |
|
virtual void | visit (ShPtr< ExtCastExpr > expr) override |
|
virtual void | visit (ShPtr< TruncCastExpr > expr) override |
|
virtual void | visit (ShPtr< FPToIntCastExpr > expr) override |
|
virtual void | visit (ShPtr< IntToFPCastExpr > expr) override |
|
virtual void | visit (ShPtr< IntToPtrCastExpr > expr) override |
|
virtual void | visit (ShPtr< PtrToIntCastExpr > expr) override |
|
|
| HLLWriter (llvm::raw_ostream &out, const std::string &outputFormat="") |
| Constructs a new writer. More...
|
|
void | sortFuncsForEmission (FuncVector &funcs) |
| Sort the given list of functions for emission. More...
|
|
bool | tryEmitVarInfoInComment (ShPtr< Variable > var, ShPtr< Statement > stmt=nullptr) |
| Tries to emit a comment with the information about the given variable. More...
|
|
bool | tryEmitVarAddressInComment (ShPtr< Variable > var) |
| Tries to emit the address of the given variable into a comment. More...
|
|
bool | shouldBeEmittedInHexa (ShPtr< ConstInt > constant) const |
| Returns true if the given constant should be emitted in hexa, false otherwise. More...
|
|
bool | shouldBeEmittedInStructuredWay (ShPtr< ConstArray > array) const |
| Checks whether the given array should be emitted in a structured way. More...
|
|
bool | shouldBeEmittedInStructuredWay (ShPtr< ConstStruct > structure) const |
| Checks whether the given structure should be emitted in a structured way. More...
|
|
std::string | getGotoLabel (ShPtr< Statement > stmt) |
| Returns the goto label for the given statement. More...
|
|
void | increaseIndentLevel () |
| Increases the indentation level. More...
|
|
void | decreaseIndentLevel () |
| Decreases the indentation level. More...
|
|
std::string | getCurrentIndent () const |
| Returns the current indentation (to indent the current block). More...
|
|
std::string | getSingleLevelIndent () const |
| Returns the single level of indentation. More...
|
|
std::string | getIndentForGotoLabel () const |
| Returns indentation for a goto label. More...
|
|
virtual bool | emitGlobalVariablesHeader () |
| Emits the header of the global variables block. More...
|
|
virtual bool | emitGlobalVariable (ShPtr< GlobalVarDef > varDef) |
| Emits the given global variable, including the ending newline. More...
|
|
virtual bool | emitClassesHeader () |
| Emits the header of the classes block. More...
|
|
virtual bool | emitClasses () |
| Emits classes. More...
|
|
virtual bool | emitClass (const std::string &className) |
| Emits the class with the given name. More...
|
|
virtual bool | emitFunctionsHeader () |
| Emits the header of the functions block. More...
|
|
virtual bool | emitFunctions () |
| Emits functions in the module. More...
|
|
virtual bool | emitFunction (ShPtr< Function > func) |
| Emits the given function, including the ending newline. More...
|
|
virtual bool | emitStaticallyLinkedFunctionsHeader () |
| Emits the header of the statically linked functions block. More...
|
|
virtual bool | emitStaticallyLinkedFunctions () |
| Emits statically linked functions in the module. More...
|
|
virtual bool | emitDynamicallyLinkedFunctionsHeader () |
| Emits the header of the dynamically linked functions block. More...
|
|
virtual bool | emitDynamicallyLinkedFunctions () |
| Emits dynamically linked functions in the module. More...
|
|
virtual bool | emitSyscallFunctionsHeader () |
| Emits the header of the syscall functions block. More...
|
|
virtual bool | emitSyscallFunctions () |
| Emits syscall functions in the module. More...
|
|
virtual bool | emitInstructionIdiomFunctionsHeader () |
| Emits the header of the instruction-idiom functions block. More...
|
|
virtual bool | emitInstructionIdiomFunctions () |
| Emits instruction-idiom functions in the module. More...
|
|
virtual bool | emitExternalFunctions (const FuncSet &funcs) |
| Emits the given external functions. More...
|
|
virtual bool | emitMetaInfoHeader () |
| Emits the header of the meta-information block. More...
|
|
virtual bool | emitMetaInfo () |
| Emits meta-information. More...
|
|
virtual void | emitExprWithBracketsIfNeeded (ShPtr< Expression > expr) |
| Emits the given expression with brackets around it (if needed). More...
|
|
void | emitUnaryOpExpr (const std::string &opRepr, ShPtr< UnaryOpExpr > expr) |
| Emits the given unary expression. More...
|
|
void | emitBinaryOpExpr (const std::string &opRepr, ShPtr< BinaryOpExpr > expr, bool spaceBefore=true, bool spaceAfter=true) |
| Emits the given binary expression. More...
|
|
bool | emitDetectedCryptoPatternForGlobalVarIfAvailable (ShPtr< Variable > var) |
| Emits a description of the detected cryptographic pattern for the given global variable. More...
|
|
bool | emitModuleNameForFuncIfAvailable (ShPtr< Function > func) |
| If there is a module name from debug information assigned to the function, emit it in a comment. More...
|
|
bool | emitAddressRangeForFuncIfAvailable (ShPtr< Function > func) |
| Emits address range for the given function (if available). More...
|
|
bool | emitLineRangeForFuncIfAvailable (ShPtr< Function > func) |
| Emits line range for the given function (if available). More...
|
|
bool | emitWrapperInfoForFuncIfAvailable (ShPtr< Function > func) |
| Emits wrapper-related information for the given function (if available). More...
|
|
bool | emitClassInfoIfAvailable (ShPtr< Function > func) |
| Emits class-related information for the given function (if available). More...
|
|
bool | emitDemangledNameIfAvailable (ShPtr< Function > func) |
| Emits demangled name of the given function (if available). More...
|
|
bool | emitCommentIfAvailable (ShPtr< Function > func) |
| Emits a comment of the given function (if available). More...
|
|
bool | emitDetectedCryptoPatternsForFuncIfAvailable (ShPtr< Function > func) |
| Emits a list of detected cryptographic patterns for the given function (if available). More...
|
|
void | emitSectionHeader (const std::string §ionName) |
| Emits a section header comment. More...
|
|
template<class ContainerType > |
void | emitSequenceWithAccept (const ContainerType &seq, const std::string &space=" ", bool newline=false) |
| Emits the given sequence seq by calling accept on every value. Separator = ','. More...
|
|
virtual std::string | getConstNullPointerTextRepr () const |
| Returns the textual representation of a null pointer. More...
|
|
| Visitor ()=default |
|
ShPtr< Module > | module |
| The module to be written. More...
|
|
UPtr< OutputManager > | out |
| Output where the resulting code will be generated. More...
|
|
ShPtr< BracketManager > | bracketsManager |
| Recognizes which brackets around expressions are needed. More...
|
|
bool | emitConstantsInStructuredWay |
|
bool | optionEmitDebugComments |
| Emit also debug comments? More...
|
|
bool | optionKeepAllBrackets |
| Keep all (even redundant) brackets? More...
|
|
bool | optionEmitTimeVaryingInfo |
| Emit time-varying information, like dates? More...
|
|
bool | optionUseCompoundOperators |
| Use compound operators (like += ) instead of assignments? More...
|
|
ShPtr< Function > | currFunc |
| The currently emitted function definition (if any). More...
|
|
std::size_t | currFuncGotoLabelCounter |
| Counter for goto labels for the current function. More...
|
|
A HLL writer for the C language (C99).
Use create() to create instances. Instances of this class have reference object semantics.