1/* libs/pixelflinger/codeflinger/ARMAssemblerProxy.cpp
2**
3** Copyright 2006, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18
19#include <stdint.h>
20#include <sys/types.h>
21
22#include "codeflinger/ARMAssemblerProxy.h"
23
24namespace android {
25
26// ----------------------------------------------------------------------------
27
28ARMAssemblerProxy::ARMAssemblerProxy()
29    : mTarget(0)
30{
31}
32
33ARMAssemblerProxy::ARMAssemblerProxy(ARMAssemblerInterface* target)
34    : mTarget(target)
35{
36}
37
38ARMAssemblerProxy::~ARMAssemblerProxy()
39{
40    delete mTarget;
41}
42
43void ARMAssemblerProxy::setTarget(ARMAssemblerInterface* target)
44{
45    delete mTarget;
46    mTarget = target;
47}
48
49void ARMAssemblerProxy::reset() {
50    mTarget->reset();
51}
52int ARMAssemblerProxy::generate(const char* name) {
53    return mTarget->generate(name);
54}
55void ARMAssemblerProxy::disassemble(const char* name) {
56    return mTarget->disassemble(name);
57}
58int ARMAssemblerProxy::getCodegenArch()
59{
60    return mTarget->getCodegenArch();
61}
62void ARMAssemblerProxy::prolog() {
63    mTarget->prolog();
64}
65void ARMAssemblerProxy::epilog(uint32_t touched) {
66    mTarget->epilog(touched);
67}
68void ARMAssemblerProxy::comment(const char* string) {
69    mTarget->comment(string);
70}
71
72
73
74// addressing modes
75
76bool ARMAssemblerProxy::isValidImmediate(uint32_t immed)
77{
78    return mTarget->isValidImmediate(immed);
79}
80
81int ARMAssemblerProxy::buildImmediate(uint32_t i, uint32_t& rot, uint32_t& imm)
82{
83    return mTarget->buildImmediate(i, rot, imm);
84}
85
86
87
88uint32_t ARMAssemblerProxy::imm(uint32_t immediate)
89{
90    return mTarget->imm(immediate);
91}
92
93uint32_t ARMAssemblerProxy::reg_imm(int Rm, int type, uint32_t shift)
94{
95    return mTarget->reg_imm(Rm, type, shift);
96}
97
98uint32_t ARMAssemblerProxy::reg_rrx(int Rm)
99{
100    return mTarget->reg_rrx(Rm);
101}
102
103uint32_t ARMAssemblerProxy::reg_reg(int Rm, int type, int Rs)
104{
105    return mTarget->reg_reg(Rm, type, Rs);
106}
107
108
109// addressing modes...
110// LDR(B)/STR(B)/PLD
111// (immediate and Rm can be negative, which indicates U=0)
112uint32_t ARMAssemblerProxy::immed12_pre(int32_t immed12, int W)
113{
114    return mTarget->immed12_pre(immed12, W);
115}
116
117uint32_t ARMAssemblerProxy::immed12_post(int32_t immed12)
118{
119    return mTarget->immed12_post(immed12);
120}
121
122uint32_t ARMAssemblerProxy::reg_scale_pre(int Rm, int type, uint32_t shift, int W)
123{
124    return mTarget->reg_scale_pre(Rm, type, shift, W);
125}
126
127uint32_t ARMAssemblerProxy::reg_scale_post(int Rm, int type, uint32_t shift)
128{
129    return mTarget->reg_scale_post(Rm, type, shift);
130}
131
132
133// LDRH/LDRSB/LDRSH/STRH
134// (immediate and Rm can be negative, which indicates U=0)
135uint32_t ARMAssemblerProxy::immed8_pre(int32_t immed8, int W)
136{
137    return mTarget->immed8_pre(immed8, W);
138}
139
140uint32_t ARMAssemblerProxy::immed8_post(int32_t immed8)
141{
142    return mTarget->immed8_post(immed8);
143}
144
145uint32_t ARMAssemblerProxy::reg_pre(int Rm, int W)
146{
147    return mTarget->reg_pre(Rm, W);
148}
149
150uint32_t ARMAssemblerProxy::reg_post(int Rm)
151{
152    return mTarget->reg_post(Rm);
153}
154
155
156//------------------------------------------------------------------------
157
158
159
160void ARMAssemblerProxy::dataProcessing( int opcode, int cc, int s,
161                                        int Rd, int Rn, uint32_t Op2)
162{
163    mTarget->dataProcessing(opcode, cc, s, Rd, Rn, Op2);
164}
165
166void ARMAssemblerProxy::MLA(int cc, int s, int Rd, int Rm, int Rs, int Rn) {
167    mTarget->MLA(cc, s, Rd, Rm, Rs, Rn);
168}
169void ARMAssemblerProxy::MUL(int cc, int s, int Rd, int Rm, int Rs) {
170    mTarget->MUL(cc, s, Rd, Rm, Rs);
171}
172void ARMAssemblerProxy::UMULL(int cc, int s,
173            int RdLo, int RdHi, int Rm, int Rs) {
174    mTarget->UMULL(cc, s, RdLo, RdHi, Rm, Rs);
175}
176void ARMAssemblerProxy::UMUAL(int cc, int s,
177            int RdLo, int RdHi, int Rm, int Rs) {
178    mTarget->UMUAL(cc, s, RdLo, RdHi, Rm, Rs);
179}
180void ARMAssemblerProxy::SMULL(int cc, int s,
181            int RdLo, int RdHi, int Rm, int Rs) {
182    mTarget->SMULL(cc, s, RdLo, RdHi, Rm, Rs);
183}
184void ARMAssemblerProxy::SMUAL(int cc, int s,
185            int RdLo, int RdHi, int Rm, int Rs) {
186    mTarget->SMUAL(cc, s, RdLo, RdHi, Rm, Rs);
187}
188
189void ARMAssemblerProxy::B(int cc, uint32_t* pc) {
190    mTarget->B(cc, pc);
191}
192void ARMAssemblerProxy::BL(int cc, uint32_t* pc) {
193    mTarget->BL(cc, pc);
194}
195void ARMAssemblerProxy::BX(int cc, int Rn) {
196    mTarget->BX(cc, Rn);
197}
198void ARMAssemblerProxy::label(const char* theLabel) {
199    mTarget->label(theLabel);
200}
201void ARMAssemblerProxy::B(int cc, const char* label) {
202    mTarget->B(cc, label);
203}
204void ARMAssemblerProxy::BL(int cc, const char* label) {
205    mTarget->BL(cc, label);
206}
207
208uint32_t* ARMAssemblerProxy::pcForLabel(const char* label) {
209    return mTarget->pcForLabel(label);
210}
211
212void ARMAssemblerProxy::LDR(int cc, int Rd, int Rn, uint32_t offset) {
213    mTarget->LDR(cc, Rd, Rn, offset);
214}
215void ARMAssemblerProxy::LDRB(int cc, int Rd, int Rn, uint32_t offset) {
216    mTarget->LDRB(cc, Rd, Rn, offset);
217}
218void ARMAssemblerProxy::STR(int cc, int Rd, int Rn, uint32_t offset) {
219    mTarget->STR(cc, Rd, Rn, offset);
220}
221void ARMAssemblerProxy::STRB(int cc, int Rd, int Rn, uint32_t offset) {
222    mTarget->STRB(cc, Rd, Rn, offset);
223}
224void ARMAssemblerProxy::LDRH(int cc, int Rd, int Rn, uint32_t offset) {
225    mTarget->LDRH(cc, Rd, Rn, offset);
226}
227void ARMAssemblerProxy::LDRSB(int cc, int Rd, int Rn, uint32_t offset) {
228    mTarget->LDRSB(cc, Rd, Rn, offset);
229}
230void ARMAssemblerProxy::LDRSH(int cc, int Rd, int Rn, uint32_t offset) {
231    mTarget->LDRSH(cc, Rd, Rn, offset);
232}
233void ARMAssemblerProxy::STRH(int cc, int Rd, int Rn, uint32_t offset) {
234    mTarget->STRH(cc, Rd, Rn, offset);
235}
236void ARMAssemblerProxy::LDM(int cc, int dir, int Rn, int W, uint32_t reg_list) {
237    mTarget->LDM(cc, dir, Rn, W, reg_list);
238}
239void ARMAssemblerProxy::STM(int cc, int dir, int Rn, int W, uint32_t reg_list) {
240    mTarget->STM(cc, dir, Rn, W, reg_list);
241}
242
243void ARMAssemblerProxy::SWP(int cc, int Rn, int Rd, int Rm) {
244    mTarget->SWP(cc, Rn, Rd, Rm);
245}
246void ARMAssemblerProxy::SWPB(int cc, int Rn, int Rd, int Rm) {
247    mTarget->SWPB(cc, Rn, Rd, Rm);
248}
249void ARMAssemblerProxy::SWI(int cc, uint32_t comment) {
250    mTarget->SWI(cc, comment);
251}
252
253
254void ARMAssemblerProxy::PLD(int Rn, uint32_t offset) {
255    mTarget->PLD(Rn, offset);
256}
257void ARMAssemblerProxy::CLZ(int cc, int Rd, int Rm) {
258    mTarget->CLZ(cc, Rd, Rm);
259}
260void ARMAssemblerProxy::QADD(int cc, int Rd, int Rm, int Rn) {
261    mTarget->QADD(cc, Rd, Rm, Rn);
262}
263void ARMAssemblerProxy::QDADD(int cc, int Rd, int Rm, int Rn) {
264    mTarget->QDADD(cc, Rd, Rm, Rn);
265}
266void ARMAssemblerProxy::QSUB(int cc, int Rd, int Rm, int Rn) {
267    mTarget->QSUB(cc, Rd, Rm, Rn);
268}
269void ARMAssemblerProxy::QDSUB(int cc, int Rd, int Rm, int Rn) {
270    mTarget->QDSUB(cc, Rd, Rm, Rn);
271}
272void ARMAssemblerProxy::SMUL(int cc, int xy, int Rd, int Rm, int Rs) {
273    mTarget->SMUL(cc, xy, Rd, Rm, Rs);
274}
275void ARMAssemblerProxy::SMULW(int cc, int y, int Rd, int Rm, int Rs) {
276    mTarget->SMULW(cc, y, Rd, Rm, Rs);
277}
278void ARMAssemblerProxy::SMLA(int cc, int xy, int Rd, int Rm, int Rs, int Rn) {
279    mTarget->SMLA(cc, xy, Rd, Rm, Rs, Rn);
280}
281void ARMAssemblerProxy::SMLAL(  int cc, int xy,
282                                int RdHi, int RdLo, int Rs, int Rm) {
283    mTarget->SMLAL(cc, xy, RdHi, RdLo, Rs, Rm);
284}
285void ARMAssemblerProxy::SMLAW(int cc, int y, int Rd, int Rm, int Rs, int Rn) {
286    mTarget->SMLAW(cc, y, Rd, Rm, Rs, Rn);
287}
288
289void ARMAssemblerProxy::UXTB16(int cc, int Rd, int Rm, int rotate) {
290    mTarget->UXTB16(cc, Rd, Rm, rotate);
291}
292
293void ARMAssemblerProxy::UBFX(int cc, int Rd, int Rn, int lsb, int width) {
294    mTarget->UBFX(cc, Rd, Rn, lsb, width);
295}
296
297}; // namespace android
298
299