⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mddecl.java

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 JAVA
字号:
package CatDecaf.IR; // Java Package generated by the BNF Converter.
import parser.*;
import CatDecaf.Utilities.Debugger.*;

public class MdDecl  implements CatDecaf.Utilities.Visitable
{
  public Typ typ_;
  public Identifier identifier_;
  public MdParaList mdParaList_;
  public Block block_;
  public int localSize_;
  public int paramSize_;  

  
/*
  public MdDecl(Typ p1, Identifier p2, MdParaList p3, Block p4) 
  	{ typ_ = p1; identifier_ = p2; mdParaList_ = p3; block_ = p4;}
*/
    public MdDecl(Typ p1, Identifier p2, MdParaList p3, Block p4, int p5, int p6) 
  	{ typ_ = p1; identifier_ = p2; mdParaList_ = p3; block_ = p4;
	  localSize_ = p5;
	  paramSize_ = p6;
    	}

    public int getReserveSize(){
    	int spaceForAutomaticVars = localSize_;
    	int spaceForParamPastSixth = 0 ; //(paramSize_/4>6 ? paramSize_/4-6 :0)*4;
    	int spaceForCalleeRegister = 6*4;
    	int spaceForHiddenParam = 1*4;
    	int spaceFor16Register = 16*4;

    	int totalSize 	= spaceForAutomaticVars 
    		 		+ spaceForParamPastSixth 
    		 		+ spaceForCalleeRegister
    		 		+ spaceForHiddenParam
    		 		+ spaceFor16Register+4;

	if ((totalSize % 8)!=0) totalSize +=4;
    	
    	
	return totalSize;
    }

  public void accept(CatDecaf.Utilities.Visitor v) { v.visit(this); }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -