forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AMDGPU: Add skeleton GlobalIsel implementation
Summary: This adds the necessary target code to be able to run the ir translator. Lowering function arguments and returns is a nop and there is no support for RegBankSelect. Reviewers: arsenm, qcolombet Subscribers: arsenm, joker.eph, vkalintiris, llvm-commits Differential Revision: http://reviews.llvm.org/D19077 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266356 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
407de62
commit 65b5541
Showing
7 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===-- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp - Call lowering ---===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// This file implements the lowering of LLVM calls to machine code calls for | ||
/// GlobalISel. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "AMDGPUCallLowering.h" | ||
#include "AMDGPUISelLowering.h" | ||
|
||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" | ||
#include "llvm/CodeGen/MachineInstrBuilder.h" | ||
|
||
using namespace llvm; | ||
|
||
#ifndef LLVM_BUILD_GLOBAL_ISEL | ||
#error "This shouldn't be built without GISel" | ||
#endif | ||
|
||
AMDGPUCallLowering::AMDGPUCallLowering(const AMDGPUTargetLowering &TLI) | ||
: CallLowering(&TLI) { | ||
} | ||
|
||
bool AMDGPUCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, | ||
const Value *Val, unsigned VReg) const { | ||
return true; | ||
} | ||
|
||
bool AMDGPUCallLowering::lowerFormalArguments( | ||
MachineIRBuilder &MIRBuilder, const Function::ArgumentListType &Args, | ||
const SmallVectorImpl<unsigned> &VRegs) const { | ||
// TODO: Implement once there are generic loads/stores. | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//===- lib/Target/AMDGPU/AMDGPUCallLowering.h - Call lowering -*- C++ -*---===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// This file describes how to lower LLVM calls to machine code calls. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H | ||
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H | ||
|
||
#include "llvm/CodeGen/GlobalISel/CallLowering.h" | ||
|
||
namespace llvm { | ||
|
||
class AMDGPUTargetLowering; | ||
|
||
class AMDGPUCallLowering: public CallLowering { | ||
public: | ||
AMDGPUCallLowering(const AMDGPUTargetLowering &TLI); | ||
|
||
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, | ||
unsigned VReg) const override; | ||
bool | ||
lowerFormalArguments(MachineIRBuilder &MIRBuilder, | ||
const Function::ArgumentListType &Args, | ||
const SmallVectorImpl<unsigned> &VRegs) const override; | ||
}; | ||
} // End of namespace llvm; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; RUN: llc -march=amdgcn -mcpu=fiji -O0 -stop-after=irtranslator -global-isel %s -o - 2>&1 | FileCheck %s | ||
; REQUIRES: global-isel | ||
; This file checks that the translation from llvm IR to generic MachineInstr | ||
; is correct. | ||
|
||
; Tests for add. | ||
; CHECK: name: addi32 | ||
; CHECK: G_ADD i32 | ||
define i32 @addi32(i32 %arg1, i32 %arg2) { | ||
%res = add i32 %arg1, %arg2 | ||
ret i32 %res | ||
} |