本文整理汇总了Python中Lib.genFns方法的典型用法代码示例。如果您正苦于以下问题:Python Lib.genFns方法的具体用法?Python Lib.genFns怎么用?Python Lib.genFns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lib
的用法示例。
在下文中一共展示了Lib.genFns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Lib [as 别名]
# 或者: from Lib import genFns [as 别名]
def main():
fileName = "./../test/test1.ir"
if len(sys.argv) == 2:
fileName = sys.argv[1]
ir = IR(fileName)
code = CodeGen(ir)
print "\t.text"
print "\t.globl main\n"
print "main:\n"
codeBlocks = code._codeBlocks
# add the library functions
# Now add the generated block by code generator
i = 1
for node in codeBlocks:
print "B"+str(i)+":"
print "\t"+"\n\t".join(node)
i += 1
print "\tj "+LibFns["exit"]
lib = Lib()
instrs = lib.genFns()
for ins in instrs.keys():
print str(ins)+":"
print "\t"+"\n\t".join(instrs[ins])
print "\n\t.data"
for var in code._globalVars:
print "g_"+str(var) + ":\t.word\t0"
示例2: len
# 需要导入模块: import Lib [as 别名]
# 或者: from Lib import genFns [as 别名]
if __name__ == '__main__':
fileName = "./../test/test1.ir"
if len(sys.argv) == 2:
fileName = sys.argv[1]
ir = IR(fileName)
code = CodeGen(ir)
print "\t.text"
print "\t.globl main\n"
print "main:\n"
codeBlocks = code._codeBlocks
# add the library functions
# Now add the generated block by code generator
i = 1
for node in codeBlocks:
print "B"+str(i)+":"
print "\t"+"\n\t".join(node)
i += 1
print "\tj "+LibFns["exit"]
lib = Lib()
instrs = lib.genFns()
for ins in instrs.keys():
print str(ins)+":"
print "\t"+"\n\t".join(instrs[ins])
print "\n\t.data"
for var in code._globalVars:
print "g_"+str(var) + ":\t.word\t0"