diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
commit | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch) | |
tree | 599ab169a01f1c86eda9adc774edaedde2f2db5b /utils/TableGen/CallingConvEmitter.cpp | |
parent | 1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff) |
Diffstat (limited to 'utils/TableGen/CallingConvEmitter.cpp')
-rw-r--r-- | utils/TableGen/CallingConvEmitter.cpp | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/utils/TableGen/CallingConvEmitter.cpp b/utils/TableGen/CallingConvEmitter.cpp index d452031f8850..de5044e24d49 100644 --- a/utils/TableGen/CallingConvEmitter.cpp +++ b/utils/TableGen/CallingConvEmitter.cpp @@ -1,9 +1,8 @@ //===- CallingConvEmitter.cpp - Generate calling conventions --------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -41,11 +40,17 @@ void CallingConvEmitter::run(raw_ostream &O) { // each other. for (Record *CC : CCs) { if (!CC->getValueAsBit("Custom")) { - O << "static bool " << CC->getName() - << "(unsigned ValNo, MVT ValVT,\n" - << std::string(CC->getName().size() + 13, ' ') - << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" - << std::string(CC->getName().size() + 13, ' ') + unsigned Pad = CC->getName().size(); + if (CC->getValueAsBit("Entry")) { + O << "bool llvm::"; + Pad += 12; + } else { + O << "static bool "; + Pad += 13; + } + O << CC->getName() << "(unsigned ValNo, MVT ValVT,\n" + << std::string(Pad, ' ') << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" + << std::string(Pad, ' ') << "ISD::ArgFlagsTy ArgFlags, CCState &State);\n"; } } @@ -62,12 +67,18 @@ void CallingConvEmitter::EmitCallingConv(Record *CC, raw_ostream &O) { ListInit *CCActions = CC->getValueAsListInit("Actions"); Counter = 0; - O << "\n\nstatic bool " << CC->getName() - << "(unsigned ValNo, MVT ValVT,\n" - << std::string(CC->getName().size()+13, ' ') - << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" - << std::string(CC->getName().size()+13, ' ') - << "ISD::ArgFlagsTy ArgFlags, CCState &State) {\n"; + O << "\n\n"; + unsigned Pad = CC->getName().size(); + if (CC->getValueAsBit("Entry")) { + O << "bool llvm::"; + Pad += 12; + } else { + O << "static bool "; + Pad += 13; + } + O << CC->getName() << "(unsigned ValNo, MVT ValVT,\n" + << std::string(Pad, ' ') << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n" + << std::string(Pad, ' ') << "ISD::ArgFlagsTy ArgFlags, CCState &State) {\n"; // Emit all of the actions, in order. for (unsigned i = 0, e = CCActions->size(); i != e; ++i) { O << "\n"; @@ -97,7 +108,7 @@ void CallingConvEmitter::EmitAction(Record *Action, O << Action->getValueAsString("Predicate"); } else { errs() << *Action; - PrintFatalError("Unknown CCPredicateAction!"); + PrintFatalError(Action->getLoc(), "Unknown CCPredicateAction!"); } O << ") {\n"; @@ -134,7 +145,8 @@ void CallingConvEmitter::EmitAction(Record *Action, ListInit *RegList = Action->getValueAsListInit("RegList"); ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList"); if (!ShadowRegList->empty() && ShadowRegList->size() != RegList->size()) - PrintFatalError("Invalid length of list of shadowed registers"); + PrintFatalError(Action->getLoc(), + "Invalid length of list of shadowed registers"); if (RegList->size() == 1) { O << IndentStr << "if (unsigned Reg = State.AllocateReg("; @@ -237,7 +249,8 @@ void CallingConvEmitter::EmitAction(Record *Action, MVT::SimpleValueType DestVT = getValueType(DestTy); O << IndentStr << "LocVT = " << getEnumName(DestVT) << ";\n"; if (MVT(DestVT).isFloatingPoint()) { - PrintFatalError("CCPromoteToUpperBitsInType does not handle floating " + PrintFatalError(Action->getLoc(), + "CCPromoteToUpperBitsInType does not handle floating " "point"); } else { O << IndentStr << "if (ArgFlags.isSExt())\n" @@ -269,7 +282,7 @@ void CallingConvEmitter::EmitAction(Record *Action, O << IndentStr << IndentStr << "return false;\n"; } else { errs() << *Action; - PrintFatalError("Unknown CCAction!"); + PrintFatalError(Action->getLoc(), "Unknown CCAction!"); } } } |