PageRenderTime 35ms CodeModel.GetById 21ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/JIT/opcodes/slice.h

http://unladen-swallow.googlecode.com/
C++ Header | 58 lines | 38 code | 11 blank | 9 comment | 0 complexity | 10f87a4bf84cfe73ba07a09d7e321e52 MD5 | raw file
 1// -*- C++ -*-
 2#ifndef OPCODE_SLICE_H_
 3#define OPCODE_SLICE_H_
 4
 5#ifndef __cplusplus
 6#error This header expects to be included only in C++ source
 7#endif
 8
 9namespace llvm {
10    class Value;
11}
12
13namespace py {
14
15class LlvmFunctionBuilder;
16class LlvmFunctionState;
17
18// This class contains all opcodes related to slices.
19class OpcodeSlice
20{
21public:
22    OpcodeSlice(LlvmFunctionBuilder *fbuilder);
23
24    void SLICE_NONE();
25    void SLICE_LEFT();
26    void SLICE_RIGHT();
27    void SLICE_BOTH();
28    void STORE_SLICE_NONE();
29    void STORE_SLICE_LEFT();
30    void STORE_SLICE_RIGHT();
31    void STORE_SLICE_BOTH();
32    void DELETE_SLICE_NONE();
33    void DELETE_SLICE_LEFT();
34    void DELETE_SLICE_RIGHT();
35    void DELETE_SLICE_BOTH();
36
37    void BUILD_SLICE_TWO();
38    void BUILD_SLICE_THREE();
39
40private:
41    // Apply a classic slice to a sequence, pushing the result onto the
42    // stack.  'start' and 'stop' can be Value*'s representing NULL to
43    // indicate missing arguments, and all references are stolen.
44    void ApplySlice(llvm::Value *seq, llvm::Value *start, llvm::Value *stop);
45    // Assign to or delete a slice of a sequence. 'start' and 'stop' can be
46    // Value*'s representing NULL to indicate missing arguments, and
47    // 'source' can be a Value* representing NULL to indicate slice
48    // deletion. All references are stolen.
49    void AssignSlice(llvm::Value *seq, llvm::Value *start, llvm::Value *stop,
50                     llvm::Value *source);
51
52    LlvmFunctionBuilder *fbuilder_;
53    LlvmFunctionState *state_;
54};
55
56}
57
58#endif /* OPCODE_SLICE_H_ */