|
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 public abstract class Thumb_LoadOrStore : ThumbInstruction |
|
28 { |
|
29 #region Constructors |
|
30 protected Thumb_LoadOrStore() |
|
31 { |
|
32 base.AIGroup = SymbianStructuresLib.Arm.Instructions.TArmInstructionGroup.EGroupDataTransfer; |
|
33 } |
|
34 #endregion |
|
35 |
|
36 #region From ArmBaseInstruction |
|
37 protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister ) |
|
38 { |
|
39 bool ret = false; |
|
40 // |
|
41 TArmDataTransferType type = this.DataTransferType; |
|
42 if ( type == TArmDataTransferType.EStore ) |
|
43 { |
|
44 // STR <Rd>, [<Rn>, #<immed_5> * 4] |
|
45 // Rd = dest, Rn is source |
|
46 // |
|
47 // Cannot test here, requires derived class to implement this check |
|
48 } |
|
49 else if ( type == TArmDataTransferType.ELoad ) |
|
50 { |
|
51 // LDR <Rd>, [<Rn>, #<immed_5> * 4] |
|
52 // LDR <Rd>, [<Rn>, <Rm>] |
|
53 // LDR <Rd>, [PC, #<immed_8> * 4] |
|
54 // LDR <Rd>, [SP, #<immed_8> * 4] |
|
55 TArmRegisterType reg = this.Rd; |
|
56 ret = ( reg == aRegister ); |
|
57 } |
|
58 // |
|
59 return ret; |
|
60 } |
|
61 |
|
62 protected override bool DoQueryInvolvementAsDestination( TArmRegisterType aRegister ) |
|
63 { |
|
64 bool ret = false; |
|
65 // |
|
66 TArmDataTransferType type = this.DataTransferType; |
|
67 if ( type == TArmDataTransferType.EStore ) |
|
68 { |
|
69 // STR <Rd>, [<Rn>, #<immed_5> * 4] |
|
70 // Rd = dest, Rn is source |
|
71 TArmRegisterType reg = this.Rd; |
|
72 ret = ( reg == aRegister ); |
|
73 } |
|
74 else if ( type == TArmDataTransferType.ELoad ) |
|
75 { |
|
76 // LDR <Rd>, [<Rn>, #<immed_5> * 4] |
|
77 // LDR <Rd>, [<Rn>, <Rm>] |
|
78 // LDR <Rd>, [PC, #<immed_8> * 4] |
|
79 // LDR <Rd>, [SP, #<immed_8> * 4] |
|
80 // |
|
81 // Cannot test here, requires derived class to implement this check |
|
82 } |
|
83 // |
|
84 return ret; |
|
85 } |
|
86 #endregion |
|
87 |
|
88 #region Framework API |
|
89 public abstract TArmDataTransferType DataTransferType |
|
90 { |
|
91 get; |
|
92 } |
|
93 |
|
94 public abstract TArmRegisterType Rd |
|
95 { |
|
96 get; |
|
97 } |
|
98 #endregion |
|
99 |
|
100 #region Properties |
|
101 #endregion |
|
102 |
|
103 #region Internal methods |
|
104 protected static readonly SymMask KBits2To0 = new SymMask( 0x7 ); |
|
105 protected static readonly SymMask KBits5To3 = new SymMask( 0x38 ); |
|
106 #endregion |
|
107 |
|
108 #region Data members |
|
109 #endregion |
|
110 } |
|
111 } |
|
112 |