Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 1 | //===-- InlineAsm.cpp - Implement the InlineAsm class ---------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the InlineAsm class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/InlineAsm.h" |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 15 | #include "ConstantsContext.h" |
| 16 | #include "LLVMContextImpl.h" |
Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 17 | #include "llvm/DerivedTypes.h" |
Jeff Cohen | b24b66f | 2006-02-01 04:37:04 +0000 | [diff] [blame] | 18 | #include <algorithm> |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 19 | #include <cctype> |
Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 20 | using namespace llvm; |
| 21 | |
Gordon Henriksen | 14a5569 | 2007-12-10 02:14:30 +0000 | [diff] [blame] | 22 | // Implement the first virtual method in this class in this file so the |
| 23 | // InlineAsm vtable is emitted here. |
| 24 | InlineAsm::~InlineAsm() { |
| 25 | } |
| 26 | |
| 27 | |
Daniel Dunbar | ad36e8a | 2009-11-06 10:58:06 +0000 | [diff] [blame] | 28 | InlineAsm *InlineAsm::get(const FunctionType *Ty, StringRef AsmString, |
| 29 | StringRef Constraints, bool hasSideEffects, |
Dale Johannesen | 1cfb958 | 2009-10-21 23:28:00 +0000 | [diff] [blame] | 30 | bool isAlignStack) { |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 31 | InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack); |
| 32 | LLVMContextImpl *pImpl = Ty->getContext().pImpl; |
| 33 | return pImpl->InlineAsms.getOrCreate(PointerType::getUnqual(Ty), Key); |
Chris Lattner | a2d810d | 2006-01-25 22:26:05 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 36 | InlineAsm::InlineAsm(const PointerType *Ty, const std::string &asmString, |
| 37 | const std::string &constraints, bool hasSideEffects, |
Dale Johannesen | 1cfb958 | 2009-10-21 23:28:00 +0000 | [diff] [blame] | 38 | bool isAlignStack) |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 39 | : Value(Ty, Value::InlineAsmVal), |
Christopher Lamb | edf0788 | 2007-12-17 01:12:55 +0000 | [diff] [blame] | 40 | AsmString(asmString), |
Dale Johannesen | 1cfb958 | 2009-10-21 23:28:00 +0000 | [diff] [blame] | 41 | Constraints(constraints), HasSideEffects(hasSideEffects), |
| 42 | IsAlignStack(isAlignStack) { |
Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 43 | |
Chris Lattner | a2d810d | 2006-01-25 22:26:05 +0000 | [diff] [blame] | 44 | // Do various checks on the constraint string and type. |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 45 | assert(Verify(getFunctionType(), constraints) && |
| 46 | "Function type not legal for constraints!"); |
| 47 | } |
| 48 | |
| 49 | void InlineAsm::destroyConstant() { |
Dale Johannesen | e81d45d | 2010-11-02 17:59:27 +0000 | [diff] [blame] | 50 | getRawType()->getContext().pImpl->InlineAsms.remove(this); |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 51 | delete this; |
Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | const FunctionType *InlineAsm::getFunctionType() const { |
| 55 | return cast<FunctionType>(getType()->getElementType()); |
| 56 | } |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 57 | |
| 58 | ///Default constructor. |
| 59 | InlineAsm::ConstraintInfo::ConstraintInfo() : |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 60 | Type(isInput), isEarlyClobber(false), |
| 61 | MatchingInput(-1), isCommutative(false), |
Eric Christopher | 5f87834 | 2010-09-13 18:25:05 +0000 | [diff] [blame] | 62 | isIndirect(false), isMultipleAlternative(false), |
| 63 | currentAlternativeIndex(0) { |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | /// Copy constructor. |
| 67 | InlineAsm::ConstraintInfo::ConstraintInfo(const ConstraintInfo &other) : |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 68 | Type(other.Type), isEarlyClobber(other.isEarlyClobber), |
| 69 | MatchingInput(other.MatchingInput), isCommutative(other.isCommutative), |
| 70 | isIndirect(other.isIndirect), Codes(other.Codes), |
Eric Christopher | 5f87834 | 2010-09-13 18:25:05 +0000 | [diff] [blame] | 71 | isMultipleAlternative(other.isMultipleAlternative), |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 72 | multipleAlternatives(other.multipleAlternatives), |
| 73 | currentAlternativeIndex(other.currentAlternativeIndex) { |
| 74 | } |
Chris Lattner | a2d810d | 2006-01-25 22:26:05 +0000 | [diff] [blame] | 75 | |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 76 | /// Parse - Analyze the specified string (e.g. "==&{eax}") and fill in the |
| 77 | /// fields in this structure. If the constraint string is not understood, |
| 78 | /// return true, otherwise return false. |
Daniel Dunbar | ad36e8a | 2009-11-06 10:58:06 +0000 | [diff] [blame] | 79 | bool InlineAsm::ConstraintInfo::Parse(StringRef Str, |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 80 | InlineAsm::ConstraintInfoVector &ConstraintsSoFar) { |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 81 | StringRef::iterator I = Str.begin(), E = Str.end(); |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 82 | unsigned multipleAlternativeCount = Str.count('|') + 1; |
| 83 | unsigned multipleAlternativeIndex = 0; |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 84 | ConstraintCodeVector *pCodes = &Codes; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 85 | |
| 86 | // Initialize |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 87 | isMultipleAlternative = (multipleAlternativeCount > 1 ? true : false); |
| 88 | if (isMultipleAlternative) { |
| 89 | multipleAlternatives.resize(multipleAlternativeCount); |
| 90 | pCodes = &multipleAlternatives[0].Codes; |
| 91 | } |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 92 | Type = isInput; |
| 93 | isEarlyClobber = false; |
Chris Lattner | 860df6e | 2008-10-17 16:47:46 +0000 | [diff] [blame] | 94 | MatchingInput = -1; |
Chris Lattner | de5a9f4 | 2006-02-23 23:36:53 +0000 | [diff] [blame] | 95 | isCommutative = false; |
Chris Lattner | c48e2c3 | 2007-04-28 01:02:58 +0000 | [diff] [blame] | 96 | isIndirect = false; |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 97 | currentAlternativeIndex = 0; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 98 | |
Chris Lattner | c48e2c3 | 2007-04-28 01:02:58 +0000 | [diff] [blame] | 99 | // Parse prefixes. |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 100 | if (*I == '~') { |
| 101 | Type = isClobber; |
| 102 | ++I; |
| 103 | } else if (*I == '=') { |
| 104 | ++I; |
| 105 | Type = isOutput; |
Chris Lattner | c48e2c3 | 2007-04-28 01:02:58 +0000 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | if (*I == '*') { |
| 109 | isIndirect = true; |
| 110 | ++I; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | if (I == E) return true; // Just a prefix, like "==" or "~". |
| 114 | |
| 115 | // Parse the modifiers. |
| 116 | bool DoneWithModifiers = false; |
| 117 | while (!DoneWithModifiers) { |
| 118 | switch (*I) { |
| 119 | default: |
| 120 | DoneWithModifiers = true; |
| 121 | break; |
Chris Lattner | de5a9f4 | 2006-02-23 23:36:53 +0000 | [diff] [blame] | 122 | case '&': // Early clobber. |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 123 | if (Type != isOutput || // Cannot early clobber anything but output. |
| 124 | isEarlyClobber) // Reject &&&&&& |
| 125 | return true; |
| 126 | isEarlyClobber = true; |
| 127 | break; |
Chris Lattner | de5a9f4 | 2006-02-23 23:36:53 +0000 | [diff] [blame] | 128 | case '%': // Commutative. |
| 129 | if (Type == isClobber || // Cannot commute clobbers. |
| 130 | isCommutative) // Reject %%%%% |
| 131 | return true; |
| 132 | isCommutative = true; |
| 133 | break; |
| 134 | case '#': // Comment. |
| 135 | case '*': // Register preferencing. |
| 136 | return true; // Not supported. |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | if (!DoneWithModifiers) { |
| 140 | ++I; |
| 141 | if (I == E) return true; // Just prefixes and modifiers! |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | // Parse the various constraints. |
| 146 | while (I != E) { |
| 147 | if (*I == '{') { // Physical register reference. |
| 148 | // Find the end of the register name. |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 149 | StringRef::iterator ConstraintEnd = std::find(I+1, E, '}'); |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 150 | if (ConstraintEnd == E) return true; // "{foo" |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 151 | pCodes->push_back(std::string(I, ConstraintEnd+1)); |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 152 | I = ConstraintEnd+1; |
Chris Lattner | 2f34a9e | 2006-02-02 00:23:53 +0000 | [diff] [blame] | 153 | } else if (isdigit(*I)) { // Matching Constraint |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 154 | // Maximal munch numbers. |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 155 | StringRef::iterator NumStart = I; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 156 | while (I != E && isdigit(*I)) |
| 157 | ++I; |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 158 | pCodes->push_back(std::string(NumStart, I)); |
| 159 | unsigned N = atoi(pCodes->back().c_str()); |
Chris Lattner | 2f34a9e | 2006-02-02 00:23:53 +0000 | [diff] [blame] | 160 | // Check that this is a valid matching constraint! |
| 161 | if (N >= ConstraintsSoFar.size() || ConstraintsSoFar[N].Type != isOutput|| |
| 162 | Type != isInput) |
| 163 | return true; // Invalid constraint number. |
| 164 | |
Chris Lattner | 860df6e | 2008-10-17 16:47:46 +0000 | [diff] [blame] | 165 | // If Operand N already has a matching input, reject this. An output |
| 166 | // can't be constrained to the same value as multiple inputs. |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 167 | if (isMultipleAlternative) { |
| 168 | InlineAsm::SubConstraintInfo &scInfo = |
| 169 | ConstraintsSoFar[N].multipleAlternatives[multipleAlternativeIndex]; |
| 170 | if (scInfo.MatchingInput != -1) |
| 171 | return true; |
| 172 | // Note that operand #n has a matching input. |
| 173 | scInfo.MatchingInput = ConstraintsSoFar.size(); |
| 174 | } else { |
| 175 | if (ConstraintsSoFar[N].hasMatchingInput()) |
| 176 | return true; |
| 177 | // Note that operand #n has a matching input. |
| 178 | ConstraintsSoFar[N].MatchingInput = ConstraintsSoFar.size(); |
| 179 | } |
| 180 | } else if (*I == '|') { |
| 181 | multipleAlternativeIndex++; |
| 182 | pCodes = &multipleAlternatives[multipleAlternativeIndex].Codes; |
| 183 | ++I; |
Eric Christopher | ca9b7bb | 2011-06-02 19:26:37 +0000 | [diff] [blame] | 184 | } else if (*I == '^') { |
| 185 | // Multi-letter constraint |
Eric Christopher | 1e3e893 | 2011-06-03 22:09:12 +0000 | [diff] [blame^] | 186 | // FIXME: For now assuming these are 2-character constraints. |
| 187 | pCodes->push_back(std::string(I+1, I+3)); |
| 188 | I += 3; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 189 | } else { |
| 190 | // Single letter constraint. |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 191 | pCodes->push_back(std::string(I, I+1)); |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 192 | ++I; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | return false; |
| 197 | } |
| 198 | |
John Thompson | 1094c80 | 2010-09-13 18:15:37 +0000 | [diff] [blame] | 199 | /// selectAlternative - Point this constraint to the alternative constraint |
| 200 | /// indicated by the index. |
| 201 | void InlineAsm::ConstraintInfo::selectAlternative(unsigned index) { |
| 202 | if (index < multipleAlternatives.size()) { |
| 203 | currentAlternativeIndex = index; |
| 204 | InlineAsm::SubConstraintInfo &scInfo = |
| 205 | multipleAlternatives[currentAlternativeIndex]; |
| 206 | MatchingInput = scInfo.MatchingInput; |
| 207 | Codes = scInfo.Codes; |
| 208 | } |
| 209 | } |
| 210 | |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 211 | InlineAsm::ConstraintInfoVector |
Daniel Dunbar | ad36e8a | 2009-11-06 10:58:06 +0000 | [diff] [blame] | 212 | InlineAsm::ParseConstraints(StringRef Constraints) { |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 213 | ConstraintInfoVector Result; |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 214 | |
| 215 | // Scan the constraints string. |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 216 | for (StringRef::iterator I = Constraints.begin(), |
| 217 | E = Constraints.end(); I != E; ) { |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 218 | ConstraintInfo Info; |
| 219 | |
| 220 | // Find the end of this constraint. |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 221 | StringRef::iterator ConstraintEnd = std::find(I, E, ','); |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 222 | |
| 223 | if (ConstraintEnd == I || // Empty constraint like ",," |
Benjamin Kramer | 5aaf677 | 2010-07-25 23:18:32 +0000 | [diff] [blame] | 224 | Info.Parse(StringRef(I, ConstraintEnd-I), Result)) { |
Chris Lattner | 2f34a9e | 2006-02-02 00:23:53 +0000 | [diff] [blame] | 225 | Result.clear(); // Erroneous constraint? |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 226 | break; |
| 227 | } |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 228 | |
| 229 | Result.push_back(Info); |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 230 | |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 231 | // ConstraintEnd may be either the next comma or the end of the string. In |
| 232 | // the former case, we skip the comma. |
| 233 | I = ConstraintEnd; |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 234 | if (I != E) { |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 235 | ++I; |
| 236 | if (I == E) { Result.clear(); break; } // don't allow "xyz," |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return Result; |
| 241 | } |
| 242 | |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 243 | /// Verify - Verify that the specified constraint string is reasonable for the |
| 244 | /// specified function type, and otherwise validate the constraint string. |
Daniel Dunbar | ad36e8a | 2009-11-06 10:58:06 +0000 | [diff] [blame] | 245 | bool InlineAsm::Verify(const FunctionType *Ty, StringRef ConstStr) { |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 246 | if (Ty->isVarArg()) return false; |
| 247 | |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 248 | ConstraintInfoVector Constraints = ParseConstraints(ConstStr); |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 249 | |
| 250 | // Error parsing constraints. |
| 251 | if (Constraints.empty() && !ConstStr.empty()) return false; |
| 252 | |
| 253 | unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0; |
Chris Lattner | ee00d04 | 2008-05-22 04:46:38 +0000 | [diff] [blame] | 254 | unsigned NumIndirect = 0; |
Chris Lattner | c981b8e | 2006-01-26 02:21:59 +0000 | [diff] [blame] | 255 | |
| 256 | for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 257 | switch (Constraints[i].Type) { |
| 258 | case InlineAsm::isOutput: |
Chris Lattner | ee00d04 | 2008-05-22 04:46:38 +0000 | [diff] [blame] | 259 | if ((NumInputs-NumIndirect) != 0 || NumClobbers != 0) |
| 260 | return false; // outputs before inputs and clobbers. |
Chris Lattner | c48e2c3 | 2007-04-28 01:02:58 +0000 | [diff] [blame] | 261 | if (!Constraints[i].isIndirect) { |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 262 | ++NumOutputs; |
| 263 | break; |
| 264 | } |
Chris Lattner | ee00d04 | 2008-05-22 04:46:38 +0000 | [diff] [blame] | 265 | ++NumIndirect; |
Chris Lattner | c48e2c3 | 2007-04-28 01:02:58 +0000 | [diff] [blame] | 266 | // FALLTHROUGH for Indirect Outputs. |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 267 | case InlineAsm::isInput: |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 268 | if (NumClobbers) return false; // inputs before clobbers. |
| 269 | ++NumInputs; |
| 270 | break; |
Chris Lattner | 7ed3101 | 2006-02-01 01:29:47 +0000 | [diff] [blame] | 271 | case InlineAsm::isClobber: |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 272 | ++NumClobbers; |
| 273 | break; |
| 274 | } |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 275 | } |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 276 | |
Chris Lattner | 10748d8 | 2008-04-27 23:33:55 +0000 | [diff] [blame] | 277 | switch (NumOutputs) { |
| 278 | case 0: |
Benjamin Kramer | ccce8ba | 2010-01-05 13:12:22 +0000 | [diff] [blame] | 279 | if (!Ty->getReturnType()->isVoidTy()) return false; |
Chris Lattner | 10748d8 | 2008-04-27 23:33:55 +0000 | [diff] [blame] | 280 | break; |
| 281 | case 1: |
Duncan Sands | 19d0b47 | 2010-02-16 11:11:14 +0000 | [diff] [blame] | 282 | if (Ty->getReturnType()->isStructTy()) return false; |
Chris Lattner | 10748d8 | 2008-04-27 23:33:55 +0000 | [diff] [blame] | 283 | break; |
| 284 | default: |
| 285 | const StructType *STy = dyn_cast<StructType>(Ty->getReturnType()); |
| 286 | if (STy == 0 || STy->getNumElements() != NumOutputs) |
| 287 | return false; |
| 288 | break; |
| 289 | } |
Chris Lattner | 8547e3a | 2006-01-26 00:48:33 +0000 | [diff] [blame] | 290 | |
| 291 | if (Ty->getNumParams() != NumInputs) return false; |
Chris Lattner | a2d810d | 2006-01-25 22:26:05 +0000 | [diff] [blame] | 292 | return true; |
| 293 | } |
Reid Spencer | 5113dc5 | 2006-06-07 23:03:13 +0000 | [diff] [blame] | 294 | |