1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2011 Christoph Bumiller
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"),
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and/or sell copies of the Software, and to permit persons to whom the
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software is furnished to do so, subject to the following conditions:
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice shall be included in
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * all copies or substantial portions of the Software.
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "nv50/codegen/nv50_ir_target.h"
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace nv50_ir {
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NVC0_BUILTIN_DIV_U32 0
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NVC0_BUILTIN_DIV_S32 1
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NVC0_BUILTIN_RCP_F64 2
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NVC0_BUILTIN_RSQ_F64 3
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define NVC0_BUILTIN_COUNT 4
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgclass TargetNV50 : public Target
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgpublic:
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   TargetNV50(unsigned int chipset);
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual CodeEmitter *getCodeEmitter(Program::Type);
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool runLegalizePass(Program *, CGStage stage) const;
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual void getBuiltinCode(const uint32_t **code, uint32_t *size) const;
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual void parseDriverInfo(const struct nv50_ir_prog_info *);
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool insnCanLoad(const Instruction *insn, int s,
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            const Instruction *ld) const;
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool isOpSupported(operation, DataType) const;
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool isAccessSupported(DataFile, DataType) const;
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool isModSupported(const Instruction *, int s, Modifier) const;
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool isSatSupported(const Instruction *) const;
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual bool mayPredicate(const Instruction *, const Value *) const;
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual int getLatency(const Instruction *) const;
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual int getThroughput(const Instruction *) const;
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual unsigned int getFileSize(DataFile) const;
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual unsigned int getFileUnit(DataFile) const;
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   virtual uint32_t getSVAddress(DataFile shaderFile, const Symbol *sv) const;
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t getBuiltinOffset(int builtin) const;
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgprivate:
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   void initOpInfo();
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint16_t sysvalLocation[SV_LAST + 1];
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint8_t wposMask;
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} // namespace nv50_ir
73