中止llvmlite代码生成

时间:2016-08-14 10:48:56

标签: python llvm llvm-ir llvmlite

我使用llvmlite和Python生成llvm IR代码。我在一个给定的模块中为许多函数生成代码。问题是当发生异常时,在为其中一个函数生成代码时,整个模块代码生成都会被破坏。我想通过对模块说:“嘿,完全忘记这个功能”然后采取其他行动来从异常中恢复。例如:

# Create function
func = ir.Function(module, functype, funcname)

# Create the entry BB in the function and set a new builder to it.
bb_entry = func.append_basic_block('entry')
builder = ir.IRBuilder(bb_entry)

try:
  # Generate code for func with the builder ...

except:
  # Oops, a problem occured while generating code
  # Remove func from module : How to do that ?
  del module.globals[funcname] # does not work...

任何帮助?

0 个答案:

没有答案
相关问题