summaryrefslogtreecommitdiff
path: root/src/mir
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-01-08 09:48:19 +0800
committerJohn Hodge <tpg@mutabah.net>2017-01-08 09:48:19 +0800
commit3f047e495793a1eed8244b96bc0dddff275cd19c (patch)
treea53112cc7ecfd414b1832a8a1a28c4643c100b46 /src/mir
parentaf7089cec53828533462af5349e861f7d524d22e (diff)
downloadmrust-3f047e495793a1eed8244b96bc0dddff275cd19c.tar.gz
All - i128/u182 support, typecheck and parse fixes
Diffstat (limited to 'src/mir')
-rw-r--r--src/mir/check.cpp2
-rw-r--r--src/mir/cleanup.cpp2
-rw-r--r--src/mir/from_hir.cpp3
-rw-r--r--src/mir/from_hir_match.cpp10
4 files changed, 17 insertions, 0 deletions
diff --git a/src/mir/check.cpp b/src/mir/check.cpp
index 8a350f3c..0dce004e 100644
--- a/src/mir/check.cpp
+++ b/src/mir/check.cpp
@@ -477,6 +477,7 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize:
good = true;
break;
@@ -496,6 +497,7 @@ void MIR_Validate(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize:
case ::HIR::CoreType::Char:
good = true;
diff --git a/src/mir/cleanup.cpp b/src/mir/cleanup.cpp
index aded2beb..0cfe2bda 100644
--- a/src/mir/cleanup.cpp
+++ b/src/mir/cleanup.cpp
@@ -315,12 +315,14 @@ const ::HIR::Literal* MIR_Cleanup_GetConstant(const Span& sp, const StaticTraitR
{
case ::HIR::CoreType::Char:
case ::HIR::CoreType::Usize:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::U64:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U8:
return ::MIR::Constant::make_Uint( lit.as_Integer() );
case ::HIR::CoreType::Isize:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::I64:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I16:
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index 6eb91386..6abf3508 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -983,6 +983,7 @@ namespace {
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize:
BUG(node.span(), "`-` operator on unsigned integer - " << ty_val);
break;
@@ -1611,6 +1612,7 @@ namespace {
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize:
m_builder.set_result(node.span(), ::MIR::RValue( ::MIR::Constant(e.m_value) ));
break;
@@ -1618,6 +1620,7 @@ namespace {
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize:
m_builder.set_result(node.span(), ::MIR::RValue( ::MIR::Constant( static_cast<int64_t>(e.m_value) ) ));
break;
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index 620fd368..227c46f3 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -535,6 +535,7 @@ void PatternRulesetBuilder::append_from_lit(const Span& sp, const ::HIR::Literal
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize: {
ASSERT_BUG(sp, lit.is_Integer(), "Matching integer type with non-integer literal - " << lit);
uint64_t val = lit.as_Integer();
@@ -544,6 +545,7 @@ void PatternRulesetBuilder::append_from_lit(const Span& sp, const ::HIR::Literal
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize: {
ASSERT_BUG(sp, lit.is_Integer(), "Matching integer type with non-integer literal - " << lit);
int64_t val = static_cast<int64_t>( lit.as_Integer() );
@@ -825,6 +827,7 @@ void PatternRulesetBuilder::append_from(const Span& sp, const ::HIR::Pattern& pa
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize: {
uint64_t start = H::get_pattern_value_int(sp, pat, pe.start);
uint64_t end = H::get_pattern_value_int(sp, pat, pe.end );
@@ -834,6 +837,7 @@ void PatternRulesetBuilder::append_from(const Span& sp, const ::HIR::Pattern& pa
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize: {
int64_t start = H::get_pattern_value_int(sp, pat, pe.start);
int64_t end = H::get_pattern_value_int(sp, pat, pe.end );
@@ -865,6 +869,7 @@ void PatternRulesetBuilder::append_from(const Span& sp, const ::HIR::Pattern& pa
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize: {
uint64_t val = H::get_pattern_value_int(sp, pat, pe.val);
this->push_rule( PatternRule::make_Value( ::MIR::Constant(val) ) );
@@ -873,6 +878,7 @@ void PatternRulesetBuilder::append_from(const Span& sp, const ::HIR::Pattern& pa
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize: {
int64_t val = H::get_pattern_value_int(sp, pat, pe.val);
this->push_rule( PatternRule::make_Value( ::MIR::Constant(val) ) );
@@ -1547,6 +1553,7 @@ int MIR_LowerHIR_Match_Simple__GeneratePattern(MirBuilder& builder, const Span&
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize:
TU_MATCH_DEF( PatternRule, (rule), (re),
(
@@ -1569,6 +1576,7 @@ int MIR_LowerHIR_Match_Simple__GeneratePattern(MirBuilder& builder, const Span&
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize:
TU_MATCH_DEF( PatternRule, (rule), (re),
(
@@ -3160,6 +3168,7 @@ void DecisionTreeGen::generate_tree_code(
case ::HIR::CoreType::U16:
case ::HIR::CoreType::U32:
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::U128:
case ::HIR::CoreType::Usize:
ASSERT_BUG(sp, node.m_branches.is_Unsigned(), "Tree for unsigned isn't a _Unsigned - node="<<node);
this->generate_branches_Unsigned(sp, node.m_default, node.m_branches.as_Unsigned(), ty, mv$(val), mv$(and_then));
@@ -3168,6 +3177,7 @@ void DecisionTreeGen::generate_tree_code(
case ::HIR::CoreType::I16:
case ::HIR::CoreType::I32:
case ::HIR::CoreType::I64:
+ case ::HIR::CoreType::I128:
case ::HIR::CoreType::Isize:
ASSERT_BUG(sp, node.m_branches.is_Signed(), "Tree for unsigned isn't a _Signed - node="<<node);
this->generate_branches_Signed(sp, node.m_default, node.m_branches.as_Signed(), ty, mv$(val), mv$(and_then));