radeon/llvm: Remove the EXPORT_REG instruction
This commit is contained in:
@@ -115,7 +115,6 @@ static void llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
|
|||||||
unsigned chan;
|
unsigned chan;
|
||||||
for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
|
for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
|
||||||
LLVMValueRef output;
|
LLVMValueRef output;
|
||||||
LLVMValueRef store_output;
|
|
||||||
unsigned adjusted_reg_idx = i +
|
unsigned adjusted_reg_idx = i +
|
||||||
ctx->reserved_reg_count;
|
ctx->reserved_reg_count;
|
||||||
LLVMValueRef reg_index = lp_build_const_int32(
|
LLVMValueRef reg_index = lp_build_const_int32(
|
||||||
@@ -125,16 +124,11 @@ static void llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
|
|||||||
output = LLVMBuildLoad(base->gallivm->builder,
|
output = LLVMBuildLoad(base->gallivm->builder,
|
||||||
ctx->soa.outputs[i][chan], "");
|
ctx->soa.outputs[i][chan], "");
|
||||||
|
|
||||||
store_output = lp_build_intrinsic_binary(
|
lp_build_intrinsic_binary(
|
||||||
base->gallivm->builder,
|
base->gallivm->builder,
|
||||||
"llvm.AMDGPU.store.output",
|
"llvm.AMDGPU.store.output",
|
||||||
base->elem_type,
|
|
||||||
output, reg_index);
|
|
||||||
|
|
||||||
lp_build_intrinsic_unary(base->gallivm->builder,
|
|
||||||
"llvm.AMDGPU.export.reg",
|
|
||||||
LLVMVoidTypeInContext(base->gallivm->context),
|
LLVMVoidTypeInContext(base->gallivm->context),
|
||||||
store_output);
|
output, reg_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ namespace llvm {
|
|||||||
class AMDGPUTargetMachine;
|
class AMDGPUTargetMachine;
|
||||||
|
|
||||||
FunctionPass *createR600CodeEmitterPass(formatted_raw_ostream &OS);
|
FunctionPass *createR600CodeEmitterPass(formatted_raw_ostream &OS);
|
||||||
FunctionPass *createR600LowerShaderInstructionsPass(TargetMachine &tm);
|
|
||||||
FunctionPass *createR600LowerInstructionsPass(TargetMachine &tm);
|
FunctionPass *createR600LowerInstructionsPass(TargetMachine &tm);
|
||||||
|
|
||||||
FunctionPass *createSIAssignInterpRegsPass(TargetMachine &tm);
|
FunctionPass *createSIAssignInterpRegsPass(TargetMachine &tm);
|
||||||
|
@@ -35,13 +35,6 @@ class AMDGPUShaderInst <dag outs, dag ins, string asm, list<dag> pattern>
|
|||||||
|
|
||||||
let isCodeGenOnly = 1 in {
|
let isCodeGenOnly = 1 in {
|
||||||
|
|
||||||
def EXPORT_REG : AMDGPUShaderInst <
|
|
||||||
(outs),
|
|
||||||
(ins GPRF32:$src),
|
|
||||||
"EXPORT_REG $src",
|
|
||||||
[(int_AMDGPU_export_reg GPRF32:$src)]
|
|
||||||
>;
|
|
||||||
|
|
||||||
def MASK_WRITE : AMDGPUShaderInst <
|
def MASK_WRITE : AMDGPUShaderInst <
|
||||||
(outs),
|
(outs),
|
||||||
(ins GPRF32:$src),
|
(ins GPRF32:$src),
|
||||||
|
@@ -13,11 +13,10 @@
|
|||||||
|
|
||||||
let TargetPrefix = "AMDGPU", isTarget = 1 in {
|
let TargetPrefix = "AMDGPU", isTarget = 1 in {
|
||||||
|
|
||||||
def int_AMDGPU_export_reg : Intrinsic<[], [llvm_float_ty], []>;
|
|
||||||
def int_AMDGPU_load_const : Intrinsic<[llvm_float_ty], [llvm_i32_ty], []>;
|
def int_AMDGPU_load_const : Intrinsic<[llvm_float_ty], [llvm_i32_ty], []>;
|
||||||
def int_AMDGPU_load_imm : Intrinsic<[llvm_v4f32_ty], [llvm_i32_ty], []>;
|
def int_AMDGPU_load_imm : Intrinsic<[llvm_v4f32_ty], [llvm_i32_ty], []>;
|
||||||
def int_AMDGPU_reserve_reg : Intrinsic<[], [llvm_i32_ty], []>;
|
def int_AMDGPU_reserve_reg : Intrinsic<[], [llvm_i32_ty], []>;
|
||||||
def int_AMDGPU_store_output : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_i32_ty], []>;
|
def int_AMDGPU_store_output : Intrinsic<[], [llvm_float_ty, llvm_i32_ty], []>;
|
||||||
def int_AMDGPU_swizzle : Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_i32_ty], []>;
|
def int_AMDGPU_swizzle : Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_i32_ty], []>;
|
||||||
|
|
||||||
def int_AMDGPU_arl : Intrinsic<[llvm_i32_ty], [llvm_float_ty], []>;
|
def int_AMDGPU_arl : Intrinsic<[llvm_i32_ty], [llvm_float_ty], []>;
|
||||||
|
@@ -128,7 +128,6 @@ bool AMDGPUPassConfig::addPreRegAlloc() {
|
|||||||
const AMDILSubtarget &ST = TM->getSubtarget<AMDILSubtarget>();
|
const AMDILSubtarget &ST = TM->getSubtarget<AMDILSubtarget>();
|
||||||
|
|
||||||
if (ST.device()->getGeneration() <= AMDILDeviceInfo::HD6XXX) {
|
if (ST.device()->getGeneration() <= AMDILDeviceInfo::HD6XXX) {
|
||||||
PM->add(createR600LowerShaderInstructionsPass(*TM));
|
|
||||||
PM->add(createR600LowerInstructionsPass(*TM));
|
PM->add(createR600LowerInstructionsPass(*TM));
|
||||||
} else {
|
} else {
|
||||||
PM->add(createSILowerShaderInstructionsPass(*TM));
|
PM->add(createSILowerShaderInstructionsPass(*TM));
|
||||||
|
@@ -30,7 +30,6 @@ bool llvm::isPlaceHolderOpcode(unsigned opcode)
|
|||||||
{
|
{
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
default: return false;
|
default: return false;
|
||||||
case AMDIL::EXPORT_REG:
|
|
||||||
case AMDIL::RETURN:
|
case AMDIL::RETURN:
|
||||||
case AMDIL::LOAD_INPUT:
|
case AMDIL::LOAD_INPUT:
|
||||||
case AMDIL::LAST:
|
case AMDIL::LAST:
|
||||||
|
@@ -50,7 +50,6 @@ CPP_SOURCES := \
|
|||||||
R600InstrInfo.cpp \
|
R600InstrInfo.cpp \
|
||||||
R600KernelParameters.cpp \
|
R600KernelParameters.cpp \
|
||||||
R600LowerInstructions.cpp \
|
R600LowerInstructions.cpp \
|
||||||
R600LowerShaderInstructions.cpp \
|
|
||||||
R600MachineFunctionInfo.cpp \
|
R600MachineFunctionInfo.cpp \
|
||||||
R600RegisterInfo.cpp \
|
R600RegisterInfo.cpp \
|
||||||
SIAssignInterpRegs.cpp \
|
SIAssignInterpRegs.cpp \
|
||||||
|
@@ -100,13 +100,12 @@ MachineBasicBlock * R600TargetLowering::EmitInstrWithCustomInserter(
|
|||||||
case AMDIL::STORE_OUTPUT:
|
case AMDIL::STORE_OUTPUT:
|
||||||
{
|
{
|
||||||
MachineBasicBlock::iterator I = *MI;
|
MachineBasicBlock::iterator I = *MI;
|
||||||
int64_t OutputIndex = MI->getOperand(2).getImm();
|
int64_t OutputIndex = MI->getOperand(1).getImm();
|
||||||
unsigned OutputReg = AMDIL::R600_TReg32RegClass.getRegister(OutputIndex);
|
unsigned OutputReg = AMDIL::R600_TReg32RegClass.getRegister(OutputIndex);
|
||||||
|
|
||||||
BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDIL::COPY), OutputReg)
|
BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDIL::COPY), OutputReg)
|
||||||
.addOperand(MI->getOperand(1));
|
.addOperand(MI->getOperand(0));
|
||||||
|
|
||||||
MRI.replaceRegWith(MI->getOperand(0).getReg(), OutputReg);
|
|
||||||
if (!MRI.isLiveOut(OutputReg)) {
|
if (!MRI.isLiveOut(OutputReg)) {
|
||||||
MRI.addLiveOut(OutputReg);
|
MRI.addLiveOut(OutputReg);
|
||||||
}
|
}
|
||||||
|
@@ -1006,10 +1006,10 @@ def RESERVE_REG : AMDGPUShaderInst <
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
def STORE_OUTPUT: AMDGPUShaderInst <
|
def STORE_OUTPUT: AMDGPUShaderInst <
|
||||||
(outs R600_Reg32:$dst),
|
(outs),
|
||||||
(ins R600_Reg32:$src0, i32imm:$src1),
|
(ins R600_Reg32:$src0, i32imm:$src1),
|
||||||
"STORE_OUTPUT $dst, $src0, $src1",
|
"STORE_OUTPUT $src0, $src1",
|
||||||
[(set R600_Reg32:$dst, (int_AMDGPU_store_output R600_Reg32:$src0, imm:$src1))]
|
[(int_AMDGPU_store_output R600_Reg32:$src0, imm:$src1)]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
} // End usesCustomInserter = 1, isPseudo = 1
|
} // End usesCustomInserter = 1, isPseudo = 1
|
||||||
|
@@ -1,90 +0,0 @@
|
|||||||
//===-- R600LowerShaderInstructions.cpp - TODO: Add brief description -------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// TODO: Add full description
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#include "AMDGPU.h"
|
|
||||||
#include "AMDGPUUtil.h"
|
|
||||||
#include "AMDIL.h"
|
|
||||||
#include "AMDILInstrInfo.h"
|
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
||||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
|
||||||
|
|
||||||
using namespace llvm;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
class R600LowerShaderInstructionsPass : public MachineFunctionPass {
|
|
||||||
|
|
||||||
private:
|
|
||||||
static char ID;
|
|
||||||
TargetMachine &TM;
|
|
||||||
MachineRegisterInfo * MRI;
|
|
||||||
|
|
||||||
void lowerEXPORT_REG_FAKE(MachineInstr &MI, MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I);
|
|
||||||
|
|
||||||
public:
|
|
||||||
R600LowerShaderInstructionsPass(TargetMachine &tm) :
|
|
||||||
MachineFunctionPass(ID), TM(tm) { }
|
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &MF);
|
|
||||||
|
|
||||||
const char *getPassName() const { return "R600 Lower Shader Instructions"; }
|
|
||||||
};
|
|
||||||
} /* End anonymous namespace */
|
|
||||||
|
|
||||||
char R600LowerShaderInstructionsPass::ID = 0;
|
|
||||||
|
|
||||||
FunctionPass *llvm::createR600LowerShaderInstructionsPass(TargetMachine &tm) {
|
|
||||||
return new R600LowerShaderInstructionsPass(tm);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INSTR_CASE_FLOAT_V(inst) \
|
|
||||||
case AMDIL:: inst##_v4f32: \
|
|
||||||
|
|
||||||
#define INSTR_CASE_FLOAT_S(inst) \
|
|
||||||
case AMDIL:: inst##_f32:
|
|
||||||
|
|
||||||
#define INSTR_CASE_FLOAT(inst) \
|
|
||||||
INSTR_CASE_FLOAT_V(inst) \
|
|
||||||
INSTR_CASE_FLOAT_S(inst)
|
|
||||||
bool R600LowerShaderInstructionsPass::runOnMachineFunction(MachineFunction &MF)
|
|
||||||
{
|
|
||||||
MRI = &MF.getRegInfo();
|
|
||||||
|
|
||||||
|
|
||||||
for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
|
|
||||||
BB != BB_E; ++BB) {
|
|
||||||
MachineBasicBlock &MBB = *BB;
|
|
||||||
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end();) {
|
|
||||||
MachineInstr &MI = *I;
|
|
||||||
bool deleteInstr = false;
|
|
||||||
switch (MI.getOpcode()) {
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
|
|
||||||
case AMDIL::EXPORT_REG:
|
|
||||||
deleteInstr = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
++I;
|
|
||||||
|
|
||||||
if (deleteInstr) {
|
|
||||||
MI.eraseFromParent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
Reference in New Issue
Block a user