mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 22:53:05 +08:00
Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC
llvm-svn: 250876
This commit is contained in:
@@ -648,8 +648,7 @@ public:
|
||||
// a constraint is valid and provides information about it.
|
||||
// FIXME: These should return a real error instead of just true/false.
|
||||
bool validateOutputConstraint(ConstraintInfo &Info) const;
|
||||
bool validateInputConstraint(ConstraintInfo *OutputConstraints,
|
||||
unsigned NumOutputs,
|
||||
bool validateInputConstraint(MutableArrayRef<ConstraintInfo> OutputConstraints,
|
||||
ConstraintInfo &info) const;
|
||||
|
||||
virtual bool validateOutputSize(StringRef /*Constraint*/,
|
||||
@@ -673,8 +672,8 @@ public:
|
||||
TargetInfo::ConstraintInfo &info) const = 0;
|
||||
|
||||
bool resolveSymbolicName(const char *&Name,
|
||||
ConstraintInfo *OutputConstraints,
|
||||
unsigned NumOutputs, unsigned &Index) const;
|
||||
ArrayRef<ConstraintInfo> OutputConstraints,
|
||||
unsigned &Index) const;
|
||||
|
||||
// Constraint parm will be left pointing at the last character of
|
||||
// the constraint. In practice, it won't be changed unless the
|
||||
|
||||
@@ -510,8 +510,7 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
|
||||
}
|
||||
|
||||
bool TargetInfo::resolveSymbolicName(const char *&Name,
|
||||
ConstraintInfo *OutputConstraints,
|
||||
unsigned NumOutputs,
|
||||
ArrayRef<ConstraintInfo> OutputConstraints,
|
||||
unsigned &Index) const {
|
||||
assert(*Name == '[' && "Symbolic name did not start with '['");
|
||||
Name++;
|
||||
@@ -526,16 +525,16 @@ bool TargetInfo::resolveSymbolicName(const char *&Name,
|
||||
|
||||
std::string SymbolicName(Start, Name - Start);
|
||||
|
||||
for (Index = 0; Index != NumOutputs; ++Index)
|
||||
for (Index = 0; Index != OutputConstraints.size(); ++Index)
|
||||
if (SymbolicName == OutputConstraints[Index].getName())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
|
||||
unsigned NumOutputs,
|
||||
ConstraintInfo &Info) const {
|
||||
bool TargetInfo::validateInputConstraint(
|
||||
MutableArrayRef<ConstraintInfo> OutputConstraints,
|
||||
ConstraintInfo &Info) const {
|
||||
const char *Name = Info.ConstraintStr.c_str();
|
||||
|
||||
if (!*Name)
|
||||
@@ -556,7 +555,7 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
|
||||
return false;
|
||||
|
||||
// Check if matching constraint is out of bounds.
|
||||
if (i >= NumOutputs) return false;
|
||||
if (i >= OutputConstraints.size()) return false;
|
||||
|
||||
// A number must refer to an output only operand.
|
||||
if (OutputConstraints[i].isReadWrite())
|
||||
@@ -579,7 +578,7 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
|
||||
break;
|
||||
case '[': {
|
||||
unsigned Index = 0;
|
||||
if (!resolveSymbolicName(Name, OutputConstraints, NumOutputs, Index))
|
||||
if (!resolveSymbolicName(Name, OutputConstraints, Index))
|
||||
return false;
|
||||
|
||||
// If the constraint is already tied, it must be tied to the
|
||||
|
||||
@@ -1587,9 +1587,7 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
|
||||
assert(OutCons &&
|
||||
"Must pass output names to constraints with a symbolic name");
|
||||
unsigned Index;
|
||||
bool result = Target.resolveSymbolicName(Constraint,
|
||||
&(*OutCons)[0],
|
||||
OutCons->size(), Index);
|
||||
bool result = Target.resolveSymbolicName(Constraint, *OutCons, Index);
|
||||
assert(result && "Could not resolve symbolic name"); (void)result;
|
||||
Result += llvm::utostr(Index);
|
||||
break;
|
||||
@@ -1744,8 +1742,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
||||
Name = GAS->getInputName(i);
|
||||
TargetInfo::ConstraintInfo Info(S.getInputConstraint(i), Name);
|
||||
bool IsValid =
|
||||
getTarget().validateInputConstraint(OutputConstraintInfos.data(),
|
||||
S.getNumOutputs(), Info);
|
||||
getTarget().validateInputConstraint(OutputConstraintInfos, Info);
|
||||
assert(IsValid && "Failed to parse input constraint"); (void)IsValid;
|
||||
InputConstraintInfos.push_back(Info);
|
||||
}
|
||||
|
||||
@@ -252,8 +252,8 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
||||
InputName = Names[i]->getName();
|
||||
|
||||
TargetInfo::ConstraintInfo Info(Literal->getString(), InputName);
|
||||
if (!Context.getTargetInfo().validateInputConstraint(
|
||||
OutputConstraintInfos.data(), NumOutputs, Info)) {
|
||||
if (!Context.getTargetInfo().validateInputConstraint(OutputConstraintInfos,
|
||||
Info)) {
|
||||
return StmtError(Diag(Literal->getLocStart(),
|
||||
diag::err_asm_invalid_input_constraint)
|
||||
<< Info.getConstraintStr());
|
||||
|
||||
Reference in New Issue
Block a user