summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2018-01-10 20:05:09 +0000
committerAlex Bradbury <asb@lowrisc.org>2018-01-10 20:05:09 +0000
commit9330e64485aee847682704ddb62750d4b2badf22 (patch)
treecfb747009cbb5d5275bba58a377dfe4a3afb9b1b /llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
parent9fea4881d01882e8ea921efa1ba1018d80ceca87 (diff)
downloadbcm5719-llvm-9330e64485aee847682704ddb62750d4b2badf22.tar.gz
bcm5719-llvm-9330e64485aee847682704ddb62750d4b2badf22.zip
[RISCV] Add basic support for inline asm constraints
llvm-svn: 322217
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp')
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index 113a45ac7cc..23a0382d442 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -44,6 +44,9 @@ public:
void Select(SDNode *Node) override;
+ bool SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID,
+ std::vector<SDValue> &OutOps) override;
+
bool SelectAddrFI(SDValue Addr, SDValue &Base);
// Include the pieces autogenerated from the target description.
@@ -93,6 +96,22 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
SelectCode(Node);
}
+bool RISCVDAGToDAGISel::SelectInlineAsmMemoryOperand(
+ const SDValue &Op, unsigned ConstraintID, std::vector<SDValue> &OutOps) {
+ switch (ConstraintID) {
+ case InlineAsm::Constraint_i:
+ case InlineAsm::Constraint_m:
+ // We just support simple memory operands that have a single address
+ // operand and need no special handling.
+ OutOps.push_back(Op);
+ return false;
+ default:
+ break;
+ }
+
+ return true;
+}
+
bool RISCVDAGToDAGISel::SelectAddrFI(SDValue Addr, SDValue &Base) {
if (auto FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), Subtarget->getXLenVT());
OpenPOWER on IntegriCloud