English 中文(简体)
1. 从1 000米以上的回归功能中建设AST
原标题:Building up AST from a function with more than one returns for llvm
  • 时间:2011-09-11 07:56:21
  •  标签:
  • llvm

例如,我有这一职能:

def max(a,b) {
   if(a < b) return b;
   if(a > b) return a;
}

I am curious how to parse this into an AST. If I understand this well then the node of it s body should return a ReturnInst*.

但是,在我的助产士中,本机构由两个节点组成(作为表达方式),第一个或另一个节点。

是否有点trick或设计是错误的?

Edit:我刚刚摆脱了一种可能的解决办法:

  1. CreateAlloca at the begin of the body.
  2. CreateStore and jump to the end label at every return.
  3. At the end label return the var.

这是一种好的想法吗? 如何跳跃/跑到一半?

最佳回答

如果我正确理解,你概述的解决方案是全阿加-斯库曼纽伦。 是的,伦敦考试和测验公司优化人员将只处理罚款。 或者,对特定职能中指示的数量没有任何限制。

不知道你要求做什么,如果你想写一下的话,那么你在发言结束时需要同样的选择。 一般来说,对某些简单的法典实行“地兰-S-emit-llvm”是了解如何形成简单建筑的良好方法。 而且,“军阶——等级”是了解如何在C++中制定指示的好办法。

问题回答

http://llvm.org/demo/rel=“nofollow” C或C++中你想要做的事情的类型,将显示LRV的产出。





相关问题
How to generate LLVM IR with ANTLR and C target

im currently trying to generate LLVM IR with ANTLR3. But the problem ist, that i need the C target (C++ would be better but is not working yet, or is it?) but from C i can t call the LLVM C++ API for ...

How to build LLVM using GCC 4 on Windows?

I have been able to build LLVM 2.6 (the llvm-2.6.tar.gz package) using MinGW GCC 3.4.5. I haven t tested properly, but it seems to work. The trouble is, I have libraries of my own which don t build ...

Pros/Cons of Static and Dynamic Instrumentation

There are many static and dynamic instrumentation tools. Soot is a static instrumentation tool for Java bytecode. Pin and Valgrind are dynamic instrumentation tools for binaries. What are pros and ...

Bootstrapping a language on LLVM

I m bootstrapping a programming language compiler on top of LLVM. Currently I m mostly done writing a compiler for a subset of C which is self-compiling. When I m finished with that, I ll bootstrap ...

Call LLVM Jit from c program

I have generated a bc file with the online compiler on llvm.org, and I would like to know if it is possible to load this bc file from a c or c++ program, execute the IR in the bc file with the llvm ...

LLVM MinGW installation on Vista?

From llvm.org I ve downloaded llvm-2.6-x86-mingw32.tar.bz2 into c:llvm and llvm-gcc-4.2-2.6-x86-mingw32-tar.bz2 into c:llvm-gcc as well as setup a desktop shortcut the following batch file in c:...

热门标签