graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java

Print this page
rev 8661 : Graal PTX enhancements


 150         compilationResult.recordDataReference(pos, data, alignment, inlined);
 151         return asm.getPlaceholder();
 152     }
 153 
 154     /**
 155      * Returns the integer value of any constant that can be represented by a 32-bit integer value,
 156      * including long constants that fit into the 32-bit range.
 157      */
 158     public int asIntConst(Value value) {
 159         assert (value.getKind().getStackKind() == Kind.Int || value.getKind() == Kind.Long) && isConstant(value);
 160         Constant constant = (Constant) value;
 161         assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
 162         long c = constant.asLong();
 163         if (!NumUtil.isInt(c)) {
 164             throw GraalInternalError.shouldNotReachHere();
 165         }
 166         return (int) c;
 167     }
 168 
 169     /**






























 170      * Returns the address of a float constant that is embedded as a data references into the code.
 171      */
 172     public AbstractAddress asFloatConstRef(Value value) {
 173         return asFloatConstRef(value, 4);
 174     }
 175 
 176     public AbstractAddress asFloatConstRef(Value value, int alignment) {
 177         assert value.getKind() == Kind.Float && isConstant(value);
 178         return recordDataReferenceInCode((Constant) value, alignment, false);
 179     }
 180 
 181     /**
 182      * Returns the address of a double constant that is embedded as a data references into the code.
 183      */
 184     public AbstractAddress asDoubleConstRef(Value value) {
 185         return asDoubleConstRef(value, 8);
 186     }
 187 
 188     public AbstractAddress asDoubleConstRef(Value value, int alignment) {
 189         assert value.getKind() == Kind.Double && isConstant(value);




 150         compilationResult.recordDataReference(pos, data, alignment, inlined);
 151         return asm.getPlaceholder();
 152     }
 153 
 154     /**
 155      * Returns the integer value of any constant that can be represented by a 32-bit integer value,
 156      * including long constants that fit into the 32-bit range.
 157      */
 158     public int asIntConst(Value value) {
 159         assert (value.getKind().getStackKind() == Kind.Int || value.getKind() == Kind.Long) && isConstant(value);
 160         Constant constant = (Constant) value;
 161         assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
 162         long c = constant.asLong();
 163         if (!NumUtil.isInt(c)) {
 164             throw GraalInternalError.shouldNotReachHere();
 165         }
 166         return (int) c;
 167     }
 168 
 169     /**
 170      * Returns the float value of any constant that can be represented by a 32-bit float value
 171      */
 172     public float asFloatConst(Value value) {
 173         assert (value.getKind().getStackKind() == Kind.Float && isConstant(value));
 174         Constant constant = (Constant) value;
 175         assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
 176         return constant.asFloat();
 177     }
 178 
 179     /**
 180      * Returns the long value of any constant that can be represented by a 64-bit long value
 181      */
 182     public long asLongConst(Value value) {
 183         assert (value.getKind().getStackKind() == Kind.Long && isConstant(value));
 184         Constant constant = (Constant) value;
 185         assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
 186         return constant.asLong();
 187     }
 188 
 189     /**
 190      * Returns the double value of any constant that can be represented by a 64-bit float value
 191      */
 192     public double asDoubleConst(Value value) {
 193         assert (value.getKind().getStackKind() == Kind.Double && isConstant(value));
 194         Constant constant = (Constant) value;
 195         assert !runtime.needsDataPatch(constant) : constant + " should be in a DataPatch";
 196         return constant.asDouble();
 197     }
 198 
 199     /**
 200      * Returns the address of a float constant that is embedded as a data references into the code.
 201      */
 202     public AbstractAddress asFloatConstRef(Value value) {
 203         return asFloatConstRef(value, 4);
 204     }
 205 
 206     public AbstractAddress asFloatConstRef(Value value, int alignment) {
 207         assert value.getKind() == Kind.Float && isConstant(value);
 208         return recordDataReferenceInCode((Constant) value, alignment, false);
 209     }
 210 
 211     /**
 212      * Returns the address of a double constant that is embedded as a data references into the code.
 213      */
 214     public AbstractAddress asDoubleConstRef(Value value) {
 215         return asDoubleConstRef(value, 8);
 216     }
 217 
 218     public AbstractAddress asDoubleConstRef(Value value, int alignment) {
 219         assert value.getKind() == Kind.Double && isConstant(value);