[cfe-commits] r43544 - in /cfe/trunk: CodeGen/CodeGenModule.cpp CodeGen/CodeGenModule.h CodeGen/CodeGenTypes.cpp CodeGen/CodeGenTypes.h CodeGen/ModuleBuilder.cpp Driver/ASTConsumers.cpp Driver/Makefile include/clang/Basic/TargetInfo.h include/clang/CodeGen/ModuleBuilder.h
Chris Lattner
sabre at nondot.org
Tue Oct 30 21:53:05 PDT 2007
Author: lattner
Date: Tue Oct 30 23:53:03 2007
New Revision: 43544
URL: http://llvm.org/viewvc/llvm-project?rev=43544&view=rev
Log:
temporarily revert devang's patch to link in the llvm codegen etc.
Modified:
cfe/trunk/CodeGen/CodeGenModule.cpp
cfe/trunk/CodeGen/CodeGenModule.h
cfe/trunk/CodeGen/CodeGenTypes.cpp
cfe/trunk/CodeGen/CodeGenTypes.h
cfe/trunk/CodeGen/ModuleBuilder.cpp
cfe/trunk/Driver/ASTConsumers.cpp
cfe/trunk/Driver/Makefile
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
Modified: cfe/trunk/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenModule.cpp?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenModule.cpp Tue Oct 30 23:53:03 2007
@@ -24,10 +24,8 @@
using namespace CodeGen;
-CodeGenModule::CodeGenModule(ASTContext &C, llvm::Module &M,
- const llvm::TargetData &TD)
- : Context(C), TheModule(M), TheTargetData(TD),
- Types(C, M, TD), CFConstantStringClassRef(0) {}
+CodeGenModule::CodeGenModule(ASTContext &C, llvm::Module &M)
+ : Context(C), TheModule(M), Types(C, M), CFConstantStringClassRef(0) {}
llvm::Constant *CodeGenModule::GetAddrOfGlobalDecl(const ValueDecl *D) {
// See if it is already in the map.
Modified: cfe/trunk/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenModule.h?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/CodeGen/CodeGenModule.h Tue Oct 30 23:53:03 2007
@@ -23,7 +23,6 @@
class Constant;
class Function;
class GlobalVariable;
- class TargetData;
}
namespace clang {
@@ -40,7 +39,6 @@
class CodeGenModule {
ASTContext &Context;
llvm::Module &TheModule;
- const llvm::TargetData &TheTargetData;
CodeGenTypes Types;
llvm::Function *MemCpyFn;
@@ -51,7 +49,7 @@
std::vector<llvm::Function *> BuiltinFunctions;
public:
- CodeGenModule(ASTContext &C, llvm::Module &M, const llvm::TargetData &TD);
+ CodeGenModule(ASTContext &C, llvm::Module &M);
ASTContext &getContext() const { return Context; }
llvm::Module &getModule() const { return TheModule; }
Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Tue Oct 30 23:53:03 2007
@@ -16,7 +16,6 @@
#include "clang/AST/AST.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/Target/TargetData.h"
using namespace clang;
using namespace CodeGen;
@@ -40,7 +39,7 @@
/// layoutStructFields - Do the actual work and lay out all fields. Create
/// corresponding llvm struct type. This should be invoked only after
/// all fields are added.
- void layoutStructFields(CodeGenTypes &CGT, const RecordLayout &RL);
+ void layoutStructFields(CodeGenTypes &CGT);
/// layoutUnionFields - Do the actual work and lay out all fields. Create
/// corresponding llvm struct type. This should be invoked only after
@@ -61,9 +60,8 @@
};
}
-CodeGenTypes::CodeGenTypes(ASTContext &Ctx, llvm::Module& M,
- const llvm::TargetData &TD)
- : Context(Ctx), Target(Ctx.Target), TheModule(M), TheTargetData(TD) {
+CodeGenTypes::CodeGenTypes(ASTContext &Ctx, llvm::Module& M)
+ : Context(Ctx), Target(Ctx.Target), TheModule(M) {
}
CodeGenTypes::~CodeGenTypes() {
@@ -247,8 +245,7 @@
RecordOrganizer RO;
for (unsigned i = 0, e = RD->getNumMembers(); i != e; ++i)
RO.addField(RD->getMember(i));
- const RecordLayout &RL = Context.getRecordLayout(RD, SourceLocation());
- RO.layoutStructFields(*this, RL);
+ RO.layoutStructFields(*this);
// Get llvm::StructType.
RecordLayoutInfo *RLI = new RecordLayoutInfo(RO.getLLVMType());
@@ -355,21 +352,16 @@
/// - Ignore bit fields
/// - Ignore field aligments
/// - Ignore packed structs
-void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT,
- const RecordLayout &RL) {
+void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT) {
// FIXME : Use SmallVector
std::vector<const llvm::Type*> Fields;
unsigned FieldNo = 0;
- uint64_t Cursor = 0;
-
for (llvm::SmallVector<const FieldDecl *, 8>::iterator I = FieldDecls.begin(),
E = FieldDecls.end(); I != E; ++I) {
const FieldDecl *FD = *I;
const llvm::Type *Ty = CGT.ConvertType(FD->getType());
- uint64_t Offset = RL.getFieldOffset(FieldNo);
- assert (Offset == Cursor && "FIXME Invalid struct layout");
- Cursor += CGT.getTargetData().getTypeSizeInBits(Ty);
+ // FIXME : Layout FieldDecl FD
Fields.push_back(Ty);
CGT.addFieldInfo(FD, FieldNo++);
Modified: cfe/trunk/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.h?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.h Tue Oct 30 23:53:03 2007
@@ -21,7 +21,6 @@
class Module;
class Type;
class PATypeHolder;
- class TargetData;
}
namespace clang {
@@ -62,7 +61,6 @@
ASTContext &Context;
TargetInfo &Target;
llvm::Module& TheModule;
- const llvm::TargetData& TheTargetData;
llvm::DenseMap<const TagDecl*, llvm::Type*> TagDeclTypes;
@@ -93,10 +91,9 @@
/// interface to convert type T into a llvm::Type.
const llvm::Type *ConvertNewType(QualType T);
public:
- CodeGenTypes(ASTContext &Ctx, llvm::Module &M, const llvm::TargetData &TD);
+ CodeGenTypes(ASTContext &Ctx, llvm::Module &M);
~CodeGenTypes();
- const llvm::TargetData &getTargetData() const { return TheTargetData; }
TargetInfo &getTarget() const { return Target; }
ASTContext &getContext() const { return Context; }
Modified: cfe/trunk/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/ModuleBuilder.cpp?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/CodeGen/ModuleBuilder.cpp Tue Oct 30 23:53:03 2007
@@ -18,9 +18,8 @@
/// Init - Create an ModuleBuilder with the specified ASTContext.
clang::CodeGen::BuilderTy *
-clang::CodeGen::Init(ASTContext &Context, llvm::Module &M,
- const llvm::TargetData &TD) {
- return new CodeGenModule(Context, M, TD);
+clang::CodeGen::Init(ASTContext &Context, llvm::Module &M) {
+ return new CodeGenModule(Context, M);
}
void clang::CodeGen::Terminate(BuilderTy *B) {
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Tue Oct 30 23:53:03 2007
@@ -379,19 +379,14 @@
// LLVM Emitter
#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "llvm/Module.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetMachineRegistry.h"
#include <iostream>
namespace {
class LLVMEmitter : public ASTConsumer {
Diagnostic &Diags;
llvm::Module *M;
- const llvm::TargetData *TD;
ASTContext *Ctx;
CodeGen::BuilderTy *Builder;
public:
@@ -399,16 +394,7 @@
virtual void Initialize(ASTContext &Context, unsigned MainFileID) {
Ctx = &Context;
M = new llvm::Module("foo");
- M->setTargetTriple(Ctx->Target.getTargetTriple());
- std::string Err;
- const llvm::TargetMachineRegistry::entry *TME =
- llvm::TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err);
- assert(TME && "Unable to determine target machine");
- // FIXME : Set appropriate subtarget features.
- std::string FeatureStr;
- llvm::TargetMachine *TheMachine = TME->CtorFn(*M, FeatureStr);
- TD = TheMachine->getTargetData();
- Builder = CodeGen::Init(Context, *M, *TD);
+ Builder = CodeGen::Init(Context, *M);
}
virtual void HandleTopLevelDecl(Decl *D) {
Modified: cfe/trunk/Driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Makefile?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/Driver/Makefile (original)
+++ cfe/trunk/Driver/Makefile Tue Oct 30 23:53:03 2007
@@ -4,12 +4,8 @@
TOOLNAME = clang
USEDLIBS = clangCodeGen.a clangAnalysis.a clangRewrite.a clangSEMA.a \
- clangAST.a clangParse.a clangLex.a clangBasic.a LLVMX86 \
+ clangAST.a clangParse.a clangLex.a clangBasic.a \
LLVMCore.a LLVMSupport.a LLVMSystem.a \
- LLVMBitWriter.a LLVMBitReader.a LLVMTarget.a LLVMCodeGen.a \
- LLVMSelectionDAG.a LLVMScalarOpts.a LLVMTransformUtils.a \
- LLVMCore.a LLVMAnalysis.a
-
-
+ LLVMBitWriter.a LLVMBitReader.a
include $(LEVEL)/Makefile.common
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Oct 30 23:53:03 2007
@@ -218,11 +218,6 @@
getLongLongInfo(Size, Align, Loc);
return static_cast<unsigned>(Size);
}
-
- const char *getTargetTriple() {
- // FIXME !
- return "i686-apple-darwin9";
- }
private:
void ComputeWCharInfo(SourceLocation Loc);
};
Modified: cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/ModuleBuilder.h?rev=43544&r1=43543&r2=43544&view=diff
==============================================================================
--- cfe/trunk/include/clang/CodeGen/ModuleBuilder.h (original)
+++ cfe/trunk/include/clang/CodeGen/ModuleBuilder.h Tue Oct 30 23:53:03 2007
@@ -16,7 +16,6 @@
namespace llvm {
class Module;
- class TargetData;
}
namespace clang {
@@ -30,8 +29,7 @@
typedef void BuilderTy;
/// Init - Create an ModuleBuilder with the specified ASTContext.
- BuilderTy *Init(ASTContext &Context, llvm::Module &M,
- const llvm::TargetData &TD);
+ BuilderTy *Init(ASTContext &Context, llvm::Module &M);
/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
///
More information about the cfe-commits
mailing list