aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-26 20:37:03 +0000
committerChris Lattner <sabre@nondot.org>2006-01-26 20:37:03 +0000
commit4ccb070f158b0f331c68de800c6bab8c31c2ecb6 (patch)
tree9c9cf9d276b0b537119a7c0cce395ba97639886b /lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent8211e82e40b8f6c0e200933f25aa4d9fe2cf4edc (diff)
Implement a method for inline asm support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 8f177c901d..6b6ac57770 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -13,7 +13,9 @@
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/MRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
+#include "llvm/ADT/StringExtras.h"
using namespace llvm;
TargetLowering::TargetLowering(TargetMachine &tm)
@@ -132,3 +134,18 @@ bool TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op,
uint64_t Mask) const {
return false;
}
+
+std::vector<unsigned> TargetLowering::
+getRegForInlineAsmConstraint(const std::string &Constraint) const {
+ // Scan to see if this constraint is a register name.
+ const MRegisterInfo *RI = TM.getRegisterInfo();
+ for (unsigned i = 1, e = RI->getNumRegs(); i != e; ++i) {
+ if (const char *Name = RI->get(i).Name)
+ if (StringsEqualNoCase(Constraint, Name))
+ return std::vector<unsigned>(1, i);
+ }
+
+ // Not a physreg, must not be a register reference or something.
+ return std::vector<unsigned>();
+}
+