r351559 - Clang side support for @cc assembly operands.
Nirav Dave via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 18 07:57:23 PST 2019
Author: niravd
Date: Fri Jan 18 07:57:23 2019
New Revision: 351559
URL: http://llvm.org/viewvc/llvm-project?rev=351559&view=rev
Log:
Clang side support for @cc assembly operands.
Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp
Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=351559&r1=351558&r2=351559&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Fri Jan 18 07:57:23 2019
@@ -1554,6 +1554,42 @@ bool X86TargetInfo::validateCpuIs(String
.Default(false);
}
+
+static unsigned matchAsmCCConstraint(const char *&Name) {
+ auto RV = llvm::StringSwitch<unsigned>(Name)
+ .Case("@cca", 4)
+ .Case("@ccae", 5)
+ .Case("@ccb", 4)
+ .Case("@ccbe", 5)
+ .Case("@ccc", 4)
+ .Case("@cce", 4)
+ .Case("@ccz", 4)
+ .Case("@ccg", 4)
+ .Case("@ccge", 4)
+ .Case("@ccl", 4)
+ .Case("@ccle", 5)
+ .Case("@ccna", 5)
+ .Case("@ccnae",6)
+ .Case("@ccnb", 5)
+ .Case("@ccnbe",6)
+ .Case("@ccnc", 5)
+ .Case("@ccne", 5)
+ .Case("@ccnz", 5)
+ .Case("@ccng", 5)
+ .Case("@ccnge",6)
+ .Case("@ccnl", 5)
+ .Case("@ccnle",6)
+ .Case("@ccno", 5)
+ .Case("@ccnp", 5)
+ .Case("@ccns", 5)
+ .Case("@cco", 4)
+ .Case("@ccp", 4)
+ .Case("@ccs", 4)
+ .Default(0);
+ return RV;
+}
+
+
bool X86TargetInfo::validateAsmConstraint(
const char *&Name, TargetInfo::ConstraintInfo &Info) const {
switch (*Name) {
@@ -1636,6 +1672,14 @@ bool X86TargetInfo::validateAsmConstrain
case 'C': // SSE floating point constant.
case 'G': // x87 floating point constant.
return true;
+ case '@':
+ // CC condition changes.
+ if (auto Len = matchAsmCCConstraint(Name)) {
+ Name+=Len-1;
+ Info.setAllowsRegister();
+ return true;
+ }
+ return false;
}
}
@@ -1705,8 +1749,16 @@ bool X86TargetInfo::validateOperandSize(
return true;
}
+//niravd
std::string X86TargetInfo::convertConstraint(const char *&Constraint) const {
switch (*Constraint) {
+ case '@':
+ if (auto Len = matchAsmCCConstraint(Constraint)) {
+ std::string Converted = "{" + std::string(Constraint, Len) + "}";
+ Constraint+=Len-1;
+ return Converted;
+ }
+ break;
case 'a':
return std::string("{ax}");
case 'b':
More information about the cfe-commits
mailing list