PageRenderTime 373ms CodeModel.GetById 104ms app.highlight 10ms RepoModel.GetById 128ms app.codeStats 76ms

/JIT/opcodes/loop.h

http://unladen-swallow.googlecode.com/
C++ Header | 48 lines | 31 code | 14 blank | 3 comment | 0 complexity | 7d5e77a47e4611bacc3efb7d792df6f3 MD5 | raw file
 1// -*- C++ -*-
 2#ifndef OPCODE_LOOP_H_
 3#define OPCODE_LOOP_H_
 4
 5#ifndef __cplusplus
 6#error This header expects to be included only in C++ source
 7#endif
 8
 9#include "llvm/Support/IRBuilder.h"
10#include "llvm/Support/TargetFolder.h"
11
12namespace llvm {
13    class BasicBlock;
14}
15
16namespace py {
17
18class LlvmFunctionBuilder;
19class LlvmFunctionState;
20
21// This class contains most loop related opcodes.
22// SETUP_LOOP can be found in OpcodeBlock.
23class OpcodeLoop
24{
25public:
26    OpcodeLoop(LlvmFunctionBuilder *fbuilder);
27    
28    void GET_ITER();
29    void FOR_ITER(llvm::BasicBlock *target, llvm::BasicBlock *fallthrough);
30
31
32    void CONTINUE_LOOP(llvm::BasicBlock *target,
33                       int target_opindex,
34                       llvm::BasicBlock *fallthrough);
35
36    void BREAK_LOOP();
37
38private:
39    typedef llvm::IRBuilder<true, llvm::TargetFolder> BuilderT;
40
41    LlvmFunctionBuilder *fbuilder_;
42    LlvmFunctionState *state_;
43    BuilderT &builder_;
44};
45
46}
47
48#endif /* OPCODE_LOOP_H_ */