summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-09-01 20:45:41 +0000
committerTim Northover <tnorthover@apple.com>2016-09-01 20:45:41 +0000
commit8d8812c5d7e546b40e0549fd3d82f74c7f6d4ba5 (patch)
tree1dc7afdc4727c92305b1d874892b96e545d684e5 /llvm/lib
parentbc555b7ebe054eb5fde6548b299a622fad66de34 (diff)
downloadbcm5719-llvm-8d8812c5d7e546b40e0549fd3d82f74c7f6d4ba5.tar.gz
bcm5719-llvm-8d8812c5d7e546b40e0549fd3d82f74c7f6d4ba5.zip
GlobalISel: add a G_PHI instruction to give phis a type.
They're another source of generic vregs, which are going to need a type on the definition when we remove the register width from MachineRegisterInfo. llvm-svn: 280412
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp2
-rw-r--r--llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp4
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp6
3 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index a27d53941a4..f0ac16712a5 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -405,7 +405,7 @@ bool IRTranslator::translateStaticAlloca(const AllocaInst &AI) {
bool IRTranslator::translatePHI(const User &U) {
const PHINode &PI = cast<PHINode>(U);
- MachineInstrBuilder MIB = MIRBuilder.buildInstr(TargetOpcode::PHI);
+ auto MIB = MIRBuilder.buildInstr(TargetOpcode::G_PHI, LLT{*U.getType()});
MIB.addDef(getOrCreateVReg(PI));
PendingPHIs.emplace_back(&PI, MIB.getInstr());
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp b/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp
index cc3d4ecd7c6..5a15f65c45e 100644
--- a/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp
@@ -30,8 +30,10 @@ MachineLegalizer::MachineLegalizer() : TablesInitialized(false) {
DefaultActions[TargetOpcode::G_ANYEXT] = Legal;
DefaultActions[TargetOpcode::G_TRUNC] = Legal;
- // G_TYPE is essentially an annotated COPY so it's always legal.
+ // G_TYPE and G_PHI are essentially an annotated COPY/PHI instructions so
+ // they're always legal.
DefaultActions[TargetOpcode::G_TYPE] = Legal;
+ DefaultActions[TargetOpcode::G_PHI] = Legal;
DefaultActions[TargetOpcode::G_INTRINSIC] = Legal;
DefaultActions[TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS] = Legal;
diff --git a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
index 779b624b0f7..26342a19546 100644
--- a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -235,6 +235,12 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
return true;
}
+ case TargetOpcode::G_PHI: {
+ I.setDesc(TII.get(TargetOpcode::PHI));
+ I.removeTypes();
+ return true;
+ }
+
case TargetOpcode::G_FRAME_INDEX: {
// allocas and G_FRAME_INDEX are only supported in addrspace(0).
if (I.getType() != LLT::pointer(0)) {
OpenPOWER on IntegriCloud