crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianInstructionLib/Arm/Instructions/Arm/DataProcessing/Arm_DataProcessing_Shift_Immediate.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Text;
       
    20 using System.ComponentModel;
       
    21 using SymbianUtils.BasicTypes;
       
    22 using SymbianStructuresLib.Arm.Registers;
       
    23 using SymbianInstructionLib.Arm.Instructions.Common;
       
    24 
       
    25 namespace SymbianInstructionLib.Arm.Instructions.Arm.DataProcessing
       
    26 {
       
    27     public class Arm_DataProcessing_Shift_Immediate : Arm_DataProcessing_Shift
       
    28     {
       
    29         #region Constructors
       
    30         public Arm_DataProcessing_Shift_Immediate()
       
    31             : base( TEncoding.EEncodingShiftsImmediate )
       
    32         {
       
    33             //             Cond             Op.      S       Rn       Rd  shift_imm    shift            Rm
       
    34             base.SetMask( "####" + "000" + "####" + "#" + "####" + "####" + "#####" +   "##" + "0" + "####" );
       
    35         }
       
    36         #endregion
       
    37 
       
    38         #region From Arm_DataProcessing
       
    39         public override bool SuppliesImmediate
       
    40         {
       
    41             get { return true; }
       
    42         }
       
    43 
       
    44         public override uint Immediate
       
    45         {
       
    46             get
       
    47             {
       
    48                 byte ret = base.AIRawValue[ 11, 7 ];
       
    49 
       
    50                 TShiftType type = base.ShiftType;
       
    51 
       
    52                 // Some of the shift types use a value of 0 to mean 32 bits.
       
    53                 if ( type == TShiftType.EShiftLogicalRight && ret == 0 )
       
    54                 {
       
    55                     ret = 32;
       
    56                 }
       
    57                 else if ( type == TShiftType.EShiftArithmeticRight && ret == 0 )
       
    58                 {
       
    59                     ret = 32;
       
    60                 }
       
    61 
       
    62                 return ret;
       
    63             }
       
    64         }
       
    65         #endregion
       
    66 
       
    67         #region Properties
       
    68         public override TShiftType ShiftType
       
    69         {
       
    70             get
       
    71             {
       
    72                 TShiftType type = base.ShiftType;
       
    73                 
       
    74                 // Some of the immediate values can actually alter the shift types.
       
    75                 uint immediate = Immediate;
       
    76                 if ( immediate == 0 && type == TShiftType.EShiftRotateRight )
       
    77                 {
       
    78                     // Rotate right by 32 bits is the same as an RRX.
       
    79                     type = TShiftType.EShiftRotateRightWithExtend;
       
    80                 }
       
    81                 else if ( immediate == 0 && type == TShiftType.EShiftLogicalLeft )
       
    82                 {
       
    83                     // LSL of 0 is actually not a shift.
       
    84                     type = TShiftType.EShiftNone;
       
    85                 }
       
    86 
       
    87                 return type;
       
    88             }
       
    89         }
       
    90         #endregion
       
    91 
       
    92         #region Internal methods
       
    93         #endregion
       
    94 
       
    95         #region Data members
       
    96         #endregion
       
    97     }
       
    98 }
       
    99