aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-hir-map.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-01-03 15:51:42 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-01-03 15:51:42 +0000
commit41cdd94998955b80d03d7f5dd9c5b51571ef8113 (patch)
treeed4bdc1b91a2291fe3ecc15de4388e989b8873ca /gcc/rust/util/rust-hir-map.h
parent69f6be3ee483c9895b4b5187a44b3e1c8be2ba63 (diff)
downloadgcc-41cdd94998955b80d03d7f5dd9c5b51571ef8113.zip
gcc-41cdd94998955b80d03d7f5dd9c5b51571ef8113.tar.gz
gcc-41cdd94998955b80d03d7f5dd9c5b51571ef8113.tar.bz2
Add missing bitwise lang items for operator overloading
This adds the missing bitwise lang items: - bitand: libcore/ops/bit.rs - bitor: libcore/ops/bit.rs - bitxor: libcore/ops/bit.rs - shl: libcore/ops/bit.rs - shr: libcore/ops/bit.rs - bitand_assign: libcore/ops/bit.rs - bitor_assign: libcore/ops/bit.rs - bitxor_assign: libcore/ops/bit.rs - shl_assign: libcore/ops/bit.rs - shr_assign: libcore/ops/bit.rs Addresses #742
Diffstat (limited to 'gcc/rust/util/rust-hir-map.h')
-rw-r--r--gcc/rust/util/rust-hir-map.h101
1 files changed, 91 insertions, 10 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index f1f723b..3ed3d47 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -41,6 +41,11 @@ public:
MULTIPLY,
DIVIDE,
REMAINDER,
+ BITAND,
+ BITOR,
+ BITXOR,
+ SHL,
+ SHR,
NEGATION,
NOT,
@@ -50,6 +55,11 @@ public:
MUL_ASSIGN,
DIV_ASSIGN,
REM_ASSIGN,
+ BITAND_ASSIGN,
+ BITOR_ASSIGN,
+ BITXOR_ASSIGN,
+ SHL_ASSIGN,
+ SHR_ASSIGN,
DEREF,
@@ -78,6 +88,26 @@ public:
{
return ItemType::REMAINDER;
}
+ else if (item.compare ("bitand") == 0)
+ {
+ return ItemType::BITAND;
+ }
+ else if (item.compare ("bitor") == 0)
+ {
+ return ItemType::BITOR;
+ }
+ else if (item.compare ("bitxor") == 0)
+ {
+ return ItemType::BITXOR;
+ }
+ else if (item.compare ("shl") == 0)
+ {
+ return ItemType::SHL;
+ }
+ else if (item.compare ("shr") == 0)
+ {
+ return ItemType::SHR;
+ }
else if (item.compare ("neg") == 0)
{
return ItemType::NEGATION;
@@ -106,6 +136,26 @@ public:
{
return ItemType::REM_ASSIGN;
}
+ else if (item.compare ("bitand_assign") == 0)
+ {
+ return ItemType::BITAND_ASSIGN;
+ }
+ else if (item.compare ("bitor_assign") == 0)
+ {
+ return ItemType::BITOR_ASSIGN;
+ }
+ else if (item.compare ("bitxor_assign") == 0)
+ {
+ return ItemType::BITXOR_ASSIGN;
+ }
+ else if (item.compare ("shl_assign") == 0)
+ {
+ return ItemType::SHL_ASSIGN;
+ }
+ else if (item.compare ("shr_assign") == 0)
+ {
+ return ItemType::SHR_ASSIGN;
+ }
else if (item.compare ("deref") == 0)
{
return ItemType::DEREF;
@@ -128,6 +178,16 @@ public:
return "div";
case REMAINDER:
return "rem";
+ case BITAND:
+ return "bitand";
+ case BITOR:
+ return "bitor";
+ case BITXOR:
+ return "bitxor";
+ case SHL:
+ return "shl";
+ case SHR:
+ return "shr";
case NEGATION:
return "neg";
case NOT:
@@ -142,11 +202,21 @@ public:
return "div_assign";
case REM_ASSIGN:
return "rem_assign";
+ case BITAND_ASSIGN:
+ return "bitand_assign";
+ case BITOR_ASSIGN:
+ return "bitor_assign";
+ case BITXOR_ASSIGN:
+ return "bitxor_assign";
+ case SHL_ASSIGN:
+ return "shl_assign";
+ case SHR_ASSIGN:
+ return "shr_assign";
case DEREF:
return "deref";
case UNKNOWN:
- break;
+ return "<UNKNOWN>";
}
return "<UNKNOWN>";
}
@@ -165,9 +235,16 @@ public:
return ItemType::DIVIDE;
case ArithmeticOrLogicalOperator::MODULUS:
return ItemType::REMAINDER;
-
- default:
- return ItemType::UNKNOWN;
+ case ArithmeticOrLogicalOperator::BITWISE_AND:
+ return ItemType::BITAND;
+ case ArithmeticOrLogicalOperator::BITWISE_OR:
+ return ItemType::BITOR;
+ case ArithmeticOrLogicalOperator::BITWISE_XOR:
+ return ItemType::BITXOR;
+ case ArithmeticOrLogicalOperator::LEFT_SHIFT:
+ return ItemType::SHL;
+ case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
+ return ItemType::SHR;
}
return ItemType::UNKNOWN;
}
@@ -187,9 +264,16 @@ public:
return ItemType::DIV_ASSIGN;
case ArithmeticOrLogicalOperator::MODULUS:
return ItemType::REM_ASSIGN;
-
- default:
- return ItemType::UNKNOWN;
+ case ArithmeticOrLogicalOperator::BITWISE_AND:
+ return ItemType::BITAND_ASSIGN;
+ case ArithmeticOrLogicalOperator::BITWISE_OR:
+ return ItemType::BITOR_ASSIGN;
+ case ArithmeticOrLogicalOperator::BITWISE_XOR:
+ return ItemType::BITXOR_ASSIGN;
+ case ArithmeticOrLogicalOperator::LEFT_SHIFT:
+ return ItemType::SHL_ASSIGN;
+ case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
+ return ItemType::SHR_ASSIGN;
}
return ItemType::UNKNOWN;
}
@@ -202,9 +286,6 @@ public:
return ItemType::NEGATION;
case NegationOperator::NOT:
return ItemType::NOT;
-
- default:
- return ItemType::UNKNOWN;
}
return ItemType::UNKNOWN;
}