Help save net neutrality! Learn more.
Close

[r403]: / cmajor++ / Llvm / Llvm.Ir / Constant.hpp  Maximize  Restore  History

Download this file

153 lines (118 with data), 4.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*========================================================================
Copyright (c) 2012-2013 Seppo Laakko
http://sourceforge.net/projects/cmajor/
Distributed under the GNU General Public License, version 3 (GPLv3).
(See accompanying LICENSE.txt or http://www.gnu.org/licenses/gpl.html)
========================================================================*/
#ifndef LLVM_IR_CONSTANT_INCLUDED
#define LLVM_IR_CONSTANT_INCLUDED
#include <Llvm.Ir/Object.hpp>
namespace Llvm { namespace Ir {
class Constant: public Object
{
public:
Constant(const std::string& valueName_, TypePtr type_);
virtual bool IsConstant() const { return true; }
virtual void InitTo(Emitter& emitter, TypePtr type, ObjectPtr to);
virtual void InitFrom(Emitter& emitter, TypePtr type, Constant& constant);
virtual void InitFrom(Emitter& emitter, TypePtr type, Global& global);
virtual void InitFrom(Emitter& emitter, TypePtr type, RegVar& regVar);
virtual void InitFrom(Emitter& emitter, TypePtr type, StackVar& stackVar);
virtual void InitFrom(Emitter& emitter, TypePtr type, MemberVar& memberVar);
virtual void InitFrom(Emitter& emitter, TypePtr type, RefVar& refVar);
virtual void InitFrom(Emitter& emitter, TypePtr type, Parameter& parameter);
virtual void AssignTo(Emitter& emitter, TypePtr type, ObjectPtr to);
virtual void AssignFrom(Emitter& emitter, TypePtr type, Constant& constant);
virtual void AssignFrom(Emitter& emitter, TypePtr type, Global& global);
virtual void AssignFrom(Emitter& emitter, TypePtr type, RegVar& regVar);
virtual void AssignFrom(Emitter& emitter, TypePtr type, StackVar& stackVar);
virtual void AssignFrom(Emitter& emitter, TypePtr type, MemberVar& memberVar);
virtual void AssignFrom(Emitter& emitter, TypePtr type, RefVar& refVar);
virtual void AssignFrom(Emitter& emitter, TypePtr type, Parameter& parameter);
};
ObjectPtr CreateConstant(const std::string& name, TypePtr type);
class BooleanConstant: public Constant
{
public:
BooleanConstant(bool value_);
};
ObjectPtr True();
ObjectPtr False();
ObjectPtr CreateBooleanConstant(bool value);
class CharConstant: public Constant
{
public:
CharConstant(char value_);
};
ObjectPtr CreateCharConstant(char value);
class StringConstant: public Constant
{
public:
StringConstant(const std::string& value_);
};
ObjectPtr CreateStringConstant(const std::string& value);
class NullConstant: public Constant
{
public:
NullConstant(TypePtr ptrType_);
virtual bool IsNull() const { return true; }
};
ObjectPtr Null(TypePtr ptrType);
class I8Constant: public Constant
{
public:
I8Constant(int value_);
};
ObjectPtr CreateI8Constant(int value);
class I16Constant: public Constant
{
public:
I16Constant(int value_);
};
class I32Constant: public Constant
{
public:
I32Constant(int value_);
};
typedef unsigned int uint;
class UI32Constant: public Constant
{
public:
UI32Constant(uint value_);
};
ObjectPtr CreateI8Constant(int value);
ObjectPtr CreateI16Constant(int value);
ObjectPtr CreateI32Constant(int value);
ObjectPtr CreateUI32Constant(uint value);
typedef unsigned long long ui64;
typedef long long i64;
class I64Constant: public Constant
{
public:
I64Constant(i64 value_);
};
ObjectPtr CreateI64Constant(i64 value);
class UI64Constant: public Constant
{
public:
UI64Constant(ui64 value_);
};
ObjectPtr CreateUI64Constant(ui64 value);
class FloatConstant: public Constant
{
public:
FloatConstant(float value_);
};
ObjectPtr CreateFloatConstant(float value);
class DoubleConstant: public Constant
{
public:
DoubleConstant(double value_);
};
ObjectPtr CreateDoubleConstant(double value);
std::string MakeStringConstantName(const std::string& s);
std::string MakeStringConstantName(const std::string& s, bool metadataSyntax);
void ConstantInit();
void ConstantDone();
} } // namespace Llvm::Ir
#endif // LLVM_IR_CONSTANT_INCLUDED