PageRenderTime 19ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/JIT/opcodes/closure.h

http://unladen-swallow.googlecode.com/
C++ Header | 39 lines | 27 code | 10 blank | 2 comment | 0 complexity | 39d917ddf424628e64ef5ca639fa047d MD5 | raw file
 1// -*- C++ -*-
 2#ifndef OPCODE_CLOSURE_H_
 3#define OPCODE_CLOSURE_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 py {
13
14class LlvmFunctionBuilder;
15class LlvmFunctionState;
16
17// This class contains all opcodes related to closures.
18class OpcodeClosure
19{
20public:
21    OpcodeClosure(LlvmFunctionBuilder *fbuilder);
22
23    void LOAD_CLOSURE(int freevar_index);
24    void MAKE_CLOSURE(int num_defaults);
25    void LOAD_DEREF(int index);
26    void STORE_DEREF(int index);
27
28private:
29    typedef llvm::IRBuilder<true, llvm::TargetFolder> BuilderT;
30
31    LlvmFunctionBuilder *fbuilder_;
32    LlvmFunctionState *state_;
33    BuilderT &builder_;
34    PyGlobalLlvmData *const llvm_data_;
35};
36
37}
38
39#endif /* OPCODE_CLOSURE_H_ */