diff options
Diffstat (limited to 'src/binaryen-c.cpp')
-rw-r--r-- | src/binaryen-c.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 72598d0dc..ef6c3abdd 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -1287,6 +1287,24 @@ BinaryenExpressionRef BinaryenRefEq(BinaryenModuleRef module, Builder(*(Module*)module).makeRefEq((Expression*)left, (Expression*)right)); } +BinaryenExpressionRef BinaryenTableGet(BinaryenModuleRef module, + const char* name, + BinaryenExpressionRef index, + BinaryenType type) { + return static_cast<Expression*>( + Builder(*(Module*)module) + .makeTableGet(name, (Expression*)index, Type(type))); +} + +BinaryenExpressionRef BinaryenTableSet(BinaryenModuleRef module, + const char* name, + BinaryenExpressionRef index, + BinaryenExpressionRef value) { + return static_cast<Expression*>( + Builder(*(Module*)module) + .makeTableSet(name, (Expression*)index, (Expression*)value)); +} + BinaryenExpressionRef BinaryenTry(BinaryenModuleRef module, const char* name, BinaryenExpressionRef body, @@ -1872,6 +1890,66 @@ void BinaryenGlobalSetSetValue(BinaryenExpressionRef expr, assert(valueExpr); static_cast<GlobalSet*>(expression)->value = (Expression*)valueExpr; } +// TableGet +const char* BinaryenTableGetGetTable(BinaryenExpressionRef expr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableGet>()); + return static_cast<TableGet*>(expression)->table.c_str(); +} +void BinaryenTableGetSetTable(BinaryenExpressionRef expr, const char* table) { + auto* expression = (Expression*)expr; + assert(expression->is<TableGet>()); + assert(table); + static_cast<TableGet*>(expression)->table = table; +} +BinaryenExpressionRef BinaryenTableGetGetIndex(BinaryenExpressionRef expr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableGet>()); + return static_cast<TableGet*>(expression)->index; +} +void BinaryenTableGetSetIndex(BinaryenExpressionRef expr, + BinaryenExpressionRef indexExpr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableGet>()); + assert(indexExpr); + static_cast<TableGet*>(expression)->index = (Expression*)indexExpr; +} +// TableSet +const char* BinaryenTableSetGetTable(BinaryenExpressionRef expr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + return static_cast<TableSet*>(expression)->table.c_str(); +} +void BinaryenTableSetSetTable(BinaryenExpressionRef expr, const char* table) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + assert(table); + static_cast<TableSet*>(expression)->table = table; +} +BinaryenExpressionRef BinaryenTableSetGetIndex(BinaryenExpressionRef expr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + return static_cast<TableSet*>(expression)->index; +} +void BinaryenTableSetSetIndex(BinaryenExpressionRef expr, + BinaryenExpressionRef indexExpr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + assert(indexExpr); + static_cast<TableSet*>(expression)->index = (Expression*)indexExpr; +} +BinaryenExpressionRef BinaryenTableSetGetValue(BinaryenExpressionRef expr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + return static_cast<TableSet*>(expression)->value; +} +void BinaryenTableSetSetValue(BinaryenExpressionRef expr, + BinaryenExpressionRef valueExpr) { + auto* expression = (Expression*)expr; + assert(expression->is<TableSet>()); + assert(valueExpr); + static_cast<TableSet*>(expression)->value = (Expression*)valueExpr; +} // MemoryGrow BinaryenExpressionRef BinaryenMemoryGrowGetDelta(BinaryenExpressionRef expr) { auto* expression = (Expression*)expr; @@ -4313,6 +4391,14 @@ BinaryenSideEffects BinaryenSideEffectWritesMemory(void) { return static_cast<BinaryenSideEffects>( EffectAnalyzer::SideEffects::WritesMemory); } +BinaryenSideEffects BinaryenSideEffectReadsTable(void) { + return static_cast<BinaryenSideEffects>( + EffectAnalyzer::SideEffects::ReadsTable); +} +BinaryenSideEffects BinaryenSideEffectWritesTable(void) { + return static_cast<BinaryenSideEffects>( + EffectAnalyzer::SideEffects::WritesTable); +} BinaryenSideEffects BinaryenSideEffectImplicitTrap(void) { return static_cast<BinaryenSideEffects>( EffectAnalyzer::SideEffects::ImplicitTrap); |