diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-21 23:19:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-21 23:19:36 +0000 |
commit | 3284877064af9e6f67bb8c7e540753d22bb69662 (patch) | |
tree | 1e5b2674414cf7fd5bc29ab26e4923ca7ec2ece7 /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 1018c24c1357f76d350dc42957108362bd3b830c (diff) |
add some support for blockaddress. This isn't really enough to be useful,
but it will cover uses of blockaddress that are actually in a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 00f3cafb70..da63b1e75a 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -936,6 +936,9 @@ void CppWriter::printConstant(const Constant *CV) { Out << ", " << getCppName(CE->getOperand(i)); Out << ");"; } + } else if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV)) { + Out << "Constant* " << constName << " = "; + Out << "BlockAddress::get(" << getOpName(BA->getBasicBlock()) << ");"; } else { error("Bad Constant"); Out << "Constant* " << constName << " = 0; "; @@ -1088,9 +1091,8 @@ void CppWriter::printInstruction(const Instruction *I, // forward references. So, we get the names of all the operands in advance const unsigned Ops(I->getNumOperands()); std::string* opNames = new std::string[Ops]; - for (unsigned i = 0; i < Ops; i++) { + for (unsigned i = 0; i < Ops; i++) opNames[i] = getOpName(I->getOperand(i)); - } switch (I->getOpcode()) { default: @@ -1106,7 +1108,7 @@ void CppWriter::printInstruction(const Instruction *I, case Instruction::Br: { const BranchInst* br = cast<BranchInst>(I); Out << "BranchInst::Create(" ; - if (br->getNumOperands() == 3 ) { + if (br->getNumOperands() == 3) { Out << opNames[2] << ", " << opNames[1] << ", " << opNames[0] << ", "; |