Skip to content

Commit

Permalink
[systemz] Distinguish the 'Q', 'R', 'S', and 'T' inline assembly memo…
Browse files Browse the repository at this point in the history
…ry constraints.

Summary:
But still handle them the same way since I don't know how they differ on
this target.

No functional change intended.

Reviewers: uweigand

Reviewed By: uweigand

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8251


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232495 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dsandersllvm committed Mar 17, 2015
1 parent abc795d commit 4bb6aeb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
3 changes: 3 additions & 0 deletions include/llvm/IR/InlineAsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class InlineAsm : public Value {
Constraint_o,
Constraint_v,
Constraint_Q,
Constraint_R,
Constraint_S,
Constraint_T,
Constraint_Z,
Constraint_Zy,
Constraints_Max = Constraint_Zy,
Expand Down
36 changes: 23 additions & 13 deletions lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,17 +1131,27 @@ bool SystemZDAGToDAGISel::
SelectInlineAsmMemoryOperand(const SDValue &Op,
unsigned ConstraintID,
std::vector<SDValue> &OutOps) {
assert(ConstraintID == InlineAsm::Constraint_m &&
"Unexpected constraint code");
// Accept addresses with short displacements, which are compatible
// with Q, R, S and T. But keep the index operand for future expansion.
SDValue Base, Disp, Index;
if (!selectBDXAddr(SystemZAddressingMode::FormBD,
SystemZAddressingMode::Disp12Only,
Op, Base, Disp, Index))
return true;
OutOps.push_back(Base);
OutOps.push_back(Disp);
OutOps.push_back(Index);
return false;
switch(ConstraintID) {
default:
llvm_unreachable("Unexpected asm memory constraint");
case InlineAsm::Constraint_i:
case InlineAsm::Constraint_m:
case InlineAsm::Constraint_Q:
case InlineAsm::Constraint_R:
case InlineAsm::Constraint_S:
case InlineAsm::Constraint_T:
// Accept addresses with short displacements, which are compatible
// with Q, R, S and T. But keep the index operand for future expansion.
SDValue Base, Disp, Index;
if (selectBDXAddr(SystemZAddressingMode::FormBD,
SystemZAddressingMode::Disp12Only,
Op, Base, Disp, Index)) {
OutOps.push_back(Base);
OutOps.push_back(Disp);
OutOps.push_back(Index);
return false;
}
break;
}
return true;
}
17 changes: 15 additions & 2 deletions lib/Target/SystemZ/SystemZISelLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,21 @@ class SystemZTargetLowering : public TargetLowering {

unsigned getInlineAsmMemConstraint(
const std::string &ConstraintCode) const override {
// FIXME: Map different constraints differently.
return InlineAsm::Constraint_m;
if (ConstraintCode.size() == 1) {
switch(ConstraintCode[0]) {
default:
break;
case 'Q':
return InlineAsm::Constraint_Q;
case 'R':
return InlineAsm::Constraint_R;
case 'S':
return InlineAsm::Constraint_S;
case 'T':
return InlineAsm::Constraint_T;
}
}
return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
}

MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
Expand Down

0 comments on commit 4bb6aeb

Please sign in to comment.