Exemplo n.º 1
0
void CAddressGenerationVisitor::Visit(CVariable &AStmt)
{
	if (AStmt.GetSymbol()->GetGlobal()) {
		Asm.Add(PUSH, "$" + AStmt.GetName());
	} else {
		Asm.Add(LEA, mem(AStmt.GetSymbol()->GetOffset(), EBP), EAX);
		Asm.Add(PUSH, EAX);
	}
}
Exemplo n.º 2
0
void CCodeGenerationVisitor::Visit(CVariable &AStmt)
{
	if (AStmt.GetSymbol()->GetType()->IsArray()) {
		AStmt.Accept(Addr);
	} else {
		if (AStmt.GetSymbol()->GetGlobal()) {
			Asm.Add(PUSH, AStmt.GetSymbol()->GetName());
		} else {
			Asm.Add(PUSH, mem(AStmt.GetSymbol()->GetOffset(), EBP));
		}
	}
}