]> granicus.if.org Git - clang/commitdiff
temporarily revert devang's patch to link in the llvm codegen etc.
authorChris Lattner <sabre@nondot.org>
Wed, 31 Oct 2007 04:53:03 +0000 (04:53 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 31 Oct 2007 04:53:03 +0000 (04:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43544 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 8bb4c2e51efe6528a84059b8027e9acca44567de..a596c08528dd828a8735a555bf8d94c4e3f8ccd0 100644 (file)
@@ -24,10 +24,8 @@ using namespace clang;
 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.
index a044c0d02eef680418862dce1e6282015a2f1387..4ca4f8c55063e11e8f6b1b056446ec3275e6f68c 100644 (file)
@@ -23,7 +23,6 @@ namespace llvm {
   class Constant;
   class Function;
   class GlobalVariable;
-  class TargetData;
 }
 
 namespace clang {
@@ -40,7 +39,6 @@ namespace CodeGen {
 class CodeGenModule {
   ASTContext &Context;
   llvm::Module &TheModule;
-  const llvm::TargetData &TheTargetData;
   CodeGenTypes Types;
 
   llvm::Function *MemCpyFn;
@@ -51,7 +49,7 @@ class CodeGenModule {
   
   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; }
index 745ba1d87ebd39e89971b09e30283cf95040e565..017b65c152c044f071dff15a9efe76ab290a921c 100644 (file)
@@ -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 @@ namespace {
     /// 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 @@ namespace {
   };
 }
 
-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 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
       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 @@ void RecordOrganizer::addField(const FieldDecl *FD) {
 ///    - 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++);
index b89713584c640c4f6ba9fabd721de9b25672412b..95aea85c8eb3541f2461ffbc03ad6f23ad231df8 100644 (file)
@@ -21,7 +21,6 @@ namespace llvm {
   class Module;
   class Type;
   class PATypeHolder;
-  class TargetData;
 }
 
 namespace clang {
@@ -62,7 +61,6 @@ class CodeGenTypes {
   ASTContext &Context;
   TargetInfo &Target;
   llvm::Module& TheModule;
-  const llvm::TargetData& TheTargetData;
   
   llvm::DenseMap<const TagDecl*, llvm::Type*> TagDeclTypes;
 
@@ -93,10 +91,9 @@ class CodeGenTypes {
   /// 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; }
 
index a7586b64c2f6317266b8fc8713b879b5d5bcc69f..4a5a470563b49b814d0c607fe4a484ae0c877ce9 100644 (file)
@@ -18,9 +18,8 @@ using namespace clang;
 
 /// 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) {
index 0fcebcae4cccb14caf31ea99916ee2039d09f4ac..37d637bf1008cadefe2db02807629fb1c43af783 100644 (file)
@@ -379,19 +379,14 @@ ASTConsumer *clang::CreateUnitValsChecker(Diagnostic &Diags) {
 // 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 @@ namespace {
     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) {
index bf861514ecb55eee9785fa4aaa79516a78e8fad1..6d2cfe0a750fea1277737de38d27d4b4de167410 100644 (file)
@@ -4,12 +4,8 @@ CXXFLAGS = -fno-rtti
 
 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
index f766f9e26b5183b761eebdbeb674955ccd170601..334f87851d9709c8c59d122b971488ed65de8229 100644 (file)
@@ -218,11 +218,6 @@ public:
     getLongLongInfo(Size, Align, Loc);
     return static_cast<unsigned>(Size);
   }
-
-  const char *getTargetTriple() {
-    // FIXME !
-    return "i686-apple-darwin9";
-  }
 private:
   void ComputeWCharInfo(SourceLocation Loc);
 };
index 96b0f59b8e95cc4d9ecbbd2592751c8602407d88..0b1ae476ed46b11bd1b3eb8d7c8b07c3bd8b97b0 100644 (file)
@@ -16,7 +16,6 @@
 
 namespace llvm {
   class Module;
-  class TargetData;
 }
 
 namespace clang {
@@ -30,8 +29,7 @@ namespace CodeGen {
   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.
   ///