[cfe-commits] r58546 - in /cfe/trunk/lib/CodeGen: CGBuilder.h CGDebugInfo.cpp CGDebugInfo.h CGExprAgg.cpp CGExprComplex.cpp CGExprScalar.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h CodeGenFunction.h
Daniel Dunbar
daniel at zuster.org
Fri Oct 31 18:53:16 PDT 2008
Author: ddunbar
Date: Fri Oct 31 20:53:16 2008
New Revision: 58546
URL: http://llvm.org/viewvc/llvm-project?rev=58546&view=rev
Log:
Move IRBuilder type definition to common file.
- No functionality change.
Added:
cfe/trunk/lib/CodeGen/CGBuilder.h
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGObjCRuntime.h
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Added: cfe/trunk/lib/CodeGen/CGBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=58546&view=auto
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuilder.h (added)
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Fri Oct 31 20:53:16 2008
@@ -0,0 +1,21 @@
+//===-- CGBuilder.h - Choose IRBuilder implementation ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_CODEGEN_CGBUILDER_H
+#define CLANG_CODEGEN_CGBUILDER_H
+
+#include "llvm/Support/IRBuilder.h"
+
+namespace clang {
+namespace CodeGen {
+ typedef llvm::IRBuilder<> CGBuilderTy;
+} // end namespace CodeGen
+} // end namespace clang
+
+#endif
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct 31 20:53:16 2008
@@ -27,7 +27,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/IRBuilder.h"
#include "llvm/Target/TargetMachine.h"
using namespace clang;
using namespace clang::CodeGen;
@@ -603,7 +602,7 @@
void CGDebugInfo::EmitFunctionStart(const char *Name,
QualType ReturnType,
llvm::Function *Fn,
- llvm::IRBuilder<> &Builder)
+ CGBuilderTy &Builder)
{
// Create subprogram descriptor.
Subprogram = new llvm::SubprogramDesc();
@@ -647,7 +646,7 @@
void
-CGDebugInfo::EmitStopPoint(llvm::Function *Fn, llvm::IRBuilder<> &Builder)
+CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder)
{
if (CurLoc.isInvalid() || CurLoc.isMacroID()) return;
@@ -682,7 +681,7 @@
/// EmitRegionStart- Constructs the debug code for entering a declarative
/// region - "llvm.dbg.region.start.".
void CGDebugInfo::EmitRegionStart(llvm::Function *Fn,
- llvm::IRBuilder<> &Builder)
+ CGBuilderTy &Builder)
{
llvm::BlockDesc *Block = new llvm::BlockDesc();
if (!RegionStack.empty())
@@ -700,7 +699,7 @@
/// EmitRegionEnd - Constructs the debug code for exiting a declarative
/// region - "llvm.dbg.region.end."
-void CGDebugInfo::EmitRegionEnd(llvm::Function *Fn, llvm::IRBuilder<> &Builder)
+void CGDebugInfo::EmitRegionEnd(llvm::Function *Fn, CGBuilderTy &Builder)
{
assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
@@ -722,7 +721,7 @@
/// EmitDeclare - Emit local variable declaration debug info.
void CGDebugInfo::EmitDeclare(const VarDecl *decl, unsigned Tag,
llvm::Value *AI,
- llvm::IRBuilder<> &Builder)
+ CGBuilderTy &Builder)
{
assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri Oct 31 20:53:16 2008
@@ -16,10 +16,10 @@
#include "clang/AST/Type.h"
#include "clang/Basic/SourceLocation.h"
-#include "llvm/Support/IRBuilder.h"
#include <map>
#include <vector>
+#include "CGBuilder.h"
namespace llvm {
class Function;
@@ -41,6 +41,7 @@
namespace clang {
class FunctionDecl;
class VarDecl;
+
namespace CodeGen {
class CodeGenModule;
@@ -54,8 +55,6 @@
SourceLocation CurLoc;
SourceLocation PrevLoc;
- typedef llvm::IRBuilder<> BuilderType;
-
/// CompileUnitCache - Cache of previously constructed CompileUnits.
std::map<const FileEntry*, llvm::CompileUnitDesc *> CompileUnitCache;
@@ -109,24 +108,24 @@
/// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
/// source line.
- void EmitStopPoint(llvm::Function *Fn, BuilderType &Builder);
+ void EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder);
/// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
/// start of a new function.
void EmitFunctionStart(const char *Name, QualType ReturnType,
- llvm::Function *Fn, BuilderType &Builder);
+ llvm::Function *Fn, CGBuilderTy &Builder);
/// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start
/// of a new block.
- void EmitRegionStart(llvm::Function *Fn, BuilderType &Builder);
+ void EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder);
/// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
/// block.
- void EmitRegionEnd(llvm::Function *Fn, BuilderType &Builder);
+ void EmitRegionEnd(llvm::Function *Fn, CGBuilderTy &Builder);
/// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,
- BuilderType &Builder);
+ CGBuilderTy &Builder);
/// EmitGlobalVariable - Emit information about a global variable.
void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *decl);
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Oct 31 20:53:16 2008
@@ -30,7 +30,7 @@
namespace {
class VISIBILITY_HIDDEN AggExprEmitter : public StmtVisitor<AggExprEmitter> {
CodeGenFunction &CGF;
- llvm::IRBuilder<> &Builder;
+ CGBuilderTy &Builder;
llvm::Value *DestPtr;
bool VolatileDest;
public:
Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Fri Oct 31 20:53:16 2008
@@ -32,7 +32,7 @@
class VISIBILITY_HIDDEN ComplexExprEmitter
: public StmtVisitor<ComplexExprEmitter, ComplexPairTy> {
CodeGenFunction &CGF;
- llvm::IRBuilder<> &Builder;
+ CGBuilderTy &Builder;
public:
ComplexExprEmitter(CodeGenFunction &cgf) : CGF(cgf), Builder(CGF.Builder) {
}
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Oct 31 20:53:16 2008
@@ -43,7 +43,7 @@
class VISIBILITY_HIDDEN ScalarExprEmitter
: public StmtVisitor<ScalarExprEmitter, Value*> {
CodeGenFunction &CGF;
- llvm::IRBuilder<> &Builder;
+ CGBuilderTy &Builder;
public:
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Fri Oct 31 20:53:16 2008
@@ -24,7 +24,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/IRBuilder.h"
#include "llvm/Target/TargetData.h"
#include <map>
using namespace clang;
@@ -110,14 +109,14 @@
llvm::Value *Receiver,
bool IsClassMessage,
const CallArgList &CallArgs);
- virtual llvm::Value *GetClass(llvm::IRBuilder<> &Builder,
+ virtual llvm::Value *GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *OID);
- virtual llvm::Value *GetSelector(llvm::IRBuilder<> &Builder, Selector Sel);
+ virtual llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel);
virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD);
virtual void GenerateCategory(const ObjCCategoryImplDecl *CMD);
virtual void GenerateClass(const ObjCImplementationDecl *ClassDecl);
- virtual llvm::Value *GenerateProtocolRef(llvm::IRBuilder<> &Builder,
+ virtual llvm::Value *GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *PD);
virtual void GenerateProtocol(const ObjCProtocolDecl *PD);
virtual llvm::Function *ModuleInitFunction();
@@ -182,7 +181,7 @@
}
// This has to perform the lookup every time, since posing and related
// techniques can modify the name -> class mapping.
-llvm::Value *CGObjCGNU::GetClass(llvm::IRBuilder<> &Builder,
+llvm::Value *CGObjCGNU::GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *OID) {
llvm::Value *ClassName = CGM.GetAddrOfConstantCString(OID->getName());
ClassName = Builder.CreateStructGEP(ClassName, 0);
@@ -194,7 +193,7 @@
}
/// GetSelector - Return the pointer to the unique'd string for this selector.
-llvm::Value *CGObjCGNU::GetSelector(llvm::IRBuilder<> &Builder, Selector Sel) {
+llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, Selector Sel) {
// FIXME: uniquing on the string is wasteful, unique on Sel instead!
llvm::GlobalAlias *&US = UntypedSelectors[Sel.getName()];
if (US == 0)
@@ -553,7 +552,7 @@
return MakeGlobal(ProtocolListTy, Elements, ".objc_protocol_list");
}
-llvm::Value *CGObjCGNU::GenerateProtocolRef(llvm::IRBuilder<> &Builder,
+llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *PD) {
return ExistingProtocols[PD->getName()];
}
@@ -911,7 +910,7 @@
llvm::GlobalValue::InternalLinkage, ".objc_load_function",
&TheModule);
llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", LoadFunction);
- llvm::IRBuilder<> Builder;
+ CGBuilderTy Builder;
Builder.SetInsertPoint(EntryBB);
llvm::Value *Register = TheModule.getOrInsertFunction("__objc_exec_class",
llvm::Type::VoidTy, llvm::PointerType::getUnqual(ModuleTy), NULL);
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Oct 31 20:53:16 2008
@@ -22,7 +22,6 @@
#include "llvm/Module.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/Support/IRBuilder.h"
#include "llvm/Target/TargetData.h"
#include <sstream>
@@ -257,7 +256,7 @@
/// EmitClassRef - Return a Value*, of type ObjCTypes.ClassPtrTy,
/// for the given class.
- llvm::Value *EmitClassRef(llvm::IRBuilder<> &Builder,
+ llvm::Value *EmitClassRef(CGBuilderTy &Builder,
const ObjCInterfaceDecl *ID);
CodeGen::RValue EmitMessageSend(CodeGen::CodeGenFunction &CGF,
@@ -349,7 +348,7 @@
/// EmitSelector - Return a Value*, of type ObjCTypes.SelectorPtrTy,
/// for the given selector.
- llvm::Value *EmitSelector(llvm::IRBuilder<> &Builder, Selector Sel);
+ llvm::Value *EmitSelector(CGBuilderTy &Builder, Selector Sel);
/// GetProtocolRef - Return a reference to the internal protocol
/// description, creating an empty one if it has not been
@@ -406,10 +405,10 @@
bool IsClassMessage,
const CallArgList &CallArgs);
- virtual llvm::Value *GetClass(llvm::IRBuilder<> &Builder,
+ virtual llvm::Value *GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *ID);
- virtual llvm::Value *GetSelector(llvm::IRBuilder<> &Builder, Selector Sel);
+ virtual llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel);
virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD);
@@ -417,7 +416,7 @@
virtual void GenerateClass(const ObjCImplementationDecl *ClassDecl);
- virtual llvm::Value *GenerateProtocolRef(llvm::IRBuilder<> &Builder,
+ virtual llvm::Value *GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *PD);
virtual void GenerateProtocol(const ObjCProtocolDecl *PD);
@@ -464,13 +463,13 @@
/// GetClass - Return a reference to the class for the given interface
/// decl.
-llvm::Value *CGObjCMac::GetClass(llvm::IRBuilder<> &Builder,
+llvm::Value *CGObjCMac::GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *ID) {
return EmitClassRef(Builder, ID);
}
/// GetSelector - Return the pointer to the unique'd string for this selector.
-llvm::Value *CGObjCMac::GetSelector(llvm::IRBuilder<> &Builder, Selector Sel) {
+llvm::Value *CGObjCMac::GetSelector(CGBuilderTy &Builder, Selector Sel) {
return EmitSelector(Builder, Sel);
}
@@ -577,7 +576,7 @@
return CGF.EmitCall(Fn, ResultType, ActualArgs);
}
-llvm::Value *CGObjCMac::GenerateProtocolRef(llvm::IRBuilder<> &Builder,
+llvm::Value *CGObjCMac::GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *PD) {
// FIXME: I don't understand why gcc generates this, or where it is
// resolved. Investigate. Its also wasteful to look this up over and
@@ -1873,7 +1872,7 @@
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.SymtabPtrTy);
}
-llvm::Value *CGObjCMac::EmitClassRef(llvm::IRBuilder<> &Builder,
+llvm::Value *CGObjCMac::EmitClassRef(CGBuilderTy &Builder,
const ObjCInterfaceDecl *ID) {
LazySymbols.insert(ID->getIdentifier());
@@ -1895,7 +1894,7 @@
return Builder.CreateLoad(Entry, false, "tmp");
}
-llvm::Value *CGObjCMac::EmitSelector(llvm::IRBuilder<> &Builder, Selector Sel) {
+llvm::Value *CGObjCMac::EmitSelector(CGBuilderTy &Builder, Selector Sel) {
llvm::GlobalVariable *&Entry = SelectorReferences[Sel];
if (!Entry) {
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Fri Oct 31 20:53:16 2008
@@ -17,11 +17,11 @@
#define CLANG_CODEGEN_OBCJRUNTIME_H
#include "clang/Basic/IdentifierTable.h" // Selector
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/IRBuilder.h"
#include <string>
-#include "CGValue.h"
+#include "CGBuilder.h"
#include "CGCall.h"
+#include "CGValue.h"
namespace llvm {
class Constant;
@@ -54,7 +54,6 @@
/// Implements runtime-specific code generation functions.
class CGObjCRuntime {
- typedef llvm::IRBuilder<> BuilderType;
public:
virtual ~CGObjCRuntime();
@@ -66,7 +65,7 @@
/// Get a selector for the specified name and type values. The
/// return value should have the LLVM type for pointer-to
/// ASTContext::getObjCSelType().
- virtual llvm::Value *GetSelector(BuilderType &Builder,
+ virtual llvm::Value *GetSelector(CGBuilderTy &Builder,
Selector Sel) = 0;
/// Generate a constant string object.
@@ -102,7 +101,7 @@
/// Emit the code to return the named protocol as an object, as in a
/// @protocol expression.
- virtual llvm::Value *GenerateProtocolRef(llvm::IRBuilder<true> &Builder,
+ virtual llvm::Value *GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *OPD) = 0;
/// Generate the named protocol. Protocols contain method metadata but no
@@ -126,7 +125,7 @@
/// GetClass - Return a reference to the class for the given
/// interface decl.
- virtual llvm::Value *GetClass(BuilderType &Builder,
+ virtual llvm::Value *GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *OID) = 0;
/// EnumerationMutationFunction - Return the function that's called by the
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=58546&r1=58545&r2=58546&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Oct 31 20:53:16 2008
@@ -17,7 +17,6 @@
#include "clang/AST/Type.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/IRBuilder.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
@@ -25,6 +24,7 @@
#include <vector>
#include <map>
+#include "CGBuilder.h"
#include "CGCall.h"
#include "CGValue.h"
@@ -52,7 +52,7 @@
class CodeGenModule;
class CodeGenTypes;
class CGRecordLayout;
-
+
/// CodeGenFunction - This class organizes the per-function state that is used
/// while generating LLVM code.
class CodeGenFunction {
@@ -61,7 +61,7 @@
TargetInfo &Target;
typedef std::pair<llvm::Value *, llvm::Value *> ComplexPairTy;
- llvm::IRBuilder<> Builder;
+ CGBuilderTy Builder;
// Holds the Decl for the current function or method
const Decl *CurFuncDecl;
More information about the cfe-commits
mailing list