加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

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

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

時間:2023-11-27  來源:合肥網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

掃一掃在手機打開當前頁
  • 上一篇:代寫CSC3100 Data Structures
  • 下一篇:CSCC43代做、R設計編程代寫
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業(yè)/產品研發(fā)/客戶要求/設計優(yōu)化
    有限元分析 CAE仿真分析服務-企業(yè)/產品研發(fā)
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發(fā)動機性能
    挖掘機濾芯提升發(fā)動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現(xiàn)代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現(xiàn)代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

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

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    蜜桃精品在线| 老司机精品视频在线播放| 亚洲黄色中文字幕| 欧美aaaaaaaa牛牛影院| 日本不卡123| 毛片在线网站| 亚洲精品成人| www.爱久久| 亚洲最大av| 欧美日韩尤物久久| 妖精视频成人观看www| 91精品日本| 最新国产精品| 亚洲黑人在线| 高潮在线视频| 激情综合网站| 国产suv精品一区二区四区视频| 国内精品久久久久久久影视蜜臀| 久久uomeier| 亚洲综合日韩| 国产一区亚洲| 九色丨蝌蚪丨成人| 日韩欧美ww| 疯狂欧洲av久久成人av电影| 婷婷久久免费视频| 两个人看的在线视频www| 亚洲精品电影| 久久免费高清| 成人在线超碰| 精品国产一区二区三区性色av | 国产精品欧美在线观看| 久久精品国产成人一区二区三区 | 久久久久久婷| 一区二区自拍| 激情婷婷综合| 91精品国产自产在线观看永久∴| 日韩在线观看中文字幕| 国产尤物久久久| 亚洲欧洲日韩| 日本女优在线视频一区二区| yy6080久久伦理一区二区| 无遮挡爽大片在线观看视频| 色777狠狠狠综合伊人| 裸体一区二区| 欧美一区=区| 亚洲一区二区三区高清| 在线电影一区二区| 在线日本制服中文欧美| 亚洲91中文字幕无线码三区| 欧美黑人巨大videos精品| av一级亚洲| 91在线一区| 国产成人一二| 欧美日韩麻豆| 99精品视频精品精品视频| 久久久久中文| 亚洲一级黄色| 在线一区免费| 亚洲在线观看| 蜜桃视频在线一区| 日韩综合一区| 水蜜桃在线视频| 男人的天堂免费在线视频| 亚洲精品福利电影| 日韩精品一区二区三区av| 日韩伦理在线一区| 欧美天堂一区| 青青国产91久久久久久| 一区二区三区午夜视频| 国产美女视频一区二区| 日韩影视在线观看| 国产三级精品三级在线观看国产| 精品久久视频| 亚洲欧美综合| 美女黄网久久| 日韩国产一区二区| 一区二区福利| 国产剧情一区二区在线观看| 日韩av在线播放中文字幕| 国产精品色在线网站| 91精品国产调教在线观看| 亚洲精品1区2区| 极品视频在线| 国产日韩一区二区三区在线| 久久久久97| 精品视频一区二区三区| 久久久久在线| 亚洲综合不卡| 日日夜夜天天综合| 欧美日韩一区二区国产| 日韩电影在线一区二区| 久久中文字幕av一区二区不卡| 99亚洲一区二区| 中文字幕在线看片| 美女看a上一区| 亚洲啊v在线免费视频| 女人色偷偷aa久久天堂| 欧美三级网址| 欧美日韩综合| 精品国产一区二区三区不卡蜜臂| 在线亚洲自拍| 成人亚洲视频| 日韩欧美美女在线观看| 米奇777超碰欧美日韩亚洲| 日韩av自拍| 久久午夜影院| 欧美亚洲tv| segui88久久综合9999| 亚洲精品一级| 欧美亚洲国产日韩| 成人影院在线| 中文字幕av亚洲精品一部二部| 亚洲1区在线观看| 伊人精品在线| 在线中文字幕播放| 麻豆精品蜜桃视频网站| 精品国产亚洲一区二区三区| 日韩视频一区| 欧美精选视频一区二区| 日本美女一区二区三区视频| 香蕉免费一区二区三区在线观看| 欧美~级网站不卡| 日本美女久久| 亚洲春色h网| 久久久人成影片免费观看| 每日更新成人在线视频| 久久麻豆视频| 一区二区三区在线观看免费| 99欧美视频| 激情视频网站在线播放色| 日本在线不卡视频| 久久99精品久久久久久欧洲站| 先锋影音国产一区| 日韩在线电影| 日韩精品三级| 午夜亚洲影视| 国产a久久精品一区二区三区 | 麻豆精品国产91久久久久久| 国产一区丝袜| 国产精品99一区二区三区| 国色天香一区二区| 久久国产欧美| 午夜久久中文| 日韩精彩视频在线观看| 宅男噜噜噜66国产日韩在线观看| 欧美美女被草| 欧美日韩精品一区二区视频 | 蜜臀久久久99精品久久久久久| 青草国产精品久久久久久| 久久99偷拍| av资源亚洲| 日韩欧洲国产| av免费不卡| 欧美区一区二区| 亚洲精品网址| 日本aⅴ亚洲精品中文乱码| 私拍精品福利视频在线一区| 综合久久2023| 日日夜夜精品免费视频| 亚洲国产老妈| 欧美亚洲在线| 亚洲国产综合在线看不卡| 欧美亚洲福利| 日韩母乳在线| 美女视频在线免费| 成人在线超碰| 日韩制服一区| 久久精品动漫| 激情中国色综合| 99久久九九| 三级不卡在线观看| 精品一区毛片| 亚洲国产最新| 岛国av在线播放| 精品999日本久久久影院| 亚洲黄色网址| 欧美福利视频| 中文视频一区| 石原莉奈一区二区三区在线观看| 日韩精品亚洲专区| 喷白浆一区二区| 精品中文字幕一区二区三区四区| 欧美裸体视频| 久久久xxx| 国产成人精品一区二区免费看京| 丝袜诱惑制服诱惑色一区在线观看| 国产真实有声精品录音| а√在线中文在线新版| 91在线一区| 欧美在线看片| 午夜亚洲一区| 9l视频自拍蝌蚪9l视频成人| 极品视频在线| 不卡中文一二三区| 国产精品嫩草影院在线看| 裤袜国产欧美精品一区| 伊人久久影院| 亚洲欧美在线人成swag| 超级白嫩亚洲国产第一| 久久久噜噜噜久久狠狠50岁|