summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/utils/TableGen/CodeGenTarget.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--gnu/llvm/utils/TableGen/CodeGenTarget.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/gnu/llvm/utils/TableGen/CodeGenTarget.cpp b/gnu/llvm/utils/TableGen/CodeGenTarget.cpp
index 245b9eeeed8..6503d5af2d4 100644
--- a/gnu/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/gnu/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -138,7 +138,7 @@ std::string llvm::getQualifiedName(const Record *R) {
if (R->getValue("Namespace"))
Namespace = R->getValueAsString("Namespace");
if (Namespace.empty()) return R->getName();
- return Namespace + "::" + R->getName();
+ return Namespace + "::" + R->getName().str();
}
@@ -157,7 +157,7 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records)
CodeGenTarget::~CodeGenTarget() {
}
-const std::string &CodeGenTarget::getName() const {
+const StringRef CodeGenTarget::getName() const {
return TargetRec->getName();
}
@@ -301,7 +301,7 @@ GetInstByName(const char *Name,
/// their enum value.
void CodeGenTarget::ComputeInstrsByEnum() const {
static const char *const FixedInstrs[] = {
-#define HANDLE_TARGET_OPCODE(OPC, NUM) #OPC,
+#define HANDLE_TARGET_OPCODE(OPC) #OPC,
#include "llvm/Target/TargetOpcodes.def"
nullptr};
const auto &Insts = getInstructions();
@@ -393,6 +393,16 @@ ComplexPattern::ComplexPattern(Record *R) {
SelectFunc = R->getValueAsString("SelectFunc");
RootNodes = R->getValueAsListOfDefs("RootNodes");
+ // FIXME: This is a hack to statically increase the priority of patterns which
+ // maps a sub-dag to a complex pattern. e.g. favors LEA over ADD. To get best
+ // possible pattern match we'll need to dynamically calculate the complexity
+ // of all patterns a dag can potentially map to.
+ int64_t RawComplexity = R->getValueAsInt("Complexity");
+ if (RawComplexity == -1)
+ Complexity = NumOperands * 3;
+ else
+ Complexity = RawComplexity;
+
// Parse the properties.
Properties = 0;
std::vector<Record*> PropList = R->getValueAsListOfDefs("Properties");
@@ -550,8 +560,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
// overloaded, all the types can be specified directly.
assert(((!TyEl->isSubClassOf("LLVMExtendedType") &&
!TyEl->isSubClassOf("LLVMTruncatedType") &&
- !TyEl->isSubClassOf("LLVMVectorSameWidth") &&
- !TyEl->isSubClassOf("LLVMPointerToElt")) ||
+ !TyEl->isSubClassOf("LLVMVectorSameWidth")) ||
VT == MVT::iAny || VT == MVT::vAny) &&
"Expected iAny or vAny type");
} else
@@ -584,7 +593,12 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
else if (Property->getName() == "IntrWriteMem")
ModRef = ModRefBehavior(ModRef & ~MR_Ref);
else if (Property->getName() == "IntrArgMemOnly")
- ModRef = ModRefBehavior(ModRef & ~MR_Anywhere);
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem);
+ else if (Property->getName() == "IntrInaccessibleMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_InaccessibleMem);
+ else if (Property->getName() == "IntrInaccessibleMemOrArgMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem |
+ MR_InaccessibleMem);
else if (Property->getName() == "Commutative")
isCommutative = true;
else if (Property->getName() == "Throws")