twisti@2047: /* stefank@2314: * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. twisti@2047: * Copyright 2008, 2009 Red Hat, Inc. twisti@2047: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. twisti@2047: * twisti@2047: * This code is free software; you can redistribute it and/or modify it twisti@2047: * under the terms of the GNU General Public License version 2 only, as twisti@2047: * published by the Free Software Foundation. twisti@2047: * twisti@2047: * This code is distributed in the hope that it will be useful, but WITHOUT twisti@2047: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or twisti@2047: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License twisti@2047: * version 2 for more details (a copy is included in the LICENSE file that twisti@2047: * accompanied this code). twisti@2047: * twisti@2047: * You should have received a copy of the GNU General Public License version twisti@2047: * 2 along with this work; if not, write to the Free Software Foundation, twisti@2047: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. twisti@2047: * twisti@2047: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA twisti@2047: * or visit www.oracle.com if you need additional information or have any twisti@2047: * questions. twisti@2047: * twisti@2047: */ twisti@2047: stefank@2314: #ifndef SHARE_VM_SHARK_LLVMVALUE_HPP stefank@2314: #define SHARE_VM_SHARK_LLVMVALUE_HPP stefank@2314: stefank@2314: #include "shark/llvmHeaders.hpp" stefank@2314: #include "shark/sharkContext.hpp" stefank@2314: #include "shark/sharkType.hpp" stefank@2314: twisti@2047: class LLVMValue : public AllStatic { twisti@2047: public: twisti@2047: static llvm::ConstantInt* jbyte_constant(jbyte value) twisti@2047: { twisti@2047: return llvm::ConstantInt::get(SharkType::jbyte_type(), value, true); twisti@2047: } twisti@2047: static llvm::ConstantInt* jint_constant(jint value) twisti@2047: { twisti@2047: return llvm::ConstantInt::get(SharkType::jint_type(), value, true); twisti@2047: } twisti@2047: static llvm::ConstantInt* jlong_constant(jlong value) twisti@2047: { twisti@2047: return llvm::ConstantInt::get(SharkType::jlong_type(), value, true); twisti@2047: } twisti@2047: static llvm::ConstantFP* jfloat_constant(jfloat value) twisti@2047: { twisti@2047: return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value)); twisti@2047: } twisti@2047: static llvm::ConstantFP* jdouble_constant(jdouble value) twisti@2047: { twisti@2047: return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value)); twisti@2047: } twisti@2047: static llvm::ConstantPointerNull* null() twisti@2047: { twisti@2047: return llvm::ConstantPointerNull::get(SharkType::oop_type()); twisti@2047: } twisti@4314: static llvm::ConstantPointerNull* nullKlass() twisti@4314: { twisti@4314: return llvm::ConstantPointerNull::get(SharkType::klass_type()); twisti@4314: } twisti@2047: twisti@2047: public: twisti@2047: static llvm::ConstantInt* bit_constant(int value) twisti@2047: { twisti@2047: return llvm::ConstantInt::get(SharkType::bit_type(), value, false); twisti@2047: } twisti@2047: static llvm::ConstantInt* intptr_constant(intptr_t value) twisti@2047: { twisti@2047: return llvm::ConstantInt::get(SharkType::intptr_type(), value, false); twisti@2047: } twisti@2047: }; stefank@2314: stefank@2314: #endif // SHARE_VM_SHARK_LLVMVALUE_HPP