mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
Add support for ~ operator on constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc5d414823
commit
30780ccf15
@ -125,6 +125,12 @@ private:
|
||||
ConstRules &operator=(const ConstRules &); // Do not implement
|
||||
};
|
||||
|
||||
// Unary operators...
|
||||
inline Constant *operator~(const Constant &V) {
|
||||
assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
|
||||
return ConstRules::get(V, V)->op_xor(&V,
|
||||
ConstantInt::getAllOnesValue(V.getType()));
|
||||
}
|
||||
|
||||
// Standard binary operators...
|
||||
inline Constant *operator+(const Constant &V1, const Constant &V2) {
|
||||
|
@ -125,6 +125,12 @@ private:
|
||||
ConstRules &operator=(const ConstRules &); // Do not implement
|
||||
};
|
||||
|
||||
// Unary operators...
|
||||
inline Constant *operator~(const Constant &V) {
|
||||
assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
|
||||
return ConstRules::get(V, V)->op_xor(&V,
|
||||
ConstantInt::getAllOnesValue(V.getType()));
|
||||
}
|
||||
|
||||
// Standard binary operators...
|
||||
inline Constant *operator+(const Constant &V1, const Constant &V2) {
|
||||
|
@ -125,6 +125,12 @@ private:
|
||||
ConstRules &operator=(const ConstRules &); // Do not implement
|
||||
};
|
||||
|
||||
// Unary operators...
|
||||
inline Constant *operator~(const Constant &V) {
|
||||
assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
|
||||
return ConstRules::get(V, V)->op_xor(&V,
|
||||
ConstantInt::getAllOnesValue(V.getType()));
|
||||
}
|
||||
|
||||
// Standard binary operators...
|
||||
inline Constant *operator+(const Constant &V1, const Constant &V2) {
|
||||
|
Loading…
Reference in New Issue
Block a user