2 * Copyright 2011 Christoph Bumiller
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 #include "nv50_ir_target.h"
25 #include "nv50_ir_driver.h"
28 #include "nv50/nv50_program.h"
29 #include "nv50/nv50_debug.h"
34 Modifier::Modifier(operation op
)
37 case OP_NEG
: bits
= NV50_IR_MOD_NEG
; break;
38 case OP_ABS
: bits
= NV50_IR_MOD_ABS
; break;
39 case OP_SAT
: bits
= NV50_IR_MOD_SAT
; break;
40 case OP_NOT
: bits
= NV50_IR_MOD_NOT
; break;
47 Modifier
Modifier::operator*(const Modifier m
) const
52 if (this->bits
& NV50_IR_MOD_ABS
)
53 b
&= ~NV50_IR_MOD_NEG
;
55 a
= (this->bits
^ b
) & (NV50_IR_MOD_NOT
| NV50_IR_MOD_NEG
);
56 c
= (this->bits
| m
.bits
) & (NV50_IR_MOD_ABS
| NV50_IR_MOD_SAT
);
58 return Modifier(a
| c
);
61 ValueRef::ValueRef(Value
*v
) : value(NULL
), insn(NULL
)
69 ValueRef::ValueRef(const ValueRef
& ref
) : value(NULL
), insn(ref
.insn
)
72 usedAsPtr
= ref
.usedAsPtr
;
80 ImmediateValue
*ValueRef::getImmediate() const
85 if (src
->reg
.file
== FILE_IMMEDIATE
)
88 Instruction
*insn
= src
->getUniqueInsn();
90 src
= (insn
&& insn
->op
== OP_MOV
) ? insn
->getSrc(0) : NULL
;
95 ValueDef::ValueDef(Value
*v
) : value(NULL
), insn(NULL
)
100 ValueDef::ValueDef(const ValueDef
& def
) : value(NULL
), insn(NULL
)
105 ValueDef::~ValueDef()
111 ValueRef::set(const ValueRef
&ref
)
113 this->set(ref
.get());
115 indirect
[0] = ref
.indirect
[0];
116 indirect
[1] = ref
.indirect
[1];
120 ValueRef::set(Value
*refVal
)
125 value
->uses
.remove(this);
127 refVal
->uses
.push_back(this);
133 ValueDef::set(Value
*defVal
)
138 value
->defs
.remove(this);
140 defVal
->defs
.push_back(this);
145 // Check if we can replace this definition's value by the value in @rep,
146 // including the source modifiers, i.e. make sure that all uses support
149 ValueDef::mayReplace(const ValueRef
&rep
)
154 if (!insn
|| !insn
->bb
) // Unbound instruction ?
157 const Target
*target
= insn
->bb
->getProgram()->getTarget();
159 for (Value::UseIterator it
= value
->uses
.begin(); it
!= value
->uses
.end();
161 Instruction
*insn
= (*it
)->getInsn();
164 for (int i
= 0; insn
->srcExists(i
); ++i
) {
165 if (insn
->src(i
).get() == value
) {
166 // If there are multiple references to us we'd have to check if the
167 // combination of mods is still supported, but just bail for now.
168 if (&insn
->src(i
) != (*it
))
173 assert(s
>= 0); // integrity of uses list
175 if (!target
->isModSupported(insn
, s
, rep
.mod
))
182 ValueDef::replace(const ValueRef
&repVal
, bool doSet
)
184 assert(mayReplace(repVal
));
186 if (value
== repVal
.get())
189 while (!value
->uses
.empty()) {
190 ValueRef
*ref
= value
->uses
.front();
191 ref
->set(repVal
.get());
192 ref
->mod
*= repVal
.mod
;
202 memset(®
, 0, sizeof(reg
));
207 Value::coalesce(Value
*jval
, bool force
)
209 Value
*repr
= this->join
; // new representative
210 Value
*jrep
= jval
->join
;
212 if (reg
.file
!= jval
->reg
.file
|| reg
.size
!= jval
->reg
.size
) {
215 ERROR("forced coalescing of values of different sizes/files");
218 if (!force
&& (repr
->reg
.data
.id
!= jrep
->reg
.data
.id
)) {
219 if (repr
->reg
.data
.id
>= 0 &&
220 jrep
->reg
.data
.id
>= 0)
222 if (jrep
->reg
.data
.id
>= 0) {
228 // need to check all fixed register values of the program for overlap
229 Function
*func
= defs
.front()->getInsn()->bb
->getFunction();
231 // TODO: put values in by register-id bins per function
232 ArrayList::Iterator iter
= func
->allLValues
.iterator();
233 for (; !iter
.end(); iter
.next()) {
234 Value
*fixed
= reinterpret_cast<Value
*>(iter
.get());
236 if (fixed
->reg
.data
.id
== repr
->reg
.data
.id
)
237 if (fixed
->livei
.overlaps(jrep
->livei
))
241 if (repr
->livei
.overlaps(jrep
->livei
)) {
244 // do we really want this ? if at all, only for constraint ops
245 INFO("NOTE: forced coalescing with live range overlap\n");
248 for (DefIterator it
= jrep
->defs
.begin(); it
!= jrep
->defs
.end(); ++it
)
249 (*it
)->get()->join
= repr
;
251 repr
->defs
.insert(repr
->defs
.end(),
252 jrep
->defs
.begin(), jrep
->defs
.end());
253 repr
->livei
.unify(jrep
->livei
);
255 assert(repr
->join
== repr
&& jval
->join
== repr
);
259 LValue::LValue(Function
*fn
, DataFile file
)
262 reg
.size
= (file
!= FILE_PREDICATE
) ? 4 : 1;
267 fn
->add(this, this->id
);
270 LValue::LValue(Function
*fn
, LValue
*lval
)
274 reg
.file
= lval
->reg
.file
;
275 reg
.size
= lval
->reg
.size
;
280 fn
->add(this, this->id
);
284 LValue::clone(ClonePolicy
<Function
>& pol
) const
286 LValue
*that
= new_LValue(pol
.context(), reg
.file
);
288 pol
.set
<Value
>(this, that
);
290 that
->reg
.size
= this->reg
.size
;
291 that
->reg
.type
= this->reg
.type
;
292 that
->reg
.data
= this->reg
.data
;
297 Symbol::Symbol(Program
*prog
, DataFile f
, ubyte fidx
)
302 reg
.fileIndex
= fidx
;
305 prog
->add(this, this->id
);
309 Symbol::clone(ClonePolicy
<Function
>& pol
) const
311 Program
*prog
= pol
.context()->getProgram();
313 Symbol
*that
= new_Symbol(prog
, reg
.file
, reg
.fileIndex
);
315 pol
.set
<Value
>(this, that
);
317 that
->reg
.size
= this->reg
.size
;
318 that
->reg
.type
= this->reg
.type
;
319 that
->reg
.data
= this->reg
.data
;
321 that
->baseSym
= this->baseSym
;
326 ImmediateValue::ImmediateValue(Program
*prog
, uint32_t uval
)
328 memset(®
, 0, sizeof(reg
));
330 reg
.file
= FILE_IMMEDIATE
;
336 prog
->add(this, this->id
);
339 ImmediateValue::ImmediateValue(Program
*prog
, float fval
)
341 memset(®
, 0, sizeof(reg
));
343 reg
.file
= FILE_IMMEDIATE
;
349 prog
->add(this, this->id
);
352 ImmediateValue::ImmediateValue(Program
*prog
, double dval
)
354 memset(®
, 0, sizeof(reg
));
356 reg
.file
= FILE_IMMEDIATE
;
362 prog
->add(this, this->id
);
365 ImmediateValue::ImmediateValue(const ImmediateValue
*proto
, DataType ty
)
370 reg
.size
= typeSizeof(ty
);
374 ImmediateValue::clone(ClonePolicy
<Function
>& pol
) const
376 Program
*prog
= pol
.context()->getProgram();
377 ImmediateValue
*that
= new_ImmediateValue(prog
, 0u);
379 pol
.set
<Value
>(this, that
);
381 that
->reg
.size
= this->reg
.size
;
382 that
->reg
.type
= this->reg
.type
;
383 that
->reg
.data
= this->reg
.data
;
389 ImmediateValue::isInteger(const int i
) const
393 return reg
.data
.s8
== i
;
395 return reg
.data
.u8
== i
;
397 return reg
.data
.s16
== i
;
399 return reg
.data
.u16
== i
;
402 return reg
.data
.s32
== i
; // as if ...
404 return reg
.data
.f32
== static_cast<float>(i
);
406 return reg
.data
.f64
== static_cast<double>(i
);
413 ImmediateValue::isNegative() const
416 case TYPE_S8
: return reg
.data
.s8
< 0;
417 case TYPE_S16
: return reg
.data
.s16
< 0;
419 case TYPE_U32
: return reg
.data
.s32
< 0;
420 case TYPE_F32
: return reg
.data
.u32
& (1 << 31);
421 case TYPE_F64
: return reg
.data
.u64
& (1ULL << 63);
428 ImmediateValue::isPow2() const
433 case TYPE_U32
: return util_is_power_of_two(reg
.data
.u32
);
440 ImmediateValue::applyLog2()
446 assert(!this->isNegative());
451 reg
.data
.u32
= util_logbase2(reg
.data
.u32
);
454 reg
.data
.f32
= log2f(reg
.data
.f32
);
457 reg
.data
.f64
= log2(reg
.data
.f64
);
466 ImmediateValue::compare(CondCode cc
, float fval
) const
468 if (reg
.type
!= TYPE_F32
)
469 ERROR("immediate value is not of type f32");
471 switch (static_cast<CondCode
>(cc
& 7)) {
472 case CC_TR
: return true;
473 case CC_FL
: return false;
474 case CC_LT
: return reg
.data
.f32
< fval
;
475 case CC_LE
: return reg
.data
.f32
<= fval
;
476 case CC_GT
: return reg
.data
.f32
> fval
;
477 case CC_GE
: return reg
.data
.f32
>= fval
;
478 case CC_EQ
: return reg
.data
.f32
== fval
;
479 case CC_NE
: return reg
.data
.f32
!= fval
;
487 Value::interfers(const Value
*that
) const
491 if (that
->reg
.file
!= reg
.file
|| that
->reg
.fileIndex
!= reg
.fileIndex
)
497 idA
= this->join
->reg
.data
.offset
;
498 idB
= that
->join
->reg
.data
.offset
;
500 idA
= this->join
->reg
.data
.id
* this->reg
.size
;
501 idB
= that
->join
->reg
.data
.id
* that
->reg
.size
;
505 return (idA
+ this->reg
.size
> idB
);
508 return (idB
+ that
->reg
.size
> idA
);
514 Value::equals(const Value
*that
, bool strict
) const
521 if (that
->reg
.file
!= reg
.file
|| that
->reg
.fileIndex
!= reg
.fileIndex
)
523 if (that
->reg
.size
!= this->reg
.size
)
526 if (that
->reg
.data
.id
!= this->reg
.data
.id
)
533 ImmediateValue::equals(const Value
*that
, bool strict
) const
535 const ImmediateValue
*imm
= that
->asImm();
538 return reg
.data
.u64
== imm
->reg
.data
.u64
;
542 Symbol::equals(const Value
*that
, bool strict
) const
544 if (reg
.file
!= that
->reg
.file
|| reg
.fileIndex
!= that
->reg
.fileIndex
)
546 assert(that
->asSym());
548 if (this->baseSym
!= that
->asSym()->baseSym
)
551 return this->reg
.data
.offset
== that
->reg
.data
.offset
;
554 void Instruction::init()
564 join
= terminator
= 0;
581 Instruction::Instruction()
586 dType
= sType
= TYPE_F32
;
592 Instruction::Instruction(Function
*fn
, operation opr
, DataType ty
)
602 Instruction::~Instruction()
605 Function
*fn
= bb
->getFunction();
607 fn
->allInsns
.remove(id
);
610 for (int s
= 0; srcExists(s
); ++s
)
612 // must unlink defs too since the list pointers will get deallocated
613 for (int d
= 0; defExists(d
); ++d
)
618 Instruction::setDef(int i
, Value
*val
)
620 int size
= defs
.size();
624 defs
[size
++].setInsn(this);
630 Instruction::setSrc(int s
, Value
*val
)
632 int size
= srcs
.size();
636 srcs
[size
++].setInsn(this);
642 Instruction::setSrc(int s
, const ValueRef
& ref
)
644 setSrc(s
, ref
.get());
645 srcs
[s
].mod
= ref
.mod
;
649 Instruction::swapSources(int a
, int b
)
651 Value
*value
= srcs
[a
].get();
652 Modifier m
= srcs
[a
].mod
;
661 Instruction::takeExtraSources(int s
, Value
*values
[3])
663 values
[0] = getIndirect(s
, 0);
665 setIndirect(s
, 0, NULL
);
667 values
[1] = getIndirect(s
, 1);
669 setIndirect(s
, 1, NULL
);
671 values
[2] = getPredicate();
673 setPredicate(cc
, NULL
);
677 Instruction::putExtraSources(int s
, Value
*values
[3])
680 setIndirect(s
, 0, values
[0]);
682 setIndirect(s
, 1, values
[1]);
684 setPredicate(cc
, values
[2]);
688 Instruction::clone(ClonePolicy
<Function
>& pol
, Instruction
*i
) const
691 i
= new_Instruction(pol
.context(), op
, dType
);
692 assert(typeid(*i
) == typeid(*this));
694 pol
.set
<Instruction
>(this, i
);
702 i
->saturate
= saturate
;
710 i
->perPatch
= perPatch
;
712 i
->postFactor
= postFactor
;
714 for (int d
= 0; defExists(d
); ++d
)
715 i
->setDef(d
, pol
.get(getDef(d
)));
717 for (int s
= 0; srcExists(s
); ++s
) {
718 i
->setSrc(s
, pol
.get(getSrc(s
)));
719 i
->src(s
).mod
= src(s
).mod
;
723 i
->predSrc
= predSrc
;
724 i
->flagsDef
= flagsDef
;
725 i
->flagsSrc
= flagsSrc
;
731 Instruction::defCount(unsigned int mask
) const
735 for (n
= 0, i
= 0; this->defExists(i
); ++i
, mask
>>= 1)
741 Instruction::srcCount(unsigned int mask
) const
745 for (n
= 0, i
= 0; this->srcExists(i
); ++i
, mask
>>= 1)
751 Instruction::setIndirect(int s
, int dim
, Value
*value
)
753 assert(this->srcExists(s
));
755 int p
= srcs
[s
].indirect
[dim
];
760 while (p
> 0 && !srcExists(p
- 1))
764 srcs
[p
].usedAsPtr
= (value
!= 0);
765 srcs
[s
].indirect
[dim
] = value
? p
: -1;
770 Instruction::setPredicate(CondCode ccode
, Value
*value
)
776 srcs
[predSrc
].set(NULL
);
783 predSrc
= srcs
.size();
784 while (predSrc
> 0 && !srcExists(predSrc
- 1))
788 setSrc(predSrc
, value
);
793 Instruction::writesPredicate() const
795 for (int d
= 0; defExists(d
); ++d
)
796 if (getDef(d
)->inFile(FILE_PREDICATE
) || getDef(d
)->inFile(FILE_FLAGS
))
802 insnCheckCommutation(const Instruction
*a
, const Instruction
*b
)
804 for (int d
= 0; a
->defExists(d
); ++d
)
805 for (int s
= 0; b
->srcExists(s
); ++s
)
806 if (a
->getDef(d
)->interfers(b
->getSrc(s
)))
812 Instruction::isCommutationLegal(const Instruction
*i
) const
815 ret
= ret
&& insnCheckCommutation(this, i
);
816 ret
= ret
&& insnCheckCommutation(i
, this);
820 TexInstruction::TexInstruction(Function
*fn
, operation op
)
821 : Instruction(fn
, op
, TYPE_F32
)
823 memset(&tex
, 0, sizeof(tex
));
825 tex
.rIndirectSrc
= -1;
826 tex
.sIndirectSrc
= -1;
829 TexInstruction::~TexInstruction()
831 for (int c
= 0; c
< 3; ++c
) {
838 TexInstruction::clone(ClonePolicy
<Function
>& pol
, Instruction
*i
) const
840 TexInstruction
*tex
= (i
? static_cast<TexInstruction
*>(i
) :
841 new_TexInstruction(pol
.context(), op
));
843 Instruction::clone(pol
, tex
);
845 tex
->tex
= this->tex
;
848 for (unsigned int c
= 0; c
< tex
->tex
.target
.getDim(); ++c
) {
849 tex
->dPdx
[c
].set(dPdx
[c
]);
850 tex
->dPdy
[c
].set(dPdy
[c
]);
857 const struct TexInstruction::Target::Desc
TexInstruction::Target::descTable
[] =
859 { "1D", 1, 1, false, false, false },
860 { "2D", 2, 2, false, false, false },
861 { "2D_MS", 2, 2, false, false, false },
862 { "3D", 3, 3, false, false, false },
863 { "CUBE", 2, 3, false, true, false },
864 { "1D_SHADOW", 1, 1, false, false, true },
865 { "2D_SHADOW", 2, 2, false, false, true },
866 { "CUBE_SHADOW", 2, 3, false, true, true },
867 { "1D_ARRAY", 1, 2, true, false, false },
868 { "2D_ARRAY", 2, 3, true, false, false },
869 { "2D_MS_ARRAY", 2, 3, true, false, false },
870 { "CUBE_ARRAY", 2, 4, true, true, false },
871 { "1D_ARRAY_SHADOW", 1, 2, true, false, true },
872 { "2D_ARRAY_SHADOW", 2, 3, true, false, true },
873 { "RECT", 2, 2, false, false, false },
874 { "RECT_SHADOW", 2, 2, false, false, true },
875 { "CUBE_ARRAY_SHADOW", 2, 4, true, true, true },
876 { "BUFFER", 1, 1, false, false, false },
879 CmpInstruction::CmpInstruction(Function
*fn
, operation op
)
880 : Instruction(fn
, op
, TYPE_F32
)
886 CmpInstruction::clone(ClonePolicy
<Function
>& pol
, Instruction
*i
) const
888 CmpInstruction
*cmp
= (i
? static_cast<CmpInstruction
*>(i
) :
889 new_CmpInstruction(pol
.context(), op
));
891 Instruction::clone(pol
, cmp
);
892 cmp
->setCond
= setCond
;
896 FlowInstruction::FlowInstruction(Function
*fn
, operation op
,
898 : Instruction(fn
, op
, TYPE_NONE
)
903 op
== OP_CONT
|| op
== OP_BREAK
||
904 op
== OP_RET
|| op
== OP_EXIT
)
908 terminator
= targ
? 1 : 0;
910 allWarp
= absolute
= limit
= 0;
914 FlowInstruction::clone(ClonePolicy
<Function
>& pol
, Instruction
*i
) const
916 FlowInstruction
*flow
= (i
? static_cast<FlowInstruction
*>(i
) :
917 new_FlowInstruction(pol
.context(), op
, NULL
));
919 Instruction::clone(pol
, flow
);
920 flow
->allWarp
= allWarp
;
921 flow
->absolute
= absolute
;
923 flow
->builtin
= builtin
;
926 flow
->target
.builtin
= target
.builtin
;
929 flow
->target
.fn
= target
.fn
;
932 flow
->target
.bb
= pol
.get
<BasicBlock
>(target
.bb
);
937 Program::Program(Type type
, Target
*arch
)
940 mem_Instruction(sizeof(Instruction
), 6),
941 mem_CmpInstruction(sizeof(CmpInstruction
), 4),
942 mem_TexInstruction(sizeof(TexInstruction
), 4),
943 mem_FlowInstruction(sizeof(FlowInstruction
), 4),
944 mem_LValue(sizeof(LValue
), 8),
945 mem_Symbol(sizeof(Symbol
), 7),
946 mem_ImmediateValue(sizeof(ImmediateValue
), 7)
953 main
= new Function(this, "MAIN");
960 for (ArrayList::Iterator it
= allFuncs
.iterator(); !it
.end(); it
.next())
961 delete reinterpret_cast<Function
*>(it
.get());
963 for (ArrayList::Iterator it
= allRValues
.iterator(); !it
.end(); it
.next())
964 releaseValue(reinterpret_cast<Value
*>(it
.get()));
967 void Program::releaseInstruction(Instruction
*insn
)
969 // TODO: make this not suck so much
971 insn
->~Instruction();
974 mem_CmpInstruction
.release(insn
);
977 mem_TexInstruction
.release(insn
);
980 mem_FlowInstruction
.release(insn
);
982 mem_Instruction
.release(insn
);
985 void Program::releaseValue(Value
*value
)
989 if (value
->asLValue())
990 mem_LValue
.release(value
);
993 mem_ImmediateValue
.release(value
);
996 mem_Symbol
.release(value
);
1000 } // namespace nv50_ir
1005 nv50_ir_init_prog_info(struct nv50_ir_prog_info
*info
)
1007 #if defined(PIPE_SHADER_HULL) && defined(PIPE_SHADER_DOMAIN)
1008 if (info
->type
== PIPE_SHADER_HULL
|| info
->type
== PIPE_SHADER_DOMAIN
) {
1009 info
->prop
.tp
.domain
= PIPE_PRIM_MAX
;
1010 info
->prop
.tp
.outputPrim
= PIPE_PRIM_MAX
;
1013 if (info
->type
== PIPE_SHADER_GEOMETRY
) {
1014 info
->prop
.gp
.instanceCount
= 1;
1015 info
->prop
.gp
.maxVertices
= 1;
1017 info
->io
.clipDistance
= 0xff;
1018 info
->io
.pointSize
= 0xff;
1019 info
->io
.vertexId
= 0xff;
1020 info
->io
.edgeFlagIn
= 0xff;
1021 info
->io
.edgeFlagOut
= 0xff;
1022 info
->io
.fragDepth
= 0xff;
1023 info
->io
.sampleMask
= 0xff;
1024 info
->io
.backFaceColor
[0] = info
->io
.backFaceColor
[1] = 0xff;
1028 nv50_ir_generate_code(struct nv50_ir_prog_info
*info
)
1032 nv50_ir::Program::Type type
;
1034 nv50_ir_init_prog_info(info
);
1036 #define PROG_TYPE_CASE(a, b) \
1037 case PIPE_SHADER_##a: type = nv50_ir::Program::TYPE_##b; break
1039 switch (info
->type
) {
1040 PROG_TYPE_CASE(VERTEX
, VERTEX
);
1041 // PROG_TYPE_CASE(HULL, TESSELLATION_CONTROL);
1042 // PROG_TYPE_CASE(DOMAIN, TESSELLATION_EVAL);
1043 PROG_TYPE_CASE(GEOMETRY
, GEOMETRY
);
1044 PROG_TYPE_CASE(FRAGMENT
, FRAGMENT
);
1046 type
= nv50_ir::Program::TYPE_COMPUTE
;
1049 INFO_DBG(info
->dbgFlags
, VERBOSE
, "translating program of type %u\n", type
);
1051 nv50_ir::Target
*targ
= nv50_ir::Target::create(info
->target
);
1055 nv50_ir::Program
*prog
= new nv50_ir::Program(type
, targ
);
1058 prog
->dbgFlags
= info
->dbgFlags
;
1060 switch (info
->bin
.sourceRep
) {
1066 ret
= prog
->makeFromSM4(info
) ? 0 : -2;
1071 ret
= prog
->makeFromTGSI(info
) ? 0 : -2;
1076 if (prog
->dbgFlags
& NV50_IR_DEBUG_VERBOSE
)
1079 prog
->getTarget()->runLegalizePass(prog
, nv50_ir::CG_STAGE_PRE_SSA
);
1081 prog
->convertToSSA();
1083 if (prog
->dbgFlags
& NV50_IR_DEBUG_VERBOSE
)
1086 prog
->optimizeSSA(info
->optLevel
);
1087 prog
->getTarget()->runLegalizePass(prog
, nv50_ir::CG_STAGE_SSA
);
1089 if (prog
->dbgFlags
& NV50_IR_DEBUG_BASIC
)
1092 if (!prog
->registerAllocation()) {
1096 prog
->getTarget()->runLegalizePass(prog
, nv50_ir::CG_STAGE_POST_RA
);
1098 prog
->optimizePostRA(info
->optLevel
);
1100 if (!prog
->emitBinary(info
)) {
1106 INFO_DBG(prog
->dbgFlags
, VERBOSE
, "nv50_ir_generate_code: ret = %i\n", ret
);
1108 info
->bin
.maxGPR
= prog
->maxGPR
;
1109 info
->bin
.code
= prog
->code
;
1110 info
->bin
.codeSize
= prog
->binSize
;
1113 nv50_ir::Target::destroy(targ
);