Overall clean up of gbc_expander and intrinsics.

Change-Id: I4afbafbaa3f2ecb82a55e609b3f276225c06f117
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc
index c176c4e..31fc9cf 100644
--- a/src/compiler/codegen/MethodBitcode.cc
+++ b/src/compiler/codegen/MethodBitcode.cc
@@ -1777,10 +1777,8 @@
 {
   if (bb->blockType == kDead) return false;
   llvm::BasicBlock* llvmBB = getLLVMBlock(cUnit, bb->id);
-  if (llvmBB != NULL) {
-    cUnit->irb->SetInsertPoint(llvmBB);
-    setDexOffset(cUnit, bb->startOffset);
-  }
+  cUnit->irb->SetInsertPoint(llvmBB);
+  setDexOffset(cUnit, bb->startOffset);
 
   if (cUnit->printMe) {
     LOG(INFO) << "................................";
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index 89dcf1d..d482526 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -43,6 +43,10 @@
 
 using art::greenland::IntrinsicHelper;
 
+namespace art {
+extern char remapShorty(char shortyType);
+};
+
 namespace {
 
 class GBCExpanderPass : public llvm::FunctionPass {
@@ -2490,13 +2494,7 @@
 
   char ret_shorty = shorty[0];
 #if defined(ART_USE_QUICK_COMPILER)
-  switch(ret_shorty) {
-    case 'Z' : ret_shorty = 'I'; break;
-    case 'B' : ret_shorty = 'I'; break;
-    case 'S' : ret_shorty = 'I'; break;
-    case 'C' : ret_shorty = 'I'; break;
-    default: break;
-  }
+  ret_shorty = art::remapShorty(ret_shorty);
 #endif
   llvm::Type* ret_type = irb_.getJType(ret_shorty, kAccurate);
 
@@ -2511,14 +2509,7 @@
 
   for (uint32_t i = 1; i < shorty_size; ++i) {
 #if defined(ART_USE_QUICK_COMPILER)
-    char shorty_type = shorty[i];
-    switch(shorty_type) {
-      case 'Z' : shorty_type = 'I'; break;
-      case 'B' : shorty_type = 'I'; break;
-      case 'S' : shorty_type = 'I'; break;
-      case 'C' : shorty_type = 'I'; break;
-      default: break;
-    }
+    char shorty_type = art::remapShorty(shorty[i]);
     args_type.push_back(irb_.getJType(shorty_type, kAccurate));
 #else
     args_type.push_back(irb_.getJType(shorty[i], kAccurate));
@@ -2653,13 +2644,7 @@
   // Emit the code to return default value (zero) for the given return type.
   char ret_shorty = oat_compilation_unit_->GetShorty()[0];
 #if defined(ART_USE_QUICK_COMPILER)
-  switch(ret_shorty) {
-    case 'Z' : ret_shorty = 'I'; break;
-    case 'B' : ret_shorty = 'I'; break;
-    case 'S' : ret_shorty = 'I'; break;
-    case 'C' : ret_shorty = 'I'; break;
-    default: break;
-  }
+  ret_shorty = art::remapShorty(ret_shorty);
 #endif
   if (ret_shorty == 'V') {
     irb_.CreateRetVoid();
@@ -3521,16 +3506,6 @@
                                 call_inst.getArgOperand(1));
     }
 
-    //==- Switch -----------------------------------------------------------==//
-    case IntrinsicHelper::SparseSwitch: {
-      // Nothing to be done.
-      return NULL;
-    }
-    case IntrinsicHelper::PackedSwitch: {
-      // Nothing to be done.
-      return NULL;
-    }
-
     //==- Const ------------------------------------------------------------==//
     case IntrinsicHelper::ConstInt:
     case IntrinsicHelper::ConstLong: {
@@ -3551,7 +3526,8 @@
 
     //==- Method Info ------------------------------------------------------==//
     case IntrinsicHelper::MethodInfo: {
-      // Nothing to be done.
+      // Nothing to be done, because MethodInfo carries optional hints that are
+      // not needed by the portable path.
       return NULL;
     }
 
@@ -3636,6 +3612,7 @@
 } // anonymous namespace
 
 namespace art {
+
 namespace compiler_llvm {
 
 llvm::FunctionPass*
diff --git a/src/greenland/intrinsic_func_list.def b/src/greenland/intrinsic_func_list.def
index e2faaf5..8ea69fe 100644
--- a/src/greenland/intrinsic_func_list.def
+++ b/src/greenland/intrinsic_func_list.def
@@ -1611,23 +1611,6 @@
                           _EXPAND_ARG2(kInt64Ty, kInt64Ty))
 
 //----------------------------------------------------------------------------
-// Switch
-//----------------------------------------------------------------------------
-// void sparse_switch(int, int)
-_EVAL_DEF_INTRINSICS_FUNC(SparseSwitch,
-                          dex_lang_sparse_switch,
-                          kAttrReadOnly | kAttrNoThrow,
-                          kVoidTy,
-                          _EXPAND_ARG2(kInt32Ty, kInt32Ty))
-
-// void packed_switch(int, int)
-_EVAL_DEF_INTRINSICS_FUNC(PackedSwitch,
-                          dex_lang_packed_switch,
-                          kAttrReadOnly | kAttrNoThrow,
-                          kVoidTy,
-                          _EXPAND_ARG2(kInt32Ty, kInt32Ty))
-
-//----------------------------------------------------------------------------
 // Const intrinsics to assist MIR to Greenland_ir conversion.  Should not materialize
 // For simplicity, all use integer input
 //----------------------------------------------------------------------------