| OLD | NEW |
| 1 //===- subzero/src/IceGlobalInits.cpp - Global declarations ---------------===// | 1 //===- subzero/src/IceGlobalInits.cpp - Global declarations ---------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements the notion of function declarations, global | 10 // This file implements the notion of function declarations, global |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 std::string Buffer; | 53 std::string Buffer; |
| 54 llvm::raw_string_ostream StrBuf(Buffer); | 54 llvm::raw_string_ostream StrBuf(Buffer); |
| 55 StrBuf << "Unknown calling convention: " << CallingConv; | 55 StrBuf << "Unknown calling convention: " << CallingConv; |
| 56 llvm::report_fatal_error(StrBuf.str()); | 56 llvm::report_fatal_error(StrBuf.str()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // end of anonymous namespace | 59 } // end of anonymous namespace |
| 60 | 60 |
| 61 namespace Ice { | 61 namespace Ice { |
| 62 | 62 |
| 63 FunctionDeclaration * | 63 FunctionDeclaration *FunctionDeclaration::create( |
| 64 FunctionDeclaration::create(GlobalContext *Ctx, const FuncSigType &Signature, | 64 const FuncSigType &Signature, llvm::CallingConv::ID CallingConv, |
| 65 llvm::CallingConv::ID CallingConv, | 65 llvm::GlobalValue::LinkageTypes Linkage, bool IsProto) { |
| 66 llvm::GlobalValue::LinkageTypes Linkage, | 66 return new FunctionDeclaration(Signature, CallingConv, Linkage, IsProto); |
| 67 bool IsProto) { | |
| 68 return Ctx->newFunctionDeclaration(&Signature, CallingConv, Linkage, IsProto); | |
| 69 } | 67 } |
| 70 | 68 |
| 71 void FunctionDeclaration::dumpType(Ostream &Stream) const { | 69 void FunctionDeclaration::dumpType(Ostream &Stream) const { |
| 72 if (!ALLOW_DUMP) | 70 if (!ALLOW_DUMP) |
| 73 return; | 71 return; |
| 74 Stream << Signature; | 72 Stream << Signature; |
| 75 } | 73 } |
| 76 | 74 |
| 77 void FunctionDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const { | 75 void FunctionDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const { |
| 78 if (!ALLOW_DUMP) | 76 if (!ALLOW_DUMP) |
| 79 return; | 77 return; |
| 80 if (IsProto) | 78 if (IsProto) |
| 81 Stream << "declare "; | 79 Stream << "declare "; |
| 82 ::dumpLinkage(Stream, Linkage); | 80 ::dumpLinkage(Stream, Linkage); |
| 83 ::dumpCallingConv(Stream, CallingConv); | 81 ::dumpCallingConv(Stream, CallingConv); |
| 84 Stream << Signature.getReturnType() << " @" | 82 Stream << Signature.getReturnType() << " @" |
| 85 << (Ctx ? Ctx->mangleName(Name) : Name) << "("; | 83 << (Ctx ? Ctx->mangleName(Name) : Name) << "("; |
| 86 bool IsFirst = true; | 84 bool IsFirst = true; |
| 87 for (Type ArgTy : Signature.getArgList()) { | 85 for (Type ArgTy : Signature.getArgList()) { |
| 88 if (IsFirst) | 86 if (IsFirst) |
| 89 IsFirst = false; | 87 IsFirst = false; |
| 90 else | 88 else |
| 91 Stream << ", "; | 89 Stream << ", "; |
| 92 Stream << ArgTy; | 90 Stream << ArgTy; |
| 93 } | 91 } |
| 94 Stream << ")"; | 92 Stream << ")"; |
| 95 } | 93 } |
| 96 | 94 |
| 97 VariableDeclaration *VariableDeclaration::create(GlobalContext *Ctx) { | 95 VariableDeclaration *VariableDeclaration::create() { |
| 98 return Ctx->newVariableDeclaration(); | 96 return new VariableDeclaration(); |
| 99 } | 97 } |
| 100 | 98 |
| 101 VariableDeclaration::~VariableDeclaration() { | 99 VariableDeclaration::~VariableDeclaration() { |
| 102 llvm::DeleteContainerPointers(Initializers); | 100 llvm::DeleteContainerPointers(Initializers); |
| 103 } | 101 } |
| 104 | 102 |
| 105 void VariableDeclaration::dumpType(Ostream &Stream) const { | 103 void VariableDeclaration::dumpType(Ostream &Stream) const { |
| 106 if (!ALLOW_DUMP) | 104 if (!ALLOW_DUMP) |
| 107 return; | 105 return; |
| 108 if (Initializers.size() == 1) { | 106 if (Initializers.size() == 1) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 dumpType(Stream); | 210 dumpType(Stream); |
| 213 Stream << ")"; | 211 Stream << ")"; |
| 214 if (Offset != 0) { | 212 if (Offset != 0) { |
| 215 Stream << ", "; | 213 Stream << ", "; |
| 216 dumpType(Stream); | 214 dumpType(Stream); |
| 217 Stream << " " << Offset << ")"; | 215 Stream << " " << Offset << ")"; |
| 218 } | 216 } |
| 219 } | 217 } |
| 220 | 218 |
| 221 } // end of namespace Ice | 219 } // end of namespace Ice |
| OLD | NEW |