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

📄 sloc_purge

📁 A MP3 Player Source Code, Enjoy it!
💻
字号:
#! /usr/bin/perl# remove the DSEG memory allocation for "sloc" variables# created by SDCC that were completely removed by the# custom peephole definitions in peephole.def.# first, read in all the asm codewhile (<>) {	chop;	$line[$lineno++] = $_;}for ($i=0; $i<$lineno; $i++) {	next unless $line[$i] =~ /^(_[A-Za-z0-9_]+sloc[0-9]+_[0-9]+_[0-9]+)::/;	$sloc = $1;	next unless $i < $lineno - 1;	next unless $line[$i+1] =~ /^[ \t]*\.ds[ \t]+([0-9]+)$/;	$sloc_alloc = $1;	#print "; $sloc\n";	$sloc_removable = 1;	$sloc_size = 1;	for ($j=$i+1; $j<$lineno; $j++) {		$_ = $line[$j];		$_ = $` if /;/;		if (/$sloc/) {			$sloc_removable = 0;			if (/\(${sloc} \+ ([0-9]+)\)/) {				$size = $1 + 1;				$sloc_size = $size if $size > $sloc_size;			}			#print "; $_\n";		}	}		if ($sloc_removable) {		#print "; purging $sloc\n";		$line[$i] = ';(sloc optimized away) ' . $line[$i];		$line[$i+1] = ';(sloc optimized away) ' . $line[$i+1];	} else {		if ($sloc_size < $sloc_alloc) {			$line[$i+1] = "\t.ds\t$sloc_size\t";			$line[$i+1] .= "; allocation changed to $sloc_size";			$line[$i+1] .= " (was $sloc_alloc)";		}	}}for ($i=0; $i<$lineno; $i++) {	print $line[$i], "\n";}

⌨️ 快捷键说明

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