99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

CS 2210編程代寫、Java程序語言代做

時間:2023-11-27  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



CS 2210 Programming Project (Part IV)
Code Generation
This project is intended to give you experience in writing a code generator as well as bring together
the various issues of code generation discussed in the text and in class.
Due date
The assignment is due December 9th, 2023, 11:59pm. This is the hard deadline and no extensions will be given for this project.
Project Summary
Your task is to write a code generator, the final phase of your compiler. It produces (target)
assembly code for the MIPS R2000 architecture. It takes as input the augmented AST and symbol
table produced by the previous phases of your compiler. The generated code will be executed using
SPIM S20, a simulator for the MIPS R2000.
Code generation will consist of assigning memory addresses for each variable used in the MINIJAVA program and translating subtrees of the AST (intermediate language representation) into
sequences of assembly instructions that perform the same task.
Code Generation
This is the only phase of your compiler which is machine dependent. Examples of assembly code
programs will be provided on the class webpage.
The important/interesting issues in generating code for MINI-JAVA are discussed in the following paragraphs. Please refer to chapter 7, 8 and class notes for further details on these issues,
You can make the following assumptions to simplify the project.
ˆ Code is generated for the intermediate instructions on a statement-by-statement basis without
taking into account the context of an intermediate instruction
ˆ code is generated for the intermediate instructions in the order that they occur within the
intermediate instruction sequence.
ˆ You may take advantage of any special instruction of the machine when choosing target
instructions for a given intermediate instruction.
ˆ You do not have to any fancy register allocation or optimization on your target code.
1
Computing Memory Addresses
Since address information has not been computed and entered into the symbol table by earlier
phases, the first task of the code generator is to compute the offsets of each variable name (both
global and local); that is, the address of each local data object and formal parameter within the
activation record for the block in which they are declared. This can be done by initializing a
variable offset at the start of each declaration section, and as each declaration is processed, the
current value of offset is entered as an attribute of that symbol, and offset is then incremented
by the total width of that data object (depending on its type).
The program execution begins with a method called main() being called. Since the language
has no way to initiate classes, all classes are instantiated when program execution begins. Thus,
all storage for all classes is allocated globally. The offsets of variables within classes should be
computed and stored as an attribute of the variable name, typically relative to the start of the class
or can just be relative to the start of the global storage.
For simplicity, declarations within a method donot contain any objects whose types are classes.
That is, local variables can only be of integer type or integer array type.
Call-by-value parameters will have a width dependent on the type of the parameter (remember
we are using only integer parameters), whereas call-by-reference parameters will have a width
equal to ONE word to store an address. The total activation record size of each method should be
computed at this time and entered in the symbol table as an attribute of the method name.
The machine architecture must be take into account when computing these widths, that is,
an integer in the MIPS processor is 4 bytes. Offsets of locals can be implemented as a negative
offset from the frame pointer while offsets of parameters can be positive from the frame pointer.
Thus, the computation of offsets of arguments and local variables can be done independently. This
information will be used upon every reference to the data object in addition to being used in the
allocation of storage for activation records.
Handling Structure Data Types
Storage for an array is allocated as a consecutive block of memory. Access to individual elements
of an array is handled by generating an address calculation using the base address of the array,
the index of the desired element, and the size of the elements. You are free to choose the layout of
elements of an array in your implementation (e.g., row major or column major order).
Simple Control Flow
Code for simple control statements, namely conditional and loops in MINI-JAVA, can be generated
according to the semantics of conventional programming languages using the compare and branch
instructions of the assembly language. Unique target labels will also have to be generated.
Method Invocation, Prologues, and Epilogues
Recursion in MINI-JAVA prevents the use of a static storage allocation strategy. However, the
language has no features that prevent the deallocation of activation records in a last-in-first-out
manner. That is, activation records containing data local to an execution of a method, actual
parameters, saved machine status, and other information needed to manage the activation of the
2
method can be stored on a run-time stack. The MIPS assembly language provides the subroutine
call mechanisms to manipulate the run-time user stack.
An activation record for a method is pushed onto the stack upon a call to that method, while
the activation record for the method is popped from the stack when execution of the method is
finished and control is to be returned to the caller. As MINI-JAVA does not allow dynamic classes
and arrays, the sizes of all activation records are known at compile time.
Method calls result in the generation of a calling sequence. Upon a call, an activation record for
the callee must be set up and control must be transferred to the callee after saving the appropriate
information in the activation record. For each method, the generated code sequence will consist of
a prologue, the code for the statements of the method, and the epilogue. Typically, the prologue
saves the registers upon a method call and allocates space on the stack for local variables, whereas
the epilogue consists of restoring the saved machine status and returning control to the point in the
caller immediately after the point of call. The handout on the MIPS assembly language explains
the instructions used to implement these actions.
Parameter passing
In order to correctly handle the formal parameters within the body of the callee, the symbol table
entry for each formal parameter must include an attribute that indicates the parameter passing
mode, that is, by-value or by-reference. Remember that we do not pass arrays as parameters. On
a method invocation, call-by-value parameters are handled by allocating the local store for the size
of the object in the activation record of the callee and then evaluating the actual parameter and
initializing the local store within the callee with the value of the actual parameter. All accesses to
that formal parameter will change the value in the local space, with no effect on the caller. On a
return, no values are copied back to the caller.
Call-by-reference parameters are handled by allocating local space in the callee’s activation
record for the address of the actual parameter and then copying the address of the actual parameter
into that local space. All accesses to that formal parameter during execution of the callee are indirect
accesses through this address, having a direct effect on the caller. On return, no action is taken
other than reclaiming the space.
Note that MIPS has a convention that the first 4 arguments of a method call are passed in
register $a0-$a3. You have the option to follow this convention.
Register Usage
In the MIPS processor, certain registers are typically reserved for special purposes. You should
abide by these conventions.
Possible Functions
You may want to write the following functions to help in the code generation.
1. emit call(func name, num arg)/*emit a call instruction; func name: function id lexeme pointer;
num arg: number of arguments */
2. emit label(l num)/*emit a definition of a label; l num: label number; example: L=102, code
generated = “L 102” */
3
3. emit goto(operator, l num) /*emit unconditional and conditional jump instructions; operator:
an operator in the branch-jump group; l num: label number */
4. emit data(name, type, size) /* emit one data line, which is used for STATIC allocation;
name: data object id lexeme pointer; type: type width; size: number of elements of above type
*/
5. emit str(name, str) /* emit a string constant definition line; name: pointer to the name
lexeme; str: pointer to the str */
6. emit most(operator, type, num op, op1, op2, op3) /* emit most of the instructions; operator:
one of the instructions in the general group; type: data type; num op: number of operators 1,
2 and/or 3; op1...3: operands, op2 and op3 can be omitted depending on num op */
Run-time Error Detection
You do not need to generate any run-time checks. Thus you can assume that array bounds are
within range and scalars are within range.
Testing your code
The code generated is MIPS assembly code and should follow the descriptions specified in the
handout SPIM S20. Samples will be put on the class webpage.
You can run the generated assembly code on the simulator and check the results. However, the
correct output does not guarantee that your code is completely correct. You should examine your
generated code carefully.
proj4> codeGen < sample1.java
proj4> spim -asm -file code.s
... ...
or
proj4> spim
(spim) load “code.s”
(spim) step
[0x00400000] 0x8fa40000 lw $4,0($29)
(spim) run
... ...
Assignment submission
Please submit your project in Canvas before the due time. The submission should be a compressed
file that contains your project source code and readme file (if any).
請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫CSC3100 Data Structures
  • 下一篇:CSCC43代做、R設(shè)計(jì)編程代寫
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    出評 開團(tuán)工具
    出評 開團(tuán)工具
    挖掘機(jī)濾芯提升發(fā)動機(jī)性能
    挖掘機(jī)濾芯提升發(fā)動機(jī)性能
    海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機(jī)場巴士4號線
    合肥機(jī)場巴士4號線
    合肥機(jī)場巴士3號線
    合肥機(jī)場巴士3號線
    合肥機(jī)場巴士2號線
    合肥機(jī)場巴士2號線
    合肥機(jī)場巴士1號線
    合肥機(jī)場巴士1號線
  • 短信驗(yàn)證碼 豆包 幣安下載 AI生圖 目錄網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                久久久久99精品一区| 国产精品家庭影院| 欧美大片在线观看| 欧美一区二区三区在线电影| 9191成人精品久久| 91精品国产综合久久久久久久久久| 99久久久久免费精品国产 | 亚洲天堂2014| 国产人成一区二区三区影院| 8x8x8国产精品| 欧美亚洲国产一卡| 在线视频一区二区免费| 91视频xxxx| 91香蕉视频污| 三级欧美韩日大片在线看| 亚洲一线二线三线久久久| 亚洲精品自拍动漫在线| 亚洲国产日韩综合久久精品| 亚洲综合在线电影| 亚洲电影一区二区| 日韩精品电影在线| 美女视频黄 久久| 国产精品1区2区| 暴力调教一区二区三区| 91丨porny丨国产入口| 欧美日韩精品一区二区三区蜜桃| 欧美日韩一区精品| 欧美不卡视频一区| 《视频一区视频二区| 亚洲人成人一区二区在线观看| 一区二区三区在线视频观看58 | 亚洲天堂成人在线观看| 一区二区三区四区中文字幕| 亚洲成人你懂的| 国产在线播放一区| 99视频有精品| 欧美日韩一级二级三级| 精品日韩av一区二区| 国产精品欧美精品| 天堂va蜜桃一区二区三区 | 国产成人午夜高潮毛片| jizz一区二区| 欧美电影免费观看完整版| 国产欧美一区二区精品忘忧草 | 国产精品色一区二区三区| 亚洲精品日韩一| 蜜桃精品视频在线观看| 99久久婷婷国产精品综合| 欧美精品日日鲁夜夜添| 欧美激情一区二区三区蜜桃视频| 亚洲精品日日夜夜| 国产精品你懂的在线| 亚洲第一福利一区| 成人18视频日本| jiyouzz国产精品久久| 日韩欧美一二区| 亚洲图片自拍偷拍| 大桥未久av一区二区三区中文| 欧美色图激情小说| 国产精品精品国产色婷婷| 蜜桃在线一区二区三区| 91免费精品国自产拍在线不卡| 日韩欧美一级特黄在线播放| 亚洲欧美成人一区二区三区| 国产中文字幕一区| 精品国产乱码久久久久久牛牛| 亚洲视频在线一区二区| 不卡的看片网站| 久久亚洲一区二区三区明星换脸| 亚洲免费av高清| av中文字幕亚洲| 久久久综合精品| 久久99精品久久久久| 欧美午夜精品一区二区蜜桃| 亚洲免费色视频| 97精品超碰一区二区三区| 欧美精品一区二区三区在线| 日韩精品一卡二卡三卡四卡无卡| av一区二区三区四区| 久久亚洲综合色一区二区三区 | 精品少妇一区二区三区视频免付费| 中文字幕一区二区在线观看| 国产一区二区三区国产| 久久精品一区二区| 久久成人免费日本黄色| 欧美一级理论性理论a| 日韩精品三区四区| 精品国产免费久久| 国产麻豆精品theporn| 日韩欧美一区二区免费| 麻豆精品一区二区| 久久视频一区二区| 国产成人8x视频一区二区| 久久嫩草精品久久久精品| 激情综合网最新| 久久老女人爱爱| 不卡影院免费观看| 亚洲免费伊人电影| 欧美精品自拍偷拍| 久久99国产精品久久99果冻传媒| 成人精品视频网站| 亚洲成人精品一区| 一区二区三区四区不卡在线| 国产精品丝袜91| 久久蜜桃一区二区| 国产超碰在线一区| 中文字幕一区av| 在线视频观看一区| 人人狠狠综合久久亚洲| 欧美一区二区三区喷汁尤物| 久色婷婷小香蕉久久| 欧美日韩高清一区二区三区| 日本 国产 欧美色综合| 久久女同精品一区二区| av网站免费线看精品| 一区二区三区在线视频播放| 欧美日韩www| 91久久精品国产91性色tv| 欧美人牲a欧美精品| 人人超碰91尤物精品国产| 五月婷婷另类国产| 久久亚洲影视婷婷| 福利一区在线观看| 一二三区精品视频| 国产成人在线色| 亚洲欧美二区三区| 日韩三级高清在线| 成人美女在线视频| 天天色综合成人网| 国产精品素人一区二区| 色综合一个色综合亚洲| 看电视剧不卡顿的网站| 亚洲精品乱码久久久久久久久| 精品久久国产字幕高潮| 色婷婷久久综合| 国产精品一卡二| 亚洲精品国产精品乱码不99| 久久这里只有精品6| 欧美三区在线观看| 国产精品一级黄| 色偷偷88欧美精品久久久| 亚洲国产精品一区二区久久恐怖片 | 91久久线看在观草草青青| 奇米一区二区三区av| 亚洲美女视频一区| 艳妇臀荡乳欲伦亚洲一区| 欧美高清激情brazzers| 亚洲精品乱码久久久久久久久| 男男gaygay亚洲| 91日韩精品一区| 欧美激情综合五月色丁香小说| 亚洲成a人v欧美综合天堂 | 日韩中文字幕1| 九九国产精品视频| 日韩一区二区三区视频在线观看| 午夜精品久久一牛影视| fc2成人免费人成在线观看播放 | 欧美优质美女网站| 国产另类ts人妖一区二区| 日韩在线一二三区| 一区二区三区日韩精品视频| 国产欧美精品国产国产专区| 日韩亚洲欧美一区二区三区| 欧洲日韩一区二区三区| 色婷婷综合激情| 色综合久久久久综合体| 99re这里都是精品| 91麻豆国产香蕉久久精品| 成人性生交大合| 99久久免费国产| 美女久久久精品| 中文字幕日韩精品一区| 91免费版在线看| 日韩欧美在线影院| 欧美一级久久久| 日韩欧美一级二级三级| 精品久久久久久久久久久久久久久久久| 欧美美女网站色| 精品捆绑美女sm三区| 日韩精品一区二区三区中文不卡| 精品国产在天天线2019| 精品成人一区二区| 国产精品美女久久久久久| **欧美大码日韩| 亚洲美女少妇撒尿| 亚洲成人1区2区| 国内精品视频666| 国产乱人伦偷精品视频不卡| 成人中文字幕电影| 在线精品视频小说1| 日韩一区二区在线观看视频| 日韩欧美在线综合网| 中文字幕电影一区| 夜夜揉揉日日人人青青一国产精品 | 自拍偷拍亚洲欧美日韩| 91精品国产品国语在线不卡| 欧美高清视频不卡网| 精品福利一区二区三区免费视频| 国产精品全国免费观看高清| 国产精品成人一区二区三区夜夜夜|