正在加载图片...
General Optimization Techniques Strength reduction Use the fastest version of an operation ■Eg instead of instead of Common sub expression elimination Eliminate redundant calculations ■Eg double x=d大(1im/max)大sx; double y=d *(lim max)*sy double depth =d (lim/ max double x= depth大sx; double depth Fa|2011 Advanced Compiler Techniques 88 Fall 2011 “Advanced Compiler Techniques” General Optimization Techniques ◼ Strength reduction ◼ Use the fastest version of an operation ◼ E.g. x >> 2 instead of x / 4 x << 1 instead of x * 2 ◼ Common sub expression elimination ◼ Eliminate redundant calculations ◼ E.g. double x = d * (lim / max) * sx; double y = d * (lim / max) * sy; double depth = d * (lim / max); double x = depth * sx; double y = depth * sy;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有