Handy methods for generating code.
|
static GlobalVariable * | generateAllocationForSemaphore (Module *module, string identifier) |
| Generates code that allocates a dispatch_semaphore_t.
|
|
static void | generateInitializationForSemaphore (Module *module, BasicBlock *block, GlobalVariable *semaphoreVariable, int initialValue=1) |
| Generates code that initializes a dispatch_semaphore_t.
|
|
static void | generateWaitForSemaphore (Module *module, BasicBlock *block, GlobalVariable *semaphoreVariable, dispatch_time_t timeout=DISPATCH_TIME_FOREVER) |
| Generates code that waits for and claims a dispatch_semaphore_t.
|
|
static void | generateSignalForSemaphore (Module *module, BasicBlock *block, GlobalVariable *semaphoreVariable) |
| Generates code that signals a dispatch_semaphore_t.
|
|
static GlobalVariable * | generateAllocationForDispatchGroup (Module *module, string identifier) |
| Generates code that allocates a dispatch_group_t.
|
|
static void | generateInitializationForDispatchGroup (Module *module, BasicBlock *block, GlobalVariable *dispatchGroupVariable) |
| Generates code that initializes a dispatch_group_t.
|
|
static void | generateSubmissionForDispatchGroup (Module *module, BasicBlock *block, GlobalVariable *dispatchGroupVariable, Function *workerFunction, Value *contextValue) |
| Generates code that submits a function for asynchronous execution on the global dispatch queue and associates the function with a dispatch_group_t.
|
|
static void | generateWaitForDispatchGroup (Module *module, BasicBlock *block, GlobalVariable *dispatchGroupVariable, dispatch_time_t timeout=DISPATCH_TIME_FOREVER) |
| Generates code that waits on a dispatch_group_t.
|
|
static GlobalVariable * | generateAllocationForDispatchQueue (Module *module, string identifier) |
| Generates code that allocates a dispatch_queue_t.
|
|
static void | generateInitializationForDispatchQueue (Module *module, BasicBlock *block, GlobalVariable *dispatchQueueVariable) |
| Generates code that initializes a dispatch_queue_t.
|
|
static void | generateSubmissionToDispatchQueue (Module *module, BasicBlock *block, GlobalVariable *dispatchQueueVariable, Function *workerFunction, Value *contextValue) |
| Generates code that submits a function for asynchronous execution on a dispatch queue.
|
|
static void | generateFinalizationForDispatchObject (Module *module, BasicBlock *block, GlobalVariable *dispatchObjectVariable) |
| Generates code that finalizes a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.).
|
|
static Value * | generatePointerToValue (BasicBlock *block, Value *value) |
| Generates code that creates a pointer to value (on the stack), and returns the pointer.
|
|
static Constant * | generatePointerToConstantString (Module *module, string stringValue, string globalVariableName="") |
| Generates code that creates a global string variable, initialized to the given value, and returns a pointer to it.
|
|
static Constant * | generatePointerToConstantArrayOfStrings (Module *module, vector< string > stringValues) |
| Generates code that creates a global array-of-strings variable, initialized to the given values, and returns a pointer to it.
|
|
static void | generateStringMatchingCode (Module *module, Function *function, BasicBlock *initialBlock, BasicBlock *finalBlock, Value *inputStringValue, map< string, pair< BasicBlock *, BasicBlock * > > blocksForString) |
| Generates a series of if-else statements for testing if an input string is equal to any of a set of constant strings, and executing the corresponding block of code if it is.
|
|
static Value * | generateFormattedString (Module *module, BasicBlock *block, string formatString, vector< Value * > replacementValues) |
| Generates code that allocates a buffer to hold the composite string, then calls snprintf to combine the format string and replacement values into the composite string.
|
|
static Value * | generateStringConcatenation (Module *module, BasicBlock *block, vector< Value * > stringsToConcatenate) |
| Generates code that allocates a buffer to hold the composite string, then concatenates each member of stringsToConcatenate into the composite string.
|
|
static Value * | generateMemoryAllocation (Module *module, BasicBlock *block, Type *elementType, Value *elementCountValue) |
| Generates code that dynamically allocates memory for an array.
|
|
static Value * | generateBitCast (BasicBlock *block, Value *valueToCast, Type *typeToCastTo) |
| Generates code to cast the value to the desired type (if it doesn't already have that type).
|
|
static void | generateRetainCall (Module *module, BasicBlock *block, Value *argument) |
| Generates any code needed to retain argument .
|
|
static void | generateReleaseCall (Module *module, BasicBlock *block, Value *argument) |
| Generates any code needed to release argument .
|
|
static Value * | generateSerialization (Module *module, BasicBlock *block, Value *valueToSerialize) |
| Generates code that creates a string representation of the given value.
|
|
static void | generateUnserialization (Module *module, BasicBlock *block, Value *stringToUnserialize, GlobalVariable *destination) |
| Generates code that creates a value of the given type from the given string representation, and stores it in the destination variable.
|
|
static ICmpInst * | generateIsPausedComparison (Module *module, BasicBlock *block) |
| Generates code that gets the value of the isPaused global variable as a comparison value.
|
|
static void | generatePrint (Module *module, BasicBlock *block, string stringToPrint) |
| Generates code that prints a string.
|
|
static void | generatePrint (Module *module, BasicBlock *block, string formatString, Value *value) |
| Generates code that prints a value.
|
|
static Type * | getParameterTypeBeforeLowering (Function *function, int parameterIndex, Module *module, string typeName) |
| Guesses the type that the function parameter had in the source code, before it was possibly converted ("lowered") to some other type by Clang/LLVM when the module was compiled.
|
|
static Value * | convertArgumentToParameterType (Value *argument, Function *function, int parameterIndex, Value **secondArgument, Module *module, BasicBlock *block) |
| If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s).
|
|
static Value * | convertReturnValueToExpectedType (Value *returnValue, Type *expectedType, BasicBlock *block) |
| If needed, generates code to convert the return value from its (possibly "lowered") type to the expected type.
|
|
static Value * | callFunctionWithStructReturn (Function *function, vector< Value * > args, BasicBlock *block) |
| Generates a call to the function, whose first parameter is assumed to have LLVM's sret attribute.
|
|
static bool | isFunctionReturningStructViaParameter (Function *function) |
| Returns true if the function's first parameter has LLVM's sret attribute, or in other words, LLVM has transformed struct MyType foo(...) to void foo(struct MyType *, ...) .
|
|
static StructType * | getDispatchObjectType (Module *module) |
|
static Function * | getStrcatFunction (Module *module) |
| Returns a Function reference, generating code for the declaration if needed.
|
|
static Function * | getStrcmpFunction (Module *module) |
|
static Function * | getStrlenFunction (Module *module) |
|
static Function * | getSnprintfFunction (Module *module) |
|
static Function * | getSscanfFunction (Module *module) |
|
static Function * | getPrintfFunction (Module *module) |
|
static Function * | getPutsFunction (Module *module) |
|
static Function * | getMallocFunction (Module *module) |
|
static Function * | getFreeFunction (Module *module) |
|
static Function * | getCallbackStartFunction (Module *module) |
|
static Function * | getCallbackStopFunction (Module *module) |
|
static Function * | getInitializeReferenceCountsFunction (Module *module) |
|
static Function * | getFinalizeReferenceCountsFunction (Module *module) |
|
static Function * | getGetOutputPortValueFunction (Module *module) |
|
static Function * | getGetOutputPortValueThreadUnsafeFunction (Module *module) |
|
static Function * | getSetInputPortValueFunction (Module *module) |
|
static Function * | getSendNodeExecutionStartedFunction (Module *module) |
|
static Function * | getSendNodeExecutionFinishedFunction (Module *module) |
|
static Function * | getSendOutputPortValueChangedFunction (Module *module) |
|
static Function * | getSerializeFunction (Module *module) |
|
static Function * | getUnserializeFunction (Module *module) |
|
static Function * | getOpenGraphvizGraphFunction (Module *module) |
|
static Function * | getCloseGraphvizGraphFunction (Module *module) |
|
static Function * | getGetConstantValueFromGraphvizFunction (Module *module) |
|
static Function * | getIsNodeInBothCompositionsFunction (Module *module) |
|