|
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 SymbianUtils.BasicTypes; |
|
21 using SymbianStructuresLib.Arm.Registers; |
|
22 using SymbianStructuresLib.Arm.Instructions; |
|
23 using SymbianInstructionLib.Arm.Instructions.Common; |
|
24 |
|
25 namespace SymbianInstructionLib.Arm.Instructions.Thumb.DataTransfer |
|
26 { |
|
27 [ArmRef( "A7.1.29 LDR (2)", "LDR <Rd>, [<Rn>, <Rm>]" )] |
|
28 [ArmRef( "A7.1.59 STR (2)", "STR <Rd>, [<Rn>, <Rm>]" )] |
|
29 public class Thumb_LoadOrStore_Register : Thumb_LoadOrStore |
|
30 { |
|
31 #region Constructors |
|
32 public Thumb_LoadOrStore_Register() |
|
33 { |
|
34 // Type Rm Rn Rd |
|
35 base.SetMask( "0101" + "#" + "00" + "###" + "###" + "###" ); |
|
36 } |
|
37 #endregion |
|
38 |
|
39 #region From ArmBaseInstruction |
|
40 protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister ) |
|
41 { |
|
42 bool ret = false; |
|
43 // |
|
44 TArmDataTransferType type = this.DataTransferType; |
|
45 if ( type == TArmDataTransferType.EStore ) |
|
46 { |
|
47 // STR <Rd>, [<Rn>, <Rm>] |
|
48 // Rd = dest, Rn, Rm are source registers |
|
49 TArmRegisterType regN = this.Rn; |
|
50 TArmRegisterType regM = this.Rm; |
|
51 ret = ( aRegister == regN || aRegister == regM ); |
|
52 } |
|
53 else if ( type == TArmDataTransferType.ELoad ) |
|
54 { |
|
55 // LDR <Rd>, [<Rn>, <Rm>] |
|
56 // Rd = source, Rn, Rm are destination registers |
|
57 TArmRegisterType regD = this.Rd; |
|
58 ret = ( aRegister == regD ); |
|
59 } |
|
60 // |
|
61 return ret; |
|
62 } |
|
63 |
|
64 protected override bool DoQueryInvolvementAsDestination( TArmRegisterType aRegister ) |
|
65 { |
|
66 bool ret = false; |
|
67 // |
|
68 TArmDataTransferType type = this.DataTransferType; |
|
69 if ( type == TArmDataTransferType.EStore ) |
|
70 { |
|
71 // STR <Rd>, [<Rn>, <Rm>] |
|
72 // Rd = dest, Rn, Rm are source registers |
|
73 TArmRegisterType regD = this.Rd; |
|
74 ret = ( aRegister == regD ); |
|
75 } |
|
76 else if ( type == TArmDataTransferType.ELoad ) |
|
77 { |
|
78 // LDR <Rd>, [<Rn>, <Rm>] |
|
79 // Rd = source, Rn, Rm are destination registers |
|
80 TArmRegisterType regN = this.Rn; |
|
81 TArmRegisterType regM = this.Rm; |
|
82 ret = ( aRegister == regN || aRegister == regM ); |
|
83 } |
|
84 // |
|
85 return ret; |
|
86 } |
|
87 #endregion |
|
88 |
|
89 #region Framework API |
|
90 public override TArmDataTransferType DataTransferType |
|
91 { |
|
92 get |
|
93 { |
|
94 TArmDataTransferType ret = (TArmDataTransferType) base.AIRawValue[ 11 ]; |
|
95 return ret; |
|
96 } |
|
97 } |
|
98 |
|
99 public override TArmRegisterType Rd |
|
100 { |
|
101 get |
|
102 { |
|
103 TArmRegisterType ret = (TArmRegisterType) Thumb_LoadOrStore.KBits2To0.Apply( base.AIRawValue ); |
|
104 return ret; |
|
105 } |
|
106 } |
|
107 |
|
108 public TArmRegisterType Rn |
|
109 { |
|
110 get |
|
111 { |
|
112 TArmRegisterType ret = (TArmRegisterType) Thumb_LoadOrStore.KBits5To3.Apply( base.AIRawValue ); |
|
113 return ret; |
|
114 } |
|
115 } |
|
116 |
|
117 public TArmRegisterType Rm |
|
118 { |
|
119 get |
|
120 { |
|
121 TArmRegisterType ret = (TArmRegisterType) KMaskRm.Apply( base.AIRawValue ); |
|
122 return ret; |
|
123 } |
|
124 } |
|
125 #endregion |
|
126 |
|
127 #region Properties |
|
128 #endregion |
|
129 |
|
130 #region Internal methods |
|
131 #endregion |
|
132 |
|
133 #region Data members |
|
134 private static readonly SymMask KMaskRm = new SymMask( 0x1C0, SymMask.TShiftDirection.ERight, 6 ); |
|
135 #endregion |
|
136 } |
|
137 } |
|
138 |