Improve div/rem node handling on mips. Patch by Akira Hatanaka
[oota-llvm.git] / lib / VMCore / InlineAsm.cpp
index 814b31aeb386eb7415051c05864e6a5f3e1e2c54..e4f99f09a5c2f97f41d695593715a12eb3b58c71 100644 (file)
@@ -47,6 +47,7 @@ InlineAsm::InlineAsm(const PointerType *Ty, const std::string &asmString,
 }
 
 void InlineAsm::destroyConstant() {
+  getRawType()->getContext().pImpl->InlineAsms.remove(this);
   delete this;
 }
 
@@ -56,18 +57,18 @@ const FunctionType *InlineAsm::getFunctionType() const {
     
 ///Default constructor.
 InlineAsm::ConstraintInfo::ConstraintInfo() :
-  isMultipleAlternative(false),
   Type(isInput), isEarlyClobber(false),
   MatchingInput(-1), isCommutative(false),
-  isIndirect(false), currentAlternativeIndex(0) {
+  isIndirect(false), isMultipleAlternative(false),
+  currentAlternativeIndex(0) {
 }
 
 /// Copy constructor.
 InlineAsm::ConstraintInfo::ConstraintInfo(const ConstraintInfo &other) :
-  isMultipleAlternative(other.isMultipleAlternative),
   Type(other.Type), isEarlyClobber(other.isEarlyClobber),
   MatchingInput(other.MatchingInput), isCommutative(other.isCommutative),
   isIndirect(other.isIndirect), Codes(other.Codes),
+  isMultipleAlternative(other.isMultipleAlternative),
   multipleAlternatives(other.multipleAlternatives),
   currentAlternativeIndex(other.currentAlternativeIndex) {
 }
@@ -76,11 +77,11 @@ InlineAsm::ConstraintInfo::ConstraintInfo(const ConstraintInfo &other) :
 /// fields in this structure.  If the constraint string is not understood,
 /// return true, otherwise return false.
 bool InlineAsm::ConstraintInfo::Parse(StringRef Str,
-                     std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar) {
+                     InlineAsm::ConstraintInfoVector &ConstraintsSoFar) {
   StringRef::iterator I = Str.begin(), E = Str.end();
   unsigned multipleAlternativeCount = Str.count('|') + 1;
   unsigned multipleAlternativeIndex = 0;
-  std::vector<std::string> *pCodes = &Codes;
+  ConstraintCodeVector *pCodes = &Codes;
   
   // Initialize
   isMultipleAlternative = (multipleAlternativeCount > 1 ? true : false);
@@ -202,9 +203,9 @@ void InlineAsm::ConstraintInfo::selectAlternative(unsigned index) {
   }
 }
 
-std::vector<InlineAsm::ConstraintInfo>
+InlineAsm::ConstraintInfoVector
 InlineAsm::ParseConstraints(StringRef Constraints) {
-  std::vector<ConstraintInfo> Result;
+  ConstraintInfoVector Result;
   
   // Scan the constraints string.
   for (StringRef::iterator I = Constraints.begin(),
@@ -239,7 +240,7 @@ InlineAsm::ParseConstraints(StringRef Constraints) {
 bool InlineAsm::Verify(const FunctionType *Ty, StringRef ConstStr) {
   if (Ty->isVarArg()) return false;
   
-  std::vector<ConstraintInfo> Constraints = ParseConstraints(ConstStr);
+  ConstraintInfoVector Constraints = ParseConstraints(ConstStr);
   
   // Error parsing constraints.
   if (Constraints.empty() && !ConstStr.empty()) return false;