+ExprNode* GenAddExpr (ExprNode* Left, ExprNode* Right)
+/* Generate an addition from the two operands */
+{
+ ExprNode* Root = NewExprNode (EXPR_PLUS);
+ Root->Left = Left;
+ Root->Right = Right;
+ return Root;
+}
+
+
+
ExprNode* GenCurrentPC (void)
/* Return the current program counter as expression */
{
if (RelocMode) {
/* Create SegmentBase + Offset */
- Root = NewExprNode (EXPR_PLUS);
- Root->Left = GenSectionExpr (GetCurrentSegNum ());
- Root->Right = GenLiteralExpr (GetPC ());
+ Root = GenAddExpr (GenSectionExpr (GetCurrentSegNum ()),
+ GenLiteralExpr (GetPC ()));
} else {
/* Absolute mode, just return PC value */
Root = GenLiteralExpr (GetPC ());
ExprNode* GenSymExpr (struct SymEntry* Sym);
/* Return an expression node that encodes the given symbol */
+ExprNode* GenAddExpr (ExprNode* Left, ExprNode* Right);
+/* Generate an addition from the two operands */
+
ExprNode* GenCurrentPC (void);
/* Return the current program counter as expression */