mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
New function GenAddExpr
git-svn-id: svn://svn.cc65.org/cc65/trunk@2664 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
ebd2336d2b
commit
742b1ffd8e
@ -1641,6 +1641,17 @@ static ExprNode* GenSectionExpr (unsigned SegNum)
|
||||
|
||||
|
||||
|
||||
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 */
|
||||
{
|
||||
@ -1648,9 +1659,8 @@ ExprNode* GenCurrentPC (void)
|
||||
|
||||
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 ());
|
||||
|
@ -69,6 +69,9 @@ ExprNode* GenLiteralExpr (long Val);
|
||||
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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user