llvm.org GIT mirror llvm / 50d4565
reapply git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34697 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
5 changed file(s) with 20 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
124124 throw "Unknown CCAction!";
125125 }
126126 }
127 }
127 }
128
603603 // Parse the list of argument types.
604604 ListInit *TypeList = R->getValueAsListInit("Types");
605605 for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
606 DefInit *DI = dynamic_cast(TypeList->getElement(i));
607 assert(DI && "Invalid list type!");
608 Record *TyEl = DI->getDef();
606 Record *TyEl = TypeList->getElementAsRecord(i);
609607 assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
610608 ArgTypes.push_back(TyEl->getValueAsString("TypeVal"));
611609
619617 // Parse the intrinsic properties.
620618 ListInit *PropList = R->getValueAsListInit("Properties");
621619 for (unsigned i = 0, e = PropList->getSize(); i != e; ++i) {
622 DefInit *DI = dynamic_cast(PropList->getElement(i));
623 assert(DI && "Invalid list type!");
624 Record *Property = DI->getDef();
620 Record *Property = PropList->getElementAsRecord(i);
625621 assert(Property->isSubClassOf("IntrinsicProperty") &&
626622 "Expected a property!");
627623
334334 Vals.push_back(getElement(Elements[i]));
335335 }
336336 return new ListInit(Vals);
337 }
338
339 Record *ListInit::getElementAsRecord(unsigned i) const {
340 assert(i < Values.size() && "List element index out of range!");
341 DefInit *DI = dynamic_cast(Values[i]);
342 if (DI == 0) throw "Expected record in list!";
343 return DI->getDef();
337344 }
338345
339346 Init *ListInit::resolveReferences(Record &R, const RecordVal *RV) {
625625 return Values[i];
626626 }
627627
628 Record *getElementAsRecord(unsigned i) const;
629
628630 Init *convertInitListSlice(const std::vector &Elements);
629631
630632 virtual Init *convertInitializerTo(RecTy *Ty) {
1919 #include "llvm/Support/Streams.h"
2020 #include "llvm/System/Signals.h"
2121 #include "llvm/Support/FileUtilities.h"
22 #include "CallingConvEmitter.h"
2223 #include "CodeEmitterGen.h"
2324 #include "RegisterInfoEmitter.h"
2425 #include "InstrInfoEmitter.h"
3738 GenEmitter,
3839 GenRegisterEnums, GenRegister, GenRegisterHeader,
3940 GenInstrEnums, GenInstrs, GenAsmWriter,
41 GenCallingConv,
4042 GenDAGISel,
4143 GenSubtarget,
4244 GenIntrinsic,
6062 "Generate enum values for instructions"),
6163 clEnumValN(GenInstrs, "gen-instr-desc",
6264 "Generate instruction descriptions"),
65 clEnumValN(GenCallingConv, "gen-callingconv",
66 "Generate calling convention descriptions"),
6367 clEnumValN(GenAsmWriter, "gen-asm-writer",
6468 "Generate assembly writer"),
6569 clEnumValN(GenDAGISel, "gen-dag-isel",
137141 case GenInstrs:
138142 InstrInfoEmitter(Records).run(*Out);
139143 break;
140
144 case GenCallingConv:
145 CallingConvEmitter(Records).run(*Out);
146 break;
141147 case GenAsmWriter:
142148 AsmWriterEmitter(Records).run(*Out);
143149 break;