Home | History | Annotate | Download | only in llvm
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ART_COMPILER_LLVM_BACKEND_TYPES_H_
     18 #define ART_COMPILER_LLVM_BACKEND_TYPES_H_
     19 
     20 #include "base/logging.h"
     21 
     22 
     23 namespace art {
     24 namespace llvm {
     25 
     26 
     27 enum JType {
     28   kVoid,
     29   kBoolean,
     30   kByte,
     31   kChar,
     32   kShort,
     33   kInt,
     34   kLong,
     35   kFloat,
     36   kDouble,
     37   kObject,
     38   MAX_JTYPE
     39 };
     40 
     41 enum TBAASpecialType {
     42   kTBAARegister,
     43   kTBAAStackTemp,
     44   kTBAAHeapArray,
     45   kTBAAHeapInstance,
     46   kTBAAHeapStatic,
     47   kTBAAJRuntime,
     48   kTBAARuntimeInfo,
     49   kTBAAShadowFrame,
     50   kTBAAConstJObject,
     51   MAX_TBAA_SPECIAL_TYPE
     52 };
     53 
     54 
     55 enum ExpectCond {
     56   kLikely,
     57   kUnlikely,
     58   MAX_EXPECT
     59 };
     60 
     61 
     62 inline JType GetJTypeFromShorty(char shorty_jty) {
     63   switch (shorty_jty) {
     64   case 'V':
     65     return kVoid;
     66 
     67   case 'Z':
     68     return kBoolean;
     69 
     70   case 'B':
     71     return kByte;
     72 
     73   case 'C':
     74     return kChar;
     75 
     76   case 'S':
     77     return kShort;
     78 
     79   case 'I':
     80     return kInt;
     81 
     82   case 'J':
     83     return kLong;
     84 
     85   case 'F':
     86     return kFloat;
     87 
     88   case 'D':
     89     return kDouble;
     90 
     91   case 'L':
     92     return kObject;
     93 
     94   default:
     95     LOG(FATAL) << "Unknown Dalvik shorty descriptor: " << shorty_jty;
     96     return kVoid;
     97   }
     98 }
     99 
    100 }  // namespace llvm
    101 }  // namespace art
    102 
    103 
    104 #endif  // ART_COMPILER_LLVM_BACKEND_TYPES_H_
    105