summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVISelLowering.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/RISCVISelLowering.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/RISCVISelLowering.cpp')
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelLowering.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index bd44ab9a138..0dec008a3e9 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -994,3 +994,21 @@ const char *RISCVTargetLowering::getTargetNodeName(unsigned Opcode) const {
}
return nullptr;
}
+
+std::pair<unsigned, const TargetRegisterClass *>
+RISCVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
+ StringRef Constraint,
+ MVT VT) const {
+ // First, see if this is a constraint that directly corresponds to a
+ // RISCV register class.
+ if (Constraint.size() == 1) {
+ switch (Constraint[0]) {
+ case 'r':
+ return std::make_pair(0U, &RISCV::GPRRegClass);
+ default:
+ break;
+ }
+ }
+
+ return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);
+}
OpenPOWER on IntegriCloud