Use %ull here.
[llvm/stm8.git] / lib / Target / PTX / PTXMachineFunctionInfo.h
blobb5b3c3be17b8a8eebf9126c82db49072959c8172
1 //===- PTXMachineFuctionInfo.h - PTX machine function info -------*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares PTX-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_MACHINE_FUNCTION_INFO_H
15 #define PTX_MACHINE_FUNCTION_INFO_H
17 #include "PTX.h"
18 #include "llvm/CodeGen/MachineFunction.h"
20 namespace llvm {
21 /// PTXMachineFunctionInfo - This class is derived from MachineFunction and
22 /// contains private PTX target-specific information for each MachineFunction.
23 ///
24 class PTXMachineFunctionInfo : public MachineFunctionInfo {
25 private:
26 bool is_kernel;
27 std::vector<unsigned> reg_arg, reg_local_var;
28 unsigned reg_ret;
29 bool _isDoneAddArg;
31 public:
32 PTXMachineFunctionInfo(MachineFunction &MF)
33 : is_kernel(false), reg_ret(PTX::NoRegister), _isDoneAddArg(false) {
34 reg_arg.reserve(8);
35 reg_local_var.reserve(32);
38 void setKernel(bool _is_kernel=true) { is_kernel = _is_kernel; }
40 void addArgReg(unsigned reg) { reg_arg.push_back(reg); }
41 void addLocalVarReg(unsigned reg) { reg_local_var.push_back(reg); }
42 void setRetReg(unsigned reg) { reg_ret = reg; }
44 void doneAddArg(void) {
45 std::sort(reg_arg.begin(), reg_arg.end());
46 _isDoneAddArg = true;
48 void doneAddLocalVar(void) {
49 std::sort(reg_local_var.begin(), reg_local_var.end());
52 bool isDoneAddArg(void) { return _isDoneAddArg; }
54 bool isKernel() const { return is_kernel; }
56 typedef std::vector<unsigned>::const_iterator reg_iterator;
57 typedef std::vector<unsigned>::const_reverse_iterator reg_reverse_iterator;
59 bool argRegEmpty() const { return reg_arg.empty(); }
60 int getNumArg() const { return reg_arg.size(); }
61 reg_iterator argRegBegin() const { return reg_arg.begin(); }
62 reg_iterator argRegEnd() const { return reg_arg.end(); }
63 reg_reverse_iterator argRegReverseBegin() const { return reg_arg.rbegin(); }
64 reg_reverse_iterator argRegReverseEnd() const { return reg_arg.rend(); }
66 bool localVarRegEmpty() const { return reg_local_var.empty(); }
67 reg_iterator localVarRegBegin() const { return reg_local_var.begin(); }
68 reg_iterator localVarRegEnd() const { return reg_local_var.end(); }
70 unsigned retReg() const { return reg_ret; }
72 bool isArgReg(unsigned reg) const {
73 return std::binary_search(reg_arg.begin(), reg_arg.end(), reg);
76 bool isLocalVarReg(unsigned reg) const {
77 return std::binary_search(reg_local_var.begin(), reg_local_var.end(), reg);
79 }; // class PTXMachineFunctionInfo
80 } // namespace llvm
82 #endif // PTX_MACHINE_FUNCTION_INFO_H