欢迎来到天天文库
浏览记录
ID:39713630
大小:242.10 KB
页数:6页
时间:2019-07-09
《01_12-01-_Introduction_to_Code_Generation_7m57s_0_Slides_Original_PDF》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、CompilersIntroductiontoCodeGenerationAlexAikenCodeGeneration•Wefocusongeneratingcodeforastackmachinewithaccumulator•Wewanttoruntheresultingcodeonarealmachine–e.g.,theMIPSprocessor(orsimulator)•WesimulatestackmachineinstructionsusingMIPSinstructionsandregister
2、sAlexAikenCodeGeneration•TheaccumulatoriskeptinMIPSregister$a0•Thestackiskeptinmemory–Thestackgrowstowardsloweraddresses–StandardconventiononMIPS•TheaddressofthenextlocationonthestackiskeptinMIPSregister$sp–Thetopofthestackisataddress$sp+4AlexAikenCodeGenerat
3、ionMIPSarchitecture–PrototypicalReducedInstructionSetComputer(RISC)–Mostoperationsuseregistersforoperands&results–Useload&storeinstructionstousevaluesinmemory–32generalpurposeregisters(32bitseach)•Weuse$sp,$a0and$t1(atemporaryregister)•ReadtheSPIMdocumentatio
4、nfordetailsAlexAikenCodeGeneration–lwregoffset(reg)12•Load32-bitwordfromaddressreg+offsetintoreg21–addregregreg123•regreg+reg123–swreg1offset(reg2)•Store32-bitwordinregataddressreg+offset12–addiuregregimm12•regreg+imm12•“u”meansoverflowisnotchecked–liregimm
5、•regimmAlexAikenCodeGenerationThestack-machinecodefor7+5inMIPS:acc7li$a07pushaccsw$a00($sp)addiu$sp$sp-4acc5li$a05accacc+top_of_stacklw$t14($sp)add$a0$a0$t1popaddiu$sp$sp4AlexAiken
此文档下载收益归作者所有
点击更多查看相关文章~~