shithub: rgbds

Download patch

ref: 361326e06c30212eeb7a2359501df522bc850ee1
parent: 0d31afaff8ad57ebcf48af8c9a27999c6a69096c
author: ISSOtm <[email protected]>
date: Sat Mar 7 13:18:57 EST 2020

Allow inlining of two simple RPN functions

--- a/include/asm/rpn.h
+++ b/include/asm/rpn.h
@@ -30,8 +30,22 @@
 /* FIXME: Should be defined in `asmy.h`, but impossible with POSIX Yacc */
 extern int32_t nPCOffset;
 
-bool rpn_isKnown(const struct Expression *expr);
-bool rpn_isSymbol(const struct Expression *expr);
+/*
+ * Determines if an expression is known at assembly time
+ */
+static inline bool rpn_isKnown(const struct Expression *expr)
+{
+	return expr->isKnown;
+}
+
+/*
+ * Determines if an expression is a symbol suitable for const diffing
+ */
+static inline bool rpn_isSymbol(const struct Expression *expr)
+{
+	return expr->isSymbol;
+}
+
 void rpn_Symbol(struct Expression *expr, char *tzSym);
 void rpn_Number(struct Expression *expr, uint32_t i);
 void rpn_LOGNOT(struct Expression *expr, const struct Expression *src);
@@ -45,7 +59,6 @@
 void rpn_BankSymbol(struct Expression *expr, char const *tzSym);
 void rpn_BankSection(struct Expression *expr, char const *tzSectionName);
 void rpn_BankSelf(struct Expression *expr);
-void rpn_Init(struct Expression *expr);
 void rpn_Free(struct Expression *expr);
 void rpn_CheckHRAM(struct Expression *expr, const struct Expression *src);
 void rpn_CheckRST(struct Expression *expr, const struct Expression *src);
--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -72,7 +72,7 @@
 /*
  * Init the RPN expression
  */
-void rpn_Init(struct Expression *expr)
+static void rpn_Init(struct Expression *expr)
 {
 	expr->reason = NULL;
 	expr->isKnown = true;
@@ -91,22 +91,6 @@
 	free(expr->tRPN);
 	free(expr->reason);
 	rpn_Init(expr);
-}
-
-/*
- * Determine if the current expression is known at assembly time
- */
-bool rpn_isKnown(const struct Expression *expr)
-{
-	return expr->isKnown;
-}
-
-/*
- * Determine if the current expression is a symbol suitable for const diffing
- */
-bool rpn_isSymbol(const struct Expression *expr)
-{
-	return expr->isSymbol;
 }
 
 /*