aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/LLVMBuild.txt2
-rw-r--r--lib/Target/R600/AMDGPU.h48
-rw-r--r--lib/Target/R600/AMDGPU.td40
-rw-r--r--lib/Target/R600/AMDGPUAsmPrinter.cpp138
-rw-r--r--lib/Target/R600/AMDGPUAsmPrinter.h44
-rw-r--r--lib/Target/R600/AMDGPUCodeEmitter.h49
-rw-r--r--lib/Target/R600/AMDGPUConvertToISA.cpp62
-rw-r--r--lib/Target/R600/AMDGPUISelLowering.cpp417
-rw-r--r--lib/Target/R600/AMDGPUISelLowering.h144
-rw-r--r--lib/Target/R600/AMDGPUInstrInfo.cpp257
-rw-r--r--lib/Target/R600/AMDGPUInstrInfo.h149
-rw-r--r--lib/Target/R600/AMDGPUInstrInfo.td74
-rw-r--r--lib/Target/R600/AMDGPUInstructions.td190
-rw-r--r--lib/Target/R600/AMDGPUIntrinsics.td62
-rw-r--r--lib/Target/R600/AMDGPUMCInstLower.cpp77
-rw-r--r--lib/Target/R600/AMDGPUMCInstLower.h31
-rw-r--r--lib/Target/R600/AMDGPURegisterInfo.cpp51
-rw-r--r--lib/Target/R600/AMDGPURegisterInfo.h63
-rw-r--r--lib/Target/R600/AMDGPURegisterInfo.td22
-rw-r--r--lib/Target/R600/AMDGPUSubtarget.cpp87
-rw-r--r--lib/Target/R600/AMDGPUSubtarget.h65
-rw-r--r--lib/Target/R600/AMDGPUTargetMachine.cpp141
-rw-r--r--lib/Target/R600/AMDGPUTargetMachine.h70
-rw-r--r--lib/Target/R600/AMDIL.h106
-rw-r--r--lib/Target/R600/AMDIL7XXDevice.cpp115
-rw-r--r--lib/Target/R600/AMDIL7XXDevice.h72
-rw-r--r--lib/Target/R600/AMDILBase.td85
-rw-r--r--lib/Target/R600/AMDILCFGStructurizer.cpp3049
-rw-r--r--lib/Target/R600/AMDILDevice.cpp124
-rw-r--r--lib/Target/R600/AMDILDevice.h117
-rw-r--r--lib/Target/R600/AMDILDeviceInfo.cpp94
-rw-r--r--lib/Target/R600/AMDILDeviceInfo.h88
-rw-r--r--lib/Target/R600/AMDILDevices.h19
-rw-r--r--lib/Target/R600/AMDILEvergreenDevice.cpp169
-rw-r--r--lib/Target/R600/AMDILEvergreenDevice.h93
-rw-r--r--lib/Target/R600/AMDILFrameLowering.cpp47
-rw-r--r--lib/Target/R600/AMDILFrameLowering.h40
-rw-r--r--lib/Target/R600/AMDILISelDAGToDAG.cpp485
-rw-r--r--lib/Target/R600/AMDILISelLowering.cpp652
-rw-r--r--lib/Target/R600/AMDILInstrInfo.td273
-rw-r--r--lib/Target/R600/AMDILIntrinsicInfo.cpp79
-rw-r--r--lib/Target/R600/AMDILIntrinsicInfo.h49
-rw-r--r--lib/Target/R600/AMDILIntrinsics.td242
-rw-r--r--lib/Target/R600/AMDILNIDevice.cpp65
-rw-r--r--lib/Target/R600/AMDILNIDevice.h57
-rw-r--r--lib/Target/R600/AMDILPeepholeOptimizer.cpp1215
-rw-r--r--lib/Target/R600/AMDILRegisterInfo.td107
-rw-r--r--lib/Target/R600/AMDILSIDevice.cpp45
-rw-r--r--lib/Target/R600/AMDILSIDevice.h39
-rw-r--r--lib/Target/R600/CMakeLists.txt54
-rw-r--r--lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp132
-rw-r--r--lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h52
-rw-r--r--lib/Target/R600/InstPrinter/CMakeLists.txt7
-rw-r--r--lib/Target/R600/InstPrinter/LLVMBuild.txt24
-rw-r--r--lib/Target/R600/InstPrinter/Makefile15
-rw-r--r--lib/Target/R600/LLVMBuild.txt32
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp82
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp85
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h30
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h60
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp113
-rw-r--r--lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.h55
-rw-r--r--lib/Target/R600/MCTargetDesc/CMakeLists.txt10
-rw-r--r--lib/Target/R600/MCTargetDesc/LLVMBuild.txt23
-rw-r--r--lib/Target/R600/MCTargetDesc/Makefile16
-rw-r--r--lib/Target/R600/MCTargetDesc/R600MCCodeEmitter.cpp575
-rw-r--r--lib/Target/R600/MCTargetDesc/SIMCCodeEmitter.cpp292
-rw-r--r--lib/Target/R600/Makefile23
-rw-r--r--lib/Target/R600/Processors.td29
-rw-r--r--lib/Target/R600/R600Defines.h79
-rw-r--r--lib/Target/R600/R600ExpandSpecialInstrs.cpp333
-rw-r--r--lib/Target/R600/R600ISelLowering.cpp905
-rw-r--r--lib/Target/R600/R600ISelLowering.h72
-rw-r--r--lib/Target/R600/R600InstrInfo.cpp663
-rw-r--r--lib/Target/R600/R600InstrInfo.h169
-rw-r--r--lib/Target/R600/R600Instructions.td1659
-rw-r--r--lib/Target/R600/R600Intrinsics.td32
-rw-r--r--lib/Target/R600/R600MachineFunctionInfo.cpp34
-rw-r--r--lib/Target/R600/R600MachineFunctionInfo.h39
-rw-r--r--lib/Target/R600/R600RegisterInfo.cpp89
-rw-r--r--lib/Target/R600/R600RegisterInfo.h55
-rw-r--r--lib/Target/R600/R600RegisterInfo.td107
-rw-r--r--lib/Target/R600/R600Schedule.td36
-rw-r--r--lib/Target/R600/SIAssignInterpRegs.cpp152
-rw-r--r--lib/Target/R600/SIFixSGPRLiveness.cpp179
-rw-r--r--lib/Target/R600/SIISelLowering.cpp442
-rw-r--r--lib/Target/R600/SIISelLowering.h62
-rw-r--r--lib/Target/R600/SIInstrFormats.td146
-rw-r--r--lib/Target/R600/SIInstrInfo.cpp89
-rw-r--r--lib/Target/R600/SIInstrInfo.h62
-rw-r--r--lib/Target/R600/SIInstrInfo.td589
-rw-r--r--lib/Target/R600/SIInstructions.td1306
-rw-r--r--lib/Target/R600/SIIntrinsics.td42
-rw-r--r--lib/Target/R600/SILowerControlFlow.cpp191
-rw-r--r--lib/Target/R600/SILowerLiteralConstants.cpp108
-rw-r--r--lib/Target/R600/SIMachineFunctionInfo.cpp20
-rw-r--r--lib/Target/R600/SIMachineFunctionInfo.h34
-rw-r--r--lib/Target/R600/SIRegisterInfo.cpp48
-rw-r--r--lib/Target/R600/SIRegisterInfo.h47
-rw-r--r--lib/Target/R600/SIRegisterInfo.td167
-rw-r--r--lib/Target/R600/SISchedule.td15
-rw-r--r--lib/Target/R600/TargetInfo/AMDGPUTargetInfo.cpp26
-rw-r--r--lib/Target/R600/TargetInfo/CMakeLists.txt7
-rw-r--r--lib/Target/R600/TargetInfo/LLVMBuild.txt23
-rw-r--r--lib/Target/R600/TargetInfo/Makefile15
105 files changed, 19559 insertions, 1 deletions
diff --git a/lib/Target/LLVMBuild.txt b/lib/Target/LLVMBuild.txt
index eb6c779f45..f3a9c1c3e7 100644
--- a/lib/Target/LLVMBuild.txt
+++ b/lib/Target/LLVMBuild.txt
@@ -16,7 +16,7 @@
;===------------------------------------------------------------------------===;
[common]
-subdirectories = ARM CppBackend Hexagon MBlaze MSP430 NVPTX Mips PowerPC Sparc X86 XCore
+subdirectories = ARM CppBackend Hexagon MBlaze MSP430 NVPTX Mips PowerPC R600 Sparc X86 XCore
; This is a special group whose required libraries are extended (by llvm-build)
; with the best execution engine (the native JIT, if available, or the
diff --git a/lib/Target/R600/AMDGPU.h b/lib/Target/R600/AMDGPU.h
new file mode 100644
index 0000000000..40864b09dd
--- /dev/null
+++ b/lib/Target/R600/AMDGPU.h
@@ -0,0 +1,48 @@
+//===-- AMDGPU.h - MachineFunction passes hw codegen --------------*- C++ -*-=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+/// \file
+//===----------------------------------------------------------------------===//
+
+#ifndef AMDGPU_H
+#define AMDGPU_H
+
+#include "AMDGPUTargetMachine.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Target/TargetMachine.h"
+
+namespace llvm {
+
+class FunctionPass;
+class AMDGPUTargetMachine;
+
+// R600 Passes
+FunctionPass* createR600KernelParametersPass(const DataLayout *TD);
+FunctionPass *createR600ExpandSpecialInstrsPass(TargetMachine &tm);
+
+// SI Passes
+FunctionPass *createSIAssignInterpRegsPass(TargetMachine &tm);
+FunctionPass *createSILowerControlFlowPass(TargetMachine &tm);
+FunctionPass *createSICodeEmitterPass(formatted_raw_ostream &OS);
+FunctionPass *createSILowerLiteralConstantsPass(TargetMachine &tm);
+FunctionPass *createSIFixSGPRLivenessPass(TargetMachine &tm);
+
+// Passes common to R600 and SI
+FunctionPass *createAMDGPUConvertToISAPass(TargetMachine &tm);
+
+} // End namespace llvm
+
+namespace ShaderType {
+ enum Type {
+ PIXEL = 0,
+ VERTEX = 1,
+ GEOMETRY = 2,
+ COMPUTE = 3
+ };
+}
+
+#endif // AMDGPU_H
diff --git a/lib/Target/R600/AMDGPU.td b/lib/Target/R600/AMDGPU.td
new file mode 100644
index 0000000000..40f474161a
--- /dev/null
+++ b/lib/Target/R600/AMDGPU.td
@@ -0,0 +1,40 @@
+//===-- AMDIL.td - AMDIL Tablegen files --*- tablegen -*-------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//==-----------------------------------------------------------------------===//
+
+// Include AMDIL TD files
+include "AMDILBase.td"
+
+
+def AMDGPUInstrInfo : InstrInfo {
+ let guessInstructionProperties = 1;
+}
+
+//===----------------------------------------------------------------------===//
+// Declare the target which we are implementing
+//===----------------------------------------------------------------------===//
+def AMDGPUAsmWriter : AsmWriter {
+ string AsmWriterClassName = "InstPrinter";
+ int Variant = 0;
+ bit isMCAsmWriter = 1;
+}
+
+def AMDGPU : Target {
+ // Pull in Instruction Info:
+ let InstructionSet = AMDGPUInstrInfo;
+ let AssemblyWriters = [AMDGPUAsmWriter];
+}
+
+// Include AMDGPU TD files
+include "R600Schedule.td"
+include "SISchedule.td"
+include "Processors.td"
+include "AMDGPUInstrInfo.td"
+include "AMDGPUIntrinsics.td"
+include "AMDGPURegisterInfo.td"
+include "AMDGPUInstructions.td"
diff --git a/lib/Target/R600/AMDGPUAsmPrinter.cpp b/lib/Target/R600/AMDGPUAsmPrinter.cpp
new file mode 100644
index 0000000000..4553c4556c
--- /dev/null
+++ b/lib/Target/R600/AMDGPUAsmPrinter.cpp
@@ -0,0 +1,138 @@
+//===-- AMDGPUAsmPrinter.cpp - AMDGPU Assebly printer --------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+/// \file
+///
+/// The AMDGPUAsmPrinter is used to print both assembly string and also binary
+/// code. When passed an MCAsmStreamer it prints assembly and when passed
+/// an MCObjectStreamer it outputs binary code.
+//
+//===----------------------------------------------------------------------===//
+//
+
+
+#include "AMDGPUAsmPrinter.h"
+#include "AMDGPU.h"
+#include "SIMachineFunctionInfo.h"
+#include "SIRegisterInfo.h"
+#include "llvm/MC/MCStreamer.h"
+#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/Support/TargetRegistry.h"
+
+using namespace llvm;
+
+
+static AsmPrinter *createAMDGPUAsmPrinterPass(TargetMachine &tm,
+ MCStreamer &Streamer) {
+ return new AMDGPUAsmPrinter(tm, Streamer);
+}
+
+extern "C" void LLVMInitializeR600AsmPrinter() {
+ TargetRegistry::RegisterAsmPrinter(TheAMDGPUTarget, createAMDGPUAsmPrinterPass);
+}
+
+/// We need to override this function so we can avoid
+/// the call to EmitFunctionHeader(), which the MCPureStreamer can't handle.
+bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
+ const AMDGPUSubtarget &STM = TM.getSubtarget<AMDGPUSubtarget>();
+ if (STM.dumpCode()) {
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ MF.dump();
+#endif
+ }
+ SetupMachineFunction(MF);
+ OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
+ if (STM.device()->getGeneration() > AMDGPUDeviceInfo::HD6XXX) {
+ EmitProgramInfo(MF);
+ }
+ EmitFunctionBody();
+ return false;
+}
+
+void AMDGPUAsmPrinter::EmitProgramInfo(MachineFunction &MF) {
+ unsigned MaxSGPR = 0;
+ unsigned MaxVGPR = 0;
+ bool VCCUsed = false;
+ const SIRegisterInfo * RI =
+ static_cast<const SIRegisterInfo*>(TM.getRegisterInfo());
+
+ for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
+ BB != BB_E; ++BB) {
+ MachineBasicBlock &MBB = *BB;
+ for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
+ I != E; ++I) {
+ MachineInstr &MI = *I;
+
+ unsigned numOperands = MI.getNumOperands();
+ for (unsigned op_idx = 0; op_idx < numOperands; op_idx++) {
+ MachineOperand & MO = MI.getOperand(op_idx);
+ unsigned maxUsed;
+ unsigned width = 0;
+ bool isSGPR = false;
+ unsigned reg;
+ unsigned hwReg;
+ if (!MO.isReg()) {
+ continue;
+ }
+ reg = MO.getReg();
+ if (reg == AMDGPU::VCC) {
+ VCCUsed = true;
+ continue;
+ }
+ switch (reg) {
+ default: break;
+ case AMDGPU::EXEC:
+ case AMDGPU::SI_LITERAL_CONSTANT:
+ case AMDGPU::SREG_LIT_0:
+ case AMDGPU::M0:
+ continue;
+ }
+
+ if (AMDGPU::SReg_32RegClass.contains(reg)) {
+ isSGPR = true;
+ width = 1;
+ } else if (AMDGPU::VReg_32RegClass.contains(reg)) {
+ isSGPR = false;
+ width = 1;
+ } else if (AMDGPU::SReg_64RegClass.contains(reg)) {
+ isSGPR = true;
+ width = 2;
+ } else if (AMDGPU::VReg_64RegClass.contains(reg)) {
+ isSGPR = false;
+ width = 2;
+ } else if (AMDGPU::SReg_128RegClass.contains(reg)) {
+ isSGPR = true;
+ width = 4;
+ } else if (AMDGPU::VReg_128RegClass.contains(reg)) {
+ isSGPR = false;
+ width = 4;
+ } else if (AMDGPU::SReg_256RegClass.contains(reg)) {
+ isSGPR = true;
+ width = 8;
+ } else {
+ assert(!"Unknown register class");
+ }
+ hwReg = RI->getEncodingValue(reg);
+ maxUsed = hwReg + width - 1;
+ if (isSGPR) {
+ MaxSGPR = maxUsed > MaxSGPR ? maxUsed : MaxSGPR;
+ } else {
+ MaxVGPR = maxUsed > MaxVGPR ? maxUsed : MaxVGPR;
+ }
+ }
+ }
+ }
+ if (VCCUsed) {
+ MaxSGPR += 2;
+ }
+ SIMachineFunctionInfo * MFI = MF.getInfo<SIMachineFunctionInfo>();
+ OutStreamer.EmitIntValue(MaxSGPR + 1, 4);
+ OutStreamer.EmitIntValue(MaxVGPR + 1, 4);
+ OutStreamer.EmitIntValue(MFI->SPIPSInputAddr, 4);
+}
diff --git a/lib/Target/R600/AMDGPUAsmPrinter.h b/lib/Target/R600/AMDGPUAsmPrinter.h
new file mode 100644
index 0000000000..3812282b17
--- /dev/null
+++ b/lib/Target/R60