86 // Stack pointer register
87 static OptoReg::Name c_frame_pointer;
88
89
90
91 // Increment a register number. As in:
92 // "for ( OptoReg::Name i; i=Control; i = add(i,1) ) ..."
93 static Name add( Name x, int y ) { return Name(x+y); }
94
95 // (We would like to have an operator+ for RegName, but it is not
96 // a class, so this would be illegal in C++.)
97
98 static void dump(int, outputStream *st = tty);
99
100 // Get the stack slot number of an OptoReg::Name
101 static unsigned int reg2stack( OptoReg::Name r) {
102 assert( r >= stack0(), " must be");
103 return r - stack0();
104 }
105
106 // convert a stack slot number into an OptoReg::Name
107 static OptoReg::Name stack2reg( int idx) {
108 return Name(stack0() + idx);
109 }
110
111 static bool is_stack(Name n) {
112 return n >= stack0();
113 }
114
115 static bool is_valid(Name n) {
116 return (n != Bad);
117 }
118
119 static bool is_reg(Name n) {
120 return is_valid(n) && !is_stack(n);
121 }
122
123 static VMReg as_VMReg(OptoReg::Name n) {
124 if (is_reg(n)) {
125 // Must use table, it'd be nice if Bad was indexable...
|
86 // Stack pointer register
87 static OptoReg::Name c_frame_pointer;
88
89
90
91 // Increment a register number. As in:
92 // "for ( OptoReg::Name i; i=Control; i = add(i,1) ) ..."
93 static Name add( Name x, int y ) { return Name(x+y); }
94
95 // (We would like to have an operator+ for RegName, but it is not
96 // a class, so this would be illegal in C++.)
97
98 static void dump(int, outputStream *st = tty);
99
100 // Get the stack slot number of an OptoReg::Name
101 static unsigned int reg2stack( OptoReg::Name r) {
102 assert( r >= stack0(), " must be");
103 return r - stack0();
104 }
105
106 static void invalidate(Name n) {
107 vm2opto[n] = Bad;
108 }
109
110 // convert a stack slot number into an OptoReg::Name
111 static OptoReg::Name stack2reg( int idx) {
112 return Name(stack0() + idx);
113 }
114
115 static bool is_stack(Name n) {
116 return n >= stack0();
117 }
118
119 static bool is_valid(Name n) {
120 return (n != Bad);
121 }
122
123 static bool is_reg(Name n) {
124 return is_valid(n) && !is_stack(n);
125 }
126
127 static VMReg as_VMReg(OptoReg::Name n) {
128 if (is_reg(n)) {
129 // Must use table, it'd be nice if Bad was indexable...
|