implement test/Regression/TableGen/DagIntSubst.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-01-31 06:02:35 +00:00
parent 5def058f38
commit 273d463bef
3 changed files with 19 additions and 2 deletions

View File

@ -68,7 +68,7 @@ static void addSuperClass(Record *SC) {
}
static void setValue(const std::string &ValName,
std::vector<unsigned> *BitList, Init *V) {
std::vector<unsigned> *BitList, Init *V) {
if (!V) return;
RecordVal *RV = CurRec->getValue(ValName);

View File

@ -554,6 +554,17 @@ Init *FieldInit::resolveReferences(Record &R, const RecordVal *RV) {
return this;
}
Init *DagInit::resolveReferences(Record &R, const RecordVal *RV) {
std::vector<Init*> NewArgs;
for (unsigned i = 0, e = Args.size(); i != e; ++i)
NewArgs.push_back(Args[i]->resolveReferences(R, RV));
if (Args != NewArgs)
return new DagInit(NodeTypeDef, NewArgs, ArgNames);
return this;
}
void DagInit::print(std::ostream &OS) const {
OS << "(" << NodeTypeDef->getName();

View File

@ -826,7 +826,11 @@ public:
ArgNames.push_back(args[i].second);
}
}
DagInit(Record *D, const std::vector<Init*> &args,
const std::vector<std::string> &argNames)
: NodeTypeDef(D), Args(args), ArgNames(argNames) {
}
virtual Init *convertInitializerTo(RecTy *Ty) {
return Ty->convertValue(this);
}
@ -847,6 +851,8 @@ public:
assert(Num < Args.size() && "Arg number out of range!");
Args[Num] = I;
}
virtual Init *resolveReferences(Record &R, const RecordVal *RV);
virtual void print(std::ostream &OS) const;
};