/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. #ifndef __cplusplus
  5. #error This header expects to be included only in C++ source
  6. #endif
  7. namespace llvm {
  8. class Value;
  9. }
  10. namespace py {
  11. class LlvmFunctionBuilder;
  12. class LlvmFunctionState;
  13. // This class contains all opcodes related to slices.
  14. class OpcodeSlice
  15. {
  16. public:
  17. OpcodeSlice(LlvmFunctionBuilder *fbuilder);
  18. void SLICE_NONE();
  19. void SLICE_LEFT();
  20. void SLICE_RIGHT();
  21. void SLICE_BOTH();
  22. void STORE_SLICE_NONE();
  23. void STORE_SLICE_LEFT();
  24. void STORE_SLICE_RIGHT();
  25. void STORE_SLICE_BOTH();
  26. void DELETE_SLICE_NONE();
  27. void DELETE_SLICE_LEFT();
  28. void DELETE_SLICE_RIGHT();
  29. void DELETE_SLICE_BOTH();
  30. void BUILD_SLICE_TWO();
  31. void BUILD_SLICE_THREE();
  32. private:
  33. // Apply a classic slice to a sequence, pushing the result onto the
  34. // stack. 'start' and 'stop' can be Value*'s representing NULL to
  35. // indicate missing arguments, and all references are stolen.
  36. void ApplySlice(llvm::Value *seq, llvm::Value *start, llvm::Value *stop);
  37. // Assign to or delete a slice of a sequence. 'start' and 'stop' can be
  38. // Value*'s representing NULL to indicate missing arguments, and
  39. // 'source' can be a Value* representing NULL to indicate slice
  40. // deletion. All references are stolen.
  41. void AssignSlice(llvm::Value *seq, llvm::Value *start, llvm::Value *stop,
  42. llvm::Value *source);
  43. LlvmFunctionBuilder *fbuilder_;
  44. LlvmFunctionState *state_;
  45. };
  46. }
  47. #endif /* OPCODE_SLICE_H_ */