diff options
author | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2010-09-13 18:15:37 +0000 |
---|---|---|
committer | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2010-09-13 18:15:37 +0000 |
commit | eac6e1d0c748afc3d1496be0753ffbe5f5a4279b (patch) | |
tree | 94079e066b7fbaf541433ad07e9453331d09b7ba /lib/Target | |
parent | c32a2260a6145000581a74fd61ba57bdcc4cb951 (diff) | |
download | external_llvm-eac6e1d0c748afc3d1496be0753ffbe5f5a4279b.zip external_llvm-eac6e1d0c748afc3d1496be0753ffbe5f5a4279b.tar.gz external_llvm-eac6e1d0c748afc3d1496be0753ffbe5f5a4279b.tar.bz2 |
Added skeleton for inline asm multiple alternative constraint support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 28 | ||||
-rw-r--r-- | lib/Target/X86/X86ISelLowering.h | 6 |
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index b1ce35a..797c2fc 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -11193,6 +11193,34 @@ X86TargetLowering::getConstraintType(const std::string &Constraint) const { return TargetLowering::getConstraintType(Constraint); } +/// Examine constraint type and operand type and determine a weight value, +/// where: -1 = invalid match, and 0 = so-so match to 3 = good match. +/// This object must already have been set up with the operand type +/// and the current alternative constraint selected. +int X86TargetLowering::getSingleConstraintMatchWeight( + AsmOperandInfo &info, const char *constraint) const { + int weight = -1; + Value *CallOperandVal = info.CallOperandVal; + // If we don't have a value, we can't do a match, + // but allow it at the lowest weight. + if (CallOperandVal == NULL) + return 0; + // Look at the constraint type. + switch (*constraint) { + default: + return TargetLowering::getSingleConstraintMatchWeight(info, constraint); + break; + case 'I': + if (ConstantInt *C = dyn_cast<ConstantInt>(info.CallOperandVal)) { + if (C->getZExtValue() <= 31) + weight = 3; + } + break; + // etc. + } + return weight; +} + /// LowerXConstraint - try to replace an X constraint, which matches anything, /// with another that has more specific requirements based on the type of the /// corresponding operand. diff --git a/lib/Target/X86/X86ISelLowering.h b/lib/Target/X86/X86ISelLowering.h index d2d9b28..6e6f25c 100644 --- a/lib/Target/X86/X86ISelLowering.h +++ b/lib/Target/X86/X86ISelLowering.h @@ -531,6 +531,12 @@ namespace llvm { virtual bool ExpandInlineAsm(CallInst *CI) const; ConstraintType getConstraintType(const std::string &Constraint) const; + + /// Examine constraint string and operand type and determine a weight value, + /// where: -1 = invalid match, and 0 = so-so match to 3 = good match. + /// The operand object must already have been set up with the operand type. + virtual int getSingleConstraintMatchWeight( + AsmOperandInfo &info, const char *constraint) const; std::vector<unsigned> getRegClassForInlineAsmConstraint(const std::string &Constraint, |