diff options
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r-- | src/binaryen-c.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/binaryen-c.h b/src/binaryen-c.h index c7c1d7292..889b5ba45 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -72,6 +72,10 @@ BinaryenType BinaryenInt64(void); BinaryenType BinaryenFloat32(void); BinaryenType BinaryenFloat64(void); +// Not a real type. Used as the last parameter to BinaryenBlock to let +// the API figure out the type instead of providing one. +BinaryenType BinaryenUndefined(void); + // Modules // // Modules contain lists of functions, imports, exports, function types. The @@ -261,8 +265,11 @@ BinaryenOp BinaryenHasFeature(void); typedef void* BinaryenExpressionRef; -// Block: name can be NULL -BinaryenExpressionRef BinaryenBlock(BinaryenModuleRef module, const char* name, BinaryenExpressionRef* children, BinaryenIndex numChildren); +// Block: name can be NULL. Specifying BinaryenUndefined() as the 'type' +// parameter indicates that the block's type shall be figured out +// automatically instead of explicitly providing it. This conforms +// to the behavior before the 'type' parameter has been introduced. +BinaryenExpressionRef BinaryenBlock(BinaryenModuleRef module, const char* name, BinaryenExpressionRef* children, BinaryenIndex numChildren, BinaryenType type); // If: ifFalse can be NULL BinaryenExpressionRef BinaryenIf(BinaryenModuleRef module, BinaryenExpressionRef condition, BinaryenExpressionRef ifTrue, BinaryenExpressionRef ifFalse); BinaryenExpressionRef BinaryenLoop(BinaryenModuleRef module, const char* in, BinaryenExpressionRef body); @@ -332,12 +339,14 @@ BinaryenFunctionRef BinaryenAddFunction(BinaryenModuleRef module, const char* na typedef void* BinaryenImportRef; BinaryenImportRef BinaryenAddImport(BinaryenModuleRef module, const char* internalName, const char* externalModuleName, const char *externalBaseName, BinaryenFunctionTypeRef type); +void BinaryenRemoveImport(BinaryenModuleRef module, const char* internalName); // Exports typedef void* BinaryenExportRef; BinaryenExportRef BinaryenAddExport(BinaryenModuleRef module, const char* internalName, const char* externalName); +void BinaryenRemoveExport(BinaryenModuleRef module, const char* externalName); // Function table. One per module @@ -432,6 +441,17 @@ BinaryenExpressionRef RelooperRenderAndDispose(RelooperRef relooper, RelooperBlo // TODO: compile-time option to enable/disable this feature entirely at build time? void BinaryenSetAPITracing(int on); +// +// ========= Utilities ========= +// + +// Note that this function has been added because there is no better alternative +// currently and is scheduled for removal once there is one. It takes the same set +// of parameters as BinaryenAddFunctionType but instead of adding a new function +// signature, it returns a pointer to the existing signature or NULL if there is no +// such signature yet. +BinaryenFunctionTypeRef BinaryenGetFunctionTypeBySignature(BinaryenModuleRef module, BinaryenType result, BinaryenType* paramTypes, BinaryenIndex numParams); + #ifdef __cplusplus } // extern "C" #endif |