CallingConvEmitter.cpp (193323) | CallingConvEmitter.cpp (195340) |
---|---|
1//===- CallingConvEmitter.cpp - Generate calling conventions --------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This tablegen backend is responsible for emitting descriptions of the calling 11// conventions supported by this target. 12// 13//===----------------------------------------------------------------------===// 14 15#include "CallingConvEmitter.h" 16#include "Record.h" 17#include "CodeGenTarget.h" 18using namespace llvm; 19 | 1//===- CallingConvEmitter.cpp - Generate calling conventions --------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This tablegen backend is responsible for emitting descriptions of the calling 11// conventions supported by this target. 12// 13//===----------------------------------------------------------------------===// 14 15#include "CallingConvEmitter.h" 16#include "Record.h" 17#include "CodeGenTarget.h" 18using namespace llvm; 19 |
20void CallingConvEmitter::run(std::ostream &O) { | 20void CallingConvEmitter::run(raw_ostream &O) { |
21 EmitSourceFileHeader("Calling Convention Implementation Fragment", O); 22 23 std::vector<Record*> CCs = Records.getAllDerivedDefinitions("CallingConv"); 24 25 // Emit prototypes for all of the CC's so that they can forward ref each 26 // other. 27 for (unsigned i = 0, e = CCs.size(); i != e; ++i) { 28 O << "static bool " << CCs[i]->getName() --- 5 unchanged lines hidden (view full) --- 34 } 35 36 // Emit each calling convention description in full. 37 for (unsigned i = 0, e = CCs.size(); i != e; ++i) 38 EmitCallingConv(CCs[i], O); 39} 40 41 | 21 EmitSourceFileHeader("Calling Convention Implementation Fragment", O); 22 23 std::vector<Record*> CCs = Records.getAllDerivedDefinitions("CallingConv"); 24 25 // Emit prototypes for all of the CC's so that they can forward ref each 26 // other. 27 for (unsigned i = 0, e = CCs.size(); i != e; ++i) { 28 O << "static bool " << CCs[i]->getName() --- 5 unchanged lines hidden (view full) --- 34 } 35 36 // Emit each calling convention description in full. 37 for (unsigned i = 0, e = CCs.size(); i != e; ++i) 38 EmitCallingConv(CCs[i], O); 39} 40 41 |
42void CallingConvEmitter::EmitCallingConv(Record *CC, std::ostream &O) { | 42void CallingConvEmitter::EmitCallingConv(Record *CC, raw_ostream &O) { |
43 ListInit *CCActions = CC->getValueAsListInit("Actions"); 44 Counter = 0; 45 46 O << "\n\nstatic bool " << CC->getName() 47 << "(unsigned ValNo, MVT ValVT,\n" 48 << std::string(CC->getName().size()+13, ' ') 49 << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" 50 << std::string(CC->getName().size()+13, ' ') --- 4 unchanged lines hidden (view full) --- 55 EmitAction(CCActions->getElementAsRecord(i), 2, O); 56 } 57 58 O << "\n return true; // CC didn't match.\n"; 59 O << "}\n"; 60} 61 62void CallingConvEmitter::EmitAction(Record *Action, | 43 ListInit *CCActions = CC->getValueAsListInit("Actions"); 44 Counter = 0; 45 46 O << "\n\nstatic bool " << CC->getName() 47 << "(unsigned ValNo, MVT ValVT,\n" 48 << std::string(CC->getName().size()+13, ' ') 49 << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" 50 << std::string(CC->getName().size()+13, ' ') --- 4 unchanged lines hidden (view full) --- 55 EmitAction(CCActions->getElementAsRecord(i), 2, O); 56 } 57 58 O << "\n return true; // CC didn't match.\n"; 59 O << "}\n"; 60} 61 62void CallingConvEmitter::EmitAction(Record *Action, |
63 unsigned Indent, std::ostream &O) { | 63 unsigned Indent, raw_ostream &O) { |
64 std::string IndentStr = std::string(Indent, ' '); 65 66 if (Action->isSubClassOf("CCPredicateAction")) { 67 O << IndentStr << "if ("; 68 69 if (Action->isSubClassOf("CCIfType")) { 70 ListInit *VTs = Action->getValueAsListInit("VTs"); 71 for (unsigned i = 0, e = VTs->getSize(); i != e; ++i) { --- 135 unchanged lines hidden --- | 64 std::string IndentStr = std::string(Indent, ' '); 65 66 if (Action->isSubClassOf("CCPredicateAction")) { 67 O << IndentStr << "if ("; 68 69 if (Action->isSubClassOf("CCIfType")) { 70 ListInit *VTs = Action->getValueAsListInit("VTs"); 71 for (unsigned i = 0, e = VTs->getSize(); i != e; ++i) { --- 135 unchanged lines hidden --- |