llvm.org GIT mirror llvm / 2092c8a
implement CCPromoteToType git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34720 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 13 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
2525 // other.
2626 for (unsigned i = 0, e = CCs.size(); i != e; ++i) {
2727 O << "static bool " << CCs[i]->getName()
28 << "(unsigned ValNo, MVT::ValueType ValVT, MVT::ValueType LocVT,\n"
28 << "(unsigned ValNo, MVT::ValueType ValVT,\n"
2929 << std::string(CCs[i]->getName().size()+13, ' ')
30 << "CCValAssign::LocInfo LocInfo, unsigned ArgFlags, CCState &State);\n";
30 << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
31 << std::string(CCs[i]->getName().size()+13, ' ')
32 << "unsigned ArgFlags, CCState &State);\n";
3133 }
3234
3335 // Emit each calling convention description in full.
4143 Counter = 0;
4244
4345 O << "\n\nstatic bool " << CC->getName()
44 << "(unsigned ValNo, MVT::ValueType ValVT, MVT::ValueType LocVT,\n"
46 << "(unsigned ValNo, MVT::ValueType ValVT,\n"
4547 << std::string(CC->getName().size()+13, ' ')
46 << "CCValAssign::LocInfo LocInfo, "
48 << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
49 << std::string(CC->getName().size()+13, ' ')
4750 << "unsigned ArgFlags, CCState &State) {\n";
48
4951 // Emit all of the actions, in order.
5052 for (unsigned i = 0, e = CCActions->getSize(); i != e; ++i) {
5153 O << "\n";
6769 ListInit *VTs = Action->getValueAsListInit("VTs");
6870 for (unsigned i = 0, e = VTs->getSize(); i != e; ++i) {
6971 Record *VT = VTs->getElementAsRecord(i);
70 if (i != 0) O << " || \n " << IndentStr;
72 if (i != 0) O << " ||\n " << IndentStr;
7173 O << "LocVT == " << getEnumName(getValueType(VT));
7274 }
7375
114116
115117 O << IndentStr << "unsigned Offset" << ++Counter
116118 << " = State.AllocateStack(" << Size << ", " << Align << ");\n";
117 O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ArgVT, Offset"
119 O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
118120 << Counter << ", LocVT, LocInfo));\n";
119121 O << IndentStr << "return false;\n";
120122 } else if (Action->isSubClassOf("CCPromoteToType")) {
121
123 Record *DestTy = Action->getValueAsDef("DestTy");
124 O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n";
125 O << IndentStr << "LocInfo = (ArgFlags & 1) ? CCValAssign::SExt"
126 << " : CCValAssign::ZExt;\n";
122127 } else {
123128 Action->dump();
124129 throw "Unknown CCAction!";