summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/InlineAsm.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-14 17:57:32 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-14 17:57:32 +0000
commitcd749a9c07f1de2fb8affde90537efa4bc3e7c54 (patch)
treeb21f6de4e08b89bb7931806bab798fc2a5e3a686 /lib/VMCore/InlineAsm.cpp
parent72621d11de5b873f1695f391eb95f0b336c3d2d4 (diff)
downloadFreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.zip
FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.tar.gz
Update llvm to r84119.
Diffstat (limited to 'lib/VMCore/InlineAsm.cpp')
-rw-r--r--lib/VMCore/InlineAsm.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/VMCore/InlineAsm.cpp b/lib/VMCore/InlineAsm.cpp
index 524e294..0520dfa 100644
--- a/lib/VMCore/InlineAsm.cpp
+++ b/lib/VMCore/InlineAsm.cpp
@@ -26,18 +26,20 @@ InlineAsm::~InlineAsm() {
// NOTE: when memoizing the function type, we have to be careful to handle the
// case when the type gets refined.
-InlineAsm *InlineAsm::get(const FunctionType *Ty, const std::string &AsmString,
- const std::string &Constraints, bool hasSideEffects) {
+InlineAsm *InlineAsm::get(const FunctionType *Ty, const StringRef &AsmString,
+ const StringRef &Constraints, bool hasSideEffects,
+ bool isMsAsm) {
// FIXME: memoize!
- return new InlineAsm(Ty, AsmString, Constraints, hasSideEffects);
+ return new InlineAsm(Ty, AsmString, Constraints, hasSideEffects, isMsAsm);
}
-InlineAsm::InlineAsm(const FunctionType *Ty, const std::string &asmString,
- const std::string &constraints, bool hasSideEffects)
+InlineAsm::InlineAsm(const FunctionType *Ty, const StringRef &asmString,
+ const StringRef &constraints, bool hasSideEffects,
+ bool isMsAsm)
: Value(PointerType::getUnqual(Ty),
Value::InlineAsmVal),
AsmString(asmString),
- Constraints(constraints), HasSideEffects(hasSideEffects) {
+ Constraints(constraints), HasSideEffects(hasSideEffects), IsMsAsm(isMsAsm) {
// Do various checks on the constraint string and type.
assert(Verify(Ty, constraints) && "Function type not legal for constraints!");
@@ -50,9 +52,9 @@ const FunctionType *InlineAsm::getFunctionType() const {
/// Parse - Analyze the specified string (e.g. "==&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
-bool InlineAsm::ConstraintInfo::Parse(const std::string &Str,
+bool InlineAsm::ConstraintInfo::Parse(const StringRef &Str,
std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar) {
- std::string::const_iterator I = Str.begin(), E = Str.end();
+ StringRef::iterator I = Str.begin(), E = Str.end();
// Initialize
Type = isInput;
@@ -111,13 +113,13 @@ bool InlineAsm::ConstraintInfo::Parse(const std::string &Str,
while (I != E) {
if (*I == '{') { // Physical register reference.
// Find the end of the register name.
- std::string::const_iterator ConstraintEnd = std::find(I+1, E, '}');
+ StringRef::iterator ConstraintEnd = std::find(I+1, E, '}');
if (ConstraintEnd == E) return true; // "{foo"
Codes.push_back(std::string(I, ConstraintEnd+1));
I = ConstraintEnd+1;
} else if (isdigit(*I)) { // Matching Constraint
// Maximal munch numbers.
- std::string::const_iterator NumStart = I;
+ StringRef::iterator NumStart = I;
while (I != E && isdigit(*I))
++I;
Codes.push_back(std::string(NumStart, I));
@@ -145,16 +147,16 @@ bool InlineAsm::ConstraintInfo::Parse(const std::string &Str,
}
std::vector<InlineAsm::ConstraintInfo>
-InlineAsm::ParseConstraints(const std::string &Constraints) {
+InlineAsm::ParseConstraints(const StringRef &Constraints) {
std::vector<ConstraintInfo> Result;
// Scan the constraints string.
- for (std::string::const_iterator I = Constraints.begin(),
- E = Constraints.end(); I != E; ) {
+ for (StringRef::iterator I = Constraints.begin(),
+ E = Constraints.end(); I != E; ) {
ConstraintInfo Info;
// Find the end of this constraint.
- std::string::const_iterator ConstraintEnd = std::find(I, E, ',');
+ StringRef::iterator ConstraintEnd = std::find(I, E, ',');
if (ConstraintEnd == I || // Empty constraint like ",,"
Info.Parse(std::string(I, ConstraintEnd), Result)) {
@@ -179,7 +181,7 @@ InlineAsm::ParseConstraints(const std::string &Constraints) {
/// Verify - Verify that the specified constraint string is reasonable for the
/// specified function type, and otherwise validate the constraint string.
-bool InlineAsm::Verify(const FunctionType *Ty, const std::string &ConstStr) {
+bool InlineAsm::Verify(const FunctionType *Ty, const StringRef &ConstStr) {
if (Ty->isVarArg()) return false;
std::vector<ConstraintInfo> Constraints = ParseConstraints(ConstStr);
@@ -213,7 +215,7 @@ bool InlineAsm::Verify(const FunctionType *Ty, const std::string &ConstStr) {
switch (NumOutputs) {
case 0:
- if (Ty->getReturnType() != Type::VoidTy) return false;
+ if (Ty->getReturnType() != Type::getVoidTy(Ty->getContext())) return false;
break;
case 1:
if (isa<StructType>(Ty->getReturnType())) return false;
OpenPOWER on IntegriCloud