From lattner at cs.uiuc.edu Mon Jul 11 00:15:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 00:15:43 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507110515.AAA06924@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.3 -> 1.4 --- Log message: expose a new code emitter object --- Diffs of the changes: (+14 -1) ELFWriter.h | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.3 llvm/include/llvm/CodeGen/ELFWriter.h:1.4 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.3 Sun Jul 10 22:11:10 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Mon Jul 11 00:15:32 2005 @@ -19,12 +19,22 @@ namespace llvm { class GlobalVariable; class Mangler; + class MachineCodeEmitter; + class ELFCodeEmitter; /// ELFWriter - This class implements the common target-independent code for /// writing ELF files. Targets should derive a class from this to /// parameterize the output format. /// class ELFWriter : public MachineFunctionPass { + friend class ELFCodeEmitter; + public: + MachineCodeEmitter &getMachineCodeEmitter() const { + return *(MachineCodeEmitter*)MCE; + } + + ~ELFWriter(); + protected: ELFWriter(std::ostream &O, TargetMachine &TM); @@ -40,6 +50,10 @@ /// Mangler *Mang; + /// MCE - The MachineCodeEmitter object that we are exposing to emit machine + /// code for functions to the .o file. + ELFCodeEmitter *MCE; + //===------------------------------------------------------------------===// // Properties to be set by the derived class ctor, used to configure the // ELFWriter. @@ -143,7 +157,6 @@ /// the local symbols first in the list). std::vector SymbolTable; - // As we accumulate the ELF file into OutputBuffer, we occasionally need to // keep track of locations to update later (e.g. the location of the section // table in the ELF header. These members keep track of the offset in From lattner at cs.uiuc.edu Mon Jul 11 00:17:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 00:17:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507110517.AAA06944@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.4 -> 1.5 --- Log message: add code to emit the .text section to the section header. Add a *VERY INITIAL* machine code emitter class. This is enough to take this C function: int foo(int X) { return X +1; } and make objdump produce the following: $ objdump -d t-llvm.o t-llvm.o: file format elf32-i386 Disassembly of section .text: 00000000 <.text>: 0: b8 01 00 00 00 mov $0x1,%eax 5: 03 44 24 04 add 0x4(%esp,1),%eax 9: c3 ret Anything using branches or refering to the constant pool or requiring relocations will not work yet. --- Diffs of the changes: (+89 -4) ELFWriter.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 89 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.4 llvm/lib/CodeGen/ELFWriter.cpp:1.5 --- llvm/lib/CodeGen/ELFWriter.cpp:1.4 Sun Jul 10 22:11:47 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Mon Jul 11 00:17:18 2005 @@ -34,16 +34,92 @@ #include "llvm/CodeGen/ELFWriter.h" #include "llvm/Module.h" +#include "llvm/CodeGen/MachineCodeEmitter.h" +#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" using namespace llvm; +namespace llvm { + class ELFCodeEmitter : public MachineCodeEmitter { + ELFWriter &EW; + std::vector &OutputBuffer; + size_t FnStart; + public: + ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutputBuffer(EW.OutputBuffer) {} + + void startFunction(MachineFunction &F) { + // Align the output buffer to the appropriate alignment. + unsigned Align = 16; // FIXME: GENERICIZE!! + ELFWriter::ELFSection &TextSection = EW.SectionList.back(); + + // Upgrade the section alignment if required. + if (TextSection.Align < Align) TextSection.Align = Align; + + // Add padding zeros to the end of the buffer to make sure that the + // function will start on the correct byte alignment within the section. + size_t SectionOff = OutputBuffer.size()-TextSection.Offset; + if (SectionOff & (Align-1)) { + // Add padding to get alignment to the correct place. + size_t Pad = Align-(SectionOff & (Align-1)); + OutputBuffer.resize(OutputBuffer.size()+Pad); + } + + FnStart = OutputBuffer.size(); + } + void finishFunction(MachineFunction &F) {} + void emitConstantPool(MachineConstantPool *MCP) { + if (MCP->isEmpty()) return; + assert(0 && "unimp"); + } + virtual void emitByte(unsigned char B) { + OutputBuffer.push_back(B); + } + virtual void emitWordAt(unsigned W, unsigned *Ptr) { + assert(0 && "ni"); + } + virtual void emitWord(unsigned W) { + assert(0 && "ni"); + } + virtual uint64_t getCurrentPCValue() { + return OutputBuffer.size(); + } + virtual uint64_t getCurrentPCOffset() { + return OutputBuffer.size()-FnStart; + } + void addRelocation(const MachineRelocation &MR) { + assert(0 && "relo not handled yet!"); + } + virtual uint64_t getConstantPoolEntryAddress(unsigned Index) { + assert(0 && "CP not implementated yet!"); + } + /// JIT SPECIFIC FUNCTIONS + void startFunctionStub(unsigned StubSize) { + assert(0 && "JIT specific function called!"); + abort(); + } + void *finishFunctionStub(const Function *F) { + assert(0 && "JIT specific function called!"); + abort(); + return 0; + } + }; +} + + ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) { e_machine = 0; // e_machine defaults to 'No Machine' e_flags = 0; // e_flags defaults to 0, no flags. is64Bit = TM.getTargetData().getPointerSizeInBits() == 64; isLittleEndian = TM.getTargetData().isLittleEndian(); + + // Create the machine code emitter object for this target. + MCE = new ELFCodeEmitter(*this); +} + +ELFWriter::~ELFWriter() { + delete MCE; } // doInitialization - Emit the file header and all of the global variables for @@ -91,9 +167,8 @@ // entry. SymbolTable.push_back(ELFSym(0)); + SectionList.push_back(ELFSection(".text", OutputBuffer.size())); - - // FIXME: Should start the .text section. return false; } @@ -180,14 +255,24 @@ bool ELFWriter::runOnMachineFunction(MachineFunction &MF) { + // Nothing to do here, this is all done through the MCE object above. return false; } /// doFinalization - Now that the module has been completely processed, emit /// the ELF file to 'O'. bool ELFWriter::doFinalization(Module &M) { - // Okay, the .text section has now been finalized. - // FIXME: finalize the .text section. + // Okay, the .text section has now been finalized. If it contains nothing, do + // not emit it. + uint64_t TextSize = OutputBuffer.size() - SectionList.back().Offset; + if (TextSize == 0) { + SectionList.pop_back(); + } else { + ELFSection &Text = SectionList.back(); + Text.Size = TextSize; + Text.Type = ELFSection::SHT_PROGBITS; + Text.Flags = ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC; + } // Okay, the ELF header and .text sections have been completed, build the // .data, .bss, and "common" sections next. From lattner at cs.uiuc.edu Mon Jul 11 00:17:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 00:17:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86CodeEmitter.cpp X86ELFWriter.cpp X86TargetMachine.cpp Message-ID: <200507110517.AAA06964@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.34 -> 1.35 X86CodeEmitter.cpp updated: 1.81 -> 1.82 X86ELFWriter.cpp updated: 1.1 -> 1.2 X86TargetMachine.cpp updated: 1.81 -> 1.82 --- Log message: Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter after itself. --- Diffs of the changes: (+32 -24) X86.h | 17 +++++++++++------ X86CodeEmitter.cpp | 16 ++++------------ X86ELFWriter.cpp | 14 +++++++++----- X86TargetMachine.cpp | 9 ++++++++- 4 files changed, 32 insertions(+), 24 deletions(-) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.34 llvm/lib/Target/X86/X86.h:1.35 --- llvm/lib/Target/X86/X86.h:1.34 Sun Jul 10 23:20:55 2005 +++ llvm/lib/Target/X86/X86.h Mon Jul 11 00:17:48 2005 @@ -20,8 +20,10 @@ namespace llvm { class TargetMachine; +class PassManager; class FunctionPass; class IntrinsicLowering; +class MachineCodeEmitter; enum X86VectorEnum { NoSSE, SSE, SSE2, SSE3 @@ -59,16 +61,19 @@ /// createX86CodePrinterPass - Returns a pass that prints the X86 /// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. +/// using the given target machine description. /// -FunctionPass *createX86CodePrinterPass(std::ostream &o,TargetMachine &tm); +FunctionPass *createX86CodePrinterPass(std::ostream &o, TargetMachine &tm); -/// createX86ELFObjectWriterPass - Returns a pass that outputs the generated +/// createX86CodeEmitterPass - Return a pass that emits the collected X86 code +/// to the specified MCE object. +FunctionPass *createX86CodeEmitterPass(MachineCodeEmitter &MCE); + +/// addX86ELFObjectWriterPass - Add passes to the FPM that output the generated /// code as an ELF object file. /// -FunctionPass *createX86ELFObjectWriterPass(std::ostream &o, TargetMachine &tm); - +void addX86ELFObjectWriterPass(PassManager &FPM, + std::ostream &o, TargetMachine &tm); /// createX86EmitCodeToMemory - Returns a pass that converts a register /// allocated function into raw machine code in a dynamically Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.81 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.82 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.81 Wed Jul 6 13:59:03 2005 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Jul 11 00:17:48 2005 @@ -68,18 +68,10 @@ }; } -/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get -/// machine code emitted. This uses a MachineCodeEmitter object to handle -/// actually outputting the machine code and resolving things like the address -/// of functions. This method should returns true if machine code emission is -/// not supported. -/// -bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE) { - PM.add(new Emitter(MCE)); - // Delete machine code for this function - PM.add(createMachineCodeDeleter()); - return false; +/// createX86CodeEmitterPass - Return a pass that emits the collected X86 code +/// to the specified MCE object. +FunctionPass *llvm::createX86CodeEmitterPass(MachineCodeEmitter &MCE) { + return new Emitter(MCE); } bool Emitter::runOnMachineFunction(MachineFunction &MF) { Index: llvm/lib/Target/X86/X86ELFWriter.cpp diff -u llvm/lib/Target/X86/X86ELFWriter.cpp:1.1 llvm/lib/Target/X86/X86ELFWriter.cpp:1.2 --- llvm/lib/Target/X86/X86ELFWriter.cpp:1.1 Mon Jun 27 01:30:12 2005 +++ llvm/lib/Target/X86/X86ELFWriter.cpp Mon Jul 11 00:17:48 2005 @@ -13,7 +13,9 @@ //===----------------------------------------------------------------------===// #include "X86.h" +#include "llvm/PassManager.h" #include "llvm/CodeGen/ELFWriter.h" +#include "llvm/Target/TargetMachine.h" using namespace llvm; namespace { @@ -25,10 +27,12 @@ }; } -/// createX86ELFObjectWriterPass - Returns a pass that outputs the generated -/// code as an ELF object file. +/// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code +/// as an ELF object file. /// -FunctionPass *llvm::createX86ELFObjectWriterPass(std::ostream &O, - TargetMachine &TM) { - return new X86ELFWriter(O, TM); +void llvm::addX86ELFObjectWriterPass(PassManager &FPM, + std::ostream &O, TargetMachine &TM) { + X86ELFWriter *EW = new X86ELFWriter(O, TM); + FPM.add(EW); + FPM.add(createX86CodeEmitterPass(EW->getMachineCodeEmitter())); } Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.81 llvm/lib/Target/X86/X86TargetMachine.cpp:1.82 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.81 Wed Jul 6 13:59:04 2005 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Mon Jul 11 00:17:48 2005 @@ -162,7 +162,7 @@ // FIXME: We only support emission of ELF files for now, this should check // the target triple and decide on the format to write (e.g. COFF on // win32). - PM.add(createX86ELFObjectWriterPass(Out, *this)); + addX86ELFObjectWriterPass(PM, Out, *this); break; } @@ -225,3 +225,10 @@ PM.add(createX86CodePrinterPass(std::cerr, TM)); } +bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, + MachineCodeEmitter &MCE) { + PM.add(createX86CodeEmitterPass(MCE)); + // Delete machine code for this function + PM.add(createMachineCodeDeleter()); + return false; +} From lattner at cs.uiuc.edu Mon Jul 11 01:16:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:16:36 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507110616.BAA08601@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.4 -> 1.5 --- Log message: The symbol table just needs a const GlobalValue*, not a non-const one. --- Diffs of the changes: (+4 -5) ELFWriter.h | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.4 llvm/include/llvm/CodeGen/ELFWriter.h:1.5 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.4 Mon Jul 11 00:15:32 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Mon Jul 11 01:16:24 2005 @@ -127,9 +127,8 @@ /// added to logical symbol table for the module. This is eventually /// turned into a real symbol table in the file. struct ELFSym { - GlobalValue *GV; // The global value this corresponds to. - //std::string Name; // Name of the symbol. - unsigned NameIdx; // Index in .strtab of name, once emitted. + const GlobalValue *GV; // The global value this corresponds to. + unsigned NameIdx; // Index in .strtab of name, once emitted. uint64_t Value; unsigned Size; unsigned char Info; @@ -139,8 +138,8 @@ enum { STB_LOCAL = 0, STB_GLOBAL = 1, STB_WEAK = 2 }; enum { STT_NOTYPE = 0, STT_OBJECT = 1, STT_FUNC = 2, STT_SECTION = 3, STT_FILE = 4 }; - ELFSym(GlobalValue *gv) : GV(gv), Value(0), Size(0), Info(0), - Other(0), SectionIdx(0) {} + ELFSym(const GlobalValue *gv) : GV(gv), Value(0), Size(0), Info(0), + Other(0), SectionIdx(0) {} void SetBind(unsigned X) { assert(X == (X & 0xF) && "Bind value out of range!"); From lattner at cs.uiuc.edu Mon Jul 11 01:17:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:17:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507110617.BAA08614@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.5 -> 1.6 --- Log message: Emit a symbol table entry for each function we output to the ELF file. This allows objdump to know which function we are emitting to: 00000000 : <---- 0: b8 01 00 00 00 mov $0x1,%eax 5: 03 44 24 04 add 0x4(%esp,1),%eax 9: c3 ret ... and allows .o files to be useful for linking :) --- Diffs of the changes: (+31 -1) ELFWriter.cpp | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.5 llvm/lib/CodeGen/ELFWriter.cpp:1.6 --- llvm/lib/CodeGen/ELFWriter.cpp:1.5 Mon Jul 11 00:17:18 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Mon Jul 11 01:17:35 2005 @@ -67,7 +67,37 @@ FnStart = OutputBuffer.size(); } - void finishFunction(MachineFunction &F) {} + void finishFunction(MachineFunction &F) { + // We now know the size of the function, add a symbol to represent it. + ELFWriter::ELFSym FnSym(F.getFunction()); + + // Figure out the binding (linkage) of the symbol. + switch (F.getFunction()->getLinkage()) { + default: + // appending linkage is illegal for functions. + assert(0 && "Unknown linkage type!"); + case GlobalValue::ExternalLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_GLOBAL); + break; + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK); + break; + case GlobalValue::InternalLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL); + break; + } + + FnSym.SetType(ELFWriter::ELFSym::STT_FUNC); + FnSym.SectionIdx = EW.SectionList.size()-1; // .text section. + // Value = Offset from start of .text + FnSym.Value = FnStart - EW.SectionList.back().Offset; + FnSym.Size = OutputBuffer.size()-FnStart; + + // Finally, add it to the symtab. + EW.SymbolTable.push_back(FnSym); + } + void emitConstantPool(MachineConstantPool *MCP) { if (MCP->isEmpty()) return; assert(0 && "unimp"); From lattner at cs.uiuc.edu Mon Jul 11 01:25:58 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:25:58 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200507110625.BAA09171@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.141 -> 1.142 --- Log message: Fix crazy indentation --- Diffs of the changes: (+73 -75) X86AsmPrinter.cpp | 148 ++++++++++++++++++++++++++---------------------------- 1 files changed, 73 insertions(+), 75 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.141 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.142 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.141 Thu Jul 7 19:23:26 2005 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Jul 11 01:25:47 2005 @@ -31,12 +31,12 @@ enum AsmWriterFlavorTy { att, intel }; cl::opt AsmWriterFlavor("x86-asm-syntax", - cl::desc("Choose style of code to emit from X86 backend:"), - cl::values( - clEnumVal(att, " Emit AT&T-style assembly"), - clEnumVal(intel, " Emit Intel-style assembly"), - clEnumValEnd), - cl::init(att)); + cl::desc("Choose style of code to emit from X86 backend:"), + cl::values( + clEnumVal(att, " Emit AT&T-style assembly"), + clEnumVal(intel, " Emit Intel-style assembly"), + clEnumValEnd), + cl::init(att)); /// doInitialization bool X86SharedAsmPrinter::doInitialization(Module& M) { @@ -48,15 +48,15 @@ TT.find("mingw") != std::string::npos; forDarwin = TT.find("darwin") != std::string::npos; } else if (TT.empty()) { - #if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__CYGWIN__) || defined(__MINGW32__) forCygwin = true; - #elif defined(__APPLE__) +#elif defined(__APPLE__) forDarwin = true; - #elif defined(_WIN32) +#elif defined(_WIN32) leadingUnderscore = true; - #else +#else leadingUnderscore = false; - #endif +#endif } if (leadingUnderscore || forCygwin || forDarwin) GlobalPrefix = "_"; @@ -95,76 +95,74 @@ std::string CurSection; // Print out module-level global variables here. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - if (I->hasInitializer()) { // External global require no code - O << "\n\n"; - std::string name = Mang->getValueName(I); - Constant *C = I->getInitializer(); - unsigned Size = TD.getTypeSize(C->getType()); - unsigned Align = TD.getTypeAlignmentShift(C->getType()); - - if (C->isNullValue() && - (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || - I->hasWeakLinkage() /* FIXME: Verify correct */)) { - SwitchSection(O, CurSection, ".data"); - if (!forCygwin && !forDarwin && I->hasInternalLinkage()) - O << "\t.local " << name << "\n"; - if (forDarwin && I->hasInternalLinkage()) - O << "\t.lcomm " << name << "," << Size << "," << Align; - else - O << "\t.comm " << name << "," << Size; - if (!forCygwin && !forDarwin) - O << "," << (1 << Align); - O << "\t\t# "; - WriteAsOperand(O, I, true, true, &M); - O << "\n"; - } else { - switch (I->getLinkage()) { - case GlobalValue::LinkOnceLinkage: - case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak. - // Nonnull linkonce -> weak - O << "\t.weak " << name << "\n"; - SwitchSection(O, CurSection, ""); - O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\", at progbits\n"; - break; - case GlobalValue::AppendingLinkage: - // FIXME: appending linkage variables should go into a section of - // their name or something. For now, just emit them as external. - case GlobalValue::ExternalLinkage: - // If external or appending, declare as a global symbol - O << "\t.globl " << name << "\n"; - // FALL THROUGH - case GlobalValue::InternalLinkage: - if (C->isNullValue()) - SwitchSection(O, CurSection, ".bss"); - else - SwitchSection(O, CurSection, ".data"); - break; - case GlobalValue::GhostLinkage: - std::cerr << "GhostLinkage cannot appear in X86AsmPrinter!\n"; - abort(); - } - - emitAlignment(Align); - if (!forCygwin && !forDarwin) { - O << "\t.type " << name << ", at object\n"; - O << "\t.size " << name << "," << Size << "\n"; - } - O << name << ":\t\t\t\t# "; - WriteAsOperand(O, I, true, true, &M); - O << " = "; - WriteAsOperand(O, C, false, false, &M); - O << "\n"; - emitGlobalConstant(C); - } + for (Module::const_global_iterator I = M.global_begin(), + E = M.global_end(); I != E; ++I) + if (I->hasInitializer()) { // External global require no code + O << "\n\n"; + std::string name = Mang->getValueName(I); + Constant *C = I->getInitializer(); + unsigned Size = TD.getTypeSize(C->getType()); + unsigned Align = TD.getTypeAlignmentShift(C->getType()); + + if (C->isNullValue() && + (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || + I->hasWeakLinkage() /* FIXME: Verify correct */)) { + SwitchSection(O, CurSection, ".data"); + if (!forCygwin && !forDarwin && I->hasInternalLinkage()) + O << "\t.local " << name << "\n"; + if (forDarwin && I->hasInternalLinkage()) + O << "\t.lcomm " << name << "," << Size << "," << Align; + else + O << "\t.comm " << name << "," << Size; + if (!forCygwin && !forDarwin) + O << "," << (1 << Align); + O << "\t\t# "; + WriteAsOperand(O, I, true, true, &M); + O << "\n"; + } else { + switch (I->getLinkage()) { + default: assert(0 && "Unknown linkage type!"); + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak. + // Nonnull linkonce -> weak + O << "\t.weak " << name << "\n"; + SwitchSection(O, CurSection, ""); + O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\", at progbits\n"; + break; + case GlobalValue::AppendingLinkage: + // FIXME: appending linkage variables should go into a section of + // their name or something. For now, just emit them as external. + case GlobalValue::ExternalLinkage: + // If external or appending, declare as a global symbol + O << "\t.globl " << name << "\n"; + // FALL THROUGH + case GlobalValue::InternalLinkage: + if (C->isNullValue()) + SwitchSection(O, CurSection, ".bss"); + else + SwitchSection(O, CurSection, ".data"); + break; + } + + emitAlignment(Align); + if (!forCygwin && !forDarwin) { + O << "\t.type " << name << ", at object\n"; + O << "\t.size " << name << "," << Size << "\n"; + } + O << name << ":\t\t\t\t# "; + WriteAsOperand(O, I, true, true, &M); + O << " = "; + WriteAsOperand(O, C, false, false, &M); + O << "\n"; + emitGlobalConstant(C); + } } if (forDarwin) { // Output stubs for dynamically-linked functions unsigned j = 1; for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); - i != e; ++i, ++j) - { + i != e; ++i, ++j) { O << "\t.symbol_stub\n"; O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; From lattner at cs.uiuc.edu Mon Jul 11 01:26:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:26:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Message-ID: <200507110626.BAA09178@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86IntelAsmPrinter.cpp updated: 1.2 -> 1.3 --- Log message: convert dos newlines to unix. No other changes. --- Diffs of the changes: (+205 -205) X86IntelAsmPrinter.cpp | 410 ++++++++++++++++++++++++------------------------- 1 files changed, 205 insertions(+), 205 deletions(-) Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.2 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.3 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.2 Sun Jul 3 12:34:39 2005 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Mon Jul 11 01:25:34 2005 @@ -1,205 +1,205 @@ -//===-- X86IntelAsmPrinter.cpp - Convert X86 LLVM code to Intel assembly --===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains a printer that converts from our internal representation -// of machine-dependent LLVM code to Intel format assembly language. -// This printer is the output mechanism used by `llc'. -// -//===----------------------------------------------------------------------===// - -#include "X86IntelAsmPrinter.h" -#include "X86.h" -#include "llvm/Module.h" -#include "llvm/Assembly/Writer.h" -#include "llvm/Support/Mangler.h" -using namespace llvm; -using namespace x86; - -/// runOnMachineFunction - This uses the printMachineInstruction() -/// method to print assembly for each instruction. -/// -bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - setupMachineFunction(MF); - O << "\n\n"; - - // Print out constants referenced by the function - printConstantPool(MF.getConstantPool()); - - // Print out labels for the function. - O << "\t.text\n"; - emitAlignment(4); - O << "\t.globl\t" << CurrentFnName << "\n"; - if (!forCygwin && !forDarwin) - O << "\t.type\t" << CurrentFnName << ", @function\n"; - O << CurrentFnName << ":\n"; - - // Print out code for the function. - for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); - I != E; ++I) { - // Print a label for the basic block if there are any predecessors. - if (I->pred_begin() != I->pred_end()) - O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" - << CommentString << " " << I->getBasicBlock()->getName() << "\n"; - for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); - II != E; ++II) { - // Print the assembly for the instruction. - O << "\t"; - printMachineInstruction(II); - } - } - - // We didn't modify anything. - return false; -} - -void X86IntelAsmPrinter::printOp(const MachineOperand &MO, - bool elideOffsetKeyword /* = false */) { - const MRegisterInfo &RI = *TM.getRegisterInfo(); - switch (MO.getType()) { - case MachineOperand::MO_VirtualRegister: - if (Value *V = MO.getVRegValueOrNull()) { - O << "<" << V->getName() << ">"; - return; - } - // FALLTHROUGH - case MachineOperand::MO_MachineRegister: - if (MRegisterInfo::isPhysicalRegister(MO.getReg())) - // Bug Workaround: See note in Printer::doInitialization about %. - O << "%" << RI.get(MO.getReg()).Name; - else - O << "%reg" << MO.getReg(); - return; - - case MachineOperand::MO_SignExtendedImmed: - case MachineOperand::MO_UnextendedImmed: - O << (int)MO.getImmedValue(); - return; - case MachineOperand::MO_MachineBasicBlock: { - MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); - O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) - << "_" << MBBOp->getNumber () << "\t# " - << MBBOp->getBasicBlock ()->getName (); - return; - } - case MachineOperand::MO_PCRelativeDisp: - std::cerr << "Shouldn't use addPCDisp() when building X86 MachineInstrs"; - abort (); - return; - case MachineOperand::MO_GlobalAddress: { - if (!elideOffsetKeyword) - O << "OFFSET "; - O << Mang->getValueName(MO.getGlobal()); - int Offset = MO.getOffset(); - if (Offset > 0) - O << " + " << Offset; - else if (Offset < 0) - O << " - " << -Offset; - return; - } - case MachineOperand::MO_ExternalSymbol: - O << GlobalPrefix << MO.getSymbolName(); - return; - default: - O << ""; return; - } -} - -void X86IntelAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){ - assert(isMem(MI, Op) && "Invalid memory reference!"); - - const MachineOperand &BaseReg = MI->getOperand(Op); - int ScaleVal = MI->getOperand(Op+1).getImmedValue(); - const MachineOperand &IndexReg = MI->getOperand(Op+2); - const MachineOperand &DispSpec = MI->getOperand(Op+3); - - if (BaseReg.isFrameIndex()) { - O << "[frame slot #" << BaseReg.getFrameIndex(); - if (DispSpec.getImmedValue()) - O << " + " << DispSpec.getImmedValue(); - O << "]"; - return; - } else if (BaseReg.isConstantPoolIndex()) { - O << "[.CPI" << CurrentFnName << "_" - << BaseReg.getConstantPoolIndex(); - - if (IndexReg.getReg()) { - O << " + "; - if (ScaleVal != 1) - O << ScaleVal << "*"; - printOp(IndexReg); - } - - if (DispSpec.getImmedValue()) - O << " + " << DispSpec.getImmedValue(); - O << "]"; - return; - } - - O << "["; - bool NeedPlus = false; - if (BaseReg.getReg()) { - printOp(BaseReg, true); - NeedPlus = true; - } - - if (IndexReg.getReg()) { - if (NeedPlus) O << " + "; - if (ScaleVal != 1) - O << ScaleVal << "*"; - printOp(IndexReg); - NeedPlus = true; - } - - if (DispSpec.isGlobalAddress()) { - if (NeedPlus) - O << " + "; - printOp(DispSpec, true); - } else { - int DispVal = DispSpec.getImmedValue(); - if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) { - if (NeedPlus) - if (DispVal > 0) - O << " + "; - else { - O << " - "; - DispVal = -DispVal; - } - O << DispVal; - } - } - O << "]"; -} - - -/// printMachineInstruction -- Print out a single X86 LLVM instruction -/// MI in Intel syntax to the current output stream. -/// -void X86IntelAsmPrinter::printMachineInstruction(const MachineInstr *MI) { - ++EmittedInsts; - - // Call the autogenerated instruction printer routines. - printInstruction(MI); -} - -bool X86IntelAsmPrinter::doInitialization(Module &M) { - X86SharedAsmPrinter::doInitialization(M); - // Tell gas we are outputting Intel syntax (not AT&T syntax) assembly. - // - // Bug: gas in `intel_syntax noprefix' mode interprets the symbol `Sp' in an - // instruction as a reference to the register named sp, and if you try to - // reference a symbol `Sp' (e.g. `mov ECX, OFFSET Sp') then it gets lowercased - // before being looked up in the symbol table. This creates spurious - // `undefined symbol' errors when linking. Workaround: Do not use `noprefix' - // mode, and decorate all register names with percent signs. - O << "\t.intel_syntax\n"; - return false; -} - -// Include the auto-generated portion of the assembly writer. -#include "X86GenAsmWriter1.inc" +//===-- X86IntelAsmPrinter.cpp - Convert X86 LLVM code to Intel assembly --===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains a printer that converts from our internal representation +// of machine-dependent LLVM code to Intel format assembly language. +// This printer is the output mechanism used by `llc'. +// +//===----------------------------------------------------------------------===// + +#include "X86IntelAsmPrinter.h" +#include "X86.h" +#include "llvm/Module.h" +#include "llvm/Assembly/Writer.h" +#include "llvm/Support/Mangler.h" +using namespace llvm; +using namespace x86; + +/// runOnMachineFunction - This uses the printMachineInstruction() +/// method to print assembly for each instruction. +/// +bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + setupMachineFunction(MF); + O << "\n\n"; + + // Print out constants referenced by the function + printConstantPool(MF.getConstantPool()); + + // Print out labels for the function. + O << "\t.text\n"; + emitAlignment(4); + O << "\t.globl\t" << CurrentFnName << "\n"; + if (!forCygwin && !forDarwin) + O << "\t.type\t" << CurrentFnName << ", @function\n"; + O << CurrentFnName << ":\n"; + + // Print out code for the function. + for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); + I != E; ++I) { + // Print a label for the basic block if there are any predecessors. + if (I->pred_begin() != I->pred_end()) + O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" + << CommentString << " " << I->getBasicBlock()->getName() << "\n"; + for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); + II != E; ++II) { + // Print the assembly for the instruction. + O << "\t"; + printMachineInstruction(II); + } + } + + // We didn't modify anything. + return false; +} + +void X86IntelAsmPrinter::printOp(const MachineOperand &MO, + bool elideOffsetKeyword /* = false */) { + const MRegisterInfo &RI = *TM.getRegisterInfo(); + switch (MO.getType()) { + case MachineOperand::MO_VirtualRegister: + if (Value *V = MO.getVRegValueOrNull()) { + O << "<" << V->getName() << ">"; + return; + } + // FALLTHROUGH + case MachineOperand::MO_MachineRegister: + if (MRegisterInfo::isPhysicalRegister(MO.getReg())) + // Bug Workaround: See note in Printer::doInitialization about %. + O << "%" << RI.get(MO.getReg()).Name; + else + O << "%reg" << MO.getReg(); + return; + + case MachineOperand::MO_SignExtendedImmed: + case MachineOperand::MO_UnextendedImmed: + O << (int)MO.getImmedValue(); + return; + case MachineOperand::MO_MachineBasicBlock: { + MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); + O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) + << "_" << MBBOp->getNumber () << "\t# " + << MBBOp->getBasicBlock ()->getName (); + return; + } + case MachineOperand::MO_PCRelativeDisp: + std::cerr << "Shouldn't use addPCDisp() when building X86 MachineInstrs"; + abort (); + return; + case MachineOperand::MO_GlobalAddress: { + if (!elideOffsetKeyword) + O << "OFFSET "; + O << Mang->getValueName(MO.getGlobal()); + int Offset = MO.getOffset(); + if (Offset > 0) + O << " + " << Offset; + else if (Offset < 0) + O << " - " << -Offset; + return; + } + case MachineOperand::MO_ExternalSymbol: + O << GlobalPrefix << MO.getSymbolName(); + return; + default: + O << ""; return; + } +} + +void X86IntelAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){ + assert(isMem(MI, Op) && "Invalid memory reference!"); + + const MachineOperand &BaseReg = MI->getOperand(Op); + int ScaleVal = MI->getOperand(Op+1).getImmedValue(); + const MachineOperand &IndexReg = MI->getOperand(Op+2); + const MachineOperand &DispSpec = MI->getOperand(Op+3); + + if (BaseReg.isFrameIndex()) { + O << "[frame slot #" << BaseReg.getFrameIndex(); + if (DispSpec.getImmedValue()) + O << " + " << DispSpec.getImmedValue(); + O << "]"; + return; + } else if (BaseReg.isConstantPoolIndex()) { + O << "[.CPI" << CurrentFnName << "_" + << BaseReg.getConstantPoolIndex(); + + if (IndexReg.getReg()) { + O << " + "; + if (ScaleVal != 1) + O << ScaleVal << "*"; + printOp(IndexReg); + } + + if (DispSpec.getImmedValue()) + O << " + " << DispSpec.getImmedValue(); + O << "]"; + return; + } + + O << "["; + bool NeedPlus = false; + if (BaseReg.getReg()) { + printOp(BaseReg, true); + NeedPlus = true; + } + + if (IndexReg.getReg()) { + if (NeedPlus) O << " + "; + if (ScaleVal != 1) + O << ScaleVal << "*"; + printOp(IndexReg); + NeedPlus = true; + } + + if (DispSpec.isGlobalAddress()) { + if (NeedPlus) + O << " + "; + printOp(DispSpec, true); + } else { + int DispVal = DispSpec.getImmedValue(); + if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) { + if (NeedPlus) + if (DispVal > 0) + O << " + "; + else { + O << " - "; + DispVal = -DispVal; + } + O << DispVal; + } + } + O << "]"; +} + + +/// printMachineInstruction -- Print out a single X86 LLVM instruction +/// MI in Intel syntax to the current output stream. +/// +void X86IntelAsmPrinter::printMachineInstruction(const MachineInstr *MI) { + ++EmittedInsts; + + // Call the autogenerated instruction printer routines. + printInstruction(MI); +} + +bool X86IntelAsmPrinter::doInitialization(Module &M) { + X86SharedAsmPrinter::doInitialization(M); + // Tell gas we are outputting Intel syntax (not AT&T syntax) assembly. + // + // Bug: gas in `intel_syntax noprefix' mode interprets the symbol `Sp' in an + // instruction as a reference to the register named sp, and if you try to + // reference a symbol `Sp' (e.g. `mov ECX, OFFSET Sp') then it gets lowercased + // before being looked up in the symbol table. This creates spurious + // `undefined symbol' errors when linking. Workaround: Do not use `noprefix' + // mode, and decorate all register names with percent signs. + O << "\t.intel_syntax\n"; + return false; +} + +// Include the auto-generated portion of the assembly writer. +#include "X86GenAsmWriter1.inc" From lattner at cs.uiuc.edu Mon Jul 11 01:29:25 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:29:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200507110629.BAA10194@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.2 -> 1.3 --- Log message: Output .size directives to tell the assembler the size of each function. --- Diffs of the changes: (+1 -0) X86ATTAsmPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.2 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.3 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.2 Thu Jul 7 19:23:26 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Jul 11 01:29:14 2005 @@ -53,6 +53,7 @@ printMachineInstruction(II); } } + O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; // We didn't modify anything. return false; From lattner at cs.uiuc.edu Mon Jul 11 01:34:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 01:34:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507110634.BAA10219@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.6 -> 1.7 --- Log message: Clean up code, no functionality changes. --- Diffs of the changes: (+68 -50) ELFWriter.cpp | 118 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 68 insertions(+), 50 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.6 llvm/lib/CodeGen/ELFWriter.cpp:1.7 --- llvm/lib/CodeGen/ELFWriter.cpp:1.6 Mon Jul 11 01:17:35 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Mon Jul 11 01:34:30 2005 @@ -40,7 +40,13 @@ #include "llvm/Support/Mangler.h" using namespace llvm; +//===----------------------------------------------------------------------===// +// ELFCodeEmitter Implementation +//===----------------------------------------------------------------------===// + namespace llvm { + /// ELFCodeEmitter - This class is used by the ELFWriter to emit the code for + /// functions to the ELF file. class ELFCodeEmitter : public MachineCodeEmitter { ELFWriter &EW; std::vector &OutputBuffer; @@ -48,55 +54,8 @@ public: ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutputBuffer(EW.OutputBuffer) {} - void startFunction(MachineFunction &F) { - // Align the output buffer to the appropriate alignment. - unsigned Align = 16; // FIXME: GENERICIZE!! - ELFWriter::ELFSection &TextSection = EW.SectionList.back(); - - // Upgrade the section alignment if required. - if (TextSection.Align < Align) TextSection.Align = Align; - - // Add padding zeros to the end of the buffer to make sure that the - // function will start on the correct byte alignment within the section. - size_t SectionOff = OutputBuffer.size()-TextSection.Offset; - if (SectionOff & (Align-1)) { - // Add padding to get alignment to the correct place. - size_t Pad = Align-(SectionOff & (Align-1)); - OutputBuffer.resize(OutputBuffer.size()+Pad); - } - - FnStart = OutputBuffer.size(); - } - void finishFunction(MachineFunction &F) { - // We now know the size of the function, add a symbol to represent it. - ELFWriter::ELFSym FnSym(F.getFunction()); - - // Figure out the binding (linkage) of the symbol. - switch (F.getFunction()->getLinkage()) { - default: - // appending linkage is illegal for functions. - assert(0 && "Unknown linkage type!"); - case GlobalValue::ExternalLinkage: - FnSym.SetBind(ELFWriter::ELFSym::STB_GLOBAL); - break; - case GlobalValue::LinkOnceLinkage: - case GlobalValue::WeakLinkage: - FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK); - break; - case GlobalValue::InternalLinkage: - FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL); - break; - } - - FnSym.SetType(ELFWriter::ELFSym::STT_FUNC); - FnSym.SectionIdx = EW.SectionList.size()-1; // .text section. - // Value = Offset from start of .text - FnSym.Value = FnStart - EW.SectionList.back().Offset; - FnSym.Size = OutputBuffer.size()-FnStart; - - // Finally, add it to the symtab. - EW.SymbolTable.push_back(FnSym); - } + void startFunction(MachineFunction &F); + void finishFunction(MachineFunction &F); void emitConstantPool(MachineConstantPool *MCP) { if (MCP->isEmpty()) return; @@ -123,7 +82,8 @@ virtual uint64_t getConstantPoolEntryAddress(unsigned Index) { assert(0 && "CP not implementated yet!"); } - /// JIT SPECIFIC FUNCTIONS + + /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE! void startFunctionStub(unsigned StubSize) { assert(0 && "JIT specific function called!"); abort(); @@ -136,6 +96,64 @@ }; } +/// startFunction - This callback is invoked when a new machine function is +/// about to be emitted. +void ELFCodeEmitter::startFunction(MachineFunction &F) { + // Align the output buffer to the appropriate alignment. + unsigned Align = 16; // FIXME: GENERICIZE!! + ELFWriter::ELFSection &TextSection = EW.SectionList.back(); + + // Upgrade the section alignment if required. + if (TextSection.Align < Align) TextSection.Align = Align; + + // Add padding zeros to the end of the buffer to make sure that the + // function will start on the correct byte alignment within the section. + size_t SectionOff = OutputBuffer.size()-TextSection.Offset; + if (SectionOff & (Align-1)) { + // Add padding to get alignment to the correct place. + size_t Pad = Align-(SectionOff & (Align-1)); + OutputBuffer.resize(OutputBuffer.size()+Pad); + } + + FnStart = OutputBuffer.size(); +} + +/// finishFunction - This callback is invoked after the function is completely +/// finished. +void ELFCodeEmitter::finishFunction(MachineFunction &F) { + // We now know the size of the function, add a symbol to represent it. + ELFWriter::ELFSym FnSym(F.getFunction()); + + // Figure out the binding (linkage) of the symbol. + switch (F.getFunction()->getLinkage()) { + default: + // appending linkage is illegal for functions. + assert(0 && "Unknown linkage type!"); + case GlobalValue::ExternalLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_GLOBAL); + break; + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK); + break; + case GlobalValue::InternalLinkage: + FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL); + break; + } + + FnSym.SetType(ELFWriter::ELFSym::STT_FUNC); + FnSym.SectionIdx = EW.SectionList.size()-1; // .text section. + // Value = Offset from start of .text + FnSym.Value = FnStart - EW.SectionList.back().Offset; + FnSym.Size = OutputBuffer.size()-FnStart; + + // Finally, add it to the symtab. + EW.SymbolTable.push_back(FnSym); +} + +//===----------------------------------------------------------------------===// +// ELFWriter Implementation +//===----------------------------------------------------------------------===// ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) { e_machine = 0; // e_machine defaults to 'No Machine' From alenhar2 at cs.uiuc.edu Mon Jul 11 12:41:23 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 11 Jul 2005 12:41:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200507111741.MAA08933@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.70 -> 1.71 --- Log message: because on alpha: # define errno (*__errno_location ()) *shakes head --- Diffs of the changes: (+1 -0) BasicAliasAnalysis.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.70 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.71 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.70 Sun May 8 18:58:12 2005 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Mon Jul 11 12:41:12 2005 @@ -743,6 +743,7 @@ // glibc functions: "__fpclassify", "__fpclassifyf", "__fpclassifyl", "__signbit", "__signbitf", "__signbitl", + "__errno_location", }; static const unsigned DAMTableSize = From alenhar2 at cs.uiuc.edu Mon Jul 11 15:35:31 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 11 Jul 2005 15:35:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200507112035.PAA25937@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.71 -> 1.72 --- Log message: Remove glibc specific functions, and mark a couple as C99 --- Diffs of the changes: (+1 -3) BasicAliasAnalysis.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.71 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.72 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.71 Mon Jul 11 12:41:12 2005 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Mon Jul 11 15:35:20 2005 @@ -740,10 +740,8 @@ "nexttoward", "nexttowardf", "nexttowardd", "nextafter", "nextafterf", "nextafterd", - // glibc functions: - "__fpclassify", "__fpclassifyf", "__fpclassifyl", + // ISO C99: "__signbit", "__signbitf", "__signbitl", - "__errno_location", }; static const unsigned DAMTableSize = From lattner at cs.uiuc.edu Mon Jul 11 17:46:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 17:46:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp Message-ID: <200507112246.RAA27164@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/ModuloScheduling: MSchedGraphSB.cpp updated: 1.2 -> 1.3 --- Log message: fix a warning --- Diffs of the changes: (+1 -1) MSchedGraphSB.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp diff -u llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp:1.2 llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp:1.3 --- llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp:1.2 Thu Jun 16 23:21:09 2005 +++ llvm/lib/Target/SparcV9/ModuloScheduling/MSchedGraphSB.cpp Mon Jul 11 17:46:18 2005 @@ -185,7 +185,7 @@ llvmBBs.insert((*MBB)->getBasicBlock()); //create predicate nodes - DEBUG("Create predicate nodes\n"); + DEBUG(std::cerr << "Create predicate nodes\n"); for(std::vector::iterator MBB = bbs.begin(), ME = bbs.end()-1; MBB != ME; ++MBB) { //Get LLVM basic block From lattner at cs.uiuc.edu Mon Jul 11 19:21:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 19:21:00 -0500 Subject: [llvm-commits] CVS: llvm/docs/CodeGenerator.html Message-ID: <200507120021.TAA27937@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodeGenerator.html updated: 1.14 -> 1.15 --- Log message: add a note so I can remember the common t-t's --- Diffs of the changes: (+23 -1) CodeGenerator.html | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletion(-) Index: llvm/docs/CodeGenerator.html diff -u llvm/docs/CodeGenerator.html:1.14 llvm/docs/CodeGenerator.html:1.15 --- llvm/docs/CodeGenerator.html:1.14 Mon May 9 10:41:03 2005 +++ llvm/docs/CodeGenerator.html Mon Jul 11 19:20:49 2005 @@ -934,6 +934,28 @@ + +
+

+The following are the known target triples that are supported by the X86 +backend. This is not an exhaustive list, but it would be useful to add those +that people test. +

+ +
    +
  • i686-pc-linux-gnu - Linux
  • +
  • i386-unknown-freebsd5.3 - FreeBSD 5.3
  • +
  • i686-pc-cygwin - Cygwin on Win32
  • +
  • i686-pc-mingw32 - MingW on Win32
  • +
  • i686-apple-darwin* - Apple Darwin
  • +
+ +
+ + + @@ -992,7 +1014,7 @@ Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2005/05/09 15:41:03 $ + Last modified: $Date: 2005/07/12 00:20:49 $ From lattner at cs.uiuc.edu Mon Jul 11 20:00:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 20:00:43 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp Message-ID: <200507120100.UAA28171@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Miscompilation.cpp updated: 1.67 -> 1.68 --- Log message: Fix PR576: http://llvm.cs.uiuc.edu/PR576 . Instead of emitting a JIT stub that looks like this: internal void %l1_main_entry_2E_ce_wrapper(int) { header: %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) ) ; [#uses=1] %resolverCast = cast sbyte* %resolver to void (int)* ; [#uses=1] call void %resolverCast( int %0 ) ret void } Emit one that looks like this: internal void %l1_main_entry_2E_ce_wrapper(int) { Entry: %fpcache = load void (int)** %l1_main_entry_2E_ce.fpcache ; [#uses=2] %isNull = seteq void (int)* %fpcache, null ; [#uses=1] br bool %isNull, label %lookupfp, label %usecache usecache: ; preds = %lookupfp, %Entry %fp = phi void (int)* [ %resolverCast, %lookupfp ], [ %fpcache, %Entry ] ; [#uses=1] call void %fp( int %0 ) ret void lookupfp: ; preds = %Entry %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) ) ; [#uses=1] %resolverCast = cast sbyte* %resolver to void (int)* ; [#uses=2] store void (int)* %resolverCast, void (int)** %l1_main_entry_2E_ce.fpcache br label %usecache } This makes the JIT debugger *MUCH* faster on large programs, as getPointerToNamedFunction takes time linear with the size of the program, and before we would call it every time a function in the text module was called from the safe module (ouch!). --- Diffs of the changes: (+36 -21) Miscompilation.cpp | 57 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 36 insertions(+), 21 deletions(-) Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.67 llvm/tools/bugpoint/Miscompilation.cpp:1.68 --- llvm/tools/bugpoint/Miscompilation.cpp:1.67 Thu Jul 7 22:08:58 2005 +++ llvm/tools/bugpoint/Miscompilation.cpp Mon Jul 11 20:00:32 2005 @@ -686,28 +686,47 @@ // Rewrite uses of F in global initializers, etc. to uses of a wrapper // function that dynamically resolves the calls to F via our JIT API - if (F->use_begin() != F->use_end()) { + if (!F->use_empty()) { + // Create a new global to hold the cached function pointer. + Constant *NullPtr = ConstantPointerNull::get(F->getType()); + GlobalVariable *Cache = + new GlobalVariable(F->getType(), false,GlobalValue::InternalLinkage, + NullPtr,F->getName()+".fpcache", F->getParent()); + // Construct a new stub function that will re-route calls to F const FunctionType *FuncTy = F->getFunctionType(); Function *FuncWrapper = new Function(FuncTy, GlobalValue::InternalLinkage, F->getName() + "_wrapper", F->getParent()); - BasicBlock *Header = new BasicBlock("header", FuncWrapper); - + BasicBlock *EntryBB = new BasicBlock("entry", FuncWrapper); + BasicBlock *DoCallBB = new BasicBlock("usecache", FuncWrapper); + BasicBlock *LookupBB = new BasicBlock("lookupfp", FuncWrapper); + + // Check to see if we already looked up the value. + Value *CachedVal = new LoadInst(Cache, "fpcache", EntryBB); + Value *IsNull = new SetCondInst(Instruction::SetEQ, CachedVal, + NullPtr, "isNull", EntryBB); + new BranchInst(LookupBB, DoCallBB, IsNull, EntryBB); + // Resolve the call to function F via the JIT API: // // call resolver(GetElementPtr...) - CallInst *resolve = new CallInst(resolverFunc, ResolverArgs, - "resolver"); - Header->getInstList().push_back(resolve); + CallInst *Resolver = new CallInst(resolverFunc, ResolverArgs, + "resolver", LookupBB); // cast the result from the resolver to correctly-typed function - CastInst *castResolver = - new CastInst(resolve, PointerType::get(F->getFunctionType()), - "resolverCast"); - Header->getInstList().push_back(castResolver); - - // Save the argument list + CastInst *CastedResolver = + new CastInst(Resolver, PointerType::get(F->getFunctionType()), + "resolverCast", LookupBB); + // Save the value in our cache. + new StoreInst(CastedResolver, Cache, LookupBB); + new BranchInst(DoCallBB, LookupBB); + + PHINode *FuncPtr = new PHINode(NullPtr->getType(), "fp", DoCallBB); + FuncPtr->addIncoming(CastedResolver, LookupBB); + FuncPtr->addIncoming(CachedVal, EntryBB); + + // Save the argument list. std::vector Args; for (Function::arg_iterator i = FuncWrapper->arg_begin(), e = FuncWrapper->arg_end(); i != e; ++i) @@ -715,17 +734,13 @@ // Pass on the arguments to the real function, return its result if (F->getReturnType() == Type::VoidTy) { - CallInst *Call = new CallInst(castResolver, Args); - Header->getInstList().push_back(Call); - ReturnInst *Ret = new ReturnInst(); - Header->getInstList().push_back(Ret); + CallInst *Call = new CallInst(FuncPtr, Args, "", DoCallBB); + new ReturnInst(DoCallBB); } else { - CallInst *Call = new CallInst(castResolver, Args, "redir"); - Header->getInstList().push_back(Call); - ReturnInst *Ret = new ReturnInst(Call); - Header->getInstList().push_back(Ret); + CallInst *Call = new CallInst(FuncPtr, Args, "retval", DoCallBB); + new ReturnInst(Call, DoCallBB); } - + // Use the wrapper function instead of the old function F->replaceAllUsesWith(FuncWrapper); } From natebegeman at mac.com Mon Jul 11 20:37:39 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 20:37:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp Message-ID: <200507120137.UAA28429@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.3 -> 1.4 X86AsmPrinter.cpp updated: 1.142 -> 1.143 --- Log message: Commit some pending darwin changes before subtarget support. --- Diffs of the changes: (+13 -11) X86ATTAsmPrinter.cpp | 3 ++- X86AsmPrinter.cpp | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.3 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.4 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.3 Mon Jul 11 01:29:14 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Jul 11 20:37:28 2005 @@ -53,7 +53,8 @@ printMachineInstruction(II); } } - O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; + if (!forDarwin) + O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; // We didn't modify anything. return false; Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.142 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.143 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.142 Mon Jul 11 01:25:47 2005 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Jul 11 20:37:28 2005 @@ -58,6 +58,7 @@ leadingUnderscore = false; #endif } + if (leadingUnderscore || forCygwin || forDarwin) GlobalPrefix = "_"; @@ -159,6 +160,16 @@ } if (forDarwin) { + // Output stubs for external global variables + if (GVStubs.begin() != GVStubs.end()) + O << "\t.non_lazy_symbol_pointer\n"; + for (std::set::iterator i = GVStubs.begin(), e = GVStubs.end(); + i != e; ++i) { + O << "L" << *i << "$non_lazy_ptr:\n"; + O << "\t.indirect_symbol " << *i << "\n"; + O << "\t.long\t0\n"; + } + // Output stubs for dynamically-linked functions unsigned j = 1; for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); @@ -178,16 +189,6 @@ O << "\n"; - // Output stubs for external global variables - if (GVStubs.begin() != GVStubs.end()) - O << ".data\n.non_lazy_symbol_pointer\n"; - for (std::set::iterator i = GVStubs.begin(), e = GVStubs.end(); - i != e; ++i) { - O << "L" << *i << "$non_lazy_ptr:\n"; - O << "\t.indirect_symbol " << *i << "\n"; - O << "\t.long\t0\n"; - } - // Output stubs for link-once variables if (LinkOnceStubs.begin() != LinkOnceStubs.end()) O << ".data\n.align 2\n"; From natebegeman at mac.com Mon Jul 11 20:42:05 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 20:42:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86ISelPattern.cpp X86TargetMachine.cpp X86TargetMachine.h Message-ID: <200507120142.UAA28519@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp added (r1.1) X86Subtarget.h added (r1.1) X86ISelPattern.cpp updated: 1.149 -> 1.150 X86TargetMachine.cpp updated: 1.82 -> 1.83 X86TargetMachine.h updated: 1.28 -> 1.29 --- Log message: Implement Subtarget support Implement the X86 Subtarget. This consolidates the checks for target triple, and setting options based on target triple into one place. This allows us to convert the asm printer and isel over from being littered with "forDarwin", "forCygwin", etc. into just having the appropriate flags for each subtarget feature controlling the code for that feature. This patch also implements indirect external and weak references in the X86 pattern isel, for darwin. Next up is to convert over the asm printers to use this new interface. --- Diffs of the changes: (+148 -4) X86ISelPattern.cpp | 31 ++++++++++++++++++++++++-- X86Subtarget.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ X86Subtarget.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++ X86TargetMachine.cpp | 4 ++- X86TargetMachine.h | 3 ++ 5 files changed, 148 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -c /dev/null llvm/lib/Target/X86/X86Subtarget.cpp:1.1 *** /dev/null Mon Jul 11 20:42:04 2005 --- llvm/lib/Target/X86/X86Subtarget.cpp Mon Jul 11 20:41:54 2005 *************** *** 0 **** --- 1,59 ---- + //===- X86Subtarget.cpp - X86 Instruction Information -----------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nate Begeman and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the X86 specific subclass of TargetSubtarget. + // + //===----------------------------------------------------------------------===// + + #include "X86Subtarget.h" + #include "llvm/Module.h" + using namespace llvm; + + X86Subtarget::X86Subtarget(const Module &M) + : TargetSubtarget(M), stackAlignment(8), + indirectExternAndWeakGlobals(false), asmDarwinLinkerStubs(false), + asmLeadingUnderscore(false), asmAlignmentIsInBytes(false), + asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false), + asmPrintConstantAlignment(false) { + // Declare a boolean for each platform + bool forCygwin = false; + bool forDarwin = false; + bool forWindows = false; + + // Set the boolean corresponding to the current target triple, or the default + // if one cannot be determined, to true. + const std::string& TT = M.getTargetTriple(); + if (TT.length() > 5) { + forCygwin = TT.find("cygwin") != std::string::npos || + TT.find("mingw") != std::string::npos; + forDarwin = TT.find("darwin") != std::string::npos; + forWindows = TT.find("win32") != std::string::npos; + } else if (TT.empty()) { + #if defined(__CYGWIN__) || defined(__MINGW32__) + forCygwin = true; + #elif defined(__APPLE__) + forDarwin = true; + #elif defined(_WIN32) + forWindws = true; + #endif + } + + if (forCygwin) { + asmLeadingUnderscore = true; + } + if (forDarwin) { + stackAlignment = 16; + indirectExternAndWeakGlobals = true; + asmDarwinLinkerStubs = true; + asmLeadingUnderscore = true; + asmPrintDotLCommConstants = true; + } + if (forWindows) { + } + } Index: llvm/lib/Target/X86/X86Subtarget.h diff -c /dev/null llvm/lib/Target/X86/X86Subtarget.h:1.1 *** /dev/null Mon Jul 11 20:42:05 2005 --- llvm/lib/Target/X86/X86Subtarget.h Mon Jul 11 20:41:54 2005 *************** *** 0 **** --- 1,55 ---- + //=====-- X86Subtarget.h - Define TargetMachine for the X86 ---*- C++ -*--====// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nate Begeman and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file declares the X86 specific subclass of TargetSubtarget. + // + //===----------------------------------------------------------------------===// + + #ifndef X86SUBTARGET_H + #define X86SUBTARGET_H + + #include "llvm/Target/TargetSubtarget.h" + + namespace llvm { + class Module; + + class X86Subtarget : public TargetSubtarget { + protected: + /// Used by the target machine to set up the target frame info + unsigned stackAlignment; + + /// Used by instruction selector + bool indirectExternAndWeakGlobals; + + /// Used by the asm printer + bool asmDarwinLinkerStubs; + bool asmLeadingUnderscore; + bool asmAlignmentIsInBytes; + bool asmPrintDotLocalConstants; + bool asmPrintDotLCommConstants; + bool asmPrintConstantAlignment; + public: + /// This constructor initializes the data members to match that + /// of the specified module. + /// + X86Subtarget(const Module &M); + + /// Returns the preferred stack alignment for the current target triple, or + /// the default if no target triple is set. + unsigned getStackAlignment() const { return stackAlignment; } + + /// Returns true if the instruction selector should treat global values + /// referencing external or weak symbols as indirect rather than direct + /// references. + bool getIndirectExternAndWeakGlobals() const { + return indirectExternAndWeakGlobals; } + }; + } // End llvm namespace + + #endif Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.149 llvm/lib/Target/X86/X86ISelPattern.cpp:1.150 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.149 Sat Jul 9 20:56:13 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Mon Jul 11 20:41:54 2005 @@ -14,6 +14,7 @@ #include "X86.h" #include "X86InstrBuilder.h" #include "X86RegisterInfo.h" +#include "X86Subtarget.h" #include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -26,6 +27,7 @@ #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Support/CFG.h" #include "llvm/Support/MathExtras.h" @@ -996,8 +998,13 @@ /// TheDAG - The DAG being selected during Select* operations. SelectionDAG *TheDAG; + + /// Subtarget - Keep a pointer to the X86Subtarget around so that we can + /// make the right decision when generating code for different targets. + const X86Subtarget *Subtarget; public: ISel(TargetMachine &TM) : SelectionDAGISel(X86Lowering), X86Lowering(TM) { + Subtarget = TM.getSubtarget(); } virtual const char *getPassName() const { @@ -1314,8 +1321,18 @@ break; case ISD::GlobalAddress: if (AM.GV == 0) { - AM.GV = cast(N)->getGlobal(); - return false; + GlobalValue *GV = cast(N)->getGlobal(); + // For Darwin, external and weak symbols are indirect, so we want to load + // the value at address GV, not the value of GV itself. This means that + // the GlobalAddress must be in the base or index register of the address, + // not the GV offset field. + if (Subtarget->getIndirectExternAndWeakGlobals() && + (GV->hasWeakLinkage() || GV->isExternal())) { + break; + } else { + AM.GV = GV; + return false; + } } break; case ISD::Constant: @@ -2236,7 +2253,15 @@ return Result; case ISD::GlobalAddress: { GlobalValue *GV = cast(N)->getGlobal(); - BuildMI(BB, X86::MOV32ri, 1, Result).addGlobalAddress(GV); + // For Darwin, external and weak symbols are indirect, so we want to load + // the value at address GV, not the value of GV itself. + if (Subtarget->getIndirectExternAndWeakGlobals() && + (GV->hasWeakLinkage() || GV->isExternal())) { + BuildMI(BB, X86::MOV32rm, 4, Result).addReg(0).addZImm(1).addReg(0) + .addGlobalAddress(GV, false, 0); + } else { + BuildMI(BB, X86::MOV32ri, 1, Result).addGlobalAddress(GV); + } return Result; } case ISD::ExternalSymbol: { Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.82 llvm/lib/Target/X86/X86TargetMachine.cpp:1.83 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.82 Mon Jul 11 00:17:48 2005 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Mon Jul 11 20:41:54 2005 @@ -92,7 +92,9 @@ /// X86TargetMachine::X86TargetMachine(const Module &M, IntrinsicLowering *IL) : TargetMachine("X86", IL, true, 4, 4, 4, 4, 4), - FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), + Subtarget(M), + FrameInfo(TargetFrameInfo::StackGrowsDown, + Subtarget.getStackAlignment(), -4), JITInfo(*this) { // Scalar SSE FP requires at least SSE2 X86ScalarSSE &= X86Vector >= SSE2; Index: llvm/lib/Target/X86/X86TargetMachine.h diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.28 llvm/lib/Target/X86/X86TargetMachine.h:1.29 --- llvm/lib/Target/X86/X86TargetMachine.h:1.28 Fri Jun 24 21:48:37 2005 +++ llvm/lib/Target/X86/X86TargetMachine.h Mon Jul 11 20:41:54 2005 @@ -19,12 +19,14 @@ #include "llvm/PassManager.h" #include "X86InstrInfo.h" #include "X86JITInfo.h" +#include "X86Subtarget.h" namespace llvm { class IntrinsicLowering; class X86TargetMachine : public TargetMachine { X86InstrInfo InstrInfo; + X86Subtarget Subtarget; TargetFrameInfo FrameInfo; X86JITInfo JITInfo; public: @@ -33,6 +35,7 @@ virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual TargetJITInfo *getJITInfo() { return &JITInfo; } + virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; } virtual const MRegisterInfo *getRegisterInfo() const { return &InstrInfo.getRegisterInfo(); } From natebegeman at mac.com Mon Jul 11 20:42:06 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 20:42:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSubtarget.cpp Message-ID: <200507120142.UAA28523@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSubtarget.cpp added (r1.1) --- Log message: Implement Subtarget support Implement the X86 Subtarget. This consolidates the checks for target triple, and setting options based on target triple into one place. This allows us to convert the asm printer and isel over from being littered with "forDarwin", "forCygwin", etc. into just having the appropriate flags for each subtarget feature controlling the code for that feature. This patch also implements indirect external and weak references in the X86 pattern isel, for darwin. Next up is to convert over the asm printers to use this new interface. --- Diffs of the changes: (+22 -0) TargetSubtarget.cpp | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+) Index: llvm/lib/Target/TargetSubtarget.cpp diff -c /dev/null llvm/lib/Target/TargetSubtarget.cpp:1.1 *** /dev/null Mon Jul 11 20:42:04 2005 --- llvm/lib/Target/TargetSubtarget.cpp Mon Jul 11 20:41:54 2005 *************** *** 0 **** --- 1,22 ---- + //===-- TargetSubtarget.cpp - General Target Information -------------------==// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nate Begeman and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file describes the general parts of a Subtarget. + // + //===----------------------------------------------------------------------===// + + #include "llvm/Target/TargetSubtarget.h" + using namespace llvm; + + //--------------------------------------------------------------------------- + // TargetSubtarget Class + // + TargetSubtarget::TargetSubtarget(const Module &M) {} + + TargetSubtarget::~TargetSubtarget() {} From natebegeman at mac.com Mon Jul 11 20:42:06 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 20:42:06 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetSubtarget.h TargetMachine.h Message-ID: <200507120142.UAA28529@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetSubtarget.h added (r1.1) TargetMachine.h updated: 1.53 -> 1.54 --- Log message: Implement Subtarget support Implement the X86 Subtarget. This consolidates the checks for target triple, and setting options based on target triple into one place. This allows us to convert the asm printer and isel over from being littered with "forDarwin", "forCygwin", etc. into just having the appropriate flags for each subtarget feature controlling the code for that feature. This patch also implements indirect external and weak references in the X86 pattern isel, for darwin. Next up is to convert over the asm printers to use this new interface. --- Diffs of the changes: (+49 -0) TargetMachine.h | 8 ++++++++ TargetSubtarget.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) Index: llvm/include/llvm/Target/TargetSubtarget.h diff -c /dev/null llvm/include/llvm/Target/TargetSubtarget.h:1.1 *** /dev/null Mon Jul 11 20:42:04 2005 --- llvm/include/llvm/Target/TargetSubtarget.h Mon Jul 11 20:41:54 2005 *************** *** 0 **** --- 1,41 ---- + //==-- llvm/Target/TargetSubtarget.h - Target Information --------*- C++ -*-==// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nate Begeman and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file describes the subtarget options of a Target machine. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_TARGET_TARGETSUBTARGET_H + #define LLVM_TARGET_TARGETSUBTARGET_H + + namespace llvm { + + class Module; + + //===----------------------------------------------------------------------===// + /// + /// TargetSubtarget - Generic base class for all target subtargets. All + /// Target-specific options that control code generation and printing should + /// be exposed through a TargetSubtarget-derived class. + /// + class TargetSubtarget { + TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT + void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT + protected: // Can only create subclasses... + /// This constructor initializes the data members to match that + /// of the specified module. + /// + TargetSubtarget(const Module &M); + public: + virtual ~TargetSubtarget(); + }; + + } // End llvm namespace + + #endif Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.53 llvm/include/llvm/Target/TargetMachine.h:1.54 --- llvm/include/llvm/Target/TargetMachine.h:1.53 Fri Jun 24 22:31:43 2005 +++ llvm/include/llvm/Target/TargetMachine.h Mon Jul 11 20:41:54 2005 @@ -19,6 +19,7 @@ namespace llvm { +class TargetSubtarget; class TargetInstrInfo; class TargetInstrDescriptor; class TargetJITInfo; @@ -97,6 +98,13 @@ virtual const TargetFrameInfo *getFrameInfo() const { return 0; } const TargetData &getTargetData() const { return DataLayout; } + virtual const TargetSubtarget *getSubtargetImpl() const { return 0; } + template STC *getSubtarget() const { + assert(getSubtargetImpl() && dynamic_cast(getSubtargetImpl()) && + "Not the right kind of subtarget!"); + return (STC*)getSubtargetImpl(); + } + /// getRegisterInfo - If register information is available, return it. If /// not, return null. This is kept separate from RegInfo until RegInfo has /// details of graph coloring register allocation removed from it. From lattner at cs.uiuc.edu Mon Jul 11 21:35:49 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 21:35:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200507120235.VAA03513@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.4 -> 1.5 --- Log message: Add a note --- Diffs of the changes: (+1 -1) X86ATTAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.4 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.5 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.4 Mon Jul 11 20:37:28 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Jul 11 21:35:36 2005 @@ -33,7 +33,7 @@ // Print out labels for the function. O << "\t.text\n"; - emitAlignment(4); + emitAlignment(4); // FIXME: This should be parameterized somewhere. O << "\t.globl\t" << CurrentFnName << "\n"; if (!forCygwin && !forDarwin) O << "\t.type\t" << CurrentFnName << ", @function\n"; From lattner at cs.uiuc.edu Mon Jul 11 21:36:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 11 Jul 2005 21:36:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h Message-ID: <200507120236.VAA03533@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.1 -> 1.2 X86Subtarget.h updated: 1.1 -> 1.2 --- Log message: Minor changes to improve comments and fix the build on _WIN32 systems. --- Diffs of the changes: (+13 -12) X86Subtarget.cpp | 10 ++++------ X86Subtarget.h | 15 +++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.1 llvm/lib/Target/X86/X86Subtarget.cpp:1.2 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.1 Mon Jul 11 20:41:54 2005 +++ llvm/lib/Target/X86/X86Subtarget.cpp Mon Jul 11 21:36:10 2005 @@ -21,7 +21,7 @@ asmLeadingUnderscore(false), asmAlignmentIsInBytes(false), asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false), asmPrintConstantAlignment(false) { - // Declare a boolean for each platform + // Declare a boolean for each major platform. bool forCygwin = false; bool forDarwin = false; bool forWindows = false; @@ -40,20 +40,18 @@ #elif defined(__APPLE__) forDarwin = true; #elif defined(_WIN32) - forWindws = true; + forWindows = true; #endif } if (forCygwin) { asmLeadingUnderscore = true; - } - if (forDarwin) { + } else if (forDarwin) { stackAlignment = 16; indirectExternAndWeakGlobals = true; asmDarwinLinkerStubs = true; asmLeadingUnderscore = true; asmPrintDotLCommConstants = true; - } - if (forWindows) { + } else if (forWindows) { } } Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.1 llvm/lib/Target/X86/X86Subtarget.h:1.2 --- llvm/lib/Target/X86/X86Subtarget.h:1.1 Mon Jul 11 20:41:54 2005 +++ llvm/lib/Target/X86/X86Subtarget.h Mon Jul 11 21:36:10 2005 @@ -21,7 +21,8 @@ class X86Subtarget : public TargetSubtarget { protected: - /// Used by the target machine to set up the target frame info + /// stackAlignment - The minimum alignment known to hold of the stack frame on + /// entry to the function and which must be maintained by every function. unsigned stackAlignment; /// Used by instruction selector @@ -39,16 +40,18 @@ /// of the specified module. /// X86Subtarget(const Module &M); - - /// Returns the preferred stack alignment for the current target triple, or - /// the default if no target triple is set. + + /// getStackAlignment - Returns the minimum alignment known to hold of the + /// stack frame on entry to the function and which must be maintained by every + /// function for this subtarget. unsigned getStackAlignment() const { return stackAlignment; } /// Returns true if the instruction selector should treat global values /// referencing external or weak symbols as indirect rather than direct /// references. - bool getIndirectExternAndWeakGlobals() const { - return indirectExternAndWeakGlobals; } + bool getIndirectExternAndWeakGlobals() const { + return indirectExternAndWeakGlobals; + } }; } // End llvm namespace From natebegeman at mac.com Mon Jul 11 21:41:30 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 21:41:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200507120241.VAA04037@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.2 -> 1.3 --- Log message: Clean up the TargetSubtarget class a bit, removing an unnecessary argument to the constructor. --- Diffs of the changes: (+1 -1) X86Subtarget.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.2 llvm/lib/Target/X86/X86Subtarget.cpp:1.3 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.2 Mon Jul 11 21:36:10 2005 +++ llvm/lib/Target/X86/X86Subtarget.cpp Mon Jul 11 21:41:19 2005 @@ -16,7 +16,7 @@ using namespace llvm; X86Subtarget::X86Subtarget(const Module &M) - : TargetSubtarget(M), stackAlignment(8), + : TargetSubtarget(), stackAlignment(8), indirectExternAndWeakGlobals(false), asmDarwinLinkerStubs(false), asmLeadingUnderscore(false), asmAlignmentIsInBytes(false), asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false), From natebegeman at mac.com Mon Jul 11 21:41:30 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 21:41:30 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetSubtarget.h Message-ID: <200507120241.VAA04041@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetSubtarget.h updated: 1.1 -> 1.2 --- Log message: Clean up the TargetSubtarget class a bit, removing an unnecessary argument to the constructor. --- Diffs of the changes: (+1 -6) TargetSubtarget.h | 7 +------ 1 files changed, 1 insertion(+), 6 deletions(-) Index: llvm/include/llvm/Target/TargetSubtarget.h diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.1 llvm/include/llvm/Target/TargetSubtarget.h:1.2 --- llvm/include/llvm/Target/TargetSubtarget.h:1.1 Mon Jul 11 20:41:54 2005 +++ llvm/include/llvm/Target/TargetSubtarget.h Mon Jul 11 21:41:19 2005 @@ -16,8 +16,6 @@ namespace llvm { -class Module; - //===----------------------------------------------------------------------===// /// /// TargetSubtarget - Generic base class for all target subtargets. All @@ -28,10 +26,7 @@ TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT protected: // Can only create subclasses... - /// This constructor initializes the data members to match that - /// of the specified module. - /// - TargetSubtarget(const Module &M); + TargetSubtarget(); public: virtual ~TargetSubtarget(); }; From jeffc at jolt-lang.org Mon Jul 11 21:53:44 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 11 Jul 2005 21:53:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507120253.VAA04109@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.7 -> 1.8 --- Log message: VC++ demands that the function returns a value --- Diffs of the changes: (+1 -0) ELFWriter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.7 llvm/lib/CodeGen/ELFWriter.cpp:1.8 --- llvm/lib/CodeGen/ELFWriter.cpp:1.7 Mon Jul 11 01:34:30 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Mon Jul 11 21:53:33 2005 @@ -81,6 +81,7 @@ } virtual uint64_t getConstantPoolEntryAddress(unsigned Index) { assert(0 && "CP not implementated yet!"); + return 0; } /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE! From jeffc at jolt-lang.org Mon Jul 11 21:59:49 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 11 Jul 2005 21:59:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSubtarget.cpp Message-ID: <200507120259.VAA04143@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSubtarget.cpp updated: 1.1 -> 1.2 --- Log message: I don't know how this ever compiled with gcc, but VC++ correctly rejects it. --- Diffs of the changes: (+1 -1) TargetSubtarget.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetSubtarget.cpp diff -u llvm/lib/Target/TargetSubtarget.cpp:1.1 llvm/lib/Target/TargetSubtarget.cpp:1.2 --- llvm/lib/Target/TargetSubtarget.cpp:1.1 Mon Jul 11 20:41:54 2005 +++ llvm/lib/Target/TargetSubtarget.cpp Mon Jul 11 21:59:38 2005 @@ -17,6 +17,6 @@ //--------------------------------------------------------------------------- // TargetSubtarget Class // -TargetSubtarget::TargetSubtarget(const Module &M) {} +TargetSubtarget::TargetSubtarget() {} TargetSubtarget::~TargetSubtarget() {} From jeffc at jolt-lang.org Mon Jul 11 22:00:31 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 11 Jul 2005 22:00:31 -0500 Subject: [llvm-commits] CVS: llvm/win32/Target/Target.vcproj Message-ID: <200507120300.WAA04195@zion.cs.uiuc.edu> Changes in directory llvm/win32/Target: Target.vcproj updated: 1.8 -> 1.9 --- Log message: Add new files to Visual Studio projects. --- Diffs of the changes: (+6 -0) Target.vcproj | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/win32/Target/Target.vcproj diff -u llvm/win32/Target/Target.vcproj:1.8 llvm/win32/Target/Target.vcproj:1.9 --- llvm/win32/Target/Target.vcproj:1.8 Sun Jan 30 11:54:11 2005 +++ llvm/win32/Target/Target.vcproj Mon Jul 11 22:00:20 2005 @@ -130,6 +130,9 @@ + + + + From jeffc at jolt-lang.org Mon Jul 11 22:00:31 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 11 Jul 2005 22:00:31 -0500 Subject: [llvm-commits] CVS: llvm/win32/x86/x86.vcproj Message-ID: <200507120300.WAA04199@zion.cs.uiuc.edu> Changes in directory llvm/win32/x86: x86.vcproj updated: 1.12 -> 1.13 --- Log message: Add new files to Visual Studio projects. --- Diffs of the changes: (+6 -0) x86.vcproj | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/win32/x86/x86.vcproj diff -u llvm/win32/x86/x86.vcproj:1.12 llvm/win32/x86/x86.vcproj:1.13 --- llvm/win32/x86/x86.vcproj:1.12 Fri Jul 1 21:04:26 2005 +++ llvm/win32/x86/x86.vcproj Mon Jul 11 22:00:20 2005 @@ -179,6 +179,9 @@ RelativePath="..\..\lib\Target\X86\X86RegisterInfo.cpp"> + + @@ -217,6 +220,9 @@ RelativePath="..\..\lib\Target\X86\X86RegisterInfo.td"> + + From natebegeman at mac.com Mon Jul 11 22:05:00 2005 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Jul 2005 22:05:00 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200507120305.WAA04231@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.54 -> 1.55 --- Log message: Clean up and add comments to the newly implemented subtarget code. --- Diffs of the changes: (+10 -3) TargetMachine.h | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.54 llvm/include/llvm/Target/TargetMachine.h:1.55 --- llvm/include/llvm/Target/TargetMachine.h:1.54 Mon Jul 11 20:41:54 2005 +++ llvm/include/llvm/Target/TargetMachine.h Mon Jul 11 22:04:49 2005 @@ -64,6 +64,10 @@ /// TargetMachine(const std::string &name, IntrinsicLowering *IL, const Module &M); + + /// getSubtargetImpl - virtual method implemented by subclasses that returns + /// a reference to that target's TargetSubtarget-derived member variable. + virtual const TargetSubtarget *getSubtargetImpl() const { return 0; } public: virtual ~TargetMachine(); @@ -98,11 +102,14 @@ virtual const TargetFrameInfo *getFrameInfo() const { return 0; } const TargetData &getTargetData() const { return DataLayout; } - virtual const TargetSubtarget *getSubtargetImpl() const { return 0; } + /// getSubtarget - This method returns a pointer to the specified type of + /// TargetSubtarget. In debug builds, it verifies that the object being + /// returned is of the correct type. template STC *getSubtarget() const { - assert(getSubtargetImpl() && dynamic_cast(getSubtargetImpl()) && + const TargetSubtarget *TST = getSubtargetImpl(); + assert(getSubtargetImpl() && dynamic_cast(TST) && "Not the right kind of subtarget!"); - return (STC*)getSubtargetImpl(); + return (STC*)TST; } /// getRegisterInfo - If register information is available, return it. If From alenhar2 at cs.uiuc.edu Mon Jul 11 23:21:04 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 11 Jul 2005 23:21:04 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200507120421.XAA04612@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.150 -> 1.151 --- Log message: Fix povray and minor cleanups --- Diffs of the changes: (+11 -25) AlphaISelPattern.cpp | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.150 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.151 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.150 Sat Jul 9 20:56:07 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Mon Jul 11 23:20:52 2005 @@ -590,51 +590,37 @@ static void getValueInfo(const Value* v, int& type, int& fun, int& offset) { + fun = type = offset = 0; if (v == NULL) { type = 0; - fun = 0; - offset = 0; } else if (const GlobalValue* GV = dyn_cast(v)) { type = 1; - fun = 0; const Module* M = GV->getParent(); - int i = 0; - for(Module::const_global_iterator ii = M->global_begin(); &*ii != GV; ++ii) - ++i; - offset = i; + for(Module::const_global_iterator ii = M->global_begin(); &*ii != GV; ++ii) + ++offset; } else if (const Argument* Arg = dyn_cast(v)) { type = 2; const Function* F = Arg->getParent(); const Module* M = F->getParent(); - int i = 0; for(Module::const_iterator ii = M->begin(); &*ii != F; ++ii) - ++i; - fun = i; - i = 0; + ++fun; for(Function::const_arg_iterator ii = F->arg_begin(); &*ii != Arg; ++ii) - ++i; - offset = i; + ++offset; } else if (const Instruction* I = dyn_cast(v)) { assert(dyn_cast(I->getType())); type = 3; const BasicBlock* bb = I->getParent(); const Function* F = bb->getParent(); const Module* M = F->getParent(); - int i = 0; for(Module::const_iterator ii = M->begin(); &*ii != F; ++ii) - ++i; - fun = i; - i = 0; + ++fun; for(Function::const_iterator ii = F->begin(); &*ii != bb; ++ii) - i += ii->size(); + offset += ii->size(); for(BasicBlock::const_iterator ii = bb->begin(); &*ii != I; ++ii) - ++i; - offset = i; + ++offset; } else if (const Constant* C = dyn_cast(v)) { //Don't know how to look these up yet type = 0; - fun = 0; - offset = 0; } else { assert(0 && "Error in value marking"); } @@ -1485,7 +1471,7 @@ //FIXME: first check for Scaled Adds and Subs! ConstantSDNode* CSD = NULL; if(!isMul && N.getOperand(0).getOperand(0).getOpcode() == ISD::SHL && - (CSD = cast(N.getOperand(0).getOperand(0).getOperand(1))) && + (CSD = dyn_cast(N.getOperand(0).getOperand(0).getOperand(1))) && (CSD->getValue() == 2 || CSD->getValue() == 3)) { bool use4 = CSD->getValue() == 2; @@ -1495,7 +1481,7 @@ 2,Result).addReg(Tmp1).addReg(Tmp2); } else if(isAdd && N.getOperand(0).getOperand(1).getOpcode() == ISD::SHL && - (CSD = cast(N.getOperand(0).getOperand(1).getOperand(1))) && + (CSD = dyn_cast(N.getOperand(0).getOperand(1).getOperand(1))) && (CSD->getValue() == 2 || CSD->getValue() == 3)) { bool use4 = CSD->getValue() == 2; @@ -1504,7 +1490,7 @@ BuildMI(BB, use4?Alpha::S4ADDL:Alpha::S8ADDL, 2,Result).addReg(Tmp1).addReg(Tmp2); } else if(N.getOperand(0).getOperand(1).getOpcode() == ISD::Constant && - cast(N.getOperand(0).getOperand(1))->getValue() <= 255) + cast(N.getOperand(0).getOperand(1))->getValue() <= 255) { //Normal imm add/sub Opc = isAdd ? Alpha::ADDLi : (isMul ? Alpha::MULLi : Alpha::SUBLi); Tmp1 = SelectExpr(N.getOperand(0).getOperand(0)); From lattner at cs.uiuc.edu Tue Jul 12 01:40:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 01:40:40 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507120640.BAA05344@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.5 -> 1.6 --- Log message: Add some apparently undocumented ELF section header flags --- Diffs of the changes: (+12 -1) ELFWriter.h | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.5 llvm/include/llvm/CodeGen/ELFWriter.h:1.6 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.5 Mon Jul 11 01:16:24 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Tue Jul 12 01:40:29 2005 @@ -110,7 +110,18 @@ SHT_RELA = 4, SHT_HASH = 5, SHT_DYNAMIC = 6, SHT_NOTE = 7, SHT_NOBITS = 8, SHT_REL = 9, SHT_SHLIB = 10, SHT_DYNSYM = 11 }; enum { SHN_UNDEF = 0, SHN_ABS = 0xFFF1, SHN_COMMON = 0xFFF2 }; - enum { SHF_WRITE = 1, SHF_ALLOC = 2, SHF_EXECINSTR = 4 }; + enum { // SHF - ELF Section Header Flags + SHF_WRITE = 1 << 0, // Writable + SHF_ALLOC = 1 << 1, // Mapped into the process addr space + SHF_EXECINSTR = 1 << 2, // Executable + SHF_MERGE = 1 << 4, // Might be merged if equal + SHF_STRINGS = 1 << 5, // Contains null-terminated strings + SHF_INFO_LINK = 1 << 6, // 'sh_info' contains SHT index + SHF_LINK_ORDER = 1 << 7, // Preserve order after combining + SHF_OS_NONCONFORMING = 1 << 8, // nonstandard OS support required + SHF_GROUP = 1 << 9, // Section is a member of a group + SHF_TLS = 1 << 10,// Section holds thread-local data + }; ELFSection(const char *name = "", unsigned offset = 0) : Name(name), Type(0), Flags(0), Addr(0), Offset(offset), Size(0), From lattner at cs.uiuc.edu Tue Jul 12 01:57:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 01:57:37 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507120657.BAA05505@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.6 -> 1.7 --- Log message: Add support for emitting 64-bit integers --- Diffs of the changes: (+28 -1) ELFWriter.h | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.6 llvm/include/llvm/CodeGen/ELFWriter.h:1.7 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.6 Tue Jul 12 01:40:29 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Tue Jul 12 01:57:26 2005 @@ -208,11 +208,38 @@ OutputBuffer.push_back((X >> 0) & 255); } } + void outxword(uint64_t X) { + if (isLittleEndian) { + OutputBuffer.push_back((X >> 0) & 255); + OutputBuffer.push_back((X >> 8) & 255); + OutputBuffer.push_back((X >> 16) & 255); + OutputBuffer.push_back((X >> 24) & 255); + OutputBuffer.push_back((X >> 32) & 255); + OutputBuffer.push_back((X >> 40) & 255); + OutputBuffer.push_back((X >> 48) & 255); + OutputBuffer.push_back((X >> 56) & 255); + } else { + OutputBuffer.push_back((X >> 56) & 255); + OutputBuffer.push_back((X >> 48) & 255); + OutputBuffer.push_back((X >> 40) & 255); + OutputBuffer.push_back((X >> 32) & 255); + OutputBuffer.push_back((X >> 24) & 255); + OutputBuffer.push_back((X >> 16) & 255); + OutputBuffer.push_back((X >> 8) & 255); + OutputBuffer.push_back((X >> 0) & 255); + } + } + void outaddr32(unsigned X) { + outword(X); + } + void outaddr64(uint64_t X) { + outxword(X); + } void outaddr(uint64_t X) { if (!is64Bit) outword((unsigned)X); else - assert(0 && "Emission of 64-bit data not implemented yet!"); + outxword(X); } // fix functions - Replace an existing entry at an offset. From lattner at cs.uiuc.edu Tue Jul 12 01:58:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 01:58:03 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507120658.BAA05521@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.8 -> 1.9 --- Log message: Add support for 64-bit elf files --- Diffs of the changes: (+24 -16) ELFWriter.cpp | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.8 llvm/lib/CodeGen/ELFWriter.cpp:1.9 --- llvm/lib/CodeGen/ELFWriter.cpp:1.8 Mon Jul 11 21:53:33 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Tue Jul 12 01:57:52 2005 @@ -197,11 +197,10 @@ outaddr(0); // e_shoff outword(e_flags); // e_flags = whatever the target wants - assert(!is64Bit && "These sizes need to be adjusted for 64-bit!"); - outhalf(52); // e_ehsize = ELF header size + outhalf(is64Bit ? 64 : 52); // e_ehsize = ELF header size outhalf(0); // e_phentsize = prog header entry size outhalf(0); // e_phnum = # prog header entries = 0 - outhalf(40); // e_shentsize = sect header entry size + outhalf(is64Bit ? 64 : 40); // e_shentsize = sect header entry size ELFHeader_e_shnum_Offset = OutputBuffer.size(); @@ -409,27 +408,36 @@ // Now that we have emitted the string table and know the offset into the // string table of each symbol, emit the symbol table itself. - assert(!is64Bit && "Should this be 8 byte aligned for 64-bit?" - " (check .Align below also)"); - align(4); + align(is64Bit ? 8 : 4); SectionList.push_back(ELFSection(".symtab", OutputBuffer.size())); ELFSection &SymTab = SectionList.back(); SymTab.Type = ELFSection::SHT_SYMTAB; - SymTab.Align = 4; // FIXME: check for ELF64 + SymTab.Align = is64Bit ? 8 : 4; SymTab.Link = SectionList.size()-2; // Section Index of .strtab. SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. SymTab.EntSize = 16; // Size of each symtab entry. FIXME: wrong for ELF64 - assert(!is64Bit && "check this!"); - for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { - ELFSym &Sym = SymbolTable[i]; - outword(Sym.NameIdx); - outaddr(Sym.Value); - outword(Sym.Size); - outbyte(Sym.Info); - outbyte(Sym.Other); - outhalf(Sym.SectionIdx); + if (!is64Bit) { // 32-bit and 64-bit formats are shuffled a bit. + for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { + ELFSym &Sym = SymbolTable[i]; + outword(Sym.NameIdx); + outaddr32(Sym.Value); + outword(Sym.Size); + outbyte(Sym.Info); + outbyte(Sym.Other); + outhalf(Sym.SectionIdx); + } + } else { + for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { + ELFSym &Sym = SymbolTable[i]; + outword(Sym.NameIdx); + outbyte(Sym.Info); + outbyte(Sym.Other); + outhalf(Sym.SectionIdx); + outaddr64(Sym.Value); + outxword(Sym.Size); + } } SymTab.Size = OutputBuffer.size()-SymTab.Offset; From reid at x10sys.com Tue Jul 12 02:19:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 02:19:26 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200507120719.CAA05643@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.186 -> 1.187 --- Log message: In support of PR418: http://llvm.cs.uiuc.edu/PR418 : Make sure that -lpthread gets added to LIBS variable which puts it at the end of the tools' link commands, if libpthread.a is found. Add a test for pthread.h so we can use #ifdef HAVE_PTHREAD_H --- Diffs of the changes: (+4 -1) configure.ac | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.186 llvm/autoconf/configure.ac:1.187 --- llvm/autoconf/configure.ac:1.186 Mon Jun 6 14:29:36 2005 +++ llvm/autoconf/configure.ac Tue Jul 12 02:19:13 2005 @@ -417,6 +417,7 @@ dnl libelf is for sparc only; we can ignore it if we don't have it AC_CHECK_LIB(elf, elf_begin) + dnl lt_dlopen may be required for plugin support. AC_SEARCH_LIBS(lt_dlopen,ltdl,AC_DEFINE([HAVE_LT_DLOPEN],[1], [Define if lt_dlopen() is available on this platform]), @@ -434,6 +435,7 @@ dnl pthread locking functions are optional - but llvm will not be thread-safe dnl without locks. +AC_CHECK_LIB(pthread,pthread_mutex_init) AC_SEARCH_LIBS(pthread_mutex_lock,pthread, AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1], [Have pthread_mutex_lock])) @@ -456,7 +458,8 @@ AC_HEADER_TIME AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h]) -AC_CHECK_HEADERS([malloc.h signal.h stdint.h unistd.h utime.h windows.h]) +AC_CHECK_HEADERS([malloc.h pthread.h signal.h stdint.h unistd.h utime.h]) +AC_CHECK_HEADERS([windows.h]) AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/types.h]) AC_CHECK_HEADERS([rw/stdex/hash_map.h rw/stdex/hash_set.h]) From reid at x10sys.com Tue Jul 12 10:24:32 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:24:32 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200507121524.KAA03051@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.49 -> 1.50 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : * Add check for pthread.h * Make sure -lpthread gets added to LIBS if its available --- Diffs of the changes: (+6 -0) config.h.in | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.49 llvm/include/llvm/Config/config.h.in:1.50 --- llvm/include/llvm/Config/config.h.in:1.49 Sun May 15 17:15:11 2005 +++ llvm/include/llvm/Config/config.h.in Tue Jul 12 10:24:20 2005 @@ -151,6 +151,9 @@ /* Define to 1 if you have the `elf' library (-lelf). */ #undef HAVE_LIBELF +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -216,6 +219,9 @@ /* Define to have the %a format string */ #undef HAVE_PRINTF_A +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + /* Have pthread_mutex_lock */ #undef HAVE_PTHREAD_MUTEX_LOCK From reid at x10sys.com Tue Jul 12 10:24:32 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:24:32 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200507121524.KAA03053@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.190 -> 1.191 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : * Add check for pthread.h * Make sure -lpthread gets added to LIBS if its available --- Diffs of the changes: (+255 -36) configure | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 255 insertions(+), 36 deletions(-) Index: llvm/configure diff -u llvm/configure:1.190 llvm/configure:1.191 --- llvm/configure:1.190 Thu Jun 2 17:34:49 2005 +++ llvm/configure Tue Jul 12 10:24:19 2005 @@ -1774,12 +1774,6 @@ ;; esac -case $target in - sparc*-*-solaris*) target=sparcv9-sun-solaris2.8 - - ;; -esac - echo "$as_me:$LINENO: checking target architecture" >&5 echo $ECHO_N "checking target architecture... $ECHO_C" >&6 if test "${llvm_cv_target_arch+set}" = set; then @@ -8235,7 +8229,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 10223 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10711,7 +10705,7 @@ # Provide some information about the compiler. -echo "$as_me:10714:" \ +echo "$as_me:10708:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -11768,11 +11762,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11771: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11765: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11775: \$? = $ac_status" >&5 + echo "$as_me:11769: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12011,11 +12005,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12014: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12008: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12018: \$? = $ac_status" >&5 + echo "$as_me:12012: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12071,11 +12065,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12074: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12068: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12078: \$? = $ac_status" >&5 + echo "$as_me:12072: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14256,7 +14250,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16544: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16554: \$? = $ac_status" >&5 + echo "$as_me:16548: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16607,11 +16601,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16610: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16604: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16614: \$? = $ac_status" >&5 + echo "$as_me:16608: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17968,7 +17962,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:18900: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18910: \$? = $ac_status" >&5 + echo "$as_me:18904: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -18963,11 +18957,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18966: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18960: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18970: \$? = $ac_status" >&5 + echo "$as_me:18964: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21002,11 +20996,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21005: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20999: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21009: \$? = $ac_status" >&5 + echo "$as_me:21003: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21245,11 +21239,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21248: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21242: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21252: \$? = $ac_status" >&5 + echo "$as_me:21246: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21305,11 +21299,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21308: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21302: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21312: \$? = $ac_status" >&5 + echo "$as_me:21306: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23490,7 +23484,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 echo $ECHO_N "checking for library containing lt_dlopen... $ECHO_C" >&6 if test "${ac_cv_search_lt_dlopen+set}" = set; then @@ -25240,6 +25235,80 @@ fi + +echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +fi + echo "$as_me:$LINENO: checking for library containing pthread_mutex_lock" >&5 echo $ECHO_N "checking for library containing pthread_mutex_lock... $ECHO_C" >&6 if test "${ac_cv_search_pthread_mutex_lock+set}" = set; then @@ -26300,7 +26369,157 @@ -for ac_header in malloc.h signal.h stdint.h unistd.h utime.h windows.h +for ac_header in malloc.h pthread.h signal.h stdint.h unistd.h utime.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to llvmbugs at cs.uiuc.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in windows.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then From reid at x10sys.com Tue Jul 12 10:37:55 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:37:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp Message-ID: <200507121537.KAA03110@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Mutex.cpp added (r1.1) --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : Add a Mutex class for thread synchronization in a platform-independent way. The current implementation only supports pthreads. Win32 use of Critical Sections will be added later. The design permits other threading models to be used if (and only if) pthreads is not available. --- Diffs of the changes: (+141 -0) Mutex.cpp | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 141 insertions(+) Index: llvm/lib/System/Mutex.cpp diff -c /dev/null llvm/lib/System/Mutex.cpp:1.1 *** /dev/null Tue Jul 12 10:37:53 2005 --- llvm/lib/System/Mutex.cpp Tue Jul 12 10:37:43 2005 *************** *** 0 **** --- 1,141 ---- + //===- Mutex.cpp - Mutual Exclusion Lock ------------------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the llvm::sys::Mutex class. + // + //===----------------------------------------------------------------------===// + + #include "llvm/System/Mutex.h" + #include "llvm/Config/config.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only TRULY operating system + //=== independent code. + //===----------------------------------------------------------------------===// + + #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK) + #include + #include + #include + + // This variable is useful for situations where the pthread library has been + // compiled with weak linkage for its interface symbols. This allows the + // threading support to be turned off by simply not linking against -lpthread. + // In that situation, the value of pthread_mutex_init will be 0 and + // consequently pthread_enabled will be false. In such situations, all the + // pthread operations become no-ops and the functions all return false. If + // pthread_mutex_init does have an address, then mutex support is enabled. + // Note: all LLVM tools will link against -lpthread if its available since it + // is configured into the LIBS variable. + // Note: this line of code generates a warning if pthread_mutex_init is not + // declared with weak linkage. Its safe to ignore the warning. + static const bool pthread_enabled = static_cast(pthread_mutex_init); + + // Construct a Mutex using pthread calls + Mutex::Mutex( bool recursive) + : data_(0) + { + if (pthread_enabled) + { + // Declare the pthread_mutex data structures + pthread_mutex_t* mutex = + static_cast(malloc(sizeof(pthread_mutex_t))); + pthread_mutexattr_t attr; + + // Initialize the mutex attributes + int errorcode = pthread_mutexattr_init(&attr); + assert(errorcode == 0); + + // Initialize the mutex as a recursive mutex, if requested, or normal + // otherwise. + int kind = ( recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_NORMAL ); + errorcode = pthread_mutexattr_settype(&attr, kind); + assert(errorcode == 0); + + // Make it a process local mutex + errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); + + // Initialize the mutex + errorcode = pthread_mutex_init(mutex, &attr); + assert(errorcode == 0); + + // Destroy the attributes + errorcode = pthread_mutexattr_destroy(&attr); + assert(errorcode == 0); + + // Assign the data member + data_ = mutex; + } + } + + // Destruct a Mutex + Mutex::~Mutex() + { + if (pthread_enabled) + { + pthread_mutex_t* mutex = reinterpret_cast(data_); + assert(mutex != 0); + int errorcode = pthread_mutex_destroy(mutex); + assert(mutex != 0); + } + } + + bool + Mutex::acquire() + { + if (pthread_enabled) + { + pthread_mutex_t* mutex = reinterpret_cast(data_); + assert(mutex != 0); + + int errorcode = pthread_mutex_lock(mutex); + return errorcode == 0; + } + return false; + } + + bool + Mutex::release() + { + if (pthread_enabled) + { + pthread_mutex_t* mutex = reinterpret_cast(data_); + assert(mutex != 0); + + int errorcode = pthread_mutex_unlock(mutex); + return errorcode == 0; + } + return false; + } + + bool + Mutex::tryacquire() + { + if (pthread_enabled) + { + pthread_mutex_t* mutex = reinterpret_cast(data_); + assert(mutex != 0); + + int errorcode = pthread_mutex_trylock(mutex); + return errorcode == 0; + } + return false; + } + + } + #elif defined(LLVM_ON_UNIX) + #include "Unix/Mutex.inc" + #elif defined( LLVM_ON_WIN32) + #include "Win32/Mutex.inc" + #else + #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in System/Mutex.cpp + #endif From reid at x10sys.com Tue Jul 12 10:37:55 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:37:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Mutex.inc Message-ID: <200507121537.KAA03108@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Mutex.inc added (r1.1) --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : Add a Mutex class for thread synchronization in a platform-independent way. The current implementation only supports pthreads. Win32 use of Critical Sections will be added later. The design permits other threading models to be used if (and only if) pthreads is not available. --- Diffs of the changes: (+46 -0) Mutex.inc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+) Index: llvm/lib/System/Win32/Mutex.inc diff -c /dev/null llvm/lib/System/Win32/Mutex.inc:1.1 *** /dev/null Tue Jul 12 10:37:53 2005 --- llvm/lib/System/Win32/Mutex.inc Tue Jul 12 10:37:43 2005 *************** *** 0 **** --- 1,46 ---- + //===- llvm/System/Win32/Mutex.inc - Win32 Mutex Implementation -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Win32 specific (non-pthread) Mutex class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic Win32 code that + //=== is guaranteed to work on *all* Win32 variants. + //===----------------------------------------------------------------------===// + + namespace llvm + { + using namespace sys; + + Mutex::Mutex( bool recursive) + { + } + + Mutex::~Mutex() + { + } + + bool + Mutex::acquire() + { + } + + bool + Mutex::release() + { + } + + bool + Mutex::tryacquire( void ) + { + } + + } From reid at x10sys.com Tue Jul 12 10:37:55 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:37:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Mutex.inc Message-ID: <200507121537.KAA03120@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Mutex.inc added (r1.1) --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : Add a Mutex class for thread synchronization in a platform-independent way. The current implementation only supports pthreads. Win32 use of Critical Sections will be added later. The design permits other threading models to be used if (and only if) pthreads is not available. --- Diffs of the changes: (+46 -0) Mutex.inc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+) Index: llvm/lib/System/Unix/Mutex.inc diff -c /dev/null llvm/lib/System/Unix/Mutex.inc:1.1 *** /dev/null Tue Jul 12 10:37:53 2005 --- llvm/lib/System/Unix/Mutex.inc Tue Jul 12 10:37:43 2005 *************** *** 0 **** --- 1,46 ---- + //===- llvm/System/Unix/Mutex.inc - Unix Mutex Implementation ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Unix specific (non-pthread) Mutex class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic UNIX code that + //=== is guaranteed to work on *all* UNIX variants. + //===----------------------------------------------------------------------===// + + namespace llvm + { + using namespace sys; + + Mutex::Mutex( bool recursive) + { + } + + Mutex::~Mutex() + { + } + + bool + Mutex::acquire() + { + } + + bool + Mutex::release() + { + } + + bool + Mutex::tryacquire( void ) + { + } + + } From reid at x10sys.com Tue Jul 12 10:37:55 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:37:55 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Mutex.h Message-ID: <200507121537.KAA03116@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Mutex.h added (r1.1) --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : Add a Mutex class for thread synchronization in a platform-independent way. The current implementation only supports pthreads. Win32 use of Critical Sections will be added later. The design permits other threading models to be used if (and only if) pthreads is not available. --- Diffs of the changes: (+82 -0) Mutex.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+) Index: llvm/include/llvm/System/Mutex.h diff -c /dev/null llvm/include/llvm/System/Mutex.h:1.1 *** /dev/null Tue Jul 12 10:37:53 2005 --- llvm/include/llvm/System/Mutex.h Tue Jul 12 10:37:43 2005 *************** *** 0 **** --- 1,82 ---- + //===- llvm/System/Mutex.h - Mutex Operating System Concept -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file declares the llvm::sys::Mutex class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_SYSTEM_MUTEX_H + #define LLVM_SYSTEM_MUTEX_H + + namespace llvm + { + namespace sys + { + /// @brief Platform agnostic Mutex class. + class Mutex + { + /// @name Constructors + /// @{ + public: + + /// Initializes the lock but doesn't acquire it. if \p recursive is set + /// to false, the lock will not be recursive which makes it cheaper but + /// also more likely to deadlock (same thread can't acquire more than + /// once). + /// @brief Default Constructor. + Mutex ( bool recursive = true ); + + /// Releases and removes the lock + /// @brief Destructor + ~Mutex ( void ); + + /// @} + /// @name Methods + /// @{ + public: + + /// Attempts to unconditionally acquire the lock. If the lock is held by + /// another thread, this method will wait until it can acquire the lock. + /// @returns false if any kind of error occurs, true otherwise. + /// @brief Unconditionally acquire the lock. + bool acquire(); + + /// Attempts to release the lock. If the lock is held by the current + /// thread, the lock is released allowing other threads to acquire the + /// lock. + /// @returns false if any kind of error occurs, true otherwise. + /// @brief Unconditionally release the lock. + bool release(void); + + /// Attempts to acquire the lock without blocking. If the lock is not + /// available, this function returns false quickly (without blocking). If + /// the lock is available, it is acquired. + /// @returns false if any kind of error occurs or the lock is not + /// available, true otherwise. + /// @brief Try to acquire the lock. + bool tryacquire(); + + //@} + /// @name Platform Dependent Data + /// @{ + private: + void* data_; ///< We don't know what the data will be + + /// @} + /// @name Do Not Implement + /// @{ + private: + Mutex(const Mutex & original); + void operator=(const Mutex &); + /// @} + }; + } + } + + #endif From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Message-ID: <200507121552.KAA03208@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ExecutionEngine: ExecutionEngine.h updated: 1.32 -> 1.33 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+45 -15) ExecutionEngine.h | 60 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 45 insertions(+), 15 deletions(-) Index: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h diff -u llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.32 llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.33 --- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.32 Thu Apr 21 15:39:54 2005 +++ llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Tue Jul 12 10:51:55 2005 @@ -19,6 +19,7 @@ #include #include #include +#include "llvm/Support/MutexGuard.h" namespace llvm { @@ -33,10 +34,9 @@ class Type; class IntrinsicLowering; -class ExecutionEngine { - Module &CurMod; - const TargetData *TD; +class ExecutionEngineState { +private: /// GlobalAddressMap - A mapping between LLVM global values and their /// actualized version... std::map GlobalAddressMap; @@ -46,6 +46,24 @@ /// at the address. This map is not computed unless getGlobalValueAtAddress /// is called at some point. std::map GlobalAddressReverseMap; + +public: + std::map& getGlobalAddressMap(const MutexGuard& locked) { + return GlobalAddressMap; + } + + std::map& getGlobalAddressReverseMap(const MutexGuard& locked) { + return GlobalAddressReverseMap; + } +}; + + +class ExecutionEngine { + Module &CurMod; + const TargetData *TD; + + ExecutionEngineState state; + protected: ModuleProvider *MP; @@ -54,6 +72,10 @@ } public: + /// lock - This lock is protects the ExecutionEngine, JIT, JITResolver and JITEmitter classes. + /// It must be held while changing the internal state of any of those classes. + sys::Mutex lock; // Used to make this class and subclasses thread-safe + ExecutionEngine(ModuleProvider *P); ExecutionEngine(Module *M); virtual ~ExecutionEngine(); @@ -81,13 +103,15 @@ void addGlobalMapping(const GlobalValue *GV, void *Addr) { - void *&CurVal = GlobalAddressMap[GV]; + MutexGuard locked(lock); + + void *&CurVal = state.getGlobalAddressMap(locked)[GV]; assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!"); CurVal = Addr; // If we are using the reverse mapping, add it too - if (!GlobalAddressReverseMap.empty()) { - const GlobalValue *&V = GlobalAddressReverseMap[Addr]; + if (!state.getGlobalAddressReverseMap(locked).empty()) { + const GlobalValue *&V = state.getGlobalAddressReverseMap(locked)[Addr]; assert((V == 0 || GV == 0) && "GlobalMapping already established!"); V = GV; } @@ -96,21 +120,25 @@ /// clearAllGlobalMappings - Clear all global mappings and start over again /// use in dynamic compilation scenarios when you want to move globals void clearAllGlobalMappings() { - GlobalAddressMap.clear(); - GlobalAddressReverseMap.clear(); + MutexGuard locked(lock); + + state.getGlobalAddressMap(locked).clear(); + state.getGlobalAddressReverseMap(locked).clear(); } /// updateGlobalMapping - Replace an existing mapping for GV with a new /// address. This updates both maps as required. void updateGlobalMapping(const GlobalValue *GV, void *Addr) { - void *&CurVal = GlobalAddressMap[GV]; - if (CurVal && !GlobalAddressReverseMap.empty()) - GlobalAddressReverseMap.erase(CurVal); + MutexGuard locked(lock); + + void *&CurVal = state.getGlobalAddressMap(locked)[GV]; + if (CurVal && !state.getGlobalAddressReverseMap(locked).empty()) + state.getGlobalAddressReverseMap(locked).erase(CurVal); CurVal = Addr; // If we are using the reverse mapping, add it too - if (!GlobalAddressReverseMap.empty()) { - const GlobalValue *&V = GlobalAddressReverseMap[Addr]; + if (!state.getGlobalAddressReverseMap(locked).empty()) { + const GlobalValue *&V = state.getGlobalAddressReverseMap(locked)[Addr]; assert((V == 0 || GV == 0) && "GlobalMapping already established!"); V = GV; } @@ -120,8 +148,10 @@ /// global value if it is available, otherwise it returns null. /// void *getPointerToGlobalIfAvailable(const GlobalValue *GV) { - std::map::iterator I = GlobalAddressMap.find(GV); - return I != GlobalAddressMap.end() ? I->second : 0; + MutexGuard locked(lock); + + std::map::iterator I = state.getGlobalAddressMap(locked).find(GV); + return I != state.getGlobalAddressMap(locked).end() ? I->second : 0; } /// getPointerToGlobal - This returns the address of the specified global From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200507121552.KAA03210@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.187 -> 1.188 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+1 -3) configure.ac | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.187 llvm/autoconf/configure.ac:1.188 --- llvm/autoconf/configure.ac:1.187 Tue Jul 12 02:19:13 2005 +++ llvm/autoconf/configure.ac Tue Jul 12 10:51:55 2005 @@ -606,12 +606,10 @@ dnl===-----------------------------------------------------------------------=== dnl Configure header files -AC_CONFIG_HEADERS(include/llvm/Config/config.h) - +AC_CONFIG_HEADERS([include/llvm/Config/config.h]) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) -AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h]) AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) dnl Configure the makefile's configuration data From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200507121552.KAA03214@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.70 -> 1.71 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+10 -7) ExecutionEngine.cpp | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.70 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.71 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.70 Sun Jul 10 21:49:16 2005 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Tue Jul 12 10:51:55 2005 @@ -50,16 +50,18 @@ /// at the specified address. /// const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) { + MutexGuard locked(lock); + // If we haven't computed the reverse mapping yet, do so first. - if (GlobalAddressReverseMap.empty()) { + if (state.getGlobalAddressReverseMap(locked).empty()) { for (std::map::iterator I = - GlobalAddressMap.begin(), E = GlobalAddressMap.end(); I != E; ++I) - GlobalAddressReverseMap.insert(std::make_pair(I->second, I->first)); + state.getGlobalAddressMap(locked).begin(), E = state.getGlobalAddressMap(locked).end(); I != E; ++I) + state.getGlobalAddressReverseMap(locked).insert(std::make_pair(I->second, I->first)); } std::map::iterator I = - GlobalAddressReverseMap.find(Addr); - return I != GlobalAddressReverseMap.end() ? I->second : 0; + state.getGlobalAddressReverseMap(locked).find(Addr); + return I != state.getGlobalAddressReverseMap(locked).end() ? I->second : 0; } // CreateArgv - Turn a vector of strings into a nice argv style array of @@ -168,8 +170,9 @@ if (Function *F = const_cast(dyn_cast(GV))) return getPointerToFunction(F); - assert(GlobalAddressMap[GV] && "Global hasn't had an address allocated yet?"); - return GlobalAddressMap[GV]; + MutexGuard locked(lock); + assert(state.getGlobalAddressMap(locked)[GV] && "Global hasn't had an address allocated yet?"); + return state.getGlobalAddressMap(locked)[GV]; } /// FIXME: document From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp JIT.h JITEmitter.cpp Message-ID: <200507121552.KAA03224@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.55 -> 1.56 JIT.h updated: 1.26 -> 1.27 JITEmitter.cpp updated: 1.67 -> 1.68 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+76 -27) JIT.cpp | 20 ++++++++++++++------ JIT.h | 27 ++++++++++++++++++++++----- JITEmitter.cpp | 56 ++++++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 76 insertions(+), 27 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.55 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.56 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.55 Fri May 6 01:48:54 2005 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Tue Jul 12 10:51:55 2005 @@ -30,13 +30,15 @@ using namespace llvm; JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji) - : ExecutionEngine(MP), TM(tm), TJI(tji), PM(MP) { + : ExecutionEngine(MP), TM(tm), TJI(tji), state(MP) { setTargetData(TM.getTargetData()); // Initialize MCE MCE = createEmitter(*this); // Add target data + MutexGuard locked(lock); + FunctionPassManager& PM = state.getPM(locked); PM.add(new TargetData(TM.getTargetData())); // Compile LLVM Code down to machine code in the intermediate representation @@ -216,18 +218,20 @@ void JIT::runJITOnFunction(Function *F) { static bool isAlreadyCodeGenerating = false; assert(!isAlreadyCodeGenerating && "Error: Recursive compilation detected!"); + + MutexGuard locked(lock); // JIT the function isAlreadyCodeGenerating = true; - PM.run(*F); + state.getPM(locked).run(*F); isAlreadyCodeGenerating = false; // If the function referred to a global variable that had not yet been // emitted, it allocates memory for the global, but doesn't emit it yet. Emit // all of these globals now. - while (!PendingGlobals.empty()) { - const GlobalVariable *GV = PendingGlobals.back(); - PendingGlobals.pop_back(); + while (!state.getPendingGlobals(locked).empty()) { + const GlobalVariable *GV = state.getPendingGlobals(locked).back(); + state.getPendingGlobals(locked).pop_back(); EmitGlobalVariable(GV); } } @@ -236,6 +240,8 @@ /// specified function, compiling it if neccesary. /// void *JIT::getPointerToFunction(Function *F) { + MutexGuard locked(lock); + if (void *Addr = getPointerToGlobalIfAvailable(F)) return Addr; // Check if function already code gen'd @@ -270,6 +276,8 @@ /// variable, possibly emitting it to memory if needed. This is used by the /// Emitter. void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) { + MutexGuard locked(lock); + void *Ptr = getPointerToGlobalIfAvailable(GV); if (Ptr) return Ptr; @@ -287,7 +295,7 @@ // compilation. uint64_t S = getTargetData().getTypeSize(GV->getType()->getElementType()); Ptr = new char[(size_t)S]; - PendingGlobals.push_back(GV); + state.getPendingGlobals(locked).push_back(GV); } addGlobalMapping(GV, Ptr); return Ptr; Index: llvm/lib/ExecutionEngine/JIT/JIT.h diff -u llvm/lib/ExecutionEngine/JIT/JIT.h:1.26 llvm/lib/ExecutionEngine/JIT/JIT.h:1.27 --- llvm/lib/ExecutionEngine/JIT/JIT.h:1.26 Thu Apr 21 17:45:04 2005 +++ llvm/lib/ExecutionEngine/JIT/JIT.h Tue Jul 12 10:51:55 2005 @@ -27,18 +27,35 @@ class TargetJITInfo; class MachineCodeEmitter; -class JIT : public ExecutionEngine { - TargetMachine &TM; // The current target we are compiling to - TargetJITInfo &TJI; // The JITInfo for the target we are compiling to - +class JITState { +private: FunctionPassManager PM; // Passes to compile a function - MachineCodeEmitter *MCE; // MCE object /// PendingGlobals - Global variables which have had memory allocated for them /// while a function was code generated, but which have not been initialized /// yet. std::vector PendingGlobals; +public: + JITState(ModuleProvider *MP) : PM(MP) {} + + FunctionPassManager& getPM(const MutexGuard& locked) { + return PM; + } + + std::vector& getPendingGlobals(const MutexGuard& locked) { + return PendingGlobals; + } +}; + + +class JIT : public ExecutionEngine { + TargetMachine &TM; // The current target we are compiling to + TargetJITInfo &TJI; // The JITInfo for the target we are compiling to + MachineCodeEmitter *MCE; // MCE object + + JITState state; + JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji); public: ~JIT(); Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.67 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.68 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.67 Thu Apr 21 23:06:43 2005 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Jul 12 10:51:55 2005 @@ -120,6 +120,28 @@ // JIT lazy compilation code. // namespace { + class JITResolverState { + private: + /// FunctionToStubMap - Keep track of the stub created for a particular + /// function so that we can reuse them if necessary. + std::map FunctionToStubMap; + + /// StubToFunctionMap - Keep track of the function that each stub + /// corresponds to. + std::map StubToFunctionMap; + + public: + std::map& getFunctionToStubMap(const MutexGuard& locked) { + assert(locked.holds(TheJIT->lock)); + return FunctionToStubMap; + } + + std::map& getStubToFunctionMap(const MutexGuard& locked) { + assert(locked.holds(TheJIT->lock)); + return StubToFunctionMap; + } + }; + /// JITResolver - Keep track of, and resolve, call sites for functions that /// have not yet been compiled. class JITResolver { @@ -130,13 +152,7 @@ /// rewrite instructions to use. TargetJITInfo::LazyResolverFn LazyResolverFn; - // FunctionToStubMap - Keep track of the stub created for a particular - // function so that we can reuse them if necessary. - std::map FunctionToStubMap; - - // StubToFunctionMap - Keep track of the function that each stub corresponds - // to. - std::map StubToFunctionMap; + JITResolverState state; /// ExternalFnToStubMap - This is the equivalent of FunctionToStubMap for /// external functions. @@ -159,8 +175,9 @@ /// instruction without the use of a stub, record the location of the use so /// we know which function is being used at the location. void *AddCallbackAtLocation(Function *F, void *Location) { + MutexGuard locked(TheJIT->lock); /// Get the target-specific JIT resolver function. - StubToFunctionMap[Location] = F; + state.getStubToFunctionMap(locked)[Location] = F; return (void*)LazyResolverFn; } @@ -181,8 +198,10 @@ /// getFunctionStub - This returns a pointer to a function stub, creating /// one on demand as needed. void *JITResolver::getFunctionStub(Function *F) { + MutexGuard locked(TheJIT->lock); + // If we already have a stub for this function, recycle it. - void *&Stub = FunctionToStubMap[F]; + void *&Stub = state.getFunctionToStubMap(locked)[F]; if (Stub) return Stub; // Call the lazy resolver function unless we already KNOW it is an external @@ -207,7 +226,7 @@ // Finally, keep track of the stub-to-Function mapping so that the // JITCompilerFn knows which function to compile! - StubToFunctionMap[Stub] = F; + state.getStubToFunctionMap(locked)[Stub] = F; return Stub; } @@ -231,16 +250,21 @@ void *JITResolver::JITCompilerFn(void *Stub) { JITResolver &JR = getJITResolver(); + MutexGuard locked(TheJIT->lock); + // The address given to us for the stub may not be exactly right, it might be // a little bit after the stub. As such, use upper_bound to find it. std::map::iterator I = - JR.StubToFunctionMap.upper_bound(Stub); - assert(I != JR.StubToFunctionMap.begin() && "This is not a known stub!"); + JR.state.getStubToFunctionMap(locked).upper_bound(Stub); + assert(I != JR.state.getStubToFunctionMap(locked).begin() && "This is not a known stub!"); Function *F = (--I)->second; - // The target function will rewrite the stub so that the compilation callback - // function is no longer called from this stub. - JR.StubToFunctionMap.erase(I); + // We might like to remove the stub from the StubToFunction map. + // We can't do that! Multiple threads could be stuck, waiting to acquire the + // lock above. As soon as the 1st function finishes compiling the function, + // the next one will be released, and needs to be able to find the function it needs + // to call. + //JR.state.getStubToFunctionMap(locked).erase(I); DEBUG(std::cerr << "JIT: Lazily resolving function '" << F->getName() << "' In stub ptr = " << Stub << " actual ptr = " @@ -249,7 +273,7 @@ void *Result = TheJIT->getPointerToFunction(F); // We don't need to reuse this stub in the future, as F is now compiled. - JR.FunctionToStubMap.erase(F); + JR.state.getFunctionToStubMap(locked).erase(F); // FIXME: We could rewrite all references to this stub if we knew them. return Result; From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/MutexGuard.h ThreadSupport-NoSupport.h ThreadSupport-PThreads.h ThreadSupport.h.in Message-ID: <200507121552.KAA03226@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: MutexGuard.h updated: 1.4 -> 1.5 ThreadSupport-NoSupport.h (r1.3) removed ThreadSupport-PThreads.h (r1.5) removed ThreadSupport.h.in (r1.4) removed --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+23 -24) MutexGuard.h | 47 +++++++++++++++++++++++------------------------ 1 files changed, 23 insertions(+), 24 deletions(-) Index: llvm/include/llvm/Support/MutexGuard.h diff -u llvm/include/llvm/Support/MutexGuard.h:1.4 llvm/include/llvm/Support/MutexGuard.h:1.5 --- llvm/include/llvm/Support/MutexGuard.h:1.4 Sun Feb 27 13:05:24 2005 +++ llvm/include/llvm/Support/MutexGuard.h Tue Jul 12 10:51:55 2005 @@ -1,4 +1,4 @@ -//===-- Support/ThreadSupport.h - Generic threading support -----*- C++ -*-===// +//===-- Support/MutexGuard.h - Acquire/Release Mutex In Scope ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,36 +7,35 @@ // //===----------------------------------------------------------------------===// // -// This file defines platform-agnostic interfaces that can be used to write -// multi-threaded programs. Autoconf is used to chose the correct -// implementation of these interfaces, or default to a non-thread-capable system -// if no matching system support is available. +// This file defines a guard for a block of code that ensures a Mutex is locked +// upon construction and released upon destruction. // //===----------------------------------------------------------------------===// -#ifndef LLVM_SUPPORT_THREADSUPPORT_H -#define LLVM_SUPPORT_THREADSUPPORT_H +#ifndef LLVM_SUPPORT_MUTEXGUARD_H +#define LLVM_SUPPORT_MUTEXGUARD_H -#undef HAVE_PTHREAD_MUTEX_LOCK - -#ifdef HAVE_PTHREAD_MUTEX_LOCK -#include "llvm/Support/ThreadSupport-PThreads.h" -#else -#include "llvm/Support/ThreadSupport-NoSupport.h" -#endif // If no system support is available +#include namespace llvm { - /// MutexLocker - Instances of this class acquire a given Lock when - /// constructed and hold that lock until destruction. - /// - class MutexLocker { - Mutex &M; - MutexLocker(const MutexLocker &); // DO NOT IMPLEMENT - void operator=(const MutexLocker &); // DO NOT IMPLEMENT + /// Instances of this class acquire a given Mutex Lock when constructed and + /// hold that lock until destruction. The intention is to instantiate one of + /// these on the stack at the top of some scope to be assured that C++ + /// destruction of the object will always release the Mutex and thus avoid + /// a host of nasty multi-threading problems in the face of exceptions, etc. + /// @brief Guard a section of code with a Mutex. + class MutexGuard { + sys::Mutex &M; + MutexGuard(const MutexGuard &); // DO NOT IMPLEMENT + void operator=(const MutexGuard &); // DO NOT IMPLEMENT public: - MutexLocker(Mutex &m) : M(m) { M.acquire(); } - ~MutexLocker() { M.release(); } + MutexGuard(sys::Mutex &m) : M(m) { M.acquire(); } + ~MutexGuard() { M.release(); } + /// holds - Returns true if this locker instance holds the specified lock. + /// This is mostly used in assertions to validate that the correct mutex + /// is held. + bool holds(const sys::Mutex& lock) const { return &M == &lock; } }; } -#endif // SUPPORT_THREADSUPPORT_H +#endif // LLVM_SUPPORT_MUTEXGUARD_H From reid at x10sys.com Tue Jul 12 10:52:08 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 10:52:08 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200507121552.KAA03228@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.191 -> 1.192 --- Log message: For PR540: http://llvm.cs.uiuc.edu/PR540 : This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. --- Diffs of the changes: (+0 -4) configure | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/configure diff -u llvm/configure:1.191 llvm/configure:1.192 --- llvm/configure:1.191 Tue Jul 12 10:24:19 2005 +++ llvm/configure Tue Jul 12 10:51:55 2005 @@ -30489,15 +30489,12 @@ ac_config_headers="$ac_config_headers include/llvm/Config/config.h" - ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" ac_config_headers="$ac_config_headers include/llvm/ADT/hash_map" ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set" - ac_config_headers="$ac_config_headers include/llvm/Support/ThreadSupport.h" - ac_config_headers="$ac_config_headers include/llvm/ADT/iterator" @@ -31106,7 +31103,6 @@ "include/llvm/Support/DataTypes.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; "include/llvm/ADT/hash_map" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map" ;; "include/llvm/ADT/hash_set" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set" ;; - "include/llvm/Support/ThreadSupport.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/ThreadSupport.h" ;; "include/llvm/ADT/iterator" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} From reid at x10sys.com Tue Jul 12 11:36:35 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 11:36:35 -0500 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200507121636.LAA03582@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.332 -> 1.333 --- Log message: Update release notes regarding thread-safe JIT. --- Diffs of the changes: (+9 -5) ReleaseNotes.html | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.332 llvm/docs/ReleaseNotes.html:1.333 --- llvm/docs/ReleaseNotes.html:1.332 Wed Jun 29 11:22:34 2005 +++ llvm/docs/ReleaseNotes.html Tue Jul 12 11:36:24 2005 @@ -77,6 +77,14 @@

See LLVM 1.5 Release Notes

+
    +
  1. The JIT now uses mutexes to protect its internal data structures. This + allows multi-threaded programs to be run from the JIT or interpreter without + corruption of the internal data structures. See + PR418 and + PR540 for the details. +
  2. +
@@ -180,10 +188,6 @@
  • In the JIT, dlsym() on a symbol compiled by the JIT will not work.
  • -
  • The JIT does not use mutexes to protect its internal data structures. As - such, execution of a threaded program could cause these data structures to be - corrupted. -
  • The lower-invoke pass does not mark values live across a setjmp as volatile. This missing feature only affects targets whose setjmp/longjmp libraries do not save and restore @@ -584,7 +588,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/06/29 16:22:34 $ + Last modified: $Date: 2005/07/12 16:36:24 $ From reid at x10sys.com Tue Jul 12 12:36:05 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 12:36:05 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200507121736.MAA03852@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.21 -> 1.22 --- Log message: Test for the re_comp function so that platform differences can be compensated for via testing in makefiles if HAVE_RE_COMP is defined. With this change, llvm-test makefiles can do something like: ifdef HAVE_RE_COMP ... endif --- Diffs of the changes: (+4 -0) configure.ac | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.21 llvm-test/autoconf/configure.ac:1.22 --- llvm-test/autoconf/configure.ac:1.21 Wed May 18 15:18:40 2005 +++ llvm-test/autoconf/configure.ac Tue Jul 12 12:35:53 2005 @@ -98,6 +98,10 @@ dnl Determine if the linker supports the -R option. AC_LINK_USE_R +dnl Check for needed functions +AC_CHECK_FUNC([re_comp],[AC_SUBST(HAVE_RE_COMP,[HAVE_RE_COMP:=1])], + [AC_SUBST(HAVE_RE_COMP,[[]])]) + dnl Configure the default locations of the external benchmarks EXTERNAL_BENCHMARK(spec95,/home/vadve/shared/benchmarks/spec95/benchspec) EXTERNAL_BENCHMARK(spec2000,/home/vadve/shared/benchmarks/speccpu2000/benchspec) From reid at x10sys.com Tue Jul 12 12:36:05 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 12:36:05 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Makefile.config.in Message-ID: <200507121736.MAA03858@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.20 -> 1.21 Makefile.config.in updated: 1.15 -> 1.16 --- Log message: Test for the re_comp function so that platform differences can be compensated for via testing in makefiles if HAVE_RE_COMP is defined. With this change, llvm-test makefiles can do something like: ifdef HAVE_RE_COMP ... endif --- Diffs of the changes: (+104 -1) Makefile.config.in | 3 + configure | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 104 insertions(+), 1 deletion(-) Index: llvm-test/configure diff -u llvm-test/configure:1.20 llvm-test/configure:1.21 --- llvm-test/configure:1.20 Wed May 18 15:18:37 2005 +++ llvm-test/configure Tue Jul 12 12:35:53 2005 @@ -465,7 +465,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH F2C F2C_INC F2C_LIB USE_F2C LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HAVE_RE_COMP SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH F2C F2C_INC F2C_LIB USE_F2C LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -19067,6 +19067,105 @@ fi +echo "$as_me:$LINENO: checking for re_comp" >&5 +echo $ECHO_N "checking for re_comp... $ECHO_C" >&6 +if test "${ac_cv_func_re_comp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define re_comp to an innocuous variant, in case declares re_comp. + For example, HP-UX 11i declares gettimeofday. */ +#define re_comp innocuous_re_comp + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char re_comp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef re_comp + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char re_comp (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_re_comp) || defined (__stub___re_comp) +choke me +#else +char (*f) () = re_comp; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != re_comp; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_re_comp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_re_comp=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_re_comp" >&5 +echo "${ECHO_T}$ac_cv_func_re_comp" >&6 +if test $ac_cv_func_re_comp = yes; then + HAVE_RE_COMP=HAVE_RE_COMP:=1 + +else + HAVE_RE_COMP= + +fi + + # Check whether --enable-spec95 or --disable-spec95 was given. if test "${enable_spec95+set}" = set; then @@ -20263,6 +20362,7 @@ s, at FFLAGS@,$FFLAGS,;t t s, at ac_ct_F77@,$ac_ct_F77,;t t s, at LIBTOOL@,$LIBTOOL,;t t +s, at HAVE_RE_COMP@,$HAVE_RE_COMP,;t t s, at SPEC95_ROOT@,$SPEC95_ROOT,;t t s, at USE_SPEC95@,$USE_SPEC95,;t t s, at SPEC2000_ROOT@,$SPEC2000_ROOT,;t t Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.15 llvm-test/Makefile.config.in:1.16 --- llvm-test/Makefile.config.in:1.15 Thu May 19 20:53:16 2005 +++ llvm-test/Makefile.config.in Tue Jul 12 12:35:53 2005 @@ -66,3 +66,6 @@ # Disable LLC diffs for testing. @DISABLE_LLC_DIFFS@ + +# Define HAVE_RE_COMP to 1 if re_comp is found, don't define it otherwise + at HAVE_RE_COMP@ From natebegeman at mac.com Tue Jul 12 13:34:26 2005 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 12 Jul 2005 13:34:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Message-ID: <200507121834.NAA04383@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCAsmPrinter.cpp updated: 1.78 -> 1.79 --- Log message: Remove some code that moved to the generic asm printer a long time ago. --- Diffs of the changes: (+0 -84) PowerPCAsmPrinter.cpp | 84 -------------------------------------------------- 1 files changed, 84 deletions(-) Index: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.78 llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.79 --- llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.78 Thu Jul 7 19:23:26 2005 +++ llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Tue Jul 12 13:34:15 2005 @@ -225,90 +225,6 @@ } } -/// isStringCompatible - Can we treat the specified array as a string? -/// Only if it is an array of ubytes or non-negative sbytes. -/// -static bool isStringCompatible(const ConstantArray *CVA) { - const Type *ETy = cast(CVA->getType())->getElementType(); - if (ETy == Type::UByteTy) return true; - if (ETy != Type::SByteTy) return false; - - for (unsigned i = 0; i < CVA->getNumOperands(); ++i) - if (cast(CVA->getOperand(i))->getValue() < 0) - return false; - - return true; -} - -/// toOctal - Convert the low order bits of X into an octal digit. -/// -static inline char toOctal(int X) { - return (X&7)+'0'; -} - -// Possible states while outputting ASCII strings -namespace { - enum StringSection { - None, - Alpha, - Numeric - }; -} - -/// SwitchStringSection - manage the changes required to output bytes as -/// characters in a string vs. numeric decimal values -/// -static inline void SwitchStringSection(std::ostream &O, StringSection NewSect, - StringSection &Current) { - if (Current == None) { - if (NewSect == Alpha) - O << "\t.byte \""; - else if (NewSect == Numeric) - O << "\t.byte "; - } else if (Current == Alpha) { - if (NewSect == None) - O << "\""; - else if (NewSect == Numeric) - O << "\"\n" - << "\t.byte "; - } else if (Current == Numeric) { - if (NewSect == Alpha) - O << '\n' - << "\t.byte \""; - else if (NewSect == Numeric) - O << ", "; - } - - Current = NewSect; -} - -/// getAsCString - Return the specified array as a C compatible -/// string, only if the predicate isStringCompatible is true. -/// -static void printAsCString(std::ostream &O, const ConstantArray *CVA) { - assert(isStringCompatible(CVA) && "Array is not string compatible!"); - - if (CVA->getNumOperands() == 0) - return; - - StringSection Current = None; - for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) { - unsigned char C = cast(CVA->getOperand(i))->getRawValue(); - if (C == '"') { - SwitchStringSection(O, Alpha, Current); - O << "\"\""; - } else if (isprint(C)) { - SwitchStringSection(O, Alpha, Current); - O << C; - } else { - SwitchStringSection(O, Numeric, Current); - O << utostr((unsigned)C); - } - } - SwitchStringSection(O, None, Current); - O << '\n'; -} - /// createDarwinAsmPrinterPass - Returns a pass that prints the PPC assembly /// code for a MachineFunction to the given output stream, in a format that the /// Darwin assembler can deal with. From natebegeman at mac.com Tue Jul 12 13:35:09 2005 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 12 Jul 2005 13:35:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200507121835.NAA04403@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.5 -> 1.6 --- Log message: Check in the last of the darwin-specific code necessary to get shootout working before modifying the asm printer to use the subtarget info. --- Diffs of the changes: (+11 -11) X86ATTAsmPrinter.cpp | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.5 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.6 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.5 Mon Jul 11 21:35:36 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Jul 12 13:34:58 2005 @@ -101,22 +101,22 @@ if (F && isCallOp && F->isExternal()) { FnStubs.insert(Name); O << "L" << Name << "$stub"; - return; - } - - // Link-once, External, or Weakly-linked global variables need - // non-lazily-resolved stubs - if (GV->hasLinkOnceLinkage()) { + } else if (GV->hasLinkOnceLinkage()) { + // Link-once, External, or Weakly-linked global variables need + // non-lazily-resolved stubs LinkOnceStubs.insert(Name); O << "L" << Name << "$non_lazy_ptr"; - return; - } - if (GV->isExternal() || GV->hasWeakLinkage()) { + } else if (GV->isExternal() || GV->hasWeakLinkage()) { GVStubs.insert(Name); O << "L" << Name << "$non_lazy_ptr"; - return; + } else { + O << Mang->getValueName(GV); } - O << Mang->getValueName(GV); + int Offset = MO.getOffset(); + if (Offset > 0) + O << "+" << Offset; + else if (Offset < 0) + O << Offset; return; } if (!isCallOp) O << '$'; From lattner at cs.uiuc.edu Tue Jul 12 13:43:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 13:43:34 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile Message-ID: <200507121843.NAA04515@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig: Makefile updated: 1.1 -> 1.2 --- Log message: disable this test on systems that don't have re_exec, like darwin --- Diffs of the changes: (+5 -0) Makefile | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile:1.2 --- llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile:1.1 Tue Oct 5 16:07:24 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C/plot2fig/Makefile Tue Jul 12 13:43:23 2005 @@ -1,5 +1,10 @@ LEVEL = ../../../.. +include $(LEVEL)/Makefile.config +# This test uses the deprecated re_comp functions. +ifdef HAVE_RE_COMP PROG = plot2fig +endif + include $(LEVEL)/MultiSource/Makefile.multisrc From lattner at cs.uiuc.edu Tue Jul 12 13:47:20 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 13:47:20 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile Message-ID: <200507121847.NAA04570@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client: Makefile updated: 1.2 -> 1.3 --- Log message: disable this test on platforms without the re_* fns --- Diffs of the changes: (+6 -0) Makefile | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile:1.3 --- llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile:1.2 Thu Dec 9 18:18:22 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile Tue Jul 12 13:47:09 2005 @@ -1,6 +1,12 @@ LEVEL = ../../../.. +include $(LEVEL)/Makefile.config + +# This test uses the deprecated re_comp functions. +ifdef HAVE_RE_COMP PROG = archie +endif + include $(LEVEL)/MultiSource/Makefile.multisrc ifeq ($(OS),SunOS) From llvm at cs.uiuc.edu Tue Jul 12 16:48:37 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Tue, 12 Jul 2005 16:48:37 -0500 Subject: [llvm-commits] CVS: llvm/examples/ParallelJIT/ Message-ID: <200507122148.QAA22792@zion.cs.uiuc.edu> Changes in directory llvm/examples/ParallelJIT: --- Log message: Directory /var/cvs/llvm/llvm/examples/ParallelJIT added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From reid at x10sys.com Tue Jul 12 16:51:45 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 16:51:45 -0500 Subject: [llvm-commits] CVS: llvm/examples/Makefile Message-ID: <200507122151.QAA22824@zion.cs.uiuc.edu> Changes in directory llvm/examples: Makefile updated: 1.5 -> 1.6 --- Log message: For PR418: http://llvm.cs.uiuc.edu/PR418 : Add an example program that utilizes multiple threads in the JIT to process work. This was used by Evan Jones as the original test case for ensuring that the ExecutionEngine was thread safe. Original source by Evan Jones (adapted from other LLVM JIT examples) and made LLVM style compliant by Reid Spencer. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/examples/Makefile diff -u llvm/examples/Makefile:1.5 llvm/examples/Makefile:1.6 --- llvm/examples/Makefile:1.5 Tue Oct 5 13:05:53 2004 +++ llvm/examples/Makefile Tue Jul 12 16:51:34 2005 @@ -11,6 +11,6 @@ include $(LEVEL)/Makefile.config #PARALLEL_DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile)) -PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker BFtoLLVM +PARALLEL_DIRS:= ParallelJIT Fibonacci HowToUseJIT ModuleMaker BFtoLLVM include $(LEVEL)/Makefile.common From reid at x10sys.com Tue Jul 12 16:51:45 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 16:51:45 -0500 Subject: [llvm-commits] CVS: llvm/examples/ParallelJIT/Makefile ParallelJIT.cpp Message-ID: <200507122151.QAA22830@zion.cs.uiuc.edu> Changes in directory llvm/examples/ParallelJIT: Makefile added (r1.1) ParallelJIT.cpp added (r1.1) --- Log message: For PR418: http://llvm.cs.uiuc.edu/PR418 : Add an example program that utilizes multiple threads in the JIT to process work. This was used by Evan Jones as the original test case for ensuring that the ExecutionEngine was thread safe. Original source by Evan Jones (adapted from other LLVM JIT examples) and made LLVM style compliant by Reid Spencer. --- Diffs of the changes: (+311 -0) Makefile | 16 +++ ParallelJIT.cpp | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 311 insertions(+) Index: llvm/examples/ParallelJIT/Makefile diff -c /dev/null llvm/examples/ParallelJIT/Makefile:1.1 *** /dev/null Tue Jul 12 16:51:44 2005 --- llvm/examples/ParallelJIT/Makefile Tue Jul 12 16:51:34 2005 *************** *** 0 **** --- 1,16 ---- + ##===- examples/HowToUseJIT/Makefile -----------------------*- Makefile -*-===## + # + # The LLVM Compiler Infrastructure + # + # This file was developed by Valery A. Khamenya and is distributed under + # the University of Illinois Open Source License. See LICENSE.TXT for details. + # + ##===----------------------------------------------------------------------===## + LEVEL = ../.. + TOOLNAME = ParallelJIT + EXAMPLE_TOOL = 1 + + # Enable JIT support + LLVMLIBS := JIT + + include $(LEVEL)/Makefile.common Index: llvm/examples/ParallelJIT/ParallelJIT.cpp diff -c /dev/null llvm/examples/ParallelJIT/ParallelJIT.cpp:1.1 *** /dev/null Tue Jul 12 16:51:45 2005 --- llvm/examples/ParallelJIT/ParallelJIT.cpp Tue Jul 12 16:51:34 2005 *************** *** 0 **** --- 1,295 ---- + //===-- examples/ParallelJIT/ParallelJIT.cpp - Exercise threaded-safe JIT -===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Evan Jones and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // Parallel JIT + // + // This test program creates two LLVM functions then calls them from three + // separate threads. It requires the pthreads library. + // The three threads are created and then block waiting on a condition variable. + // Once all threads are blocked on the conditional variable, the main thread + // wakes them up. This complicated work is performed so that all three threads + // call into the JIT at the same time (or the best possible approximation of the + // same time). This test had assertion errors until I got the locking right. + + #include + #include "llvm/Module.h" + #include "llvm/Constants.h" + #include "llvm/Type.h" + #include "llvm/Instructions.h" + #include "llvm/ModuleProvider.h" + #include "llvm/ExecutionEngine/ExecutionEngine.h" + #include "llvm/ExecutionEngine/GenericValue.h" + #include + using namespace llvm; + + static Function* createAdd1( Module* M ) + { + // Create the add1 function entry and insert this entry into module M. The + // function will have a return type of "int" and take an argument of "int". + // The '0' terminates the list of argument types. + Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy, 0); + + // Add a basic block to the function. As before, it automatically inserts + // because of the last argument. + BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); + + // Get pointers to the constant `1'. + Value *One = ConstantSInt::get(Type::IntTy, 1); + + // Get pointers to the integer argument of the add1 function... + assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg + Argument *ArgX = Add1F->arg_begin(); // Get the arg + ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. + + // Create the add instruction, inserting it into the end of BB. + Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB); + + // Create the return instruction and add it to the basic block + new ReturnInst(Add, BB); + + // Now, function add1 is ready. + return Add1F; + } + + static Function *CreateFibFunction(Module *M) + { + // Create the fib function and insert it into module M. This function is said + // to return an int and take an int parameter. + Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, 0); + + // Add a basic block to the function. + BasicBlock *BB = new BasicBlock("EntryBlock", FibF); + + // Get pointers to the constants. + Value *One = ConstantSInt::get(Type::IntTy, 1); + Value *Two = ConstantSInt::get(Type::IntTy, 2); + + // Get pointer to the integer argument of the add1 function... + Argument *ArgX = FibF->arg_begin(); // Get the arg. + ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. + + // Create the true_block. + BasicBlock *RetBB = new BasicBlock("return", FibF); + // Create an exit block. + BasicBlock* RecurseBB = new BasicBlock("recurse", FibF); + + // Create the "if (arg < 2) goto exitbb" + Value *CondInst = BinaryOperator::createSetLE(ArgX, Two, "cond", BB); + new BranchInst(RetBB, RecurseBB, CondInst, BB); + + // Create: ret int 1 + new ReturnInst(One, RetBB); + + // create fib(x-1) + Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB); + Value *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB); + + // create fib(x-2) + Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB); + Value *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB); + + // fib(x-1)+fib(x-2) + Value *Sum = + BinaryOperator::createAdd(CallFibX1, CallFibX2, "addresult", RecurseBB); + + // Create the return instruction and add it to the basic block + new ReturnInst(Sum, RecurseBB); + + return FibF; + } + + struct threadParams { + ExecutionEngine* EE; + Function* F; + int value; + }; + + // We block the subthreads just before they begin to execute: + // we want all of them to call into the JIT at the same time, + // to verify that the locking is working correctly. + class WaitForThreads + { + public: + WaitForThreads() + { + n = 0; + waitFor = 0; + + int result = pthread_cond_init( &condition, NULL ); + assert( result == 0 ); + + result = pthread_mutex_init( &mutex, NULL ); + assert( result == 0 ); + } + + ~WaitForThreads() + { + int result = pthread_cond_destroy( &condition ); + assert( result == 0 ); + + result = pthread_mutex_destroy( &mutex ); + assert( result == 0 ); + } + + // All threads will stop here until another thread calls releaseThreads + void block() + { + int result = pthread_mutex_lock( &mutex ); + assert( result == 0 ); + n ++; + //~ std::cout << "block() n " << n << " waitFor " << waitFor << std::endl; + + assert( waitFor == 0 || n <= waitFor ); + if ( waitFor > 0 && n == waitFor ) + { + // There are enough threads blocked that we can release all of them + std::cout << "Unblocking threads from block()" << std::endl; + unblockThreads(); + } + else + { + // We just need to wait until someone unblocks us + result = pthread_cond_wait( &condition, &mutex ); + assert( result == 0 ); + } + + // unlock the mutex before returning + result = pthread_mutex_unlock( &mutex ); + assert( result == 0 ); + } + + // If there are num or more threads blocked, it will signal them all + // Otherwise, this thread blocks until there are enough OTHER threads + // blocked + void releaseThreads( size_t num ) + { + int result = pthread_mutex_lock( &mutex ); + assert( result == 0 ); + + if ( n >= num ) { + std::cout << "Unblocking threads from releaseThreads()" << std::endl; + unblockThreads(); + } + else + { + waitFor = num; + pthread_cond_wait( &condition, &mutex ); + } + + // unlock the mutex before returning + result = pthread_mutex_unlock( &mutex ); + assert( result == 0 ); + } + + private: + void unblockThreads() + { + // Reset the counters to zero: this way, if any new threads + // enter while threads are exiting, they will block instead + // of triggering a new release of threads + n = 0; + + // Reset waitFor to zero: this way, if waitFor threads enter + // while threads are exiting, they will block instead of + // triggering a new release of threads + waitFor = 0; + + int result = pthread_cond_broadcast( &condition ); + assert( result == 0 ); + } + + size_t n; + size_t waitFor; + pthread_cond_t condition; + pthread_mutex_t mutex; + }; + + static WaitForThreads synchronize; + + void* callFunc( void* param ) + { + struct threadParams* p = (struct threadParams*) param; + + // Call the `foo' function with no arguments: + std::vector Args(1); + Args[0].IntVal = p->value; + + synchronize.block(); // wait until other threads are at this point + GenericValue gv = p->EE->runFunction(p->F, Args); + + return (void*) gv.IntVal; + } + + int main() + { + // Create some module to put our function into it. + Module *M = new Module("test"); + + Function* add1F = createAdd1( M ); + Function* fibF = CreateFibFunction( M ); + + // Now we create the JIT. + ExistingModuleProvider* MP = new ExistingModuleProvider(M); + ExecutionEngine* EE = ExecutionEngine::create(MP, false); + + //~ std::cout << "We just constructed this LLVM module:\n\n" << *M; + //~ std::cout << "\n\nRunning foo: " << std::flush; + + // Create one thread for add1 and two threads for fib + struct threadParams add1 = { EE, add1F, 1000 }; + struct threadParams fib1 = { EE, fibF, 39 }; + struct threadParams fib2 = { EE, fibF, 42 }; + + pthread_t add1Thread; + int result = pthread_create( &add1Thread, NULL, callFunc, &add1 ); + if ( result != 0 ) { + std::cerr << "Could not create thread" << std::endl; + return 1; + } + + pthread_t fibThread1; + result = pthread_create( &fibThread1, NULL, callFunc, &fib1 ); + if ( result != 0 ) { + std::cerr << "Could not create thread" << std::endl; + return 1; + } + + pthread_t fibThread2; + result = pthread_create( &fibThread2, NULL, callFunc, &fib2 ); + if ( result != 0 ) { + std::cerr << "Could not create thread" << std::endl; + return 1; + } + + synchronize.releaseThreads(3); // wait until other threads are at this point + + void* returnValue; + result = pthread_join( add1Thread, &returnValue ); + if ( result != 0 ) { + std::cerr << "Could not join thread" << std::endl; + return 1; + } + std::cout << "Add1 returned " << (int) returnValue << std::endl; + + result = pthread_join( fibThread1, &returnValue ); + if ( result != 0 ) { + std::cerr << "Could not join thread" << std::endl; + return 1; + } + std::cout << "Fib1 returned " << (int) returnValue << std::endl; + + result = pthread_join( fibThread2, &returnValue ); + if ( result != 0 ) { + std::cerr << "Could not join thread" << std::endl; + return 1; + } + std::cout << "Fib2 returned " << (int) returnValue << std::endl; + + return 0; + } From reid at x10sys.com Tue Jul 12 17:00:40 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 17:00:40 -0500 Subject: [llvm-commits] CVS: llvm/examples/ParallelJIT/Makefile Message-ID: <200507122200.RAA22904@zion.cs.uiuc.edu> Changes in directory llvm/examples/ParallelJIT: Makefile updated: 1.1 -> 1.2 --- Log message: Correct the file title. --- Diffs of the changes: (+2 -2) Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/examples/ParallelJIT/Makefile diff -u llvm/examples/ParallelJIT/Makefile:1.1 llvm/examples/ParallelJIT/Makefile:1.2 --- llvm/examples/ParallelJIT/Makefile:1.1 Tue Jul 12 16:51:34 2005 +++ llvm/examples/ParallelJIT/Makefile Tue Jul 12 17:00:29 2005 @@ -1,8 +1,8 @@ -##===- examples/HowToUseJIT/Makefile -----------------------*- Makefile -*-===## +##===- examples/ParallelJIT/Makefile -----------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # -# This file was developed by Valery A. Khamenya and is distributed under +# This file was developed by Reid A. Spencer and is distributed under # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## From reid at x10sys.com Tue Jul 12 19:35:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 19:35:26 -0500 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200507130035.TAA27500@zion.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.83 -> 1.84 --- Log message: Add a test that runs the ParallelJIT example program to ensure that the JIT can run against a multi-threaded program without getting its data structures messed up. Also had to add the examples directory to the path for the tests so that ParallelJIT can be found. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.83 llvm/test/Makefile:1.84 --- llvm/test/Makefile:1.83 Fri May 20 20:29:30 2005 +++ llvm/test/Makefile Tue Jul 12 19:35:12 2005 @@ -28,7 +28,7 @@ endif check-local:: site.exp - PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ + PATH="$(LLVMToolDir):$(LLVMExmplDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ $(RUNTEST) $(RUNTESTFLAGS) clean:: From reid at x10sys.com Tue Jul 12 19:35:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 19:35:26 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/parallel.ll Message-ID: <200507130035.TAA27498@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: parallel.ll added (r1.1) --- Log message: Add a test that runs the ParallelJIT example program to ensure that the JIT can run against a multi-threaded program without getting its data structures messed up. Also had to add the examples directory to the path for the tests so that ParallelJIT can be found. --- Diffs of the changes: (+3 -0) parallel.ll | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/test/Regression/ExecutionEngine/parallel.ll diff -c /dev/null llvm/test/Regression/ExecutionEngine/parallel.ll:1.1 *** /dev/null Tue Jul 12 19:35:22 2005 --- llvm/test/Regression/ExecutionEngine/parallel.ll Tue Jul 12 19:35:12 2005 *************** *** 0 **** --- 1,3 ---- + ; This isn't really an assembly file. This test runs the ParallelJIT example + ; program and ensures its output is sane. + ; RUN: ParallelJIT | grep -q "Fib2 returned 267914296" From lattner at cs.uiuc.edu Tue Jul 12 20:42:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 20:42:14 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll Message-ID: <200507130142.UAA06273@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2005-07-12-memcpy-i64-length.ll added (r1.1) --- Log message: new testcase that crashes llc on x86/ppc. Not generated by C/C++ or LLVM though. --- Diffs of the changes: (+11 -0) 2005-07-12-memcpy-i64-length.ll | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll:1.1 *** /dev/null Tue Jul 12 20:42:13 2005 --- llvm/test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll Tue Jul 12 20:42:03 2005 *************** *** 0 **** --- 1,11 ---- + ; RUN: llvm-as < %s | llc + ; Test that llvm.memcpy works with a i64 length operand on all targets. + + + declare void %llvm.memcpy(sbyte*, sbyte*, ulong, uint) + + void %l12_l94_bc_divide_endif_2E_3_2E_ce() { + newFuncRoot: + tail call void %llvm.memcpy( sbyte* null, sbyte* null, ulong 0, uint 1 ) + unreachable + } From lattner at cs.uiuc.edu Tue Jul 12 20:42:56 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 20:42:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200507130142.UAA06342@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.138 -> 1.139 --- Log message: Fix test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll --- Diffs of the changes: (+6 -1) LegalizeDAG.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.138 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.139 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.138 Sat Jul 9 20:55:33 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jul 12 20:42:45 2005 @@ -906,7 +906,12 @@ SDOperand Tmp4; switch (getTypeAction(Node->getOperand(3).getValueType())) { - case Expand: assert(0 && "Cannot expand this yet!"); + case Expand: { + // Length is too big, just take the lo-part of the length. + SDOperand HiPart; + ExpandOp(Node->getOperand(3), HiPart, Tmp4); + break; + } case Legal: Tmp4 = LegalizeOp(Node->getOperand(3)); break; From lattner at cs.uiuc.edu Tue Jul 12 20:57:51 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 20:57:51 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll Message-ID: <200507130157.UAA06803@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: 2005-07-12-TwoMallocCalls.ll added (r1.1) --- Log message: new testcase for PR593: http://llvm.cs.uiuc.edu/PR593 --- Diffs of the changes: (+17 -0) 2005-07-12-TwoMallocCalls.ll | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll:1.1 *** /dev/null Tue Jul 12 20:57:50 2005 --- llvm/test/Regression/CodeGen/Alpha/2005-07-12-TwoMallocCalls.ll Tue Jul 12 20:57:39 2005 *************** *** 0 **** --- 1,17 ---- + ; There should be exactly two calls here (memset and malloc), no more. + ; RUN: llvm-as < %s | llc -march=alpha | grep jsr | wc -l | grep 2 + + implementation ; Functions: + + declare void %llvm.memset(sbyte*, ubyte, ulong, uint) + + bool %l12_l94_bc_divide_endif_2E_3_2E_ce(int* %tmp.71.reload, uint %scale2.1.3, uint %extra.0, %typedef.bc_struct* %n1, %typedef.bc_struct* %n2, int* %tmp.92.reload, uint %tmp.94.reload, int* %tmp.98.reload, uint %tmp.100.reload, sbyte** %tmp.112.out, uint* %tmp.157.out, sbyte** %tmp.158.out) { + newFuncRoot: + %tmp.120 = add uint %extra.0, 2 ; [#uses=1] + %tmp.122 = add uint %tmp.120, %tmp.94.reload ; [#uses=1] + %tmp.123 = add uint %tmp.122, %tmp.100.reload ; [#uses=2] + %tmp.112 = malloc sbyte, uint %tmp.123 ; [#uses=3] + %tmp.137 = cast uint %tmp.123 to ulong ; [#uses=1] + tail call void %llvm.memset( sbyte* %tmp.112, ubyte 0, ulong %tmp.137, uint 0 ) + ret bool true + } From lattner at cs.uiuc.edu Tue Jul 12 21:00:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 12 Jul 2005 21:00:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200507130200.VAA07007@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.139 -> 1.140 --- Log message: Fix Alpha/2005-07-12-TwoMallocCalls.ll and PR593: http://llvm.cs.uiuc.edu/PR593 . It is not safe to call LegalizeOp on something that has already been legalized. Instead, just force another iteration of legalization. This could affect all platforms but X86, as this codepath is dynamically dead on X86 (ISD::MEMSET and friends are legal). --- Diffs of the changes: (+2 -1) LegalizeDAG.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.139 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.140 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.139 Tue Jul 12 20:42:45 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jul 12 21:00:04 2005 @@ -972,7 +972,8 @@ std::pair CallResult = TLI.LowerCallTo(Tmp1, Type::VoidTy, false, CallingConv::C, false, DAG.getExternalSymbol(FnName, IntPtr), Args, DAG); - Result = LegalizeOp(CallResult.second); + Result = CallResult.second; + NeedsAnotherIteration = true; break; } case TargetLowering::Custom: From jeffc at jolt-lang.org Tue Jul 12 21:15:30 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 12 Jul 2005 21:15:30 -0500 Subject: [llvm-commits] CVS: llvm/win32/System/System.vcproj Message-ID: <200507130215.VAA07609@zion.cs.uiuc.edu> Changes in directory llvm/win32/System: System.vcproj updated: 1.14 -> 1.15 --- Log message: Win32 support for Mutex class. --- Diffs of the changes: (+9 -0) System.vcproj | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/win32/System/System.vcproj diff -u llvm/win32/System/System.vcproj:1.14 llvm/win32/System/System.vcproj:1.15 --- llvm/win32/System/System.vcproj:1.14 Sun Jan 30 11:54:11 2005 +++ llvm/win32/System/System.vcproj Tue Jul 12 21:15:18 2005 @@ -117,6 +117,9 @@ RelativePath="..\..\lib\System\Memory.cpp"> + + + + + + Changes in directory llvm/include/llvm/System: Mutex.h updated: 1.1 -> 1.2 --- Log message: Win32 support for Mutex class. --- Diffs of the changes: (+3 -3) Mutex.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/System/Mutex.h diff -u llvm/include/llvm/System/Mutex.h:1.1 llvm/include/llvm/System/Mutex.h:1.2 --- llvm/include/llvm/System/Mutex.h:1.1 Tue Jul 12 10:37:43 2005 +++ llvm/include/llvm/System/Mutex.h Tue Jul 12 21:15:17 2005 @@ -66,14 +66,14 @@ /// @name Platform Dependent Data /// @{ private: - void* data_; ///< We don't know what the data will be + void* data_; ///< We don't know what the data will be /// @} /// @name Do Not Implement /// @{ private: - Mutex(const Mutex & original); - void operator=(const Mutex &); + Mutex(const Mutex & original); + void operator=(const Mutex &); /// @} }; } From jeffc at jolt-lang.org Tue Jul 12 21:15:30 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 12 Jul 2005 21:15:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp Message-ID: <200507130215.VAA07613@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Mutex.cpp updated: 1.1 -> 1.2 --- Log message: Win32 support for Mutex class. --- Diffs of the changes: (+5 -3) Mutex.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/System/Mutex.cpp diff -u llvm/lib/System/Mutex.cpp:1.1 llvm/lib/System/Mutex.cpp:1.2 --- llvm/lib/System/Mutex.cpp:1.1 Tue Jul 12 10:37:43 2005 +++ llvm/lib/System/Mutex.cpp Tue Jul 12 21:15:17 2005 @@ -14,15 +14,16 @@ #include "llvm/System/Mutex.h" #include "llvm/Config/config.h" -namespace llvm { -using namespace sys; - //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system //=== independent code. //===----------------------------------------------------------------------===// #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK) + +namespace llvm { +using namespace sys; + #include #include #include @@ -132,6 +133,7 @@ } } + #elif defined(LLVM_ON_UNIX) #include "Unix/Mutex.inc" #elif defined( LLVM_ON_WIN32) From jeffc at jolt-lang.org Tue Jul 12 21:15:30 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 12 Jul 2005 21:15:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Mutex.inc Win32.h Message-ID: <200507130215.VAA07601@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Mutex.inc updated: 1.1 -> 1.2 Win32.h updated: 1.3 -> 1.4 --- Log message: Win32 support for Mutex class. --- Diffs of the changes: (+23 -9) Mutex.inc | 21 ++++++++++++++++----- Win32.h | 11 +++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) Index: llvm/lib/System/Win32/Mutex.inc diff -u llvm/lib/System/Win32/Mutex.inc:1.1 llvm/lib/System/Win32/Mutex.inc:1.2 --- llvm/lib/System/Win32/Mutex.inc:1.1 Tue Jul 12 10:37:43 2005 +++ llvm/lib/System/Win32/Mutex.inc Tue Jul 12 21:15:17 2005 @@ -2,7 +2,7 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Jeff Cohen and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// @@ -16,31 +16,42 @@ //=== is guaranteed to work on *all* Win32 variants. //===----------------------------------------------------------------------===// -namespace llvm -{ +#include "Win32.h" +#include "llvm/System/Mutex.h" + +namespace llvm { using namespace sys; -Mutex::Mutex( bool recursive) +Mutex::Mutex(bool /*recursive*/) { + data_ = new CRITICAL_SECTION; + InitializeCriticalSection((LPCRITICAL_SECTION)data_); } Mutex::~Mutex() { + DeleteCriticalSection((LPCRITICAL_SECTION)data_); + data_ = 0; } bool Mutex::acquire() { + EnterCriticalSection((LPCRITICAL_SECTION)data_); + return true; } bool Mutex::release() { + LeaveCriticalSection((LPCRITICAL_SECTION)data_); + return true; } bool -Mutex::tryacquire( void ) +Mutex::tryacquire() { + return TryEnterCriticalSection((LPCRITICAL_SECTION)data_); } } Index: llvm/lib/System/Win32/Win32.h diff -u llvm/lib/System/Win32/Win32.h:1.3 llvm/lib/System/Win32/Win32.h:1.4 --- llvm/lib/System/Win32/Win32.h:1.3 Thu Apr 21 17:48:40 2005 +++ llvm/lib/System/Win32/Win32.h Tue Jul 12 21:15:17 2005 @@ -2,20 +2,23 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Jeff Cohen and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // -// This file defines things specific to Unix implementations. +// This file defines things specific to Win32 implementations. // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// -//=== WARNING: Implementation here must contain only generic UNIX code that -//=== is guaranteed to work on all UNIX variants. +//=== WARNING: Implementation here must contain only generic Win32 code that +//=== is guaranteed to work on *all* Win32 variants. //===----------------------------------------------------------------------===// +// Require at least Windows 2000 API. +#define _WIN32_WINNT 0x0500 + #include "llvm/Config/config.h" // Get autoconf configuration settings #include "windows.h" #include From jeffc at jolt-lang.org Tue Jul 12 21:20:10 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 12 Jul 2005 21:20:10 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Mutex.h Message-ID: <200507130220.VAA07759@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Mutex.h updated: 1.2 -> 1.3 --- Log message: Eliminate tabs --- Diffs of the changes: (+2 -2) Mutex.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/System/Mutex.h diff -u llvm/include/llvm/System/Mutex.h:1.2 llvm/include/llvm/System/Mutex.h:1.3 --- llvm/include/llvm/System/Mutex.h:1.2 Tue Jul 12 21:15:17 2005 +++ llvm/include/llvm/System/Mutex.h Tue Jul 12 21:19:59 2005 @@ -72,8 +72,8 @@ /// @name Do Not Implement /// @{ private: - Mutex(const Mutex & original); - void operator=(const Mutex &); + Mutex(const Mutex & original); + void operator=(const Mutex &); /// @} }; } From jeffc at jolt-lang.org Tue Jul 12 21:58:15 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 12 Jul 2005 21:58:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Mutex.inc Message-ID: <200507130258.VAA07898@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Mutex.inc updated: 1.2 -> 1.3 --- Log message: Note to self: don't introduce memory leaks. --- Diffs of the changes: (+1 -0) Mutex.inc | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/System/Win32/Mutex.inc diff -u llvm/lib/System/Win32/Mutex.inc:1.2 llvm/lib/System/Win32/Mutex.inc:1.3 --- llvm/lib/System/Win32/Mutex.inc:1.2 Tue Jul 12 21:15:17 2005 +++ llvm/lib/System/Win32/Mutex.inc Tue Jul 12 21:58:04 2005 @@ -31,6 +31,7 @@ Mutex::~Mutex() { DeleteCriticalSection((LPCRITICAL_SECTION)data_); + delete (LPCRITICAL_SECTION)data_; data_ = 0; } From reid at x10sys.com Tue Jul 12 22:02:17 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 22:02:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp Message-ID: <200507130302.WAA07963@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Mutex.cpp updated: 1.2 -> 1.3 --- Log message: Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation of pthreads is missing that call (despite it violating the spec). --- Diffs of the changes: (+2 -0) Mutex.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/System/Mutex.cpp diff -u llvm/lib/System/Mutex.cpp:1.2 llvm/lib/System/Mutex.cpp:1.3 --- llvm/lib/System/Mutex.cpp:1.2 Tue Jul 12 21:15:17 2005 +++ llvm/lib/System/Mutex.cpp Tue Jul 12 22:02:06 2005 @@ -62,8 +62,10 @@ errorcode = pthread_mutexattr_settype(&attr, kind); assert(errorcode == 0); +#ifndef __FreeBSD__ // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); +#endif // Initialize the mutex errorcode = pthread_mutex_init(mutex, &attr); From reid at x10sys.com Tue Jul 12 22:20:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 22:20:26 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200507130320.WAA08042@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.192 -> 1.193 --- Log message: Implement a test for the Graphviz program for Chris Lattner. The symbol GRAPHVIZ will contain the path to the program if its found (or "echo Graphviz" if not) and the #define HAVE_GRAPHVIZ will be defined if its found. --- Diffs of the changes: (+78 -30) configure | 108 ++++++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 78 insertions(+), 30 deletions(-) Index: llvm/configure diff -u llvm/configure:1.192 llvm/configure:1.193 --- llvm/configure:1.192 Tue Jul 12 10:51:55 2005 +++ llvm/configure Tue Jul 12 22:20:14 2005 @@ -475,7 +475,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED JIT ENABLE_DOXYGEN TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE LIBADD_DL ECH! O AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED JIT ENABLE_DOXYGEN TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR GRAPHVIZ INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE LIBA! DD_DL ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5054,6 +5054,53 @@ echo "${ECHO_T}no" >&6 fi +# Extract the first word of "Graphviz", so it can be a program name with args. +set dummy Graphviz; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GRAPHVIZ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GRAPHVIZ in + [\\/]* | ?:[\\/]*) + ac_cv_path_GRAPHVIZ="$GRAPHVIZ" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GRAPHVIZ="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GRAPHVIZ" && ac_cv_path_GRAPHVIZ="echo GraphViz" + ;; +esac +fi +GRAPHVIZ=$ac_cv_path_GRAPHVIZ + +if test -n "$GRAPHVIZ"; then + echo "$as_me:$LINENO: result: $GRAPHVIZ" >&5 +echo "${ECHO_T}$GRAPHVIZ" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$GRAPHVIZ" != "echo GraphViz" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GRAPHVIZ 1 +_ACEOF + +fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -8229,7 +8276,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 10270 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10705,7 +10752,7 @@ # Provide some information about the compiler. -echo "$as_me:10708:" \ +echo "$as_me:10755:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -11762,11 +11809,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11765: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11812: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11769: \$? = $ac_status" >&5 + echo "$as_me:11816: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12005,11 +12052,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12008: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12055: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12012: \$? = $ac_status" >&5 + echo "$as_me:12059: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12065,11 +12112,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12068: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12115: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12072: \$? = $ac_status" >&5 + echo "$as_me:12119: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14250,7 +14297,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16591: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16548: \$? = $ac_status" >&5 + echo "$as_me:16595: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16601,11 +16648,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16604: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16651: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16608: \$? = $ac_status" >&5 + echo "$as_me:16655: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17962,7 +18009,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:18947: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18904: \$? = $ac_status" >&5 + echo "$as_me:18951: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -18957,11 +19004,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18960: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19007: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18964: \$? = $ac_status" >&5 + echo "$as_me:19011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20996,11 +21043,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20999: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21046: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21003: \$? = $ac_status" >&5 + echo "$as_me:21050: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21239,11 +21286,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21242: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21289: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21246: \$? = $ac_status" >&5 + echo "$as_me:21293: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21299,11 +21346,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21302: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21349: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21306: \$? = $ac_status" >&5 + echo "$as_me:21353: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23484,7 +23531,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/autoconf: configure.ac updated: 1.188 -> 1.189 --- Log message: Implement a test for the Graphviz program for Chris Lattner. The symbol GRAPHVIZ will contain the path to the program if its found (or "echo Graphviz" if not) and the #define HAVE_GRAPHVIZ will be defined if its found. --- Diffs of the changes: (+4 -0) configure.ac | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.188 llvm/autoconf/configure.ac:1.189 --- llvm/autoconf/configure.ac:1.188 Tue Jul 12 10:51:55 2005 +++ llvm/autoconf/configure.ac Tue Jul 12 22:20:14 2005 @@ -304,6 +304,10 @@ AC_PATH_PROG(RM, [rm], [rm]) AC_PATH_PROG(SED, [sed], [sed]) AC_PATH_PROG(TAR, [tar], [gtar]) +AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo GraphViz]) +if test "$GRAPHVIZ" != "echo GraphViz" ; then + AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) +fi dnl Find the install program AC_PROG_INSTALL From reid at x10sys.com Tue Jul 12 22:20:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 22:20:26 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200507130320.WAA08050@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.50 -> 1.51 --- Log message: Implement a test for the Graphviz program for Chris Lattner. The symbol GRAPHVIZ will contain the path to the program if its found (or "echo Graphviz" if not) and the #define HAVE_GRAPHVIZ will be defined if its found. --- Diffs of the changes: (+3 -0) config.h.in | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.50 llvm/include/llvm/Config/config.h.in:1.51 --- llvm/include/llvm/Config/config.h.in:1.50 Tue Jul 12 10:24:20 2005 +++ llvm/include/llvm/Config/config.h.in Tue Jul 12 22:20:14 2005 @@ -121,6 +121,9 @@ /* Does not have hash_set in gnu namespace */ #undef HAVE_GNU_EXT_HASH_SET +/* Define if the Graphviz program is available */ +#undef HAVE_GRAPHVIZ + /* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX From sabre at nondot.org Wed Jul 13 00:51:40 2005 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Jul 2005 00:51:40 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp In-Reply-To: <200507130302.WAA07963@zion.cs.uiuc.edu> References: <200507130302.WAA07963@zion.cs.uiuc.edu> Message-ID: What does this call do? Is it even needed? -Chris On Tue, 12 Jul 2005, Reid Spencer wrote: > > > Changes in directory llvm/lib/System: > > Mutex.cpp updated: 1.2 -> 1.3 > --- > Log message: > > Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation > of pthreads is missing that call (despite it violating the spec). > > > --- > Diffs of the changes: (+2 -0) > > Mutex.cpp | 2 ++ > 1 files changed, 2 insertions(+) > > > Index: llvm/lib/System/Mutex.cpp > diff -u llvm/lib/System/Mutex.cpp:1.2 llvm/lib/System/Mutex.cpp:1.3 > --- llvm/lib/System/Mutex.cpp:1.2 Tue Jul 12 21:15:17 2005 > +++ llvm/lib/System/Mutex.cpp Tue Jul 12 22:02:06 2005 > @@ -62,8 +62,10 @@ > errorcode = pthread_mutexattr_settype(&attr, kind); > assert(errorcode == 0); > > +#ifndef __FreeBSD__ > // Make it a process local mutex > errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); > +#endif > > // Initialize the mutex > errorcode = pthread_mutex_init(mutex, &attr); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From reid at x10sys.com Wed Jul 13 01:38:02 2005 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Jul 2005 23:38:02 -0700 Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp In-Reply-To: References: <200507130302.WAA07963@zion.cs.uiuc.edu> Message-ID: <1121236682.5395.16.camel@bashful.x10sys.com> It makes sure that you get a process-wide rather than system-wide mutex. Linux is okay but some operating systems default the mutex to system wide which is unneeded for LLVM and *way* more expensive. This call just makes sure that we get a process-wide exception. We could probably make it only be called on those systems that need it, but we're nit picking nanoseconds here .. its a 2 line function that gets called, just sets a value in a structure. Reid. On Wed, 2005-07-13 at 00:51 -0500, Chris Lattner wrote: > What does this call do? Is it even needed? > > -Chris > > On Tue, 12 Jul 2005, Reid Spencer wrote: > > > > > > > Changes in directory llvm/lib/System: > > > > Mutex.cpp updated: 1.2 -> 1.3 > > --- > > Log message: > > > > Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation > > of pthreads is missing that call (despite it violating the spec). > > > > > > --- > > Diffs of the changes: (+2 -0) > > > > Mutex.cpp | 2 ++ > > 1 files changed, 2 insertions(+) > > > > > > Index: llvm/lib/System/Mutex.cpp > > diff -u llvm/lib/System/Mutex.cpp:1.2 llvm/lib/System/Mutex.cpp:1.3 > > --- llvm/lib/System/Mutex.cpp:1.2 Tue Jul 12 21:15:17 2005 > > +++ llvm/lib/System/Mutex.cpp Tue Jul 12 22:02:06 2005 > > @@ -62,8 +62,10 @@ > > errorcode = pthread_mutexattr_settype(&attr, kind); > > assert(errorcode == 0); > > > > +#ifndef __FreeBSD__ > > // Make it a process local mutex > > errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); > > +#endif > > > > // Initialize the mutex > > errorcode = pthread_mutex_init(mutex, &attr); > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > -Chris > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20050712/d6273f5e/attachment.bin From sabre at nondot.org Wed Jul 13 01:39:24 2005 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Jul 2005 01:39:24 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/System/Mutex.cpp In-Reply-To: <1121236682.5395.16.camel@bashful.x10sys.com> References: <200507130302.WAA07963@zion.cs.uiuc.edu> <1121236682.5395.16.camel@bashful.x10sys.com> Message-ID: On Tue, 12 Jul 2005, Reid Spencer wrote: > It makes sure that you get a process-wide rather than system-wide mutex. > Linux is okay but some operating systems default the mutex to system > wide which is unneeded for LLVM and *way* more expensive. This call > just makes sure that we get a process-wide exception. We could probably > make it only be called on those systems that need it, but we're nit > picking nanoseconds here .. its a 2 line function that gets called, just > sets a value in a structure. Hrm, that is strange, are you sure that some systems default to system wide? That seems like it would violate the pthreads spec. I'm not trying to nitpick nanoseconds, just trying to make the code more portable :) -Chris >> What does this call do? Is it even needed? >> >> -Chris >> >> On Tue, 12 Jul 2005, Reid Spencer wrote: >> >>> >>> >>> Changes in directory llvm/lib/System: >>> >>> Mutex.cpp updated: 1.2 -> 1.3 >>> --- >>> Log message: >>> >>> Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation >>> of pthreads is missing that call (despite it violating the spec). >>> >>> >>> --- >>> Diffs of the changes: (+2 -0) >>> >>> Mutex.cpp | 2 ++ >>> 1 files changed, 2 insertions(+) >>> >>> >>> Index: llvm/lib/System/Mutex.cpp >>> diff -u llvm/lib/System/Mutex.cpp:1.2 llvm/lib/System/Mutex.cpp:1.3 >>> --- llvm/lib/System/Mutex.cpp:1.2 Tue Jul 12 21:15:17 2005 >>> +++ llvm/lib/System/Mutex.cpp Tue Jul 12 22:02:06 2005 >>> @@ -62,8 +62,10 @@ >>> errorcode = pthread_mutexattr_settype(&attr, kind); >>> assert(errorcode == 0); >>> >>> +#ifndef __FreeBSD__ >>> // Make it a process local mutex >>> errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); >>> +#endif >>> >>> // Initialize the mutex >>> errorcode = pthread_mutex_init(mutex, &attr); >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> -Chris >> > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From lattner at cs.uiuc.edu Wed Jul 13 12:58:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 13 Jul 2005 12:58:14 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2000/197.parser/Makefile Message-ID: <200507131758.MAA15260@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2000/197.parser: Makefile updated: 1.5 -> 1.6 --- Log message: Must include Makefile.config before testing OS. This gets 197.parser building correctly on Darwin. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm-test/External/SPEC/CINT2000/197.parser/Makefile diff -u llvm-test/External/SPEC/CINT2000/197.parser/Makefile:1.5 llvm-test/External/SPEC/CINT2000/197.parser/Makefile:1.6 --- llvm-test/External/SPEC/CINT2000/197.parser/Makefile:1.5 Mon Apr 4 21:34:16 2005 +++ llvm-test/External/SPEC/CINT2000/197.parser/Makefile Wed Jul 13 12:58:02 2005 @@ -4,6 +4,8 @@ STDOUT_FILENAME = $(RUN_TYPE).out CPPFLAGS = +include $(LEVEL)/Makefile.config + ifeq ($(OS),Darwin) CPPFLAGS += -D_ANSI_SOURCE=1 endif From lattner at cs.uiuc.edu Wed Jul 13 13:29:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 13 Jul 2005 13:29:43 -0500 Subject: [llvm-commits] CVS: llvm-test/External/Povray/Makefile Message-ID: <200507131829.NAA18489@zion.cs.uiuc.edu> Changes in directory llvm-test/External/Povray: Makefile updated: 1.14 -> 1.15 --- Log message: The povray source distro we use has libpng in the source tree. Use this source instead of depending on having an installed libpng. This gets the program working on systems without libpng (like persephone). --- Diffs of the changes: (+16 -4) Makefile | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) Index: llvm-test/External/Povray/Makefile diff -u llvm-test/External/Povray/Makefile:1.14 llvm-test/External/Povray/Makefile:1.15 --- llvm-test/External/Povray/Makefile:1.14 Sat Jan 15 21:16:09 2005 +++ llvm-test/External/Povray/Makefile Wed Jul 13 13:29:31 2005 @@ -4,11 +4,23 @@ PROG = povray -SourceDir = $(POVRAY_ROOT)/source +## Copy all of the povray sources into the local directory. +POVRAYSources := $(wildcard $(POVRAY_ROOT)/source/*.c) +RAWLIBPNGSources := $(wildcard $(POVRAY_ROOT)/source/libpng/*.c) +NONLIBPNGSources := $(addprefix $(POVRAY_ROOT)/source/libpng/, ansi2knr.c pngtest.c example.c) +LIBPNGSources := $(filter-out $(NONLIBPNGSources), $(RAWLIBPNGSources)) -CPPFLAGS += -I$(POVRAY_ROOT)/source/unix -I$(PROJ_SRC_ROOT)/runtime/libpng -DPREFIX=\"$(PROJ_OBJ_DIR)\" -DSYSCONFDIR=\"$(POVRAY_ROOT)\" -DPOV_LIB_DIR=\"$(PROJ_OBJ_DIR)/lib\" -IOutput/src -UHAVE_LIBVGA -LIBS += -lpng -lz -lm -LDFLAGS += -lpng -lz -lm +Source := $(notdir $(POVRAYSources)) $(notdir $(LIBPNGSources)) + +CPPFLAGS += -I$(POVRAY_ROOT)/source/unix -I$(PROJ_SRC_ROOT)/runtime/libpng -DPREFIX=\"$(PROJ_OBJ_DIR)\" -DSYSCONFDIR=\"$(POVRAY_ROOT)\" -DPOV_LIB_DIR=\"$(PROJ_OBJ_DIR)/lib\" -IOutput/src -UHAVE_LIBVGA -I$(POVRAY_ROOT)/source/libpng -I$(POVRAY_ROOT)/source +LIBS += -lz -lm +LDFLAGS += -lz -lm RUN_OPTIONS = -I$(POVRAY_ROOT)/scenes/advanced/chess2.pov -L$(POVRAY_ROOT)/include -GA$<.junk -O- include $(LEVEL)/MultiSource/Makefile.multisrc + +$(notdir $(POVRAYSources)) : % : $(POVRAY_ROOT)/source/% + cp $< $@ +$(notdir $(LIBPNGSources)) : % : $(POVRAY_ROOT)/source/libpng/% + cp $< $@ + From lattner at cs.uiuc.edu Wed Jul 13 13:46:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 13 Jul 2005 13:46:00 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source cdgram.y.in cdlex.c.source Message-ID: <200507131846.NAA20552@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl: cdgram.c.source updated: 1.1 -> 1.2 cdgram.y.in updated: 1.1 -> 1.2 cdlex.c.source updated: 1.1 -> 1.2 --- Log message: Fix a read-after-free memory error that is causing the test to fail on darwin --- Diffs of the changes: (+2 -61) cdgram.c.source | 2 - cdgram.y.in | 2 - cdlex.c.source | 59 -------------------------------------------------------- 3 files changed, 2 insertions(+), 61 deletions(-) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source:1.2 --- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source:1.1 Tue Oct 5 14:08:26 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source Wed Jul 13 13:45:49 2005 @@ -917,7 +917,6 @@ Debug((stderr, "\ttype='%s'\n", yypvt[-0].dynstr)); yyval.halves.left = ds(""); yyval.halves.right = ds(""); - yyval.halves.type = cat(yypvt[-1].dynstr,ds(strlen(yypvt[-1].dynstr)?" ":""),yypvt[-0].dynstr,NullCP); if (strcmp(yypvt[-0].dynstr, "void") == 0) prev = 'v'; else if ((strncmp(yypvt[-0].dynstr, "struct", 6) == 0) || @@ -925,6 +924,7 @@ prev = 's'; else prev = 't'; + yyval.halves.type = cat(yypvt[-1].dynstr,ds(strlen(yypvt[-1].dynstr)?" ":""),yypvt[-0].dynstr,NullCP); Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in:1.2 --- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in:1.1 Tue Oct 5 14:08:26 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in Wed Jul 13 13:45:49 2005 @@ -597,7 +597,6 @@ Debug((stderr, "\ttype='%s'\n", $2)); $$.left = ds(""); $$.right = ds(""); - $$.type = cat($1,ds(strlen($1)?" ":""),$2,NullCP); if (strcmp($2, "void") == 0) prev = 'v'; else if ((strncmp($2, "struct", 6) == 0) || @@ -605,6 +604,7 @@ prev = 's'; else prev = 't'; + $$.type = cat($1,ds(strlen($1)?" ":""),$2,NullCP); Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", $$.left)); Debug((stderr, "\t\tadecl.right='%s'\n", $$.right)); Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source:1.2 --- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source:1.1 Tue Oct 5 14:08:26 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source Wed Jul 13 13:45:49 2005 @@ -76,13 +76,10 @@ struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; -# line 3 "cdlex.l" /* Lexical analyzer description for ANSI and C++ cdecl. */ -# line 4 "cdlex.l" /* The output of this file is included */ -# line 5 "cdlex.l" /* into the C file cdecl.c. */ char cdlexsccsid[] = "@(#)cdlex.l 2.2 3/30/88"; # define YYNEWLINE 10 @@ -100,282 +97,226 @@ if(yywrap_nasko()) return(0); break; case 1: -# line 13 "cdlex.l" return ARRAY; break; case 2: -# line 14 "cdlex.l" return AS; break; case 3: -# line 15 "cdlex.l" return CAST; break; case 4: -# line 16 "cdlex.l" return DECLARE; break; case 5: -# line 17 "cdlex.l" return 0; break; case 6: -# line 18 "cdlex.l" return EXPLAIN; break; case 7: -# line 19 "cdlex.l" return FUNCTION; break; case 8: -# line 20 "cdlex.l" return FUNCTION; break; case 9: -# line 21 "cdlex.l" return HELP; break; case 10: -# line 22 "cdlex.l" return INTO; break; case 11: -# line 23 "cdlex.l" return MEMBER; break; case 12: -# line 24 "cdlex.l" return OF; break; case 13: -# line 25 "cdlex.l" return POINTER; break; case 14: -# line 26 "cdlex.l" return POINTER; break; case 15: -# line 27 "cdlex.l" return 0; break; case 16: -# line 28 "cdlex.l" return REFERENCE; break; case 17: -# line 29 "cdlex.l" return REFERENCE; break; case 18: -# line 30 "cdlex.l" return RETURNING; break; case 19: -# line 31 "cdlex.l" return RETURNING; break; case 20: -# line 32 "cdlex.l" return SET; break; case 21: -# line 33 "cdlex.l" return TO; break; case 22: -# line 34 "cdlex.l" return ARRAY; break; case 23: -# line 35 "cdlex.l" return DOUBLECOLON; break; case 24: -# line 36 "cdlex.l" return HELP; break; case 25: -# line 37 "cdlex.l" return COMMA; break; case 26: -# line 39 "cdlex.l" { yylval.dynstr = ds(yytext); return AUTO; } break; case 27: -# line 40 "cdlex.l" { yylval.dynstr = ds("char"); return CHAR; } break; case 28: -# line 41 "cdlex.l" { yylval.dynstr = ds(yytext); return CHAR; } break; case 29: -# line 42 "cdlex.l" { yylval.dynstr = ds(yytext); return CLASS; } break; case 30: -# line 43 "cdlex.l" { yylval.dynstr = ds("const"); return CONSTVOLATILE; } break; case 31: -# line 44 "cdlex.l" { yylval.dynstr = ds(yytext); return CONSTVOLATILE; } break; case 32: -# line 45 "cdlex.l" { yylval.dynstr = ds(yytext); return DOUBLE; } break; case 33: -# line 46 "cdlex.l" { yylval.dynstr = ds("enum"); return ENUM; } break; case 34: -# line 47 "cdlex.l" { yylval.dynstr = ds(yytext); return ENUM; } break; case 35: -# line 48 "cdlex.l" { yylval.dynstr = ds(yytext); return EXTERN; } break; case 36: -# line 49 "cdlex.l" { yylval.dynstr = ds(yytext); return FLOAT; } break; case 37: -# line 50 "cdlex.l" { yylval.dynstr = ds("int"); return INT; } break; case 38: -# line 51 "cdlex.l" { yylval.dynstr = ds(yytext); return INT; } break; case 39: -# line 52 "cdlex.l" { yylval.dynstr = ds(yytext); return LONG; } break; case 40: -# line 53 "cdlex.l" { yylval.dynstr = ds(yytext); return CONSTVOLATILE; } break; case 41: -# line 54 "cdlex.l" { yylval.dynstr = ds(yytext); return REGISTER; } break; case 42: -# line 55 "cdlex.l" { yylval.dynstr = ds(yytext); return SHORT; } break; case 43: -# line 56 "cdlex.l" { yylval.dynstr = ds(yytext); return SIGNED; } break; case 44: -# line 57 "cdlex.l" { yylval.dynstr = ds(yytext); return STATIC; } break; case 45: -# line 58 "cdlex.l" { yylval.dynstr = ds("struct"); return STRUCT; } break; case 46: -# line 59 "cdlex.l" { yylval.dynstr = ds(yytext); return STRUCT; } break; case 47: -# line 60 "cdlex.l" { yylval.dynstr = ds(yytext); return UNION; } break; case 48: -# line 61 "cdlex.l" { yylval.dynstr = ds(yytext); return UNSIGNED; } break; case 49: -# line 62 "cdlex.l" { yylval.dynstr = ds(yytext); return VOID; } break; case 50: -# line 63 "cdlex.l" { yylval.dynstr = ds(yytext); return CONSTVOLATILE; } break; case 51: -# line 65 "cdlex.l" { yylval.dynstr = ds(yytext); return NAME; } break; case 52: -# line 66 "cdlex.l" { yylval.dynstr = ds(yytext); return NUMBER; } break; case 53: -# line 68 "cdlex.l" ; break; case 54: -# line 69 "cdlex.l" ; break; case 55: -# line 70 "cdlex.l" return *yytext; break; case 56: -# line 71 "cdlex.l" { (void) printf("bad character '%s'\n",visible(*yytext)); return *yytext; From reid at x10sys.com Wed Jul 13 18:20:37 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 18:20:37 -0500 Subject: [llvm-commits] CVS: llvm/examples/ParallelJIT/ParallelJIT.cpp Message-ID: <200507132320.SAA27513@zion.cs.uiuc.edu> Changes in directory llvm/examples/ParallelJIT: ParallelJIT.cpp updated: 1.1 -> 1.2 --- Log message: Get rid of warnings on Alpha --- Diffs of the changes: (+4 -4) ParallelJIT.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/examples/ParallelJIT/ParallelJIT.cpp diff -u llvm/examples/ParallelJIT/ParallelJIT.cpp:1.1 llvm/examples/ParallelJIT/ParallelJIT.cpp:1.2 --- llvm/examples/ParallelJIT/ParallelJIT.cpp:1.1 Tue Jul 12 16:51:34 2005 +++ llvm/examples/ParallelJIT/ParallelJIT.cpp Wed Jul 13 18:20:24 2005 @@ -223,7 +223,7 @@ synchronize.block(); // wait until other threads are at this point GenericValue gv = p->EE->runFunction(p->F, Args); - return (void*) gv.IntVal; + return (void*) intptr_t(gv.IntVal); } int main() @@ -275,21 +275,21 @@ std::cerr << "Could not join thread" << std::endl; return 1; } - std::cout << "Add1 returned " << (int) returnValue << std::endl; + std::cout << "Add1 returned " << intptr_t(returnValue) << std::endl; result = pthread_join( fibThread1, &returnValue ); if ( result != 0 ) { std::cerr << "Could not join thread" << std::endl; return 1; } - std::cout << "Fib1 returned " << (int) returnValue << std::endl; + std::cout << "Fib1 returned " << intptr_t(returnValue) << std::endl; result = pthread_join( fibThread2, &returnValue ); if ( result != 0 ) { std::cerr << "Could not join thread" << std::endl; return 1; } - std::cout << "Fib2 returned " << (int) returnValue << std::endl; + std::cout << "Fib2 returned " << intptr_t(returnValue) << std::endl; return 0; } From lattner at cs.uiuc.edu Wed Jul 13 20:11:06 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 13 Jul 2005 20:11:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200507140111.UAA28108@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGPrinter.cpp updated: 1.12 -> 1.13 --- Log message: If the Graphviz program is available, use it to visualize dot graphs. --- Diffs of the changes: (+10 -1) SelectionDAGPrinter.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.13 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.12 Sat Jul 9 20:55:33 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Wed Jul 13 20:10:55 2005 @@ -116,10 +116,19 @@ F.close(); std::cerr << "\n"; +#ifdef HAVE_GRAPHVIZ + std::cerr << "Running 'Graphviz' program... " << std::flush; + if (system(("Graphviz " + Filename).c_str())) { + std::cerr << "Error viewing graph: 'Graphviz' not in path?\n"; + } else { + return; + } +#endif + std::cerr << "Running 'dot' program... " << std::flush; if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename + " > /tmp/dag.tempgraph.ps").c_str())) { - std::cerr << "Error running dot: 'dot' not in path?\n"; + std::cerr << "Error viewing graph: 'dot' not in path?\n"; } else { std::cerr << "\n"; system("gv /tmp/dag.tempgraph.ps"); From reid at x10sys.com Wed Jul 13 21:14:35 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 19:14:35 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: <200507140111.UAA28108@zion.cs.uiuc.edu> References: <200507140111.UAA28108@zion.cs.uiuc.edu> Message-ID: <1121307275.5395.41.camel@bashful.x10sys.com> See below .. On Wed, 2005-07-13 at 20:11 -0500, Chris Lattner wrote: > > Changes in directory llvm/lib/CodeGen/SelectionDAG: > > SelectionDAGPrinter.cpp updated: 1.12 -> 1.13 > --- > Log message: > > If the Graphviz program is available, use it to visualize dot graphs. > > > --- > Diffs of the changes: (+10 -1) > > SelectionDAGPrinter.cpp | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletion(-) > > > Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.13 > --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.12 Sat Jul 9 20:55:33 2005 > +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Wed Jul 13 20:10:55 2005 > @@ -116,10 +116,19 @@ > F.close(); > std::cerr << "\n"; > > +#ifdef HAVE_GRAPHVIZ > + std::cerr << "Running 'Graphviz' program... " << std::flush; > + if (system(("Graphviz " + Filename).c_str())) { This depends on Graphviz being in the path at runtime. That might not be the case. Since autoconf already figured out the full path for Graphviz, we should use that path. I will make that path available in the variable LLVM_PATH_GRAPHVIZ for you so this should be: if (system((LLVM_PATH_GRAPHVIZ + Filename).c_str())) { > + std::cerr << "Error viewing graph: 'Graphviz' not in path?\n"; > + } else { > + return; > + } > +#endif > + > std::cerr << "Running 'dot' program... " << std::flush; > if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename > + " > /tmp/dag.tempgraph.ps").c_str())) { > - std::cerr << "Error running dot: 'dot' not in path?\n"; > + std::cerr << "Error viewing graph: 'dot' not in path?\n"; > } else { > std::cerr << "\n"; > system("gv /tmp/dag.tempgraph.ps"); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20050713/fa183d50/attachment.bin From reid at x10sys.com Wed Jul 13 21:19:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 19:19:24 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: <200507140111.UAA28108@zion.cs.uiuc.edu> References: <200507140111.UAA28108@zion.cs.uiuc.edu> Message-ID: <1121307564.5395.44.camel@bashful.x10sys.com> Also ... On Wed, 2005-07-13 at 20:11 -0500, Chris Lattner wrote: > @@ -116,10 +116,19 @@ > F.close(); > std::cerr << "\n"; > > +#ifdef HAVE_GRAPHVIZ > + std::cerr << "Running 'Graphviz' program... " << std::flush; > + if (system(("Graphviz " + Filename).c_str())) { > + std::cerr << "Error viewing graph: 'Graphviz' not in path?\n"; > + } else { > + return; > + } > +#endif > + > std::cerr << "Running 'dot' program... " << std::flush; > if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename > + " > /tmp/dag.tempgraph.ps").c_str())) { > - std::cerr << "Error running dot: 'dot' not in path?\n"; > + std::cerr << "Error viewing graph: 'dot' not in path?\n"; > } else { > std::cerr << "\n"; > system("gv /tmp/dag.tempgraph.ps"); None of this code is portable because of the use of the system call. I know its convenient but windows doesn't have it. We have a facility in lib/Support for executing external programs. You should use it. Reid -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20050713/f4a656bd/attachment.bin From reid at x10sys.com Wed Jul 13 21:25:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 21:25:24 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200507140225.VAA28420@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.189 -> 1.190 --- Log message: Put the path to the Graphviz program in the #defines so it can be used. --- Diffs of the changes: (+4 -2) configure.ac | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.189 llvm/autoconf/configure.ac:1.190 --- llvm/autoconf/configure.ac:1.189 Tue Jul 12 22:20:14 2005 +++ llvm/autoconf/configure.ac Wed Jul 13 21:25:12 2005 @@ -304,9 +304,11 @@ AC_PATH_PROG(RM, [rm], [rm]) AC_PATH_PROG(SED, [sed], [sed]) AC_PATH_PROG(TAR, [tar], [gtar]) -AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo GraphViz]) -if test "$GRAPHVIZ" != "echo GraphViz" ; then +AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz]) +if test "$GRAPHVIZ" != "echo Graphviz" ; then AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) + AC_DEFINE([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ", + [Define to path to Graphviz program if found or 'echo Graphviz' otherwise]) fi dnl Find the install program From reid at x10sys.com Wed Jul 13 21:25:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 21:25:24 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200507140225.VAA28416@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.51 -> 1.52 --- Log message: Put the path to the Graphviz program in the #defines so it can be used. --- Diffs of the changes: (+3 -0) config.h.in | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.51 llvm/include/llvm/Config/config.h.in:1.52 --- llvm/include/llvm/Config/config.h.in:1.51 Tue Jul 12 22:20:14 2005 +++ llvm/include/llvm/Config/config.h.in Wed Jul 13 21:25:12 2005 @@ -392,6 +392,9 @@ /* Define if this is Win32ish platform */ #undef LLVM_ON_WIN32 +/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */ +#undef LLVM_PATH_GRAPHVIZ + /* Installation prefix directory */ #undef LLVM_PREFIX From reid at x10sys.com Wed Jul 13 21:25:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 21:25:24 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200507140225.VAA28424@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.193 -> 1.194 --- Log message: Put the path to the Graphviz program in the #defines so it can be used. --- Diffs of the changes: (+36 -31) configure | 67 +++++++++++++++++++++++++++++++++----------------------------- 1 files changed, 36 insertions(+), 31 deletions(-) Index: llvm/configure diff -u llvm/configure:1.193 llvm/configure:1.194 --- llvm/configure:1.193 Tue Jul 12 22:20:14 2005 +++ llvm/configure Wed Jul 13 21:25:12 2005 @@ -5080,7 +5080,7 @@ done done - test -z "$ac_cv_path_GRAPHVIZ" && ac_cv_path_GRAPHVIZ="echo GraphViz" + test -z "$ac_cv_path_GRAPHVIZ" && ac_cv_path_GRAPHVIZ="echo Graphviz" ;; esac fi @@ -5094,12 +5094,17 @@ echo "${ECHO_T}no" >&6 fi -if test "$GRAPHVIZ" != "echo GraphViz" ; then +if test "$GRAPHVIZ" != "echo Graphviz" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_GRAPHVIZ 1 _ACEOF + +cat >>confdefs.h <<\_ACEOF +#define LLVM_PATH_GRAPHVIZ "$GRAPHVIZ" +_ACEOF + fi # Find a good install program. We prefer a C program (faster), @@ -8276,7 +8281,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 10275 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10752,7 +10757,7 @@ # Provide some information about the compiler. -echo "$as_me:10755:" \ +echo "$as_me:10760:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -11809,11 +11814,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11812: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11817: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11816: \$? = $ac_status" >&5 + echo "$as_me:11821: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12052,11 +12057,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12055: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12060: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12059: \$? = $ac_status" >&5 + echo "$as_me:12064: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12112,11 +12117,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12115: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12120: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12119: \$? = $ac_status" >&5 + echo "$as_me:12124: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14297,7 +14302,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16596: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16595: \$? = $ac_status" >&5 + echo "$as_me:16600: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16648,11 +16653,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16651: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16656: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16655: \$? = $ac_status" >&5 + echo "$as_me:16660: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18009,7 +18014,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:18952: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18951: \$? = $ac_status" >&5 + echo "$as_me:18956: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -19004,11 +19009,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19007: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19012: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19011: \$? = $ac_status" >&5 + echo "$as_me:19016: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21043,11 +21048,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21046: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21051: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21050: \$? = $ac_status" >&5 + echo "$as_me:21055: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21286,11 +21291,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21289: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21294: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21293: \$? = $ac_status" >&5 + echo "$as_me:21298: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21346,11 +21351,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21349: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21354: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21353: \$? = $ac_status" >&5 + echo "$as_me:21358: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23531,7 +23536,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < References: <200507140111.UAA28108@zion.cs.uiuc.edu> <1121307275.5395.41.camel@bashful.x10sys.com> Message-ID: On Wed, 13 Jul 2005, Reid Spencer wrote: >> +#ifdef HAVE_GRAPHVIZ >> + std::cerr << "Running 'Graphviz' program... " << std::flush; >> + if (system(("Graphviz " + Filename).c_str())) { > > This depends on Graphviz being in the path at runtime. That might not be > the case. Since autoconf already figured out the full path for Graphviz, > we should use that path. I will make that path available in the variable > LLVM_PATH_GRAPHVIZ for you so this should be: > > if (system((LLVM_PATH_GRAPHVIZ + Filename).c_str())) { Sounds good, will fix. -Chris >> + } else { >> + return; >> + } >> +#endif >> + >> std::cerr << "Running 'dot' program... " << std::flush; >> if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename >> + " > /tmp/dag.tempgraph.ps").c_str())) { >> - std::cerr << "Error running dot: 'dot' not in path?\n"; >> + std::cerr << "Error viewing graph: 'dot' not in path?\n"; >> } else { >> std::cerr << "\n"; >> system("gv /tmp/dag.tempgraph.ps"); >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From sabre at nondot.org Wed Jul 13 23:09:33 2005 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Jul 2005 23:09:33 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: <1121307564.5395.44.camel@bashful.x10sys.com> References: <200507140111.UAA28108@zion.cs.uiuc.edu> <1121307564.5395.44.camel@bashful.x10sys.com> Message-ID: On Wed, 13 Jul 2005, Reid Spencer wrote: >> std::cerr << "Running 'dot' program... " << std::flush; >> if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename >> + " > /tmp/dag.tempgraph.ps").c_str())) { >> - std::cerr << "Error running dot: 'dot' not in path?\n"; >> + std::cerr << "Error viewing graph: 'dot' not in path?\n"; >> } else { >> std::cerr << "\n"; >> system("gv /tmp/dag.tempgraph.ps"); > > None of this code is portable because of the use of the system call. I > know its convenient but windows doesn't have it. We have a facility in > lib/Support for executing external programs. You should use it. I'm not convinced. Windows won't have 'gv' or 'Graphviz' either. I'd be happy to make the second one depend on gv being found by autoconf though. -Chris -- http://nondot.org/sabre/ http://llvm.org/ From reid at x10sys.com Wed Jul 13 23:50:03 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 23:50:03 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200507140450.XAA28861@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.22 -> 1.23 --- Log message: Minor adjustments to make --with-f2c a little easier to use and understand. --- Diffs of the changes: (+9 -9) configure.ac | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.22 llvm-test/autoconf/configure.ac:1.23 --- llvm-test/autoconf/configure.ac:1.22 Tue Jul 12 12:35:53 2005 +++ llvm-test/autoconf/configure.ac Wed Jul 13 23:49:51 2005 @@ -89,6 +89,15 @@ AC_PROG_BISON AC_PROG_LIBTOOL +dnl Check for f2c in various locations or get from --with-f2c option +CHECK_F2C_ALL() +if test "x${F2C}" = "x"; then + CHECK_F2C_BIN() + CHECK_F2C_H() + CHECK_F2C_LIB() + CHECK_F2C_ENABLE() +fi + dnl Checks for header files. dnl We don't check for ancient stuff or things that are guaranteed to be there dnl by the C++ standard. We always use the versions of C headers. @@ -110,14 +119,5 @@ EXTERNAL_BENCHMARK(sweep3d,/home/vadve/criswell/umt2k) EXTERNAL_BENCHMARK(fpgrowth,/home/vadve/shared/benchmarks/fpgrowth) -dnl Check for f2c -CHECK_F2C_ALL() -if test "x${F2C}" = "x"; then - CHECK_F2C_BIN() - CHECK_F2C_H() - CHECK_F2C_LIB() - CHECK_F2C_ENABLE() -fi - dnl Create the output files AC_OUTPUT From reid at x10sys.com Wed Jul 13 23:50:03 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 23:50:03 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/m4/f2c.m4 Message-ID: <200507140450.XAA28866@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf/m4: f2c.m4 updated: 1.3 -> 1.4 --- Log message: Minor adjustments to make --with-f2c a little easier to use and understand. --- Diffs of the changes: (+1 -0) f2c.m4 | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/autoconf/m4/f2c.m4 diff -u llvm-test/autoconf/m4/f2c.m4:1.3 llvm-test/autoconf/m4/f2c.m4:1.4 --- llvm-test/autoconf/m4/f2c.m4:1.3 Wed Dec 29 13:13:44 2004 +++ llvm-test/autoconf/m4/f2c.m4 Wed Jul 13 23:49:51 2005 @@ -12,6 +12,7 @@ AC_SUBST(F2C_INC,[$1/include]) AC_SUBST(F2C_LIB,[$1/lib]) AC_SUBST(USE_F2C,[USE_F2C=1]) + AC_SUBST(F2C_DIR,[$1]) fi ]) From reid at x10sys.com Wed Jul 13 23:50:03 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 23:50:03 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Makefile.config.in Message-ID: <200507140450.XAA28870@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.21 -> 1.22 Makefile.config.in updated: 1.16 -> 1.17 --- Log message: Minor adjustments to make --with-f2c a little easier to use and understand. --- Diffs of the changes: (+208 -196) Makefile.config.in | 1 configure | 403 +++++++++++++++++++++++++++-------------------------- 2 files changed, 208 insertions(+), 196 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.21 llvm-test/configure:1.22 --- llvm-test/configure:1.21 Tue Jul 12 12:35:53 2005 +++ llvm-test/configure Wed Jul 13 23:49:51 2005 @@ -465,7 +465,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HAVE_RE_COMP SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH F2C F2C_INC F2C_LIB USE_F2C LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL F2C F2C_INC F2C_LIB USE_F2C F2C_DIR HAVE_RE_COMP SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -18750,6 +18750,207 @@ + +# Check whether --with-f2c or --without-f2c was given. +if test "${with_f2c+set}" = set; then + withval="$with_f2c" + f2cdir=$withval +fi; +echo "$as_me:$LINENO: checking for installed f2c components" >&5 +echo $ECHO_N "checking for installed f2c components... $ECHO_C" >&6 + +if test -d "$f2cdir" && + test -d "$f2cdir/bin" && test -f "$f2cdir/bin/f2c" && + test -d "$f2cdir/include" && test -f "$f2cdir/include/f2c.h" && + test -d "$f2cdir/lib" && test -f "$f2cdir/lib/libf2c.a" +then + F2C=$f2cdir/bin/f2c + + F2C_INC=$f2cdir/include + + F2C_LIB=$f2cdir/lib + + USE_F2C=USE_F2C=1 + + F2C_DIR=$f2cdir + +fi + +if test "x$F2C" = "x"; then + +if test -d ""/usr"" && + test -d ""/usr"/bin" && test -f ""/usr"/bin/f2c" && + test -d ""/usr"/include" && test -f ""/usr"/include/f2c.h" && + test -d ""/usr"/lib" && test -f ""/usr"/lib/libf2c.a" +then + F2C="/usr"/bin/f2c + + F2C_INC="/usr"/include + + F2C_LIB="/usr"/lib + + USE_F2C=USE_F2C=1 + + F2C_DIR="/usr" + +fi + + if test "x$F2C" = "x"; then + +if test -d ""/usr/local"" && + test -d ""/usr/local"/bin" && test -f ""/usr/local"/bin/f2c" && + test -d ""/usr/local"/include" && test -f ""/usr/local"/include/f2c.h" && + test -d ""/usr/local"/lib" && test -f ""/usr/local"/lib/libf2c.a" +then + F2C="/usr/local"/bin/f2c + + F2C_INC="/usr/local"/include + + F2C_LIB="/usr/local"/lib + + USE_F2C=USE_F2C=1 + + F2C_DIR="/usr/local" + +fi + + if test "x$F2C" = "x"; then + +if test -d ""/sw"" && + test -d ""/sw"/bin" && test -f ""/sw"/bin/f2c" && + test -d ""/sw"/include" && test -f ""/sw"/include/f2c.h" && + test -d ""/sw"/lib" && test -f ""/sw"/lib/libf2c.a" +then + F2C="/sw"/bin/f2c + + F2C_INC="/sw"/include + + F2C_LIB="/sw"/lib + + USE_F2C=USE_F2C=1 + + F2C_DIR="/sw" + +fi + + if test "x$F2C" = "x"; then + +if test -d ""/opt"" && + test -d ""/opt"/bin" && test -f ""/opt"/bin/f2c" && + test -d ""/opt"/include" && test -f ""/opt"/include/f2c.h" && + test -d ""/opt"/lib" && test -f ""/opt"/lib/libf2c.a" +then + F2C="/opt"/bin/f2c + + F2C_INC="/opt"/include + + F2C_LIB="/opt"/lib + + USE_F2C=USE_F2C=1 + + F2C_DIR="/opt" + +fi + + if test "x$F2C" = "x"; then + F2C= + + F2C_INC= + + F2C_LIB= + + USE_F2C= + + checkresult="no" + else + checkresult="yes, all 3 found" + fi + else + checkresult="yes, all 3 found" + fi + else + checkresult="yes, all 3 found" + fi + else + checkresult="yes, all 3 found" + fi +else + checkresult="yes, all 3 found" +fi +echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + +if test "x${F2C}" = "x"; then + +# Check whether --with-f2cbin or --without-f2cbin was given. +if test "${with_f2cbin+set}" = set; then + withval="$with_f2cbin" + f2cbin=$withval +fi; +echo "$as_me:$LINENO: checking for f2c binary" >&5 +echo $ECHO_N "checking for f2c binary... $ECHO_C" >&6 +if test -d "$f2cbin" && test -f "$f2cbin/f2c"; then + F2C=$f2cbin/f2c + + checkresult="yes" +else + checkresult="no" +fi +echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + + +# Check whether --with-f2cinc or --without-f2cinc was given. +if test "${with_f2cinc+set}" = set; then + withval="$with_f2cinc" + f2cinc=$withval +fi; +echo "$as_me:$LINENO: checking for f2c.h" >&5 +echo $ECHO_N "checking for f2c.h... $ECHO_C" >&6 +if test -d "$f2cinc" && test -f "$f2cinc/f2c.h"; then + F2C_INC=$f2cinc + + checkresult="yes" +else + checkresult="no" +fi +echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + + +# Check whether --with-f2clib or --without-f2clib was given. +if test "${with_f2clib+set}" = set; then + withval="$with_f2clib" + f2clib=$withval +fi; +echo "$as_me:$LINENO: checking for libf2c.a" >&5 +echo $ECHO_N "checking for libf2c.a... $ECHO_C" >&6 +if test -d "$f2clib" && test -f "$f2clib/libf2c.a"; then + F2C_LIB=$f2clib + + checkresult="yes" +else + checkresult="no" +fi +echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + + echo "$as_me:$LINENO: checking whether f2c install is complete" >&5 +echo $ECHO_N "checking whether f2c install is complete... $ECHO_C" >&6 +if test -f "$F2C" && test -d "$F2C_INC" && test -d "$F2C_LIB"; then + USE_F2C=USE_F2C=1 + + checkresult="yes" +else + USE_F2C= + + checkresult="no" +fi +echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + +fi + echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -19449,197 +19650,6 @@ - -# Check whether --with-f2c or --without-f2c was given. -if test "${with_f2c+set}" = set; then - withval="$with_f2c" - f2cdir=$withval -fi; -echo "$as_me:$LINENO: checking for installed f2c components" >&5 -echo $ECHO_N "checking for installed f2c components... $ECHO_C" >&6 - -if test -d "$f2cdir" && - test -d "$f2cdir/bin" && test -f "$f2cdir/bin/f2c" && - test -d "$f2cdir/include" && test -f "$f2cdir/include/f2c.h" && - test -d "$f2cdir/lib" && test -f "$f2cdir/lib/libf2c.a" -then - F2C=$f2cdir/bin/f2c - - F2C_INC=$f2cdir/include - - F2C_LIB=$f2cdir/lib - - USE_F2C=USE_F2C=1 - -fi - -if test "x$F2C" = "x"; then - -if test -d ""/usr"" && - test -d ""/usr"/bin" && test -f ""/usr"/bin/f2c" && - test -d ""/usr"/include" && test -f ""/usr"/include/f2c.h" && - test -d ""/usr"/lib" && test -f ""/usr"/lib/libf2c.a" -then - F2C="/usr"/bin/f2c - - F2C_INC="/usr"/include - - F2C_LIB="/usr"/lib - - USE_F2C=USE_F2C=1 - -fi - - if test "x$F2C" = "x"; then - -if test -d ""/usr/local"" && - test -d ""/usr/local"/bin" && test -f ""/usr/local"/bin/f2c" && - test -d ""/usr/local"/include" && test -f ""/usr/local"/include/f2c.h" && - test -d ""/usr/local"/lib" && test -f ""/usr/local"/lib/libf2c.a" -then - F2C="/usr/local"/bin/f2c - - F2C_INC="/usr/local"/include - - F2C_LIB="/usr/local"/lib - - USE_F2C=USE_F2C=1 - -fi - - if test "x$F2C" = "x"; then - -if test -d ""/sw"" && - test -d ""/sw"/bin" && test -f ""/sw"/bin/f2c" && - test -d ""/sw"/include" && test -f ""/sw"/include/f2c.h" && - test -d ""/sw"/lib" && test -f ""/sw"/lib/libf2c.a" -then - F2C="/sw"/bin/f2c - - F2C_INC="/sw"/include - - F2C_LIB="/sw"/lib - - USE_F2C=USE_F2C=1 - -fi - - if test "x$F2C" = "x"; then - -if test -d ""/opt"" && - test -d ""/opt"/bin" && test -f ""/opt"/bin/f2c" && - test -d ""/opt"/include" && test -f ""/opt"/include/f2c.h" && - test -d ""/opt"/lib" && test -f ""/opt"/lib/libf2c.a" -then - F2C="/opt"/bin/f2c - - F2C_INC="/opt"/include - - F2C_LIB="/opt"/lib - - USE_F2C=USE_F2C=1 - -fi - - if test "x$F2C" = "x"; then - F2C= - - F2C_INC= - - F2C_LIB= - - USE_F2C= - - checkresult="no" - else - checkresult="yes, all 3 found" - fi - else - checkresult="yes, all 3 found" - fi - else - checkresult="yes, all 3 found" - fi - else - checkresult="yes, all 3 found" - fi -else - checkresult="yes, all 3 found" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - -if test "x${F2C}" = "x"; then - -# Check whether --with-f2cbin or --without-f2cbin was given. -if test "${with_f2cbin+set}" = set; then - withval="$with_f2cbin" - f2cbin=$withval -fi; -echo "$as_me:$LINENO: checking for f2c binary" >&5 -echo $ECHO_N "checking for f2c binary... $ECHO_C" >&6 -if test -d "$f2cbin" && test -f "$f2cbin/f2c"; then - F2C=$f2cbin/f2c - - checkresult="yes" -else - checkresult="no" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - - -# Check whether --with-f2cinc or --without-f2cinc was given. -if test "${with_f2cinc+set}" = set; then - withval="$with_f2cinc" - f2cinc=$withval -fi; -echo "$as_me:$LINENO: checking for f2c.h" >&5 -echo $ECHO_N "checking for f2c.h... $ECHO_C" >&6 -if test -d "$f2cinc" && test -f "$f2cinc/f2c.h"; then - F2C_INC=$f2cinc - - checkresult="yes" -else - checkresult="no" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - - -# Check whether --with-f2clib or --without-f2clib was given. -if test "${with_f2clib+set}" = set; then - withval="$with_f2clib" - f2clib=$withval -fi; -echo "$as_me:$LINENO: checking for libf2c.a" >&5 -echo $ECHO_N "checking for libf2c.a... $ECHO_C" >&6 -if test -d "$f2clib" && test -f "$f2clib/libf2c.a"; then - F2C_LIB=$f2clib - - checkresult="yes" -else - checkresult="no" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - - echo "$as_me:$LINENO: checking whether f2c install is complete" >&5 -echo $ECHO_N "checking whether f2c install is complete... $ECHO_C" >&6 -if test -f "$F2C" && test -d "$F2C_INC" && test -d "$F2C_LIB"; then - USE_F2C=USE_F2C=1 - - checkresult="yes" -else - USE_F2C= - - checkresult="no" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - -fi - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -20362,6 +20372,11 @@ s, at FFLAGS@,$FFLAGS,;t t s, at ac_ct_F77@,$ac_ct_F77,;t t s, at LIBTOOL@,$LIBTOOL,;t t +s, at F2C@,$F2C,;t t +s, at F2C_INC@,$F2C_INC,;t t +s, at F2C_LIB@,$F2C_LIB,;t t +s, at USE_F2C@,$USE_F2C,;t t +s, at F2C_DIR@,$F2C_DIR,;t t s, at HAVE_RE_COMP@,$HAVE_RE_COMP,;t t s, at SPEC95_ROOT@,$SPEC95_ROOT,;t t s, at USE_SPEC95@,$USE_SPEC95,;t t @@ -20375,10 +20390,6 @@ s, at USE_SWEEP3D@,$USE_SWEEP3D,;t t s, at FPGROWTH_ROOT@,$FPGROWTH_ROOT,;t t s, at USE_FPGROWTH@,$USE_FPGROWTH,;t t -s, at F2C@,$F2C,;t t -s, at F2C_INC@,$F2C_INC,;t t -s, at F2C_LIB@,$F2C_LIB,;t t -s, at USE_F2C@,$USE_F2C,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.16 llvm-test/Makefile.config.in:1.17 --- llvm-test/Makefile.config.in:1.16 Tue Jul 12 12:35:53 2005 +++ llvm-test/Makefile.config.in Wed Jul 13 23:49:51 2005 @@ -44,6 +44,7 @@ # F2C: Enable LLVM to run Fortran benchmarks without a Fortran front-end @USE_F2C@ +F2C_DIR := @F2C_DIR@ F2C := @F2C@ F2C_INC := @F2C_INC@ F2C_LIB := @F2C_LIB@ From reid at x10sys.com Wed Jul 13 23:58:17 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Jul 2005 21:58:17 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: References: <200507140111.UAA28108@zion.cs.uiuc.edu> <1121307564.5395.44.camel@bashful.x10sys.com> Message-ID: <1121317097.5395.54.camel@bashful.x10sys.com> On Wed, 2005-07-13 at 23:09 -0500, Chris Lattner wrote: > On Wed, 13 Jul 2005, Reid Spencer wrote: > >> std::cerr << "Running 'dot' program... " << std::flush; > >> if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename > >> + " > /tmp/dag.tempgraph.ps").c_str())) { > >> - std::cerr << "Error running dot: 'dot' not in path?\n"; > >> + std::cerr << "Error viewing graph: 'dot' not in path?\n"; > >> } else { > >> std::cerr << "\n"; > >> system("gv /tmp/dag.tempgraph.ps"); > > > > None of this code is portable because of the use of the system call. I > > know its convenient but windows doesn't have it. We have a facility in > > lib/Support for executing external programs. You should use it. > > I'm not convinced. Windows won't have 'gv' or 'Graphviz' either. I'd be > happy to make the second one depend on gv being found by autoconf though. That's crap, Chris. Here's the Graphviz Win32 download page: http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm Graphviz is definitely available on Windows. Windows users already suffer enough with LLVM, why add further deprecated features? As for gv, we should have a test and a path variable for it too .. actually for *all* programs we rely on. I'll add gv. Let me know if there are others. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20050713/6899a7d5/attachment.bin From sabre at nondot.org Thu Jul 14 00:12:25 2005 From: sabre at nondot.org (Chris Lattner) Date: Thu, 14 Jul 2005 00:12:25 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: <1121317097.5395.54.camel@bashful.x10sys.com> References: <200507140111.UAA28108@zion.cs.uiuc.edu> <1121307564.5395.44.camel@bashful.x10sys.com> <1121317097.5395.54.camel@bashful.x10sys.com> Message-ID: On Wed, 13 Jul 2005, Reid Spencer wrote: >>> None of this code is portable because of the use of the system call. I >>> know its convenient but windows doesn't have it. We have a facility in >>> lib/Support for executing external programs. You should use it. >> >> I'm not convinced. Windows won't have 'gv' or 'Graphviz' either. I'd be >> happy to make the second one depend on gv being found by autoconf though. > > That's crap, Chris. Here's the Graphviz Win32 download page: > > http://home.so-net.net.tw/oodtsen/wingraphviz/index.htm > > Graphviz is definitely available on Windows. Windows users already > suffer enough with LLVM, why add further deprecated features? FWIW, as discussed on IRC, "Graphviz" the package and "Graphviz" the program are not the same thing. Graphviz the program is an OS/X specific thing. > As for gv, we should have a test and a path variable for it too .. > actually for *all* programs we rely on. I'll add gv. Let me know if > there are others. Totally agreed, thanks! -Chris -- http://nondot.org/sabre/ http://llvm.org/ From lattner at cs.uiuc.edu Thu Jul 14 00:17:54 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 14 Jul 2005 00:17:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200507140517.AAA31868@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGPrinter.cpp updated: 1.13 -> 1.14 --- Log message: As discussed on IRC, this stuff is just for debugging. --- Diffs of the changes: (+5 -0) SelectionDAGPrinter.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.13 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.14 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.13 Wed Jul 13 20:10:55 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Thu Jul 14 00:17:43 2005 @@ -102,6 +102,10 @@ /// rendered using 'dot'. /// void SelectionDAG::viewGraph() { +// This code is only for debugging! +#ifdef NDEBUG + std::cerr << "SelectionDAG::viewGraph is only available in debug builds!\n"; +#else std::string Filename = "/tmp/dag." + getMachineFunction().getFunction()->getName() + ".dot"; std::cerr << "Writing '" << Filename << "'... "; @@ -134,4 +138,5 @@ system("gv /tmp/dag.tempgraph.ps"); } system(("rm " + Filename + " /tmp/dag.tempgraph.ps").c_str()); +#endif } From reid at x10sys.com Thu Jul 14 00:19:23 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 14 Jul 2005 00:19:23 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200507140519.AAA32461@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.190 -> 1.191 --- Log message: * Correct the AC_DEFINE for LLVM_PATH_GRAPHVIZ to use AC_DEFINE_UNQUOTED so we actually get the path and not $GRAPHVIZ as the value. * Add a #define for the gv program (HAVE_GV) and its value LLVM_PATH_GV. --- Diffs of the changes: (+7 -1) configure.ac | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.190 llvm/autoconf/configure.ac:1.191 --- llvm/autoconf/configure.ac:1.190 Wed Jul 13 21:25:12 2005 +++ llvm/autoconf/configure.ac Thu Jul 14 00:19:12 2005 @@ -307,9 +307,15 @@ AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz]) if test "$GRAPHVIZ" != "echo Graphviz" ; then AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) - AC_DEFINE([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ", + AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ", [Define to path to Graphviz program if found or 'echo Graphviz' otherwise]) fi +AC_PATH_PROG(GV, [gv], [echo gv]) +if test "$GRAPHVIZ" != "echo gv" ; then + AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available]) + AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV", + [Define to path to gv program if found or 'echo gv' otherwise]) +fi dnl Find the install program AC_PROG_INSTALL From reid at x10sys.com Thu Jul 14 00:19:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 14 Jul 2005 00:19:24 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200507140519.AAA32539@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.52 -> 1.53 --- Log message: * Correct the AC_DEFINE for LLVM_PATH_GRAPHVIZ to use AC_DEFINE_UNQUOTED so we actually get the path and not $GRAPHVIZ as the value. * Add a #define for the gv program (HAVE_GV) and its value LLVM_PATH_GV. --- Diffs of the changes: (+6 -0) config.h.in | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.52 llvm/include/llvm/Config/config.h.in:1.53 --- llvm/include/llvm/Config/config.h.in:1.52 Wed Jul 13 21:25:12 2005 +++ llvm/include/llvm/Config/config.h.in Thu Jul 14 00:19:12 2005 @@ -124,6 +124,9 @@ /* Define if the Graphviz program is available */ #undef HAVE_GRAPHVIZ +/* Define if the gv program is available */ +#undef HAVE_GV + /* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX @@ -395,6 +398,9 @@ /* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */ #undef LLVM_PATH_GRAPHVIZ +/* Define to path to gv program if found or 'echo gv' otherwise */ +#undef LLVM_PATH_GV + /* Installation prefix directory */ #undef LLVM_PREFIX From reid at x10sys.com Thu Jul 14 00:19:24 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 14 Jul 2005 00:19:24 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200507140519.AAA32530@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.194 -> 1.195 --- Log message: * Correct the AC_DEFINE for LLVM_PATH_GRAPHVIZ to use AC_DEFINE_UNQUOTED so we actually get the path and not $GRAPHVIZ as the value. * Add a #define for the gv program (HAVE_GV) and its value LLVM_PATH_GV. --- Diffs of the changes: (+84 -31) configure | 115 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 84 insertions(+), 31 deletions(-) Index: llvm/configure diff -u llvm/configure:1.194 llvm/configure:1.195 --- llvm/configure:1.194 Wed Jul 13 21:25:12 2005 +++ llvm/configure Thu Jul 14 00:19:12 2005 @@ -475,7 +475,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED JIT ENABLE_DOXYGEN TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR GRAPHVIZ INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE LIBA! DD_DL ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED JIT ENABLE_DOXYGEN TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR GRAPHVIZ GV INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE L! IBADD_DL ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5101,11 +5101,63 @@ _ACEOF -cat >>confdefs.h <<\_ACEOF +cat >>confdefs.h <<_ACEOF #define LLVM_PATH_GRAPHVIZ "$GRAPHVIZ" _ACEOF fi +# Extract the first word of "gv", so it can be a program name with args. +set dummy gv; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GV+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GV in + [\\/]* | ?:[\\/]*) + ac_cv_path_GV="$GV" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GV="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GV" && ac_cv_path_GV="echo gv" + ;; +esac +fi +GV=$ac_cv_path_GV + +if test -n "$GV"; then + echo "$as_me:$LINENO: result: $GV" >&5 +echo "${ECHO_T}$GV" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$GRAPHVIZ" != "echo gv" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GV 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define LLVM_PATH_GV "$GV" +_ACEOF + +fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -8281,7 +8333,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 10327 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10757,7 +10809,7 @@ # Provide some information about the compiler. -echo "$as_me:10760:" \ +echo "$as_me:10812:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -11814,11 +11866,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11817: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11869: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11821: \$? = $ac_status" >&5 + echo "$as_me:11873: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12057,11 +12109,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12060: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12112: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12064: \$? = $ac_status" >&5 + echo "$as_me:12116: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12117,11 +12169,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12120: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12172: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12124: \$? = $ac_status" >&5 + echo "$as_me:12176: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14302,7 +14354,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16648: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16600: \$? = $ac_status" >&5 + echo "$as_me:16652: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16653,11 +16705,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16656: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16708: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16660: \$? = $ac_status" >&5 + echo "$as_me:16712: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18014,7 +18066,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19004: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18956: \$? = $ac_status" >&5 + echo "$as_me:19008: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -19009,11 +19061,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19012: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19064: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19016: \$? = $ac_status" >&5 + echo "$as_me:19068: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21048,11 +21100,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21051: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21103: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21055: \$? = $ac_status" >&5 + echo "$as_me:21107: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21291,11 +21343,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21294: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21346: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21298: \$? = $ac_status" >&5 + echo "$as_me:21350: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21351,11 +21403,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21354: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21406: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21358: \$? = $ac_status" >&5 + echo "$as_me:21410: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23536,7 +23588,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGPrinter.cpp updated: 1.14 -> 1.15 --- Log message: Make this use the new autoconf support for finding the executables for gv and Graphviz. --- Diffs of the changes: (+8 -5) SelectionDAGPrinter.cpp | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.14 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.15 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.14 Thu Jul 14 00:17:43 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Thu Jul 14 00:33:13 2005 @@ -103,9 +103,7 @@ /// void SelectionDAG::viewGraph() { // This code is only for debugging! -#ifdef NDEBUG - std::cerr << "SelectionDAG::viewGraph is only available in debug builds!\n"; -#else +#ifndef NDEBUG std::string Filename = "/tmp/dag." + getMachineFunction().getFunction()->getName() + ".dot"; std::cerr << "Writing '" << Filename << "'... "; @@ -122,21 +120,26 @@ #ifdef HAVE_GRAPHVIZ std::cerr << "Running 'Graphviz' program... " << std::flush; - if (system(("Graphviz " + Filename).c_str())) { + if (system((LLVM_PATH_GRAPHVIZ " " + Filename).c_str())) { std::cerr << "Error viewing graph: 'Graphviz' not in path?\n"; } else { return; } #endif +#ifdef HAVE_GV std::cerr << "Running 'dot' program... " << std::flush; if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename + " > /tmp/dag.tempgraph.ps").c_str())) { std::cerr << "Error viewing graph: 'dot' not in path?\n"; } else { std::cerr << "\n"; - system("gv /tmp/dag.tempgraph.ps"); + system(LLVM_PATH_GV " /tmp/dag.tempgraph.ps"); } system(("rm " + Filename + " /tmp/dag.tempgraph.ps").c_str()); + return; #endif +#endif + std::cerr << "SelectionDAG::viewGraph is only available in debug builds on " + << "systems with Graphviz or gv!\n"; } From reid at x10sys.com Thu Jul 14 00:54:07 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 14 Jul 2005 00:54:07 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Message-ID: <200507140554.AAA00492@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.22 -> 1.23 --- Log message: Make the search for the f2c program include a search of the user's path. --- Diffs of the changes: (+13 -0) configure | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm-test/configure diff -u llvm-test/configure:1.22 llvm-test/configure:1.23 --- llvm-test/configure:1.22 Wed Jul 13 23:49:51 2005 +++ llvm-test/configure Thu Jul 14 00:53:56 2005 @@ -18755,9 +18755,22 @@ if test "${with_f2c+set}" = set; then withval="$with_f2c" f2cdir=$withval +else + f2cdir=notfound fi; echo "$as_me:$LINENO: checking for installed f2c components" >&5 echo $ECHO_N "checking for installed f2c components... $ECHO_C" >&6 +if test "$f2cdir" = "notfound" ; then + f2cdir=`which f2c` + if test "$f2cdir"x != "x" ; then + if test -d "${f2cdir%*f2c}" -a -d "${f2cdir%*f2c}/.." ; then + f2cdir=`cd "${f2cdir%*f2c}/.." ; pwd` + if test ! -d "$f2cdir" ; then + f2cdir="notfound"; + fi + fi + fi +fi if test -d "$f2cdir" && test -d "$f2cdir/bin" && test -f "$f2cdir/bin/f2c" && From reid at x10sys.com Thu Jul 14 00:54:07 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 14 Jul 2005 00:54:07 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/m4/f2c.m4 Message-ID: <200507140554.AAA00496@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf/m4: f2c.m4 updated: 1.4 -> 1.5 --- Log message: Make the search for the f2c program include a search of the user's path. --- Diffs of the changes: (+13 -2) f2c.m4 | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) Index: llvm-test/autoconf/m4/f2c.m4 diff -u llvm-test/autoconf/m4/f2c.m4:1.4 llvm-test/autoconf/m4/f2c.m4:1.5 --- llvm-test/autoconf/m4/f2c.m4:1.4 Wed Jul 13 23:49:51 2005 +++ llvm-test/autoconf/m4/f2c.m4 Thu Jul 14 00:53:56 2005 @@ -18,9 +18,20 @@ AC_DEFUN([CHECK_F2C_ALL], [AC_ARG_WITH(f2c, - AS_HELP_STRING(--with-f2c=DIR,Use f2c with install prefix DIR), - f2cdir=$withval) + AS_HELP_STRING(--with-f2c=DIR,[Use f2c with install prefix DIR]), + [f2cdir=$withval],[f2cdir=notfound]) AC_MSG_CHECKING([for installed f2c components]) +if test "$f2cdir" = "notfound" ; then + f2cdir=`which f2c` + if test "$f2cdir"x != "x" ; then + if test -d "${f2cdir%*f2c}" -a -d "${f2cdir%*f2c}/.." ; then + f2cdir=`cd "${f2cdir%*f2c}/.." ; pwd` + if test ! -d "$f2cdir" ; then + f2cdir="notfound"; + fi + fi + fi +fi CHECK_F2C($f2cdir) if test "x$F2C" = "x"; then CHECK_F2C("/usr") From lattner at cs.uiuc.edu Thu Jul 14 01:30:50 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 14 Jul 2005 01:30:50 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.f2c Message-ID: <200507140630.BAA05573@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.f2c updated: 1.6 -> 1.7 --- Log message: Clean out a layer of PR100: http://llvm.cs.uiuc.edu/PR100 related cruft, making use of the new autoconf machinery that Reid installed --- Diffs of the changes: (+16 -14) Makefile.f2c | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) Index: llvm-test/Makefile.f2c diff -u llvm-test/Makefile.f2c:1.6 llvm-test/Makefile.f2c:1.7 --- llvm-test/Makefile.f2c:1.6 Sat Apr 9 01:15:22 2005 +++ llvm-test/Makefile.f2c Thu Jul 14 01:30:39 2005 @@ -1,5 +1,12 @@ ##===- Makefile.f2c ----------------------------------------*- Makefile -*-===## # +# The LLVM Compiler Infrastructure +# +# This file was developed by the LLVM research group and is distributed under +# the University of Illinois Open Source License. See LICENSE.TXT for details. +# +#===------------------------------------------------------------------------===# +# # Enable running Fortran programs with LLVM by using f2c to convert to C and # link with libf2c, but only until we have a Fortran front-end. # @@ -8,25 +15,20 @@ # FIXME: This would be autoconf'd include $(LEVEL)/Makefile.config -ifndef TEST -all:: -else +# Make sure the correct targets come first. +ifdef TEST test:: +else +all:: endif -.PRECIOUS: %.c - -ifeq ($(ARCH),x86) -F2C_DIR = /home/vadve/shared/localtools/x86 -else - ifeq ($(ARCH),Sparc) - F2C_DIR = /home/vadve/shared/localtools/sparc - endif +ifneq ($(USE_F2C),1) +all test:: + echo "The f2c program was not found" + exit 1 endif -F2C = $(F2C_DIR)/bin/f2c -F2C_INC = $(F2C_DIR)/include -F2C_LIB = $(F2C_DIR)/lib +.PRECIOUS: %.c clean:: rm -f $(Source:%.f=%.c) From criswell at cs.uiuc.edu Thu Jul 14 14:41:34 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu, 14 Jul 2005 14:41:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200507141941.OAA30883@choi.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.241 -> 1.242 --- Log message: Fixed PR#596: Add parenthesis around the value being negated; that way, if the value begins with a minus sign (e.g. negative integer), we won't generate a C predecrement operator by mistake. --- Diffs of the changes: (+2 -2) Writer.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.241 llvm/lib/Target/CBackend/Writer.cpp:1.242 --- llvm/lib/Target/CBackend/Writer.cpp:1.241 Fri Jun 24 21:48:36 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Jul 14 14:41:16 2005 @@ -1361,9 +1361,9 @@ // If this is a negation operation, print it out as such. For FP, we don't // want to print "-0.0 - X". if (BinaryOperator::isNeg(&I)) { - Out << "-"; + Out << "-("; writeOperand(BinaryOperator::getNegArgument(cast(&I))); - + Out << ")"; } else { writeOperand(I.getOperand(0)); From criswell at cs.uiuc.edu Thu Jul 14 14:56:21 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu, 14 Jul 2005 14:56:21 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll Message-ID: <200507141956.OAA10789@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2005-07-14-NegationToMinusMinus.ll added (r1.1) --- Log message: Regression test for PR#596: Make sure that negation of a minus doesn't turn into a C predecrement operator. --- Diffs of the changes: (+19 -0) 2005-07-14-NegationToMinusMinus.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll diff -c /dev/null llvm/test/Regression/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll:1.1 *** /dev/null Thu Jul 14 14:56:14 2005 --- llvm/test/Regression/CodeGen/CBackend/2005-07-14-NegationToMinusMinus.ll Thu Jul 14 14:56:03 2005 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | llc -march=c | not grep "\-\-65535" + ; ModuleID = '' + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + + implementation ; Functions: + + declare void %func(int) + + void %funcb() { + entry: + %tmp.1 = sub int 0, -65535 ; [#uses=1] + call void %func( int %tmp.1 ) + br label %return + + return: ; preds = %entry + ret void + } From natebegeman at mac.com Thu Jul 14 17:50:41 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 14 Jul 2005 17:50:41 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200507142250.RAA09330@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: AsmWriterEmitter.cpp updated: 1.19 -> 1.20 --- Log message: Add support for a TODO; instructions in .td files can now have arguments printed as part of the opcode. This allows something like cmp${cc}ss in the x86 backed to be printed as cmpltss, cmpless, etc. depending on what the value of $cc is. --- Diffs of the changes: (+24 -1) AsmWriterEmitter.cpp | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletion(-) Index: llvm/utils/TableGen/AsmWriterEmitter.cpp diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.19 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.20 --- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.19 Thu Apr 21 19:00:35 2005 +++ llvm/utils/TableGen/AsmWriterEmitter.cpp Thu Jul 14 17:50:30 2005 @@ -155,12 +155,35 @@ LastEmitted = DollarPos+2; } else { // Get the name of the variable. - // TODO: should eventually handle ${foo}bar as $foo std::string::size_type VarEnd = DollarPos+1; + + // handle ${foo}bar as $foo by detecting whether the character following + // the dollar sign is a curly brace. If so, advance VarEnd and DollarPos + // so the variable name does not contain the leading curly brace. + bool hasCurlyBraces = false; + if (VarEnd < AsmString.size() && '{' == AsmString[VarEnd]) { + hasCurlyBraces = true; + ++DollarPos; + ++VarEnd; + } + while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) ++VarEnd; std::string VarName(AsmString.begin()+DollarPos+1, AsmString.begin()+VarEnd); + + // In order to avoid starting the next string at the terminating curly + // brace, advance the end position past it if we found an opening curly + // brace. + if (hasCurlyBraces) { + if (VarEnd >= AsmString.size()) + throw "Reached end of string before terminating curly brace in '" + + CGI.Name + "'"; + if (AsmString[VarEnd] != '}') + throw "Variant name beginning with '{' did not end with '}' in '" + + CGI.Name + "'"; + ++VarEnd; + } if (VarName.empty()) throw "Stray '$' in '" + CGI.Name + "' asm string, maybe you want $$?"; From natebegeman at mac.com Thu Jul 14 17:52:37 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 14 Jul 2005 17:52:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86IntelAsmPrinter.h X86IntelAsmPrinter.cpp Message-ID: <200507142252.RAA09370@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.6 -> 1.7 X86ATTAsmPrinter.h updated: 1.1 -> 1.2 X86IntelAsmPrinter.h updated: 1.1 -> 1.2 X86IntelAsmPrinter.cpp updated: 1.3 -> 1.4 --- Log message: Add support for printing the sse scalar comparison instruction mnemonics. --- Diffs of the changes: (+34 -0) X86ATTAsmPrinter.cpp | 16 ++++++++++++++++ X86ATTAsmPrinter.h | 1 + X86IntelAsmPrinter.cpp | 16 ++++++++++++++++ X86IntelAsmPrinter.h | 1 + 4 files changed, 34 insertions(+) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.6 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.7 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.6 Tue Jul 12 13:34:58 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Thu Jul 14 17:52:25 2005 @@ -143,6 +143,22 @@ } } +void X86ATTAsmPrinter::printSSECC(const MachineInstr *MI, unsigned Op, + MVT::ValueType VT) { + unsigned char value = MI->getOperand(Op).getImmedValue(); + assert(value <= 7 && "Invalid ssecc argument!"); + switch (value) { + case 0: O << "eq"; break; + case 1: O << "lt"; break; + case 2: O << "le"; break; + case 3: O << "unord"; break; + case 4: O << "neq"; break; + case 5: O << "nlt"; break; + case 6: O << "nle"; break; + case 7: O << "ord"; break; + } +} + void X86ATTAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){ assert(isMem(MI, Op) && "Invalid memory reference!"); Index: llvm/lib/Target/X86/X86ATTAsmPrinter.h diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.1 llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.2 --- llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.1 Fri Jul 1 17:44:09 2005 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.h Thu Jul 14 17:52:25 2005 @@ -51,6 +51,7 @@ void printMachineInstruction(const MachineInstr *MI); void printOp(const MachineOperand &MO, bool isCallOperand = false); + void printSSECC(const MachineInstr *MI, unsigned Op, MVT::ValueType VT); void printMemReference(const MachineInstr *MI, unsigned Op); bool runOnMachineFunction(MachineFunction &F); }; Index: llvm/lib/Target/X86/X86IntelAsmPrinter.h diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.1 llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.2 --- llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.1 Fri Jul 1 17:44:09 2005 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.h Thu Jul 14 17:52:25 2005 @@ -70,6 +70,7 @@ void printMachineInstruction(const MachineInstr *MI); void printOp(const MachineOperand &MO, bool elideOffsetKeyword = false); + void printSSECC(const MachineInstr *MI, unsigned Op, MVT::ValueType VT); void printMemReference(const MachineInstr *MI, unsigned Op); bool runOnMachineFunction(MachineFunction &F); bool doInitialization(Module &M); Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.3 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.4 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.3 Mon Jul 11 01:25:34 2005 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Thu Jul 14 17:52:25 2005 @@ -58,6 +58,22 @@ return false; } +void X86IntelAsmPrinter::printSSECC(const MachineInstr *MI, unsigned Op, + MVT::ValueType VT) { + unsigned char value = MI->getOperand(Op).getImmedValue(); + assert(value <= 7 && "Invalid ssecc argument!"); + switch (value) { + case 0: O << "eq"; break; + case 1: O << "lt"; break; + case 2: O << "le"; break; + case 3: O << "unord"; break; + case 4: O << "neq"; break; + case 5: O << "nlt"; break; + case 6: O << "nle"; break; + case 7: O << "ord"; break; + } +} + void X86IntelAsmPrinter::printOp(const MachineOperand &MO, bool elideOffsetKeyword /* = false */) { const MRegisterInfo &RI = *TM.getRegisterInfo(); From natebegeman at mac.com Thu Jul 14 19:39:06 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 14 Jul 2005 19:39:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.td X86InstrInfo.td X86ISelPattern.cpp Message-ID: <200507150039.TAA09904@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.td updated: 1.15 -> 1.16 X86InstrInfo.td updated: 1.129 -> 1.130 X86ISelPattern.cpp updated: 1.150 -> 1.151 --- Log message: Get closer to fully working scalar FP in SSE regs. This gets singlesource working, and Olden/power. --- Diffs of the changes: (+53 -52) X86.td | 2 - X86ISelPattern.cpp | 58 +++++++++++++++++++++++------------------------------ X86InstrInfo.td | 45 +++++++++++++++++++++++------------------ 3 files changed, 53 insertions(+), 52 deletions(-) Index: llvm/lib/Target/X86/X86.td diff -u llvm/lib/Target/X86/X86.td:1.15 llvm/lib/Target/X86/X86.td:1.16 --- llvm/lib/Target/X86/X86.td:1.15 Wed Jul 6 13:59:03 2005 +++ llvm/lib/Target/X86/X86.td Thu Jul 14 19:38:55 2005 @@ -61,7 +61,7 @@ def X86 : Target { // Specify the callee saved registers. - let CalleeSavedRegisters = [ESI, EDI, EBX, EBP, XMM4, XMM5, XMM6, XMM7]; + let CalleeSavedRegisters = [ESI, EDI, EBX, EBP]; // Yes, pointers are 32-bits in size. let PointerType = i32; Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.129 llvm/lib/Target/X86/X86InstrInfo.td:1.130 --- llvm/lib/Target/X86/X86InstrInfo.td:1.129 Wed Jul 6 13:59:04 2005 +++ llvm/lib/Target/X86/X86InstrInfo.td Thu Jul 14 19:38:55 2005 @@ -20,6 +20,9 @@ let NumMIOperands = 4; let PrintMethod = "printMemoryOperand"; } +def SSECC : Operand { + let PrintMethod = "printSSECC"; +} def i8mem : X86MemOperand; def i16mem : X86MemOperand; @@ -188,7 +191,7 @@ let isCall = 1 in // All calls clobber the non-callee saved registers... let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, - XMM0, XMM1, XMM2, XMM3] in { + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7] in { def CALLpcrel32 : I<0xE8, RawFrm, (ops calltarget:$dst), "call $dst">; def CALL32r : I<0xFF, MRM2r, (ops R32:$dst), "call {*}$dst">; def CALL32m : I<0xFF, MRM2m, (ops i32mem:$dst), "call {*}$dst">; @@ -1425,17 +1428,21 @@ def MOVAPDmr: I<0x29, MRMDestMem, (ops f64mem:$dst, RXMM:$src), "movapd {$src, $dst|$dst, $src}">, TB, OpSize; -def CVTSD2SIrr: I<0x2D, MRMSrcReg, (ops R32:$dst, RXMM:$src), - "cvtsd2si {$src, $dst|$dst, $src}">, XD; -def CVTSD2SIrm: I<0x2D, MRMSrcMem, (ops R32:$dst, f64mem:$src), - "cvtsd2si {$src, $dst|$dst, $src}">, XD; -def CVTSS2SIrr: I<0x2D, MRMSrcReg, (ops R32:$dst, RXMM:$src), - "cvtss2si {$src, $dst|$dst, $src}">, XS; -def CVTSS2SIrm: I<0x2D, MRMSrcMem, (ops R32:$dst, f32mem:$src), - "cvtss2si {$src, $dst|$dst, $src}">, XS; -def CVTSS2SDrr: I<0x5A, MRMSrcReg, (ops R32:$dst, RXMM:$src), +def CVTTSD2SIrr: I<0x2C, MRMSrcReg, (ops R32:$dst, RXMM:$src), + "cvttsd2si {$src, $dst|$dst, $src}">, XD; +def CVTTSD2SIrm: I<0x2C, MRMSrcMem, (ops R32:$dst, f64mem:$src), + "cvttsd2si {$src, $dst|$dst, $src}">, XD; +def CVTTSS2SIrr: I<0x2C, MRMSrcReg, (ops R32:$dst, RXMM:$src), + "cvttss2si {$src, $dst|$dst, $src}">, XS; +def CVTTSS2SIrm: I<0x2C, MRMSrcMem, (ops R32:$dst, f32mem:$src), + "cvttss2si {$src, $dst|$dst, $src}">, XS; +def CVTSD2SSrr: I<0x5A, MRMSrcReg, (ops RXMM:$dst, RXMM:$src), + "cvtsd2ss {$src, $dst|$dst, $src}">, XS; +def CVTSD2SSrm: I<0x5A, MRMSrcMem, (ops RXMM:$dst, f64mem:$src), + "cvtsd2ss {$src, $dst|$dst, $src}">, XS; +def CVTSS2SDrr: I<0x5A, MRMSrcReg, (ops RXMM:$dst, RXMM:$src), "cvtss2sd {$src, $dst|$dst, $src}">, XD; -def CVTSS2SDrm: I<0x5A, MRMSrcMem, (ops R32:$dst, f32mem:$src), +def CVTSS2SDrm: I<0x5A, MRMSrcMem, (ops RXMM:$dst, f32mem:$src), "cvtss2sd {$src, $dst|$dst, $src}">, XD; def CVTSI2SSrr: I<0x2A, MRMSrcReg, (ops R32:$dst, RXMM:$src), "cvtsi2ss {$src, $dst|$dst, $src}">, XS; @@ -1515,17 +1522,17 @@ "subsd {$src, $dst|$dst, $src}">, XD; def CMPSSrr : I<0xC2, MRMSrcReg, - (ops RXMM:$dst, RXMM:$src1, RXMM:$src, i8imm:$pred), - "cmpss {$src, $dst, $pred|$dst, $src, $pred}">, XS; + (ops RXMM:$dst, RXMM:$src1, RXMM:$src, SSECC:$cc), + "cmp${cc}ss {$src, $dst|$dst, $src}">, XS; def CMPSSrm : I<0xC2, MRMSrcMem, - (ops RXMM:$dst, RXMM:$src1, f32mem:$src, i8imm:$pred), - "cmpss {$src, $dst, $pred|$dst, $src, $pred}">, XS; + (ops RXMM:$dst, RXMM:$src1, f32mem:$src, SSECC:$cc), + "cmp${cc}ss {$src, $dst|$dst, $src}">, XS; def CMPSDrr : I<0xC2, MRMSrcReg, - (ops RXMM:$dst, RXMM:$src1, RXMM:$src, i8imm:$pred), - "cmpss {$src, $dst, $pred|$dst, $src, $pred}">, XD; + (ops RXMM:$dst, RXMM:$src1, RXMM:$src, SSECC:$cc), + "cmp${cc}sd {$src, $dst|$dst, $src}">, XD; def CMPSDrm : I<0xC2, MRMSrcMem, - (ops RXMM:$dst, RXMM:$src1, f64mem:$src, i8imm:$pred), - "cmpss {$src, $dst, $pred|$dst, $src, $pred}">, XD; + (ops RXMM:$dst, RXMM:$src1, f64mem:$src, SSECC:$cc), + "cmp${cc}sd {$src, $dst|$dst, $src}">, XD; } //===----------------------------------------------------------------------===// Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.150 llvm/lib/Target/X86/X86ISelPattern.cpp:1.151 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.150 Mon Jul 11 20:41:54 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Thu Jul 14 19:38:55 2005 @@ -1687,9 +1687,9 @@ /*missing*/0, /*missing*/0, X86::FCMOVB , X86::FCMOVBE, X86::FCMOVA , X86::FCMOVAE, X86::FCMOVP , X86::FCMOVNP }; - static const unsigned SSE_CMOVTAB[] = { + static const int SSE_CMOVTAB[] = { 0 /* CMPEQSS */, 4 /* CMPNEQSS */, 1 /* CMPLTSS */, 2 /* CMPLESS */, - 2 /* CMPLESS */, 1 /* CMPLTSS */, /*missing*/0, /*missing*/0, + 1 /* CMPLTSS */, 2 /* CMPLESS */, /*missing*/0, /*missing*/0, /*missing*/0, /*missing*/0, /*missing*/0, /*missing*/0 }; @@ -1761,33 +1761,12 @@ // There's no SSE equivalent of FCMOVE. In some cases we can fake it up, in // Others we will have to do the PowerPC thing and generate an MBB for the // true and false values and select between them with a PHI. - if (X86ScalarSSE) { - if (CondCode != NOT_SET) { - unsigned CMPSOpc = (SVT == MVT::f64) ? X86::CMPSDrr : X86::CMPSSrr; - unsigned CMPSImm = SSE_CMOVTAB[CondCode]; - // FIXME check for min - // FIXME check for max - // FIXME check for reverse - unsigned LHS = SelectExpr(Cond.getOperand(0)); - unsigned RHS = SelectExpr(Cond.getOperand(1)); - // emit compare mask - unsigned MaskReg = MakeReg(SVT); - BuildMI(BB, CMPSOpc, 3, MaskReg).addReg(LHS).addReg(RHS).addImm(CMPSImm); - // emit and with mask - unsigned TrueMask = MakeReg(SVT); - unsigned AndOpc = (SVT == MVT::f32) ? X86::ANDPSrr : X86::ANDPDrr; - BuildMI(BB, AndOpc, 2, TrueMask).addReg(RTrue).addReg(MaskReg); - // emit and with inverse mask - unsigned FalseMask = MakeReg(SVT); - unsigned AndnOpc = (SVT == MVT::f32) ? X86::ANDNPSrr : X86::ANDNPDrr; - BuildMI(BB, AndnOpc, 2, FalseMask).addReg(RFalse).addReg(MaskReg); - // emit or into dest reg - unsigned OROpc = (SVT == MVT::f32) ? X86::ORPSrr : X86::ORPDrr; - BuildMI(BB, OROpc, 2, RDest).addReg(TrueMask).addReg(FalseMask); - return; + if (X86ScalarSSE && (SVT == MVT::f32 || SVT == MVT::f64)) { + if (0 && CondCode != NOT_SET) { + // FIXME: check for min and max } else { - // do the test and branch thing - // Get the condition into the zero flag. + // FIXME: emit a direct compare and branch rather than setting a cond reg + // and testing it. unsigned CondReg = SelectExpr(Cond); BuildMI(BB, X86::TEST8rr, 2).addReg(CondReg).addReg(CondReg); @@ -2184,6 +2163,11 @@ Tmp1 = SelectExpr(N.getOperand(0)); BuildMI(BB, X86::CVTSS2SDrr, 1, Result).addReg(Tmp1); return Result; + case ISD::FP_ROUND: + assert(X86ScalarSSE && "Scalar SSE FP must be enabled to use f32"); + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, X86::CVTSD2SSrr, 1, Result).addReg(Tmp1); + return Result; case ISD::CopyFromReg: Select(N.getOperand(0)); if (Result == 1) { @@ -2482,9 +2466,9 @@ // CVTSD2SI instructions. if (ISD::FP_TO_SINT == N.getOpcode() && X86ScalarSSE) { if (MVT::f32 == N.getOperand(0).getValueType()) { - BuildMI(BB, X86::CVTSS2SIrr, 1, Result).addReg(Tmp1); + BuildMI(BB, X86::CVTTSS2SIrr, 1, Result).addReg(Tmp1); } else if (MVT::f64 == N.getOperand(0).getValueType()) { - BuildMI(BB, X86::CVTSD2SIrr, 1, Result).addReg(Tmp1); + BuildMI(BB, X86::CVTTSD2SIrr, 1, Result).addReg(Tmp1); } else { assert(0 && "Not an f32 or f64?"); abort(); @@ -4485,8 +4469,18 @@ SelectAddress(N.getOperand(2), AM); Select(N.getOperand(0)); } - addFullAddress(BuildMI(BB, X86::MOV32mi, 4+1), - AM).addGlobalAddress(GA->getGlobal()); + GlobalValue *GV = GA->getGlobal(); + // For Darwin, external and weak symbols are indirect, so we want to load + // the value at address GV, not the value of GV itself. + if (Subtarget->getIndirectExternAndWeakGlobals() && + (GV->hasWeakLinkage() || GV->isExternal())) { + Tmp1 = MakeReg(MVT::i32); + BuildMI(BB, X86::MOV32rm, 4, Tmp1).addReg(0).addZImm(1).addReg(0) + .addGlobalAddress(GV, false, 0); + addFullAddress(BuildMI(BB, X86::MOV32mr, 4+1),AM).addReg(Tmp1); + } else { + addFullAddress(BuildMI(BB, X86::MOV32mi, 4+1),AM).addGlobalAddress(GV); + } return; } From alenhar2 at cs.uiuc.edu Fri Jul 15 11:53:56 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 15 Jul 2005 11:53:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT95/099.go/Makefile Message-ID: <200507151653.LAA09783@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT95/099.go: Makefile updated: 1.4 -> 1.5 --- Log message: So on alpha, gcc misoptimizes things. So conditionally (on if we are on alpha) change the optimization levels of the cbe and native note llc compiles things correctly, this is only a gcc workaround --- Diffs of the changes: (+11 -0) Makefile | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm-test/External/SPEC/CINT95/099.go/Makefile diff -u llvm-test/External/SPEC/CINT95/099.go/Makefile:1.4 llvm-test/External/SPEC/CINT95/099.go/Makefile:1.5 --- llvm-test/External/SPEC/CINT95/099.go/Makefile:1.4 Mon Sep 6 23:18:02 2004 +++ llvm-test/External/SPEC/CINT95/099.go/Makefile Fri Jul 15 11:53:45 2005 @@ -11,3 +11,14 @@ RUN_OPTIONS = 50 9 endif include ../../Makefile.spec95 + +ifeq ($(ARCH),Alpha) + +Output/%.o: %.c Output/.dir + -$(CC) $(CPPFLAGS) $(CFLAGS) -O1 -c $< -o $@ + +$(PROGRAMS_TO_TEST:%=Output/%.cbe): \ +Output/%.cbe: Output/%.cbe.c + -$(CC) $< $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O0 -o $@ + +endif From criswell at cs.uiuc.edu Fri Jul 15 14:25:31 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 15 Jul 2005 14:25:31 -0500 Subject: [llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html Message-ID: <200507151925.OAA25960@choi.cs.uiuc.edu> Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.40 -> 1.41 --- Log message: Fixed some punctuation. --- Diffs of the changes: (+4 -4) WritingAnLLVMPass.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.40 llvm/docs/WritingAnLLVMPass.html:1.41 --- llvm/docs/WritingAnLLVMPass.html:1.40 Wed Apr 20 23:53:58 2005 +++ llvm/docs/WritingAnLLVMPass.html Fri Jul 15 14:25:12 2005 @@ -471,9 +471,9 @@ virtual bool runOnModule(Module &M) = 0; -

    The runOnModule method performs the interesting work of the pass, -and should return true if the module was modified by the transformation, false -otherwise.

    +

    The runOnModule method performs the interesting work of the pass. +It should return true if the module was modified by the transformation and +false otherwise.

    @@ -1593,7 +1593,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/04/21 04:53:58 $ + Last modified: $Date: 2005/07/15 19:25:12 $ From alenhar2 at cs.uiuc.edu Fri Jul 15 15:23:20 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 15 Jul 2005 15:23:20 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT95/099.go/Makefile Message-ID: <200507152023.PAA10984@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT95/099.go: Makefile updated: 1.5 -> 1.6 --- Log message: as per Misha's suggestion --- Diffs of the changes: (+4 -0) Makefile | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/External/SPEC/CINT95/099.go/Makefile diff -u llvm-test/External/SPEC/CINT95/099.go/Makefile:1.5 llvm-test/External/SPEC/CINT95/099.go/Makefile:1.6 --- llvm-test/External/SPEC/CINT95/099.go/Makefile:1.5 Fri Jul 15 11:53:45 2005 +++ llvm-test/External/SPEC/CINT95/099.go/Makefile Fri Jul 15 15:23:07 2005 @@ -14,6 +14,10 @@ ifeq ($(ARCH),Alpha) +# So on alpha, gcc misoptimizes things. So conditionally (on if we are on alpha) +# change the optimization levels of the cbe and native +# note llc compiles things correctly, this is only a gcc workaround + Output/%.o: %.c Output/.dir -$(CC) $(CPPFLAGS) $(CFLAGS) -O1 -c $< -o $@ From lattner at cs.uiuc.edu Fri Jul 15 17:43:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 15 Jul 2005 17:43:15 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200507152243.RAA11994@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: AsmWriterEmitter.cpp updated: 1.20 -> 1.21 --- Log message: Fix PR595: http://llvm.cs.uiuc.edu/PR595 : These error messages should not be looking at CGI.Name, they should be looking at CGI.TheDef->getName(). --- Diffs of the changes: (+13 -9) AsmWriterEmitter.cpp | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) Index: llvm/utils/TableGen/AsmWriterEmitter.cpp diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.20 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.21 --- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.20 Thu Jul 14 17:50:30 2005 +++ llvm/utils/TableGen/AsmWriterEmitter.cpp Fri Jul 15 17:43:04 2005 @@ -116,7 +116,8 @@ LastEmitted = DollarPos; } else if (AsmString[DollarPos] == '{') { if (inVariant) - throw "Nested variants found for instruction '" + CGI.Name + "'!"; + throw "Nested variants found for instruction '" + + CGI.TheDef->getName() + "'!"; LastEmitted = DollarPos+1; inVariant = true; // We are now inside of the variant! for (unsigned i = 0; i != Variant; ++i) { @@ -126,7 +127,8 @@ std::string::size_type NP = AsmString.find_first_of("|}", LastEmitted); if (NP == std::string::npos) - throw "Incomplete variant for instruction '" + CGI.Name + "'!"; + throw "Incomplete variant for instruction '" + + CGI.TheDef->getName() + "'!"; LastEmitted = NP+1; if (AsmString[NP] == '}') { inVariant = false; // No text for this variant. @@ -136,17 +138,18 @@ } else if (AsmString[DollarPos] == '|') { if (!inVariant) throw "'|' character found outside of a variant in instruction '" - + CGI.Name + "'!"; + + CGI.TheDef->getName() + "'!"; // Move to the end of variant list. std::string::size_type NP = AsmString.find('}', LastEmitted); if (NP == std::string::npos) - throw "Incomplete variant for instruction '" + CGI.Name + "'!"; + throw "Incomplete variant for instruction '" + + CGI.TheDef->getName() + "'!"; LastEmitted = NP+1; inVariant = false; } else if (AsmString[DollarPos] == '}') { if (!inVariant) throw "'}' character found outside of a variant in instruction '" - + CGI.Name + "'!"; + + CGI.TheDef->getName() + "'!"; LastEmitted = DollarPos+1; inVariant = false; } else if (DollarPos+1 != AsmString.size() && @@ -178,14 +181,15 @@ if (hasCurlyBraces) { if (VarEnd >= AsmString.size()) throw "Reached end of string before terminating curly brace in '" - + CGI.Name + "'"; + + CGI.TheDef->getName() + "'"; if (AsmString[VarEnd] != '}') throw "Variant name beginning with '{' did not end with '}' in '" - + CGI.Name + "'"; + + CGI.TheDef->getName() + "'"; ++VarEnd; } if (VarName.empty()) - throw "Stray '$' in '" + CGI.Name + "' asm string, maybe you want $$?"; + throw "Stray '$' in '" + CGI.TheDef->getName() + + "' asm string, maybe you want $$?"; unsigned OpNo = CGI.getOperandNamed(VarName); CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo]; @@ -196,7 +200,7 @@ if (CGI.isTwoAddress && MIOp != 0) { if (MIOp == 1) throw "Should refer to operand #0 instead of #1 for two-address" - " instruction '" + CGI.Name + "'!"; + " instruction '" + CGI.TheDef->getName() + "'!"; --MIOp; } From lattner at cs.uiuc.edu Fri Jul 15 17:48:42 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 15 Jul 2005 17:48:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200507152248.RAA12097@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGPrinter.cpp updated: 1.15 -> 1.16 --- Log message: You can't use config options without config.h --- Diffs of the changes: (+1 -0) SelectionDAGPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.15 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.16 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.15 Thu Jul 14 00:33:13 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Fri Jul 15 17:48:31 2005 @@ -16,6 +16,7 @@ #include "llvm/Function.h" #include "llvm/Support/GraphWriter.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Config/config.h" #include using namespace llvm; From lattner at cs.uiuc.edu Fri Jul 15 19:20:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 15 Jul 2005 19:20:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200507160020.TAA12558@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.140 -> 1.141 --- Log message: Break the code for expanding UINT_TO_FP operations out into its own SelectionDAGLegalize::ExpandLegalUINT_TO_FP method. Add a new method, PromoteLegalUINT_TO_FP, which allows targets to request that UINT_TO_FP operations be promoted to a larger input type. This is useful for targets that have some UINT_TO_FP or SINT_TO_FP operations but not all of them (like X86). The same should be done with SINT_TO_FP, but this patch does not do that yet. --- Diffs of the changes: (+116 -35) LegalizeDAG.cpp | 151 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 116 insertions(+), 35 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.140 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.141 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.140 Tue Jul 12 21:00:04 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jul 15 19:19:57 2005 @@ -124,6 +124,10 @@ SDOperand &Hi); SDOperand ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, SDOperand Source); + + SDOperand ExpandLegalUINT_TO_FP(SDOperand LegalOp, MVT::ValueType DestVT); + SDOperand PromoteLegalUINT_TO_FP(SDOperand LegalOp, MVT::ValueType DestVT); + bool ExpandShift(unsigned Opc, SDOperand Op, SDOperand Amt, SDOperand &Lo, SDOperand &Hi); void ExpandShiftParts(unsigned NodeOp, SDOperand Op, SDOperand Amt, @@ -147,6 +151,102 @@ "Too many value types for ValueTypeActions to hold!"); } +/// ExpandLegalUINT_TO_FP - This function is responsible for legalizing a +/// UINT_TO_FP operation of the specified operand when the target requests that +/// we expand it. At this point, we know that the result and operand types are +/// legal for the target. +SDOperand SelectionDAGLegalize::ExpandLegalUINT_TO_FP(SDOperand Op0, + MVT::ValueType DestVT) { + assert(Op0.getValueType() == MVT::i32 && + "This code only works for i32 input: extend in the future"); + SDOperand Tmp1 = DAG.getNode(ISD::SINT_TO_FP, DestVT, Op0); + + SDOperand SignSet = DAG.getSetCC(ISD::SETLT, TLI.getSetCCResultTy(), + Op0, + DAG.getConstant(0, + Op0.getValueType())); + SDOperand Zero = getIntPtrConstant(0), Four = getIntPtrConstant(4); + SDOperand CstOffset = DAG.getNode(ISD::SELECT, Zero.getValueType(), + SignSet, Four, Zero); + + uint64_t FF = 0x5f800000ULL; + if (TLI.isLittleEndian()) FF <<= 32; + static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); + + MachineConstantPool *CP = DAG.getMachineFunction().getConstantPool(); + SDOperand CPIdx = DAG.getConstantPool(CP->getConstantPoolIndex(FudgeFactor), + TLI.getPointerTy()); + CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); + SDOperand FudgeInReg; + if (DestVT == MVT::f32) + FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, + DAG.getSrcValue(NULL)); + else { + assert(DestVT == MVT::f64 && "Unexpected conversion"); + FudgeInReg = LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, + DAG.getEntryNode(), CPIdx, + DAG.getSrcValue(NULL), MVT::f32)); + } + + NeedsAnotherIteration = true; + return DAG.getNode(ISD::ADD, DestVT, Tmp1, FudgeInReg); +} + +/// PromoteLegalUINT_TO_FP - This function is responsible for legalizing a +/// UINT_TO_FP operation of the specified operand when the target requests that +/// we promote it. At this point, we know that the result and operand types are +/// legal for the target, and that there is a legal UINT_TO_FP or SINT_TO_FP +/// operation that takes a larger input. +SDOperand SelectionDAGLegalize::PromoteLegalUINT_TO_FP(SDOperand LegalOp, + MVT::ValueType DestVT) { + // First step, figure out the appropriate *INT_TO_FP operation to use. + MVT::ValueType NewInTy = LegalOp.getValueType(); + + unsigned OpToUse = 0; + + // Scan for the appropriate larger type to use. + while (1) { + NewInTy = (MVT::ValueType)(NewInTy+1); + assert(MVT::isInteger(NewInTy) && "Ran out of possibilities!"); + + // If the target supports SINT_TO_FP of this type, use it. + switch (TLI.getOperationAction(ISD::SINT_TO_FP, NewInTy)) { + default: break; + case TargetLowering::Legal: + if (!TLI.hasNativeSupportFor(NewInTy)) + break; // Can't use this datatype. + // FALL THROUGH. + case TargetLowering::Custom: + OpToUse = ISD::SINT_TO_FP; + break; + } + if (OpToUse) break; + + // If the target supports UINT_TO_FP of this type, use it. + switch (TLI.getOperationAction(ISD::UINT_TO_FP, NewInTy)) { + default: break; + case TargetLowering::Legal: + if (!TLI.hasNativeSupportFor(NewInTy)) + break; // Can't use this datatype. + // FALL THROUGH. + case TargetLowering::Custom: + OpToUse = ISD::UINT_TO_FP; + break; + } + if (OpToUse) break; + + // Otherwise, try a larger type. + } + + // Make sure to legalize any nodes we create here in the next pass. + NeedsAnotherIteration = true; + + // Okay, we found the operation and type to use. Zero extend our input to the + // desired type then run the operation on it. + return DAG.getNode(OpToUse, DestVT, + DAG.getNode(ISD::ZERO_EXTEND, NewInTy, LegalOp)); +} + void SelectionDAGLegalize::LegalizeDAG() { SDOperand OldRoot = DAG.getRoot(); SDOperand NewRoot = LegalizeOp(OldRoot); @@ -1338,42 +1438,23 @@ switch (getTypeAction(Node->getOperand(0).getValueType())) { case Legal: //still made need to expand if the op is illegal, but the types are legal - if (Node->getOpcode() == ISD::UINT_TO_FP && - TLI.getOperationAction(Node->getOpcode(), - Node->getOperand(0).getValueType()) - == TargetLowering::Expand) { - SDOperand Op0 = LegalizeOp(Node->getOperand(0)); - Tmp1 = DAG.getNode(ISD::SINT_TO_FP, Node->getValueType(0), - Op0); - - SDOperand SignSet = DAG.getSetCC(ISD::SETLT, TLI.getSetCCResultTy(), - Op0, - DAG.getConstant(0, - Op0.getValueType())); - SDOperand Zero = getIntPtrConstant(0), Four = getIntPtrConstant(4); - SDOperand CstOffset = DAG.getNode(ISD::SELECT, Zero.getValueType(), - SignSet, Four, Zero); - uint64_t FF = 0x5f800000ULL; - if (TLI.isLittleEndian()) FF <<= 32; - static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); - - MachineConstantPool *CP = DAG.getMachineFunction().getConstantPool(); - SDOperand CPIdx = DAG.getConstantPool(CP->getConstantPoolIndex(FudgeFactor), - TLI.getPointerTy()); - CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); - SDOperand FudgeInReg; - if (Node->getValueType(0) == MVT::f32) - FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, - DAG.getSrcValue(NULL)); - else { - assert(Node->getValueType(0) == MVT::f64 && "Unexpected conversion"); - FudgeInReg = - LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, - DAG.getEntryNode(), CPIdx, - DAG.getSrcValue(NULL), MVT::f32)); + if (Node->getOpcode() == ISD::UINT_TO_FP) { + switch (TLI.getOperationAction(Node->getOpcode(), + Node->getOperand(0).getValueType())) { + default: assert(0 && "Unknown operation action!"); + case TargetLowering::Expand: + Result = ExpandLegalUINT_TO_FP(LegalizeOp(Node->getOperand(0)), + Node->getValueType(0)); + AddLegalizedOperand(Op, Result); + return Result; + case TargetLowering::Promote: + Result = PromoteLegalUINT_TO_FP(LegalizeOp(Node->getOperand(0)), + Node->getValueType(0)); + AddLegalizedOperand(Op, Result); + return Result; + case TargetLowering::Legal: + break; } - Result = DAG.getNode(ISD::ADD, Node->getValueType(0), Tmp1, FudgeInReg); - break; } Tmp1 = LegalizeOp(Node->getOperand(0)); if (Tmp1 != Node->getOperand(0)) From natebegeman at mac.com Fri Jul 15 19:26:59 2005 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 15 Jul 2005 19:26:59 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c Message-ID: <200507160026.TAA12709@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Olden/voronoi: newvor.c updated: 1.9 -> 1.10 --- Log message: Switch a __POWERPC__ to a __APPLE__, so that memalign isn't available on Mac OS X for Intel either. --- Diffs of the changes: (+1 -1) newvor.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c diff -u llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.9 llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.10 --- llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.9 Mon Mar 28 13:03:28 2005 +++ llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c Fri Jul 15 19:26:48 2005 @@ -165,7 +165,7 @@ void delete_all_edges() { next_edge= 0; avail_edge = NYL;} -#if defined(__POWERPC__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) #define MEMALIGN_IS_NOT_AVAILABLE #endif From lattner at cs.uiuc.edu Fri Jul 15 19:28:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 15 Jul 2005 19:28:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200507160028.TAA12722@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.151 -> 1.152 --- Log message: Remove all knowledge of UINT_TO_FP from the X86 backend, relying on the legalizer to eliminate them. With this comes the expected code quality improvements, such as, for this: double foo(unsigned short X) { return X; } we now generate this: _foo: subl $4, %esp movzwl 8(%esp), %eax movl %eax, (%esp) fildl (%esp) addl $4, %esp ret instead of this: _foo: subl $4, %esp movw 8(%esp), %ax movzwl %ax, %eax ;; Load not folded into this. movl %eax, (%esp) fildl (%esp) addl $4, %esp ret -Chris --- Diffs of the changes: (+27 -53) X86ISelPattern.cpp | 80 +++++++++++++++++------------------------------------ 1 files changed, 27 insertions(+), 53 deletions(-) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.151 llvm/lib/Target/X86/X86ISelPattern.cpp:1.152 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.151 Thu Jul 14 19:38:55 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Fri Jul 15 19:28:20 2005 @@ -106,7 +106,16 @@ addRegisterClass(MVT::i16, X86::R16RegisterClass); addRegisterClass(MVT::i32, X86::R32RegisterClass); + // Promote all UINT_TO_FP to larger SINT_TO_FP's, as X86 doesn't have this + // operation. + setOperationAction(ISD::UINT_TO_FP , MVT::i1 , Promote); + setOperationAction(ISD::UINT_TO_FP , MVT::i8 , Promote); + setOperationAction(ISD::UINT_TO_FP , MVT::i16 , Promote); + setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Promote); + + // We can handle SINT_TO_FP from i64 even though i64 isn't legal. setOperationAction(ISD::SINT_TO_FP , MVT::i64 , Custom); + setOperationAction(ISD::BRCONDTWOWAY , MVT::Other, Expand); setOperationAction(ISD::MEMMOVE , MVT::Other, Expand); setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16 , Expand); @@ -912,6 +921,10 @@ return std::make_pair(Result, Chain); } +//===----------------------------------------------------------------------===// +// X86 Custom Lowering Hooks +//===----------------------------------------------------------------------===// + /// LowerOperation - Provide custom lowering hooks for some operations. /// SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { @@ -2346,8 +2359,7 @@ BuildMI(BB, Opc, 1, Result).addReg(Tmp2); return Result; - case ISD::SINT_TO_FP: - case ISD::UINT_TO_FP: { + case ISD::SINT_TO_FP: { Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register unsigned PromoteOpcode = 0; @@ -2357,17 +2369,14 @@ MVT::ValueType SrcTy = N.getOperand(0).getValueType(); MVT::ValueType DstTy = N.getValueType(); switch (SrcTy) { - case MVT::i1: - case MVT::i8: - PromoteOpcode = (N.getOpcode() == ISD::UINT_TO_FP) ? - X86::MOVZX32rr8 : X86::MOVSX32rr8; + case MVT::i1: // FIXME: Should teach legalize about SINT_TO_FP i1/i8/i16 + case MVT::i8: // promotion, just like UINT_TO_FP promotion. + PromoteOpcode = X86::MOVSX32rr8; break; case MVT::i16: - PromoteOpcode = (N.getOpcode() == ISD::UINT_TO_FP) ? - X86::MOVZX32rr16 : X86::MOVSX32rr16; + PromoteOpcode = X86::MOVSX32rr16; break; default: - assert(N.getOpcode() != ISD::UINT_TO_FP); break; } if (PromoteOpcode) { @@ -2386,38 +2395,23 @@ // are no unsigned FLD instructions, so we must promote an unsigned value to // a larger signed value, then use FLD on the larger value. // - MVT::ValueType PromoteType = MVT::Other; MVT::ValueType SrcTy = N.getOperand(0).getValueType(); - unsigned RealDestReg = Result; switch (SrcTy) { case MVT::i1: case MVT::i8: // We don't have the facilities for directly loading byte sized data from // memory (even signed). Promote it to 16 bits. - PromoteType = MVT::i16; - PromoteOpcode = Node->getOpcode() == ISD::SINT_TO_FP ? - X86::MOVSX16rr8 : X86::MOVZX16rr8; - break; - case MVT::i16: - if (Node->getOpcode() == ISD::UINT_TO_FP) { - PromoteType = MVT::i32; - PromoteOpcode = X86::MOVZX32rr16; - } + + // FIXME: move to legalize. + Tmp2 = MakeReg(MVT::i16); + BuildMI(BB, X86::MOVSX16rr8, 1, Tmp2).addReg(Tmp1); + SrcTy = MVT::i16; + Tmp1 = Tmp2; break; default: - // Don't fild into the real destination. - if (Node->getOpcode() == ISD::UINT_TO_FP) - Result = MakeReg(Node->getValueType(0)); break; } - if (PromoteType != MVT::Other) { - Tmp2 = MakeReg(PromoteType); - BuildMI(BB, PromoteOpcode, 1, Tmp2).addReg(Tmp1); - SrcTy = PromoteType; - Tmp1 = Tmp2; - } - // Spill the integer to memory and reload it from there. unsigned Size = MVT::getSizeInBits(SrcTy)/8; MachineFunction *F = BB->getParent(); @@ -2425,36 +2419,16 @@ switch (SrcTy) { case MVT::i32: - addFrameReference(BuildMI(BB, X86::MOV32mr, 5), - FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::MOV32mr, 5), FrameIdx).addReg(Tmp1); addFrameReference(BuildMI(BB, X86::FILD32m, 5, Result), FrameIdx); break; case MVT::i16: - addFrameReference(BuildMI(BB, X86::MOV16mr, 5), - FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::MOV16mr, 5), FrameIdx).addReg(Tmp1); addFrameReference(BuildMI(BB, X86::FILD16m, 5, Result), FrameIdx); break; default: break; // No promotion required. } - - if (Node->getOpcode() == ISD::UINT_TO_FP && Result != RealDestReg) { - // If this is a cast from uint -> double, we need to be careful when if - // the "sign" bit is set. If so, we don't want to make a negative number, - // we want to make a positive number. Emit code to add an offset if the - // sign bit is set. - - // Compute whether the sign bit is set by shifting the reg right 31 bits. - unsigned IsNeg = MakeReg(MVT::i32); - BuildMI(BB, X86::SHR32ri, 2, IsNeg).addReg(Tmp1).addImm(31); - - // Create a CP value that has the offset in one word and 0 in the other. - static ConstantInt *TheOffset = ConstantUInt::get(Type::ULongTy, - 0x4f80000000000000ULL); - unsigned CPI = F->getConstantPool()->getConstantPoolIndex(TheOffset); - BuildMI(BB, X86::FADD32m, 5, RealDestReg).addReg(Result) - .addConstantPoolIndex(CPI).addZImm(4).addReg(IsNeg).addSImm(0); - } - return RealDestReg; + return Result; } case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: { From natebegeman at mac.com Fri Jul 15 20:59:58 2005 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 15 Jul 2005 20:59:58 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200507160159.UAA26764@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.143 -> 1.144 --- Log message: A couple more darwinisms --- Diffs of the changes: (+5 -2) X86AsmPrinter.cpp | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.143 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.144 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.143 Mon Jul 11 20:37:28 2005 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Fri Jul 15 20:59:47 2005 @@ -62,9 +62,12 @@ if (leadingUnderscore || forCygwin || forDarwin) GlobalPrefix = "_"; - if (forDarwin) + if (forDarwin) { AlignmentIsInBytes = false; - + Data64bitsDirective = 0; // we can't emit a 64-bit unit + ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. + } + return AsmPrinter::doInitialization(M); } From natebegeman at mac.com Fri Jul 15 21:00:32 2005 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 15 Jul 2005 21:00:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp Message-ID: <200507160200.VAA26807@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.39 -> 1.40 --- Log message: Teach the register allocator that movaps is also a move instruction --- Diffs of the changes: (+1 -1) X86InstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.39 llvm/lib/Target/X86/X86InstrInfo.cpp:1.40 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.39 Wed Jul 6 13:59:04 2005 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Fri Jul 15 21:00:20 2005 @@ -28,7 +28,7 @@ unsigned& destReg) const { MachineOpCode oc = MI.getOpcode(); if (oc == X86::MOV8rr || oc == X86::MOV16rr || oc == X86::MOV32rr || - oc == X86::FpMOV || oc == X86::MOVAPDrr) { + oc == X86::FpMOV || oc == X86::MOVAPDrr || oc == X86::MOVAPSrr) { assert(MI.getNumOperands() == 2 && MI.getOperand(0).isRegister() && MI.getOperand(1).isRegister() && From natebegeman at mac.com Fri Jul 15 21:02:46 2005 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 15 Jul 2005 21:02:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200507160202.VAA26837@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.141 -> 1.142 --- Log message: Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that the target natively supports. This eliminates some special-case code from the x86 backend and generates better code as well. For an i8 to f64 conversion, before & after: _x87 before: subl $2, %esp movb 6(%esp), %al movsbw %al, %ax movw %ax, (%esp) filds (%esp) addl $2, %esp ret _x87 after: subl $2, %esp movsbw 6(%esp), %ax movw %ax, (%esp) filds (%esp) addl $2, %esp ret _sse before: subl $12, %esp movb 16(%esp), %al movsbl %al, %eax cvtsi2sd %eax, %xmm0 addl $12, %esp ret _sse after: subl $12, %esp movsbl 16(%esp), %eax cvtsi2sd %eax, %xmm0 addl $12, %esp ret --- Diffs of the changes: (+19 -9) LegalizeDAG.cpp | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.141 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.142 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.141 Fri Jul 15 19:19:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jul 15 21:02:34 2005 @@ -126,7 +126,8 @@ SDOperand Source); SDOperand ExpandLegalUINT_TO_FP(SDOperand LegalOp, MVT::ValueType DestVT); - SDOperand PromoteLegalUINT_TO_FP(SDOperand LegalOp, MVT::ValueType DestVT); + SDOperand PromoteLegalINT_TO_FP(SDOperand LegalOp, MVT::ValueType DestVT, + bool isSigned); bool ExpandShift(unsigned Opc, SDOperand Op, SDOperand Amt, SDOperand &Lo, SDOperand &Hi); @@ -197,8 +198,9 @@ /// we promote it. At this point, we know that the result and operand types are /// legal for the target, and that there is a legal UINT_TO_FP or SINT_TO_FP /// operation that takes a larger input. -SDOperand SelectionDAGLegalize::PromoteLegalUINT_TO_FP(SDOperand LegalOp, - MVT::ValueType DestVT) { +SDOperand SelectionDAGLegalize::PromoteLegalINT_TO_FP(SDOperand LegalOp, + MVT::ValueType DestVT, + bool isSigned) { // First step, figure out the appropriate *INT_TO_FP operation to use. MVT::ValueType NewInTy = LegalOp.getValueType(); @@ -221,6 +223,7 @@ break; } if (OpToUse) break; + if (isSigned) continue; // If the target supports UINT_TO_FP of this type, use it. switch (TLI.getOperationAction(ISD::UINT_TO_FP, NewInTy)) { @@ -244,7 +247,8 @@ // Okay, we found the operation and type to use. Zero extend our input to the // desired type then run the operation on it. return DAG.getNode(OpToUse, DestVT, - DAG.getNode(ISD::ZERO_EXTEND, NewInTy, LegalOp)); + DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, + NewInTy, LegalOp)); } void SelectionDAGLegalize::LegalizeDAG() { @@ -1438,18 +1442,24 @@ switch (getTypeAction(Node->getOperand(0).getValueType())) { case Legal: //still made need to expand if the op is illegal, but the types are legal - if (Node->getOpcode() == ISD::UINT_TO_FP) { + if (Node->getOpcode() == ISD::UINT_TO_FP || + Node->getOpcode() == ISD::SINT_TO_FP) { + bool isSigned = Node->getOpcode() == ISD::SINT_TO_FP; switch (TLI.getOperationAction(Node->getOpcode(), Node->getOperand(0).getValueType())) { default: assert(0 && "Unknown operation action!"); case TargetLowering::Expand: - Result = ExpandLegalUINT_TO_FP(LegalizeOp(Node->getOperand(0)), - Node->getValueType(0)); + if (!isSigned) + Result = ExpandLegalUINT_TO_FP(LegalizeOp(Node->getOperand(0)), + Node->getValueType(0)); + else + assert(0 && "Legalize cannot Expand SINT_TO_FP yet"); AddLegalizedOperand(Op, Result); return Result; case TargetLowering::Promote: - Result = PromoteLegalUINT_TO_FP(LegalizeOp(Node->getOperand(0)), - Node->getValueType(0)); + Result = PromoteLegalINT_TO_FP(LegalizeOp(Node->getOperand(0)), + Node->getValueType(0), + isSigned); AddLegalizedOperand(Op, Result); return Result; case TargetLowering::Legal: From natebegeman at mac.com Fri Jul 15 21:02:46 2005 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 15 Jul 2005 21:02:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200507160202.VAA26841@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.152 -> 1.153 --- Log message: Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that the target natively supports. This eliminates some special-case code from the x86 backend and generates better code as well. For an i8 to f64 conversion, before & after: _x87 before: subl $2, %esp movb 6(%esp), %al movsbw %al, %ax movw %ax, (%esp) filds (%esp) addl $2, %esp ret _x87 after: subl $2, %esp movsbw 6(%esp), %ax movw %ax, (%esp) filds (%esp) addl $2, %esp ret _sse before: subl $12, %esp movb 16(%esp), %al movsbl %al, %eax cvtsi2sd %eax, %xmm0 addl $12, %esp ret _sse after: subl $12, %esp movsbl 16(%esp), %eax cvtsi2sd %eax, %xmm0 addl $12, %esp ret --- Diffs of the changes: (+20 -45) X86ISelPattern.cpp | 65 ++++++++++++++++------------------------------------- 1 files changed, 20 insertions(+), 45 deletions(-) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.152 llvm/lib/Target/X86/X86ISelPattern.cpp:1.153 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.152 Fri Jul 15 19:28:20 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Fri Jul 15 21:02:34 2005 @@ -112,6 +112,11 @@ setOperationAction(ISD::UINT_TO_FP , MVT::i8 , Promote); setOperationAction(ISD::UINT_TO_FP , MVT::i16 , Promote); setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Promote); + + // Promote i1/i8 SINT_TO_FP to larger SINT_TO_FP's, as X86 doesn't have + // this operation. + setOperationAction(ISD::SINT_TO_FP , MVT::i1 , Promote); + setOperationAction(ISD::SINT_TO_FP , MVT::i8 , Promote); // We can handle SINT_TO_FP from i64 even though i64 isn't legal. setOperationAction(ISD::SINT_TO_FP , MVT::i64 , Custom); @@ -151,9 +156,13 @@ addRegisterClass(MVT::f32, X86::RXMMRegisterClass); addRegisterClass(MVT::f64, X86::RXMMRegisterClass); + // SSE has no load+extend ops setOperationAction(ISD::EXTLOAD, MVT::f32, Expand); setOperationAction(ISD::ZEXTLOAD, MVT::f32, Expand); - + + // SSE has no i16 to fp conversion, only i32 + setOperationAction(ISD::SINT_TO_FP, MVT::i16, Promote); + // We don't support sin/cos/sqrt/fmod setOperationAction(ISD::FSIN , MVT::f64, Expand); setOperationAction(ISD::FCOS , MVT::f64, Expand); @@ -2363,56 +2372,17 @@ Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register unsigned PromoteOpcode = 0; - // We can handle any sint to fp, and 8 and 16 uint to fp with the direct - // sse conversion instructions. + // We can handle any sint to fp with the direct sse conversion instructions. if (X86ScalarSSE) { - MVT::ValueType SrcTy = N.getOperand(0).getValueType(); - MVT::ValueType DstTy = N.getValueType(); - switch (SrcTy) { - case MVT::i1: // FIXME: Should teach legalize about SINT_TO_FP i1/i8/i16 - case MVT::i8: // promotion, just like UINT_TO_FP promotion. - PromoteOpcode = X86::MOVSX32rr8; - break; - case MVT::i16: - PromoteOpcode = X86::MOVSX32rr16; - break; - default: - break; - } - if (PromoteOpcode) { - BuildMI(BB, PromoteOpcode, 1, Tmp2).addReg(Tmp1); - Tmp1 = Tmp2; - } - Opc = (DstTy == MVT::f64) ? X86::CVTSI2SDrr : X86::CVTSI2SSrr; + Opc = (N.getValueType() == MVT::f64) ? X86::CVTSI2SDrr : X86::CVTSI2SSrr; BuildMI(BB, Opc, 1, Result).addReg(Tmp1); return Result; } - // FIXME: Most of this grunt work should be done by legalize! ContainsFPCode = true; - // Promote the integer to a type supported by FLD. We do this because there - // are no unsigned FLD instructions, so we must promote an unsigned value to - // a larger signed value, then use FLD on the larger value. - // - MVT::ValueType SrcTy = N.getOperand(0).getValueType(); - switch (SrcTy) { - case MVT::i1: - case MVT::i8: - // We don't have the facilities for directly loading byte sized data from - // memory (even signed). Promote it to 16 bits. - - // FIXME: move to legalize. - Tmp2 = MakeReg(MVT::i16); - BuildMI(BB, X86::MOVSX16rr8, 1, Tmp2).addReg(Tmp1); - SrcTy = MVT::i16; - Tmp1 = Tmp2; - break; - default: - break; - } - // Spill the integer to memory and reload it from there. + MVT::ValueType SrcTy = N.getOperand(0).getValueType(); unsigned Size = MVT::getSizeInBits(SrcTy)/8; MachineFunction *F = BB->getParent(); int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, Size); @@ -3345,8 +3315,13 @@ SelectAddress(Address, AM); Select(Chain); } - - addFullAddress(BuildMI(BB, X86::FILD64m, 4, Result), AM); + if (X86ScalarSSE) { + addFullAddress(BuildMI(BB, X86::FILD64m, 4, X86::FP0), AM); + addFullAddress(BuildMI(BB, X86::FST64m, 5), AM).addReg(X86::FP0); + addFullAddress(BuildMI(BB, X86::MOVSDrm, 4, Result), AM); + } else { + addFullAddress(BuildMI(BB, X86::FILD64m, 4, Result), AM); + } } return Result; From lattner at cs.uiuc.edu Fri Jul 15 21:14:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 15 Jul 2005 21:14:19 -0500 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200507160214.VAA28421@zion.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.103 -> 1.104 --- Log message: Fix PR594: http://llvm.cs.uiuc.edu/PR594 , a really nasty miscompilation of bitfields on big-endian targets like PPC and sparc. --- Diffs of the changes: (+19 -6) llvm-expand.c | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.103 llvm-gcc/gcc/llvm-expand.c:1.104 --- llvm-gcc/gcc/llvm-expand.c:1.103 Thu Jul 7 12:32:46 2005 +++ llvm-gcc/gcc/llvm-expand.c Fri Jul 15 21:14:08 2005 @@ -2858,6 +2858,13 @@ llvm_value *Idx; if (BitSize == 0) return Src; /* Not a bitfield reference */ + + /* If this target has bitfields laid out in big-endian order, invert the bit + * in the word if needed. + */ + if (BITS_BIG_ENDIAN) + BitStart = ValSize-BitStart-BitSize; + if (BitStart+BitSize != ValSize) { Idx = llvm_constant_new_integral(UByteTy, ValSize-(BitStart+BitSize)); Src = append_inst(Fn, create_binary_inst("tmp", O_Shl, Src, Idx)); @@ -2872,15 +2879,23 @@ unsigned BitStart, unsigned BitSize, int isVolatile) { llvm_value *OldVal; - llvm_type *ResultType; + llvm_type *ResultType = GET_POINTER_TYPE_ELEMENT(Ptr->Ty); + unsigned ResultTypeSizeInBits = llvm_type_get_size(ResultType)*8; /* Get a mask of all ones of the right size */ long long Mask = (1LL << BitSize)-1; - /* Shift it over to the right place. */ - Mask <<= BitStart; if (BitSize == 0) return Src; + /* If this target has bitfields laid out in big-endian order, invert the bit + * in the word if needed. + */ + if (BITS_BIG_ENDIAN) + BitStart = ResultTypeSizeInBits-BitStart-BitSize; + + /* Shift it over to the right place. */ + Mask <<= BitStart; + /* If we are not storing starting at the zero'th bit, emit a shift of the * computed value. */ @@ -2889,10 +2904,8 @@ Src = append_inst(Fn, create_binary_inst("tmp", O_Shl, Src, Idx)); } - ResultType = GET_POINTER_TYPE_ELEMENT(Ptr->Ty); - /* Mask off any upper bits of the value we computed, but don't want. */ - if (BitStart + BitSize != llvm_type_get_size(ResultType)) { + if (BitStart + BitSize != ResultTypeSizeInBits) { /* Make an LLVM value for the constant. */ llvm_value *MaskVal = llvm_constant_new_integral(ResultType, Mask); Src = append_inst(Fn, create_binary_inst("tmp", O_And, Src, MaskVal)); From lattner at cs.uiuc.edu Sat Jul 16 00:43:50 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 00:43:50 -0500 Subject: [llvm-commits] CVS: llvm-www/OldNews.html OpenProjects.html header.incl www-index.html Message-ID: <200507160543.AAA29159@zion.cs.uiuc.edu> Changes in directory llvm-www: OldNews.html updated: 1.2 -> 1.3 OpenProjects.html updated: 1.7 -> 1.8 header.incl updated: 1.41 -> 1.42 www-index.html updated: 1.122 -> 1.123 --- Log message: mail.cs.uiuc.edu is now known as lists.cs.uiuc.edu --- Diffs of the changes: (+29 -29) OldNews.html | 6 +++--- OpenProjects.html | 6 +++--- header.incl | 42 +++++++++++++++++++++--------------------- www-index.html | 4 ++-- 4 files changed, 29 insertions(+), 29 deletions(-) Index: llvm-www/OldNews.html diff -u llvm-www/OldNews.html:1.2 llvm-www/OldNews.html:1.3 --- llvm-www/OldNews.html:1.2 Fri Jan 7 12:58:44 2005 +++ llvm-www/OldNews.html Sat Jul 16 00:43:39 2005 @@ -16,7 +16,7 @@ May 8, 2003 - - Switched over to the rewritten C front-end which supports variable argument functions and has no known miscompilation bugs. + Switched over to the rewritten C front-end which supports variable argument functions and has no known miscompilation bugs. Mar 4, 2003 @@ -52,7 +52,7 @@ - A new mailing + href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs/">mailing list has been added for LLVM bug reports and patch submissions. @@ -70,7 +70,7 @@ - A new LLVM + href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developer's mailing list is available. This is a good place to post questions to, or monitor to find out about major changes to the LLVM source-base. Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.7 llvm-www/OpenProjects.html:1.8 --- llvm-www/OpenProjects.html:1.7 Thu Jun 2 16:52:43 2005 +++ llvm-www/OpenProjects.html Sat Jul 16 00:43:39 2005 @@ -47,7 +47,7 @@ contributions.

    If you are thinking about tackling one of these projects, please send a mail -to the LLVM +to the LLVM Developer's mailing list, so that we know the project is being worked on. Additionally this is a good way to get more information about a specific project or to suggest other projects to add to this page. @@ -117,7 +117,7 @@

    We are always looking for new testcases and benchmarks for use with LLVM. In particular, it is useful to try compiling your favorite C source code with LLVM. If it doesn't compile, try to figure out why or report it to the llvm-bugs list. If you +href="http://lists.cs.uiuc.edu/pipermail/llvmbugs/">llvm-bugs list. If you get the program to compile, it would be extremely useful to convert the build system to be compatible with the LLVM Programs testsuite so that we can check it into CVS and the automated tester can use it to track progress of the @@ -376,7 +376,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/06/02 21:52:43 $ + Last modified: $Date: 2005/07/16 05:43:39 $ Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.41 llvm-www/header.incl:1.42 --- llvm-www/header.incl:1.41 Wed May 18 14:42:06 2005 +++ llvm-www/header.incl Sat Jul 16 00:43:39 2005 @@ -65,22 +65,22 @@ Status Updates

    @@ -90,11 +90,11 @@ Useful Links
    Mailing Lists:
    - LLVM-announce
    - LLVM-dev
    - LLVM-bugs
    - LLVM-commits - LLVM-testresults + LLVM-announce
    + LLVM-dev
    + LLVM-bugs
    + LLVM-commits + LLVM-testresults

    IRC Channel:
    Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.122 llvm-www/www-index.html:1.123 --- llvm-www/www-index.html:1.122 Thu Jun 30 15:50:44 2005 +++ llvm-www/www-index.html Sat Jul 16 00:43:39 2005 @@ -89,8 +89,8 @@ code, either check out doxygen or download the most recent release. Finally, if you're interested in LLVM, have questions, and can't find any answers, please ask on -the LLVM -developer's mailing list.

    +the LLVM +Developer mailing list.

    From lattner at cs.uiuc.edu Sat Jul 16 00:45:26 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 00:45:26 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/download.html register.cgi register.html testregister.cgi testregister.html Message-ID: <200507160545.AAA29221@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: download.html updated: 1.22 -> 1.23 register.cgi updated: 1.21 -> 1.22 register.html updated: 1.8 -> 1.9 testregister.cgi updated: 1.22 -> 1.23 testregister.html updated: 1.1 -> 1.2 --- Log message: mail.cs.uiuc.edu -> lists.cs.uiuc.edu --- Diffs of the changes: (+6 -6) download.html | 2 +- register.cgi | 2 +- register.html | 4 ++-- testregister.cgi | 2 +- testregister.html | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) Index: llvm-www/releases/download.html diff -u llvm-www/releases/download.html:1.22 llvm-www/releases/download.html:1.23 --- llvm-www/releases/download.html:1.22 Wed Jun 1 12:08:45 2005 +++ llvm-www/releases/download.html Sat Jul 16 00:45:15 2005 @@ -14,7 +14,7 @@
    If you signed up for the LLVM Announcements list, you should receive a confirmation email. If you didn't, you can -subscribe to +subscribe to llvm-announce directly.
    Index: llvm-www/releases/register.cgi diff -u llvm-www/releases/register.cgi:1.21 llvm-www/releases/register.cgi:1.22 --- llvm-www/releases/register.cgi:1.21 Sat Apr 23 13:52:39 2005 +++ llvm-www/releases/register.cgi Sat Jul 16 00:45:15 2005 @@ -39,7 +39,7 @@ # def Subscribe (form): # Name of the LLVM subscription CGI script - scriptURL='http://mail.cs.uiuc.edu/mailman/subscribe/llvm-announce' + scriptURL='http://lists.cs.uiuc.edu/mailman/subscribe/llvm-announce' # # Extract from the form any information that we need Index: llvm-www/releases/register.html diff -u llvm-www/releases/register.html:1.8 llvm-www/releases/register.html:1.9 --- llvm-www/releases/register.html:1.8 Fri Mar 19 16:04:12 2004 +++ llvm-www/releases/register.html Sat Jul 16 00:45:15 2005 @@ -76,7 +76,7 @@

    The LLVM Announcements List is a low volume mailing list (approximately one +href="http://lists.cs.uiuc.edu/pipermail/llvm-announce/">one email a month) that provides LLVM users with important information on new LLVM releases. If you would like to subscribe to this list, please select "yes" and respond to the confirmation @@ -84,7 +84,7 @@

    Subscribe to -LLVM +LLVM Announcements List (default is yes):
    Yes
    Index: llvm-www/releases/testregister.cgi diff -u llvm-www/releases/testregister.cgi:1.22 llvm-www/releases/testregister.cgi:1.23 --- llvm-www/releases/testregister.cgi:1.22 Thu Dec 18 15:25:29 2003 +++ llvm-www/releases/testregister.cgi Sat Jul 16 00:45:15 2005 @@ -40,7 +40,7 @@ # def Subscribe (form): # Name of the LLVM subscription CGI script - scriptURL='http://mail.cs.uiuc.edu/mailman/subscribe/llvm-announce' + scriptURL='http://lists.cs.uiuc.edu/mailman/subscribe/llvm-announce' # # Extract from the form any information that we need Index: llvm-www/releases/testregister.html diff -u llvm-www/releases/testregister.html:1.1 llvm-www/releases/testregister.html:1.2 --- llvm-www/releases/testregister.html:1.1 Tue Dec 16 15:06:52 2003 +++ llvm-www/releases/testregister.html Sat Jul 16 00:45:15 2005 @@ -58,7 +58,7 @@

    Subscribe to -LLVM +LLVM Announcements List (default is yes):
    Yes
    From lattner at cs.uiuc.edu Sat Jul 16 00:45:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 00:45:55 -0500 Subject: [llvm-commits] CVS: llvm-www/RandomBoxes/001-C++Compiler.html Message-ID: <200507160545.AAA29253@zion.cs.uiuc.edu> Changes in directory llvm-www/RandomBoxes: 001-C++Compiler.html updated: 1.3 -> 1.4 --- Log message: mail.cs -> lists.cs --- Diffs of the changes: (+1 -1) 001-C++Compiler.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/RandomBoxes/001-C++Compiler.html diff -u llvm-www/RandomBoxes/001-C++Compiler.html:1.3 llvm-www/RandomBoxes/001-C++Compiler.html:1.4 --- llvm-www/RandomBoxes/001-C++Compiler.html:1.3 Mon Jun 28 17:07:13 2004 +++ llvm-www/RandomBoxes/001-C++Compiler.html Sat Jul 16 00:45:44 2005 @@ -1,4 +1,4 @@ Did you know that LLVM has a GCC 3.4 compatible C++ front-end and a great optimizer? We find that LLVM is able to compile C++ into substantially better code than GCC (for example). Also, because LLVM code can be converted to C, -you can even use LLVM as a C++-to-C translator. +you can even use LLVM as a C++-to-C translator. From lattner at cs.uiuc.edu Sat Jul 16 00:46:20 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 00:46:20 -0500 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200507160546.AAA29289@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.58 -> 1.59 --- Log message: mail.cs -> lists.cs --- Diffs of the changes: (+3 -3) index.cgi | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.58 llvm-www/demo/index.cgi:1.59 --- llvm-www/demo/index.cgi:1.58 Thu May 19 16:45:40 2005 +++ llvm-www/demo/index.cgi Sat Jul 16 00:46:08 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2005/05/19 21:45:40 $ +# Last modified $Date: 2005/07/16 05:46:08 $ # use strict; @@ -21,7 +21,7 @@ my $LOGFILE = '/tmp/webcompile/log.txt'; my $FORM_URL = 'index.cgi'; -my $CONTACT_ADDRESS = 'Questions or comments? Email the LLVMdev mailing list.'; +my $CONTACT_ADDRESS = 'Questions or comments? Email the LLVMdev mailing list.'; my $LOGO_IMAGE_URL = 'cathead.png'; my $TIMEOUTAMOUNT = 20; $ENV{'LLVM_LIB_SEARCH_PATH'} = '/home/vadve/gaeke/llvm/Release/runtime/'; @@ -234,7 +234,7 @@ front-end, please check the FAQ. If the FAQ does not address it, please send an email to the LLVMdev mailing +href='http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev'>LLVMdev mailing list.

    \n

    Hints:

    • The generated LLVM code will be easier to read if you use stdio (e.g., printf) than iostreams (e.g., std::cout).
    • Unused inline functions and methods are not generated. Instead From lattner at cs.uiuc.edu Sat Jul 16 03:01:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 03:01:09 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507160801.DAA32302@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.7 -> 1.8 --- Log message: Major refactor of the ELFWriter code. Instead of building up one big vector that represents the .o file at once, build up a vector for each section of the .o file. This is needed because the .o file writer needs to be able to switch between sections as it emits them (e.g. switch between the .text section and the .rel section when emitting code). This patch has no functionality change. --- Diffs of the changes: (+97 -63) ELFWriter.h | 160 ++++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 97 insertions(+), 63 deletions(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.7 llvm/include/llvm/CodeGen/ELFWriter.h:1.8 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.7 Tue Jul 12 01:57:26 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Sat Jul 16 03:00:57 2005 @@ -15,6 +15,7 @@ #define LLVM_CODEGEN_ELFWRITER_H #include "llvm/CodeGen/MachineFunctionPass.h" +#include namespace llvm { class GlobalVariable; @@ -35,6 +36,8 @@ ~ELFWriter(); + typedef std::vector DataBuffer; + protected: ELFWriter(std::ostream &O, TargetMachine &TM); @@ -85,14 +88,14 @@ bool doFinalization(Module &M); private: - // The buffer we are accumulating the file into. Note that this should be + // The buffer we accumulate the file header into. Note that this should be // changed into something much more efficient later (and the bytecode writer // as well!). - std::vector OutputBuffer; + DataBuffer FileHeader; /// ELFSection - This struct contains information about each section that is - /// emitted to the OutputBuffer. This is eventually turned into the section - /// header table at the end of the file. + /// emitted to the file. This is eventually turned into the section header + /// table at the end of the file. struct ELFSection { std::string Name; // Name of the section. unsigned NameIdx; // Index in .shstrtab of name, once emitted. @@ -106,6 +109,14 @@ unsigned Align; unsigned EntSize; + /// SectionIdx - The number of the section in the Section Table. + /// + unsigned short SectionIdx; + + /// SectionData - The actual data for this section which we are building + /// up for emission to the file. + DataBuffer SectionData; + enum { SHT_NULL = 0, SHT_PROGBITS = 1, SHT_SYMTAB = 2, SHT_STRTAB = 3, SHT_RELA = 4, SHT_HASH = 5, SHT_DYNAMIC = 6, SHT_NOTE = 7, SHT_NOBITS = 8, SHT_REL = 9, SHT_SHLIB = 10, SHT_DYNSYM = 11 }; @@ -123,8 +134,8 @@ SHF_TLS = 1 << 10,// Section holds thread-local data }; - ELFSection(const char *name = "", unsigned offset = 0) - : Name(name), Type(0), Flags(0), Addr(0), Offset(offset), Size(0), + ELFSection(const std::string &name) + : Name(name), Type(0), Flags(0), Addr(0), Offset(0), Size(0), Link(0), Info(0), Align(0), EntSize(0) { } }; @@ -132,7 +143,24 @@ /// SectionList - This is the list of sections that we have emitted to the /// file. Once the file has been completely built, the section header table /// is constructed from this info. - std::vector SectionList; + std::list SectionList; + unsigned NumSections; // Always = SectionList.size() + + /// SectionLookup - This is a mapping from section name to section number in + /// the SectionList. + std::map SectionLookup; + + /// getSection - Return the section with the specified name, creating a new + /// section if one does not already exist. + ELFSection &getSection(const std::string &Name) { + ELFSection *&SN = SectionLookup[Name]; + if (SN) return *SN; + + SectionList.push_back(Name); + SN = &SectionList.back(); + SN->SectionIdx = NumSections++; + return *SN; + } /// ELFSym - This struct contains information about each symbol that is /// added to logical symbol table for the module. This is eventually @@ -163,103 +191,109 @@ }; /// SymbolTable - This is the list of symbols we have emitted to the file. - /// This actually gets rearranged before emission to OutputBuffer (to put - /// the local symbols first in the list). + /// This actually gets rearranged before emission to the file (to put the + /// local symbols first in the list). std::vector SymbolTable; - // As we accumulate the ELF file into OutputBuffer, we occasionally need to - // keep track of locations to update later (e.g. the location of the section - // table in the ELF header. These members keep track of the offset in - // OffsetBuffer of these various pieces to update and other locations in the - // file. + // As we complete the ELF file, we need to update fields in the ELF header + // (e.g. the location of the section table). These members keep track of + // the offset in ELFHeader of these various pieces to update and other + // locations in the file. unsigned ELFHeader_e_shoff_Offset; // e_shoff in ELF header. unsigned ELFHeader_e_shstrndx_Offset; // e_shstrndx in ELF header. unsigned ELFHeader_e_shnum_Offset; // e_shnum in ELF header. + // align - Emit padding into the file until the current output position is // aligned to the specified power of two boundary. - void align(unsigned Boundary) { + static void align(DataBuffer &Output, unsigned Boundary) { assert(Boundary && (Boundary & (Boundary-1)) == 0 && "Must align to 2^k boundary"); - while (OutputBuffer.size() & (Boundary-1)) - outbyte(0xAB); + size_t Size = Output.size(); + if (Size & (Boundary-1)) { + // Add padding to get alignment to the correct place. + size_t Pad = Boundary-(Size & (Boundary-1)); + Output.resize(Size+Pad); + } } - void outbyte(unsigned char X) { OutputBuffer.push_back(X); } - void outhalf(unsigned short X) { + static void outbyte(DataBuffer &Output, unsigned char X) { + Output.push_back(X); + } + void outhalf(DataBuffer &Output, unsigned short X) { if (isLittleEndian) { - OutputBuffer.push_back(X&255); - OutputBuffer.push_back(X >> 8); + Output.push_back(X&255); + Output.push_back(X >> 8); } else { - OutputBuffer.push_back(X >> 8); - OutputBuffer.push_back(X&255); + Output.push_back(X >> 8); + Output.push_back(X&255); } } - void outword(unsigned X) { + void outword(DataBuffer &Output, unsigned X) { if (isLittleEndian) { - OutputBuffer.push_back((X >> 0) & 255); - OutputBuffer.push_back((X >> 8) & 255); - OutputBuffer.push_back((X >> 16) & 255); - OutputBuffer.push_back((X >> 24) & 255); + Output.push_back((X >> 0) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 24) & 255); } else { - OutputBuffer.push_back((X >> 24) & 255); - OutputBuffer.push_back((X >> 16) & 255); - OutputBuffer.push_back((X >> 8) & 255); - OutputBuffer.push_back((X >> 0) & 255); + Output.push_back((X >> 24) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 0) & 255); } } - void outxword(uint64_t X) { + void outxword(DataBuffer &Output, uint64_t X) { if (isLittleEndian) { - OutputBuffer.push_back((X >> 0) & 255); - OutputBuffer.push_back((X >> 8) & 255); - OutputBuffer.push_back((X >> 16) & 255); - OutputBuffer.push_back((X >> 24) & 255); - OutputBuffer.push_back((X >> 32) & 255); - OutputBuffer.push_back((X >> 40) & 255); - OutputBuffer.push_back((X >> 48) & 255); - OutputBuffer.push_back((X >> 56) & 255); + Output.push_back((X >> 0) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 24) & 255); + Output.push_back((X >> 32) & 255); + Output.push_back((X >> 40) & 255); + Output.push_back((X >> 48) & 255); + Output.push_back((X >> 56) & 255); } else { - OutputBuffer.push_back((X >> 56) & 255); - OutputBuffer.push_back((X >> 48) & 255); - OutputBuffer.push_back((X >> 40) & 255); - OutputBuffer.push_back((X >> 32) & 255); - OutputBuffer.push_back((X >> 24) & 255); - OutputBuffer.push_back((X >> 16) & 255); - OutputBuffer.push_back((X >> 8) & 255); - OutputBuffer.push_back((X >> 0) & 255); + Output.push_back((X >> 56) & 255); + Output.push_back((X >> 48) & 255); + Output.push_back((X >> 40) & 255); + Output.push_back((X >> 32) & 255); + Output.push_back((X >> 24) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 0) & 255); } } - void outaddr32(unsigned X) { - outword(X); + void outaddr32(DataBuffer &Output, unsigned X) { + outword(Output, X); } - void outaddr64(uint64_t X) { - outxword(X); + void outaddr64(DataBuffer &Output, uint64_t X) { + outxword(Output, X); } - void outaddr(uint64_t X) { + void outaddr(DataBuffer &Output, uint64_t X) { if (!is64Bit) - outword((unsigned)X); + outword(Output, (unsigned)X); else - outxword(X); + outxword(Output, X); } // fix functions - Replace an existing entry at an offset. - void fixhalf(unsigned short X, unsigned Offset) { - unsigned char *P = &OutputBuffer[Offset]; + void fixhalf(DataBuffer &Output, unsigned short X, unsigned Offset) { + unsigned char *P = &Output[Offset]; P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255; P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255; } - void fixword(unsigned X, unsigned Offset) { - unsigned char *P = &OutputBuffer[Offset]; + void fixword(DataBuffer &Output, unsigned X, unsigned Offset) { + unsigned char *P = &Output[Offset]; P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255; P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255; P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255; P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255; } - void fixaddr(uint64_t X, unsigned Offset) { + void fixaddr(DataBuffer &Output, uint64_t X, unsigned Offset) { if (!is64Bit) - fixword((unsigned)X, Offset); + fixword(Output, (unsigned)X, Offset); else assert(0 && "Emission of 64-bit data not implemented yet!"); } @@ -271,7 +305,7 @@ void EmitSymbolTable(); void EmitSectionTableStringTable(); - void EmitSectionTable(); + void OutputSectionsAndSectionTable(); }; } From lattner at cs.uiuc.edu Sat Jul 16 03:01:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 03:01:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507160801.DAA32314@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.9 -> 1.10 --- Log message: Major refactor of the ELFWriter code. Instead of building up one big vector that represents the .o file at once, build up a vector for each section of the .o file. This is needed because the .o file writer needs to be able to switch between sections as it emits them (e.g. switch between the .text section and the .rel section when emitting code). This patch has no functionality change. --- Diffs of the changes: (+173 -149) ELFWriter.cpp | 322 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 173 insertions(+), 149 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.9 llvm/lib/CodeGen/ELFWriter.cpp:1.10 --- llvm/lib/CodeGen/ELFWriter.cpp:1.9 Tue Jul 12 01:57:52 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Sat Jul 16 03:01:13 2005 @@ -49,10 +49,11 @@ /// functions to the ELF file. class ELFCodeEmitter : public MachineCodeEmitter { ELFWriter &EW; - std::vector &OutputBuffer; + ELFWriter::ELFSection *ES; // Section to write to. + std::vector *OutBuffer; size_t FnStart; public: - ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutputBuffer(EW.OutputBuffer) {} + ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutBuffer(0) {} void startFunction(MachineFunction &F); void finishFunction(MachineFunction &F); @@ -62,7 +63,7 @@ assert(0 && "unimp"); } virtual void emitByte(unsigned char B) { - OutputBuffer.push_back(B); + OutBuffer->push_back(B); } virtual void emitWordAt(unsigned W, unsigned *Ptr) { assert(0 && "ni"); @@ -71,10 +72,10 @@ assert(0 && "ni"); } virtual uint64_t getCurrentPCValue() { - return OutputBuffer.size(); + return OutBuffer->size(); } virtual uint64_t getCurrentPCOffset() { - return OutputBuffer.size()-FnStart; + return OutBuffer->size()-FnStart; } void addRelocation(const MachineRelocation &MR) { assert(0 && "relo not handled yet!"); @@ -102,21 +103,22 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) { // Align the output buffer to the appropriate alignment. unsigned Align = 16; // FIXME: GENERICIZE!! - ELFWriter::ELFSection &TextSection = EW.SectionList.back(); + // Get the ELF Section that this function belongs in. + ES = &EW.getSection(".text"); + ES->Type = ELFWriter::ELFSection::SHT_PROGBITS; + ES->Flags = ELFWriter::ELFSection::SHF_EXECINSTR | + ELFWriter::ELFSection::SHF_ALLOC; + OutBuffer = &ES->SectionData; // Upgrade the section alignment if required. - if (TextSection.Align < Align) TextSection.Align = Align; + if (ES->Align < Align) ES->Align = Align; // Add padding zeros to the end of the buffer to make sure that the // function will start on the correct byte alignment within the section. - size_t SectionOff = OutputBuffer.size()-TextSection.Offset; - if (SectionOff & (Align-1)) { - // Add padding to get alignment to the correct place. - size_t Pad = Align-(SectionOff & (Align-1)); - OutputBuffer.resize(OutputBuffer.size()+Pad); - } + size_t SectionOff = OutBuffer->size(); + ELFWriter::align(*OutBuffer, Align); - FnStart = OutputBuffer.size(); + FnStart = OutBuffer->size(); } /// finishFunction - This callback is invoked after the function is completely @@ -141,12 +143,13 @@ FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL); break; } - + + ES->Size = OutBuffer->size(); + FnSym.SetType(ELFWriter::ELFSym::STT_FUNC); - FnSym.SectionIdx = EW.SectionList.size()-1; // .text section. - // Value = Offset from start of .text - FnSym.Value = FnStart - EW.SectionList.back().Offset; - FnSym.Size = OutputBuffer.size()-FnStart; + FnSym.SectionIdx = ES->SectionIdx; + FnSym.Value = FnStart; // Value = Offset from start of Section. + FnSym.Size = OutBuffer->size()-FnStart; // Finally, add it to the symtab. EW.SymbolTable.push_back(FnSym); @@ -165,6 +168,7 @@ // Create the machine code emitter object for this target. MCE = new ELFCodeEmitter(*this); + NumSections = 0; } ELFWriter::~ELFWriter() { @@ -176,47 +180,47 @@ bool ELFWriter::doInitialization(Module &M) { Mang = new Mangler(M); - outbyte(0x7F); // EI_MAG0 - outbyte('E'); // EI_MAG1 - outbyte('L'); // EI_MAG2 - outbyte('F'); // EI_MAG3 - outbyte(is64Bit ? 2 : 1); // EI_CLASS - outbyte(isLittleEndian ? 1 : 2); // EI_DATA - outbyte(1); // EI_VERSION - for (unsigned i = OutputBuffer.size(); i != 16; ++i) - outbyte(0); // EI_PAD up to 16 bytes. + // Local alias to shortenify coming code. + std::vector &FH = FileHeader; + + outbyte(FH, 0x7F); // EI_MAG0 + outbyte(FH, 'E'); // EI_MAG1 + outbyte(FH, 'L'); // EI_MAG2 + outbyte(FH, 'F'); // EI_MAG3 + outbyte(FH, is64Bit ? 2 : 1); // EI_CLASS + outbyte(FH, isLittleEndian ? 1 : 2); // EI_DATA + outbyte(FH, 1); // EI_VERSION + FH.resize(16); // EI_PAD up to 16 bytes. // This should change for shared objects. - outhalf(1); // e_type = ET_REL - outhalf(e_machine); // e_machine = whatever the target wants - outword(1); // e_version = 1 - outaddr(0); // e_entry = 0 -> no entry point in .o file - outaddr(0); // e_phoff = 0 -> no program header for .o - - ELFHeader_e_shoff_Offset = OutputBuffer.size(); - outaddr(0); // e_shoff - outword(e_flags); // e_flags = whatever the target wants - - outhalf(is64Bit ? 64 : 52); // e_ehsize = ELF header size - outhalf(0); // e_phentsize = prog header entry size - outhalf(0); // e_phnum = # prog header entries = 0 - outhalf(is64Bit ? 64 : 40); // e_shentsize = sect header entry size - - - ELFHeader_e_shnum_Offset = OutputBuffer.size(); - outhalf(0); // e_shnum = # of section header ents - ELFHeader_e_shstrndx_Offset = OutputBuffer.size(); - outhalf(0); // e_shstrndx = Section # of '.shstrtab' + outhalf(FH, 1); // e_type = ET_REL + outhalf(FH, e_machine); // e_machine = whatever the target wants + outword(FH, 1); // e_version = 1 + outaddr(FH, 0); // e_entry = 0 -> no entry point in .o file + outaddr(FH, 0); // e_phoff = 0 -> no program header for .o + + ELFHeader_e_shoff_Offset = FH.size(); + outaddr(FH, 0); // e_shoff + outword(FH, e_flags); // e_flags = whatever the target wants + + outhalf(FH, is64Bit ? 64 : 52); // e_ehsize = ELF header size + outhalf(FH, 0); // e_phentsize = prog header entry size + outhalf(FH, 0); // e_phnum = # prog header entries = 0 + outhalf(FH, is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size + + + ELFHeader_e_shnum_Offset = FH.size(); + outhalf(FH, 0); // e_shnum = # of section header ents + ELFHeader_e_shstrndx_Offset = FH.size(); + outhalf(FH, 0); // e_shstrndx = Section # of '.shstrtab' - // Add the null section. - SectionList.push_back(ELFSection()); + // Add the null section, which is required to be first in the file. + getSection(""); // Start up the symbol table. The first entry in the symtab is the null // entry. SymbolTable.push_back(ELFSym(0)); - SectionList.push_back(ELFSection(".text", OutputBuffer.size())); - return false; } @@ -286,7 +290,7 @@ } // Set the idx of the .bss section - BSSSym.SectionIdx = &BSSSection-&SectionList[0]; + BSSSym.SectionIdx = BSSSection.SectionIdx; SymbolTable.push_back(BSSSym); // Reserve space in the .bss section for this symbol. @@ -310,40 +314,19 @@ /// doFinalization - Now that the module has been completely processed, emit /// the ELF file to 'O'. bool ELFWriter::doFinalization(Module &M) { - // Okay, the .text section has now been finalized. If it contains nothing, do - // not emit it. - uint64_t TextSize = OutputBuffer.size() - SectionList.back().Offset; - if (TextSize == 0) { - SectionList.pop_back(); - } else { - ELFSection &Text = SectionList.back(); - Text.Size = TextSize; - Text.Type = ELFSection::SHT_PROGBITS; - Text.Flags = ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC; - } - // Okay, the ELF header and .text sections have been completed, build the // .data, .bss, and "common" sections next. - SectionList.push_back(ELFSection(".data", OutputBuffer.size())); - SectionList.push_back(ELFSection(".bss")); - ELFSection &DataSection = *(SectionList.end()-2); - ELFSection &BSSSection = SectionList.back(); - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) - EmitGlobal(I, DataSection, BSSSection); - - // Finish up the data section. + ELFSection &DataSection = getSection(".data"); DataSection.Type = ELFSection::SHT_PROGBITS; DataSection.Flags = ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC; - // The BSS Section logically starts at the end of the Data Section (adjusted - // to the required alignment of the BSSSection). - BSSSection.Offset = DataSection.Offset+DataSection.Size; + ELFSection &BSSSection = getSection(".bss"); BSSSection.Type = ELFSection::SHT_NOBITS; BSSSection.Flags = ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC; - if (BSSSection.Align) - BSSSection.Offset = (BSSSection.Offset+BSSSection.Align-1) & - ~(BSSSection.Align-1); + + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) + EmitGlobal(I, DataSection, BSSSection); // Emit the symbol table now, if non-empty. EmitSymbolTable(); @@ -353,14 +336,12 @@ // Emit the string table for the sections in the ELF file we have. EmitSectionTableStringTable(); - // Emit the .o file section table. - EmitSectionTable(); + // Emit the sections to the .o file, and emit the section table for the file. + OutputSectionsAndSectionTable(); - // Emit the .o file to the specified stream. - O.write((char*)&OutputBuffer[0], OutputBuffer.size()); - - // Free the output buffer. - std::vector().swap(OutputBuffer); + // We are done with the abstract symbols. + SectionList.clear(); + NumSections = 0; // Release the name mangler object. delete Mang; Mang = 0; @@ -375,13 +356,14 @@ // FIXME: compact all local symbols to the start of the symtab. unsigned FirstNonLocalSymbol = 1; - SectionList.push_back(ELFSection(".strtab", OutputBuffer.size())); - ELFSection &StrTab = SectionList.back(); + ELFSection &StrTab = getSection(".strtab"); StrTab.Type = ELFSection::SHT_STRTAB; StrTab.Align = 1; + DataBuffer &StrTabBuf = StrTab.SectionData; + // Set the zero'th symbol to a null byte, as required. - outbyte(0); + outbyte(StrTabBuf, 0); SymbolTable[0].NameIdx = 0; unsigned Index = 1; for (unsigned i = 1, e = SymbolTable.size(); i != e; ++i) { @@ -394,53 +376,51 @@ SymbolTable[i].NameIdx = Index; // Add the name to the output buffer, including the null terminator. - OutputBuffer.insert(OutputBuffer.end(), Name.begin(), Name.end()); + StrTabBuf.insert(StrTabBuf.end(), Name.begin(), Name.end()); // Add a null terminator. - OutputBuffer.push_back(0); + StrTabBuf.push_back(0); // Keep track of the number of bytes emitted to this section. Index += Name.size()+1; } } - - StrTab.Size = OutputBuffer.size()-StrTab.Offset; + assert(Index == StrTabBuf.size()); + StrTab.Size = Index; // Now that we have emitted the string table and know the offset into the // string table of each symbol, emit the symbol table itself. - align(is64Bit ? 8 : 4); - - SectionList.push_back(ELFSection(".symtab", OutputBuffer.size())); - ELFSection &SymTab = SectionList.back(); + ELFSection &SymTab = getSection(".symtab"); SymTab.Type = ELFSection::SHT_SYMTAB; SymTab.Align = is64Bit ? 8 : 4; - SymTab.Link = SectionList.size()-2; // Section Index of .strtab. + SymTab.Link = SymTab.SectionIdx; // Section Index of .strtab. SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. SymTab.EntSize = 16; // Size of each symtab entry. FIXME: wrong for ELF64 + DataBuffer &SymTabBuf = SymTab.SectionData; if (!is64Bit) { // 32-bit and 64-bit formats are shuffled a bit. for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { ELFSym &Sym = SymbolTable[i]; - outword(Sym.NameIdx); - outaddr32(Sym.Value); - outword(Sym.Size); - outbyte(Sym.Info); - outbyte(Sym.Other); - outhalf(Sym.SectionIdx); + outword(SymTabBuf, Sym.NameIdx); + outaddr32(SymTabBuf, Sym.Value); + outword(SymTabBuf, Sym.Size); + outbyte(SymTabBuf, Sym.Info); + outbyte(SymTabBuf, Sym.Other); + outhalf(SymTabBuf, Sym.SectionIdx); } } else { for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { ELFSym &Sym = SymbolTable[i]; - outword(Sym.NameIdx); - outbyte(Sym.Info); - outbyte(Sym.Other); - outhalf(Sym.SectionIdx); - outaddr64(Sym.Value); - outxword(Sym.Size); + outword(SymTabBuf, Sym.NameIdx); + outbyte(SymTabBuf, Sym.Info); + outbyte(SymTabBuf, Sym.Other); + outhalf(SymTabBuf, Sym.SectionIdx); + outaddr64(SymTabBuf, Sym.Value); + outxword(SymTabBuf, Sym.Size); } } - SymTab.Size = OutputBuffer.size()-SymTab.Offset; + SymTab.Size = SymTabBuf.size(); } /// EmitSectionTableStringTable - This method adds and emits a section for the @@ -448,63 +428,107 @@ /// section names. void ELFWriter::EmitSectionTableStringTable() { // First step: add the section for the string table to the list of sections: - SectionList.push_back(ELFSection(".shstrtab", OutputBuffer.size())); - SectionList.back().Type = ELFSection::SHT_STRTAB; + ELFSection &SHStrTab = getSection(".shstrtab"); + SHStrTab.Type = ELFSection::SHT_STRTAB; // Now that we know which section number is the .shstrtab section, update the // e_shstrndx entry in the ELF header. - fixhalf(SectionList.size()-1, ELFHeader_e_shstrndx_Offset); + fixhalf(FileHeader, SHStrTab.SectionIdx, ELFHeader_e_shstrndx_Offset); // Set the NameIdx of each section in the string table and emit the bytes for // the string table. unsigned Index = 0; + DataBuffer &Buf = SHStrTab.SectionData; - for (unsigned i = 0, e = SectionList.size(); i != e; ++i) { + for (std::list::iterator I = SectionList.begin(), + E = SectionList.end(); I != E; ++I) { // Set the index into the table. Note if we have lots of entries with // common suffixes, we could memoize them here if we cared. - SectionList[i].NameIdx = Index; + I->NameIdx = Index; // Add the name to the output buffer, including the null terminator. - OutputBuffer.insert(OutputBuffer.end(), SectionList[i].Name.begin(), - SectionList[i].Name.end()); + Buf.insert(Buf.end(), I->Name.begin(), I->Name.end()); + // Add a null terminator. - OutputBuffer.push_back(0); + Buf.push_back(0); // Keep track of the number of bytes emitted to this section. - Index += SectionList[i].Name.size()+1; + Index += I->Name.size()+1; } // Set the size of .shstrtab now that we know what it is. - SectionList.back().Size = Index; + assert(Index == Buf.size()); + SHStrTab.Size = Index; } -/// EmitSectionTable - Now that we have emitted the entire contents of the file -/// (all of the sections), emit the section table which informs the reader where -/// the boundaries are. -void ELFWriter::EmitSectionTable() { - // Now that all of the sections have been emitted, set the e_shnum entry in - // the ELF header. - fixhalf(SectionList.size(), ELFHeader_e_shnum_Offset); - - // Now that we know the offset in the file of the section table (which we emit - // next), update the e_shoff address in the ELF header. - fixaddr(OutputBuffer.size(), ELFHeader_e_shoff_Offset); - - // Emit all of the section table entries. - for (unsigned i = 0, e = SectionList.size(); i != e; ++i) { - const ELFSection &S = SectionList[i]; - outword(S.NameIdx); // sh_name - Symbol table name idx - outword(S.Type); // sh_type - Section contents & semantics - outword(S.Flags); // sh_flags - Section flags. - outaddr(S.Addr); // sh_addr - The mem address this section appears in. - outaddr(S.Offset); // sh_offset - The offset from the start of the file. - outword(S.Size); // sh_size - The section size. - outword(S.Link); // sh_link - Section header table index link. - outword(S.Info); // sh_info - Auxillary information. - outword(S.Align); // sh_addralign - Alignment of section. - outword(S.EntSize); // sh_entsize - Size of each entry in the section. +/// OutputSectionsAndSectionTable - Now that we have constructed the file header +/// and all of the sections, emit these to the ostream destination and emit the +/// SectionTable. +void ELFWriter::OutputSectionsAndSectionTable() { + // Pass #1: Compute the file offset for each section. + size_t FileOff = FileHeader.size(); // File header first. + + // Emit all of the section data in order. + for (std::list::iterator I = SectionList.begin(), + E = SectionList.end(); I != E; ++I) { + // Align FileOff to whatever the alignment restrictions of the section are. + if (I->Align) + FileOff = (FileOff+I->Align-1) & ~(I->Align-1); + I->Offset = FileOff; + FileOff += I->SectionData.size(); + } + + // Align Section Header. + unsigned TableAlign = is64Bit ? 8 : 4; + FileOff = (FileOff+TableAlign-1) & ~(TableAlign-1); + + // Now that we know where all of the sections will be emitted, set the e_shnum + // entry in the ELF header. + fixhalf(FileHeader, NumSections, ELFHeader_e_shnum_Offset); + + // Now that we know the offset in the file of the section table, update the + // e_shoff address in the ELF header. + fixaddr(FileHeader, FileOff, ELFHeader_e_shoff_Offset); + + // Now that we know all of the data in the file header, emit it and all of the + // sections! + O.write((char*)&FileHeader[0], FileHeader.size()); + FileOff = FileHeader.size(); + DataBuffer().swap(FileHeader); + + DataBuffer Table; + + // Emit all of the section data and build the section table itself. + while (!SectionList.empty()) { + const ELFSection &S = *SectionList.begin(); + + // Align FileOff to whatever the alignment restrictions of the section are. + if (S.Align) + for (size_t NewFileOff = (FileOff+S.Align-1) & ~(S.Align-1); + FileOff != NewFileOff; ++FileOff) + O.put(0xAB); + O.write((char*)&S.SectionData[0], S.SectionData.size()); + FileOff += S.SectionData.size(); + + outword(Table, S.NameIdx); // sh_name - Symbol table name idx + outword(Table, S.Type); // sh_type - Section contents & semantics + outword(Table, S.Flags); // sh_flags - Section flags. + outaddr(Table, S.Addr); // sh_addr - The mem addr this section is in. + outaddr(Table, S.Offset); // sh_offset - Offset from the file start. + outword(Table, S.Size); // sh_size - The section size. + outword(Table, S.Link); // sh_link - Section header table index link. + outword(Table, S.Info); // sh_info - Auxillary information. + outword(Table, S.Align); // sh_addralign - Alignment of section. + outword(Table, S.EntSize); // sh_entsize - Size of entries in the section. + + SectionList.pop_front(); } - // Release the memory allocated for the section list. - std::vector().swap(SectionList); + // Align output for the section table. + for (size_t NewFileOff = (FileOff+TableAlign-1) & ~(TableAlign-1); + FileOff != NewFileOff; ++FileOff) + O.put(0xAB); + + // Emit the section table itself. + O.write((char*)&Table[0], Table.size()); } From lattner at cs.uiuc.edu Sat Jul 16 12:35:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 12:35:37 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507161735.MAA01542@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.8 -> 1.9 --- Log message: Add ability to set TYPE and FLAGS field for section trivially --- Diffs of the changes: (+4 -1) ELFWriter.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.8 llvm/include/llvm/CodeGen/ELFWriter.h:1.9 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.8 Sat Jul 16 03:00:57 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Sat Jul 16 12:35:26 2005 @@ -152,13 +152,16 @@ /// getSection - Return the section with the specified name, creating a new /// section if one does not already exist. - ELFSection &getSection(const std::string &Name) { + ELFSection &getSection(const std::string &Name, + unsigned Type, unsigned Flags = 0) { ELFSection *&SN = SectionLookup[Name]; if (SN) return *SN; SectionList.push_back(Name); SN = &SectionList.back(); SN->SectionIdx = NumSections++; + SN->Type = Type; + SN->Flags = Flags; return *SN; } From lattner at cs.uiuc.edu Sat Jul 16 12:36:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 12:36:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507161736.MAA01555@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.10 -> 1.11 --- Log message: Refactor getSection() method to make it easier to use. --- Diffs of the changes: (+16 -20) ELFWriter.cpp | 36 ++++++++++++++++-------------------- 1 files changed, 16 insertions(+), 20 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.10 llvm/lib/CodeGen/ELFWriter.cpp:1.11 --- llvm/lib/CodeGen/ELFWriter.cpp:1.10 Sat Jul 16 03:01:13 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Sat Jul 16 12:36:04 2005 @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file was developed by Chris Lattner and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -104,10 +104,9 @@ // Align the output buffer to the appropriate alignment. unsigned Align = 16; // FIXME: GENERICIZE!! // Get the ELF Section that this function belongs in. - ES = &EW.getSection(".text"); - ES->Type = ELFWriter::ELFSection::SHT_PROGBITS; - ES->Flags = ELFWriter::ELFSection::SHF_EXECINSTR | - ELFWriter::ELFSection::SHF_ALLOC; + ES = &EW.getSection(".text", ELFWriter::ELFSection::SHT_PROGBITS, + ELFWriter::ELFSection::SHF_EXECINSTR | + ELFWriter::ELFSection::SHF_ALLOC); OutBuffer = &ES->SectionData; // Upgrade the section alignment if required. @@ -215,7 +214,7 @@ outhalf(FH, 0); // e_shstrndx = Section # of '.shstrtab' // Add the null section, which is required to be first in the file. - getSection(""); + getSection("", 0, 0); // Start up the symbol table. The first entry in the symtab is the null // entry. @@ -316,13 +315,13 @@ bool ELFWriter::doFinalization(Module &M) { // Okay, the ELF header and .text sections have been completed, build the // .data, .bss, and "common" sections next. - ELFSection &DataSection = getSection(".data"); - DataSection.Type = ELFSection::SHT_PROGBITS; - DataSection.Flags = ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC; - - ELFSection &BSSSection = getSection(".bss"); - BSSSection.Type = ELFSection::SHT_NOBITS; - BSSSection.Flags = ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC; + ELFSection &DataSection = + getSection(".data", ELFSection::SHT_PROGBITS, + ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); + + ELFSection &BSSSection = + getSection(".bss", ELFSection::SHT_NOBITS, + ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) @@ -356,8 +355,7 @@ // FIXME: compact all local symbols to the start of the symtab. unsigned FirstNonLocalSymbol = 1; - ELFSection &StrTab = getSection(".strtab"); - StrTab.Type = ELFSection::SHT_STRTAB; + ELFSection &StrTab = getSection(".strtab", ELFSection::SHT_STRTAB, 0); StrTab.Align = 1; DataBuffer &StrTabBuf = StrTab.SectionData; @@ -390,8 +388,7 @@ // Now that we have emitted the string table and know the offset into the // string table of each symbol, emit the symbol table itself. - ELFSection &SymTab = getSection(".symtab"); - SymTab.Type = ELFSection::SHT_SYMTAB; + ELFSection &SymTab = getSection(".symtab", ELFSection::SHT_SYMTAB, 0); SymTab.Align = is64Bit ? 8 : 4; SymTab.Link = SymTab.SectionIdx; // Section Index of .strtab. SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. @@ -428,8 +425,7 @@ /// section names. void ELFWriter::EmitSectionTableStringTable() { // First step: add the section for the string table to the list of sections: - ELFSection &SHStrTab = getSection(".shstrtab"); - SHStrTab.Type = ELFSection::SHT_STRTAB; + ELFSection &SHStrTab = getSection(".shstrtab", ELFSection::SHT_STRTAB, 0); // Now that we know which section number is the .shstrtab section, update the // e_shstrndx entry in the ELF header. From lattner at cs.uiuc.edu Sat Jul 16 12:40:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 12:40:45 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h Message-ID: <200507161740.MAA01890@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.9 -> 1.10 --- Log message: Add two helper methods, adjust a prototype --- Diffs of the changes: (+12 -4) ELFWriter.h | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.9 llvm/include/llvm/CodeGen/ELFWriter.h:1.10 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.9 Sat Jul 16 12:35:26 2005 +++ llvm/include/llvm/CodeGen/ELFWriter.h Sat Jul 16 12:40:34 2005 @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file was developed by Chris Lattner and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -165,6 +165,15 @@ return *SN; } + ELFSection &getDataSection() { + return getSection(".data", ELFSection::SHT_PROGBITS, + ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); + } + ELFSection &getBSSSection() { + return getSection(".bss", ELFSection::SHT_NOBITS, + ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); + } + /// ELFSym - This struct contains information about each symbol that is /// added to logical symbol table for the module. This is eventually /// turned into a real symbol table in the file. @@ -302,8 +311,7 @@ } private: - void EmitGlobal(GlobalVariable *GV, ELFSection &DataSection, - ELFSection &BSSSection); + void EmitGlobal(GlobalVariable *GV); void EmitSymbolTable(); From lattner at cs.uiuc.edu Sat Jul 16 12:41:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 16 Jul 2005 12:41:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp Message-ID: <200507161741.MAA01899@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.11 -> 1.12 --- Log message: Only get the .bss and .data sections when needed instead of unconditionally. This allows is to not emit empty sections when .data or .bss is not used. --- Diffs of the changes: (+3 -11) ELFWriter.cpp | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.11 llvm/lib/CodeGen/ELFWriter.cpp:1.12 --- llvm/lib/CodeGen/ELFWriter.cpp:1.11 Sat Jul 16 12:36:04 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Sat Jul 16 12:41:06 2005 @@ -223,8 +223,7 @@ return false; } -void ELFWriter::EmitGlobal(GlobalVariable *GV, ELFSection &DataSection, - ELFSection &BSSSection) { +void ELFWriter::EmitGlobal(GlobalVariable *GV) { // If this is an external global, emit it now. TODO: Note that it would be // better to ignore the symbol here and only add it to the symbol table if // referenced. @@ -264,6 +263,7 @@ // Handle alignment. Ensure section is aligned at least as much as required // by this symbol. + ELFSection &BSSSection = getBSSSection(); BSSSection.Align = std::max(BSSSection.Align, Align); // Within the section, emit enough virtual padding to get us to an alignment @@ -315,17 +315,9 @@ bool ELFWriter::doFinalization(Module &M) { // Okay, the ELF header and .text sections have been completed, build the // .data, .bss, and "common" sections next. - ELFSection &DataSection = - getSection(".data", ELFSection::SHT_PROGBITS, - ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); - - ELFSection &BSSSection = - getSection(".bss", ELFSection::SHT_NOBITS, - ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - EmitGlobal(I, DataSection, BSSSection); + EmitGlobal(I); // Emit the symbol table now, if non-empty. EmitSymbolTable(); From reid at x10sys.com Sat Jul 16 19:50:51 2005 From: reid at x10sys.com (Reid Spencer) Date: Sat, 16 Jul 2005 19:50:51 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/m4/find_std_program.m4 sanity_check.m4 Message-ID: <200507170050.TAA10961@zion.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: find_std_program.m4 added (r1.1) sanity_check.m4 added (r1.1) --- Log message: Add two new checks for use in LLVM configuration files: * FIND_STD_PROGRAM will find a program in the path or using --with options and verify that the path/bin/program is executable. Also allows checking for include files and libraries. If found, USE_PROGRAM is set, otherwise its not set. Also sets PROGRAM_BIN (bin directory), and PROGRAM_DIR (top level directory). If headers are found, sets PROGRAM_INC. If libraries are found, sets PROGRAM_LIB. * CHECK_PROGRAM_SANITY can be used to run a program with some option that only produces information output and requires no input. If the output matches a regular expression, the program passes the sanity check. Otherwise, an error occurs. --- Diffs of the changes: (+134 -0) find_std_program.m4 | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sanity_check.m4 | 22 ++++++++++ 2 files changed, 134 insertions(+) Index: llvm/autoconf/m4/find_std_program.m4 diff -c /dev/null llvm/autoconf/m4/find_std_program.m4:1.1 *** /dev/null Sat Jul 16 19:50:50 2005 --- llvm/autoconf/m4/find_std_program.m4 Sat Jul 16 19:50:40 2005 *************** *** 0 **** --- 1,112 ---- + dnl Check for a standard program that has a bin, include and lib directory + dnl + dnl Parameters: + dnl $1 - prefix directory to check + dnl $2 - program name to check + dnl $3 - header file to check + dnl $4 - library file to check + AC_DEFUN([CHECK_STD_PROGRAM], + [m4_define([allcapsname],translit($2,a-z,A-Z)) + if test -n "$1" -a -d "$1" -a -n "$2" -a -d "$1/bin" -a -x "$1/bin/$2" ; then + AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"]) + AC_SUBST(allcapsname(),[$1/bin/$2]) + AC_SUBST(allcapsname()[_BIN],[$1/bin]) + AC_SUBST(allcapsname()[_DIR],[$1]) + if test -n "$3" -a -d "$1/include" -a -f "$1/include/$3" ; then + AC_SUBST(allcapsname()[_INC],[$1/include]) + fi + if test -n "$4" -a -d "$1/lib" -a -f "$1/lib/$4" ; then + AC_SUBST(allcapsname()[_LIB],[$1/lib]) + fi + fi + ]) + + dnl Find a program via --with options, in the path, or well known places + dnl + dnl Parameters: + dnl $1 - program name + dnl $2 - header file name to check (optional) + dnl $3 - library file name to check (optional) + AC_DEFUN([FIND_STD_PROGRAM], + [m4_define([allcapsname],translit($1,a-z,A-Z)) + AC_MSG_CHECKING([for ]$1[ bin/lib/include locations]) + AC_ARG_WITH($1, + AS_HELP_STRING([--with-]$1[=DIR],[Specify that ]$1['s install prefix is DIR]), + $1[pfxdir=$withval],$1[pfxdir=nada]) + AC_ARG_WITH($1[-bin], + AS_HELP_STRING([--with-]$1[-bin=DIR],[Specify that ]$1[ binary are in DIR]), + $1[bindir=$withval],$1[bindir=nada]) + AC_ARG_WITH($1[-lib], + AS_HELP_STRING([--with-]$1[-lib=DIR],[Specify that ]$1[ libs are in DIR]), + $1[libdir=$withval],$1[libdir=nada]) + AC_ARG_WITH($1[-inc], + AS_HELP_STRING([--with-]$1[-inc=DIR],[Specify that ]$1[ includes are in DIR]), + $1[incdir=$withval],$1[incdir=nada]) + pfxvar=$1pfxdir + binvar=$1bindir + incvar=$1incdir + libvar=$1libdir + if test "${!pfxvar}" != "nada" ; then + CHECK_STD_PROGRAM(${!pfxvar},$1,$2,$3) + elif test "${!binvar}" != "nada" ; then + if test "${!libvar}" != "nada" ; then + if test "${!incvar}" != "nada" ; then + if test -d "${!binvar}" ; then + if test -d "${!incvar}" ; then + if test -d "${!libvar}" ; then + AC_SUBST(allcapsname(),${!binvar}/$1) + AC_SUBST(allcapsname()[_BIN],${!binvar}) + AC_SUBST(allcapsname()[_INC],${!incvar}) + AC_SUBST(allcapsname()[_LIB],${!libvar}) + AC_SUBST([USE_]allcapsname(),[1]) + AC_MSG_RESULT([found via --with options]) + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-libdir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-incdir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-bindir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-incdir option must be specified]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-libdir option must be specified]) + fi + else + tmppfxdir=`which $1 2>&1` + if test -n "$tmppfxdir" -a -d "${tmppfxdir%*$1}" -a \ + -d "${tmppfxdir%*$1}/.." ; then + tmppfxdir=`cd "${tmppfxdir%*$1}/.." ; pwd` + CHECK_STD_PROGRAM($tmppfxdir,$1,$2,$3) + AC_MSG_RESULT([found in PATH at ]$tmppfxdir) + else + checkresult="yes" + checkvar="USE_"allcapsname() + CHECK_STD_PROGRAM([/usr],$1,$2,$3) + if test -z "${!checkvar}" ; then + CHECK_STD_PROGRAM([/usr/local],$1,$2,$3) + if test -z "${!checkvar}" ; then + CHECK_STD_PROGRAM([/sw],$1,$2,$3) + if test -z "${!checkvar}" ; then + CHECK_STD_PROGRAM([/opt],$1,$2,$3) + if test -z "${!checkvar}" ; then + CHECK_STD_PROGRAM([/],$1,$2,$3) + if test -z "${!checkvar}" ; then + checkresult="no" + fi + fi + fi + fi + fi + AC_MSG_RESULT($checkresult) + fi + fi + ]) Index: llvm/autoconf/m4/sanity_check.m4 diff -c /dev/null llvm/autoconf/m4/sanity_check.m4:1.1 *** /dev/null Sat Jul 16 19:50:51 2005 --- llvm/autoconf/m4/sanity_check.m4 Sat Jul 16 19:50:40 2005 *************** *** 0 **** --- 1,22 ---- + dnl Check a program for version sanity. The test runs a program, passes it an + dnl argument to make it print out some identification string, and filters that + dnl output with a regular expression. If the output is non-empty, the program + dnl passes the sanity check. + dnl $1 - Name or full path of the program to run + dnl $2 - Argument to pass to print out identification string + dnl $3 - grep RE to match identification string + AC_DEFUN([CHECK_PROGRAM_SANITY], + [ + AC_MSG_CHECKING([sanity for program ]$1) + sanity_path=`which $1 2>/dev/null` + if test "$?" -eq 0 -a -x "$sanity_path" ; then + sanity=`$1 $2 2>&1 | grep "$3"` + if test -z "$sanity" ; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.]) + fi + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([not found]) + fi + ]) From reid at x10sys.com Sat Jul 16 19:59:05 2005 From: reid at x10sys.com (Reid Spencer) Date: Sat, 16 Jul 2005 19:59:05 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200507170059.TAA10998@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.23 -> 1.24 --- Log message: Implement checks for the NAGWare F95 Fortran -> C translator. --- Diffs of the changes: (+5 -8) configure.ac | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.23 llvm-test/autoconf/configure.ac:1.24 --- llvm-test/autoconf/configure.ac:1.23 Wed Jul 13 23:49:51 2005 +++ llvm-test/autoconf/configure.ac Sat Jul 16 19:58:54 2005 @@ -89,14 +89,11 @@ AC_PROG_BISON AC_PROG_LIBTOOL -dnl Check for f2c in various locations or get from --with-f2c option -CHECK_F2C_ALL() -if test "x${F2C}" = "x"; then - CHECK_F2C_BIN() - CHECK_F2C_H() - CHECK_F2C_LIB() - CHECK_F2C_ENABLE() -fi +dnl Check for GNU f2c FORTRAN -> C translator +FIND_STD_PROGRAM(f2c,f2c.h,libf2c.a) +dnl Check for the NAG f95 FORTRAN -> C translator +FIND_STD_PROGRAM(f95,,libf97.dylib) +CHECK_PROGRAM_SANITY([f95],[-V],[NAGWare Fortran 95]) dnl Checks for header files. dnl We don't check for ancient stuff or things that are guaranteed to be there From reid at x10sys.com Sat Jul 16 19:59:06 2005 From: reid at x10sys.com (Reid Spencer) Date: Sat, 16 Jul 2005 19:59:06 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Makefile.config.in Message-ID: <200507170059.TAA11004@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.23 -> 1.24 Makefile.config.in updated: 1.17 -> 1.18 --- Log message: Implement checks for the NAGWare F95 Fortran -> C translator. --- Diffs of the changes: (+511 -168) Makefile.config.in | 7 configure | 672 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 511 insertions(+), 168 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.23 llvm-test/configure:1.24 --- llvm-test/configure:1.23 Thu Jul 14 00:53:56 2005 +++ llvm-test/configure Sat Jul 16 19:58:53 2005 @@ -465,7 +465,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL F2C F2C_INC F2C_LIB USE_F2C F2C_DIR HAVE_RE_COMP SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ DISABLE_LLC_DIFFS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL USE_F2C F2C F2C_BIN F2C_DIR F2C_INC F2C_LIB USE_F95 F95 F95_BIN F95_DIR F95_INC F95_LIB HAVE_RE_COMP SPEC95_ROOT USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 POVRAY_ROOT USE_POVRAY NAMD_ROOT USE_NAMD SWEEP3D_ROOT USE_SWEEP3D FPGROWTH_ROOT USE_FPGROWTH LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1047,10 +1047,14 @@ both] --with-tags[=TAGS] include additional configurations [automatic] - --with-f2c=DIR Use f2c with install prefix DIR - --with-f2c-bin=DIR Find f2c binary in DIR - --with-f2c-inc=DIR Find f2c.h in DIR - --with-f2c-lib=DIR Find libf2c.a in DIR + --with-f2c=DIR Specify that f2c's install prefix is DIR + --with-f2c-bin=DIR Specify that f2c binary are in DIR + --with-f2c-lib=DIR Specify that f2c libs are in DIR + --with-f2c-inc=DIR Specify that f2c includes are in DIR + --with-f95=DIR Specify that f95's install prefix is DIR + --with-f95-bin=DIR Specify that f95 binary are in DIR + --with-f95-lib=DIR Specify that f95 libs are in DIR + --with-f95-inc=DIR Specify that f95 includes are in DIR Some influential environment variables: CXX C++ compiler command @@ -3980,7 +3984,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3983 "configure"' > conftest.$ac_ext + echo '#line 3987 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4854,7 +4858,7 @@ # Provide some information about the compiler. -echo "$as_me:4857:" \ +echo "$as_me:4861:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5911,11 +5915,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5914: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5918: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:5918: \$? = $ac_status" >&5 + echo "$as_me:5922: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6154,11 +6158,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6157: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6161: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6161: \$? = $ac_status" >&5 + echo "$as_me:6165: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6214,11 +6218,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6217: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6221: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6221: \$? = $ac_status" >&5 + echo "$as_me:6225: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8399,7 +8403,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10697: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10697: \$? = $ac_status" >&5 + echo "$as_me:10701: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10750,11 +10754,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10753: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10757: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10757: \$? = $ac_status" >&5 + echo "$as_me:10761: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12111,7 +12115,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13053: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13053: \$? = $ac_status" >&5 + echo "$as_me:13057: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13106,11 +13110,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13109: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13113: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13113: \$? = $ac_status" >&5 + echo "$as_me:13117: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15145,11 +15149,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15148: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15152: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15152: \$? = $ac_status" >&5 + echo "$as_me:15156: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15388,11 +15392,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15391: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15395: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15395: \$? = $ac_status" >&5 + echo "$as_me:15399: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15448,11 +15452,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15451: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15455: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15455: \$? = $ac_status" >&5 + echo "$as_me:15459: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17633,7 +17637,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo $ECHO_N "checking for f2c bin/lib/include locations... $ECHO_C" >&6 + # Check whether --with-f2c or --without-f2c was given. if test "${with_f2c+set}" = set; then withval="$with_f2c" - f2cdir=$withval + f2cpfxdir=$withval else - f2cdir=notfound + f2cpfxdir=nada fi; -echo "$as_me:$LINENO: checking for installed f2c components" >&5 -echo $ECHO_N "checking for installed f2c components... $ECHO_C" >&6 -if test "$f2cdir" = "notfound" ; then - f2cdir=`which f2c` - if test "$f2cdir"x != "x" ; then - if test -d "${f2cdir%*f2c}" -a -d "${f2cdir%*f2c}/.." ; then - f2cdir=`cd "${f2cdir%*f2c}/.." ; pwd` - if test ! -d "$f2cdir" ; then - f2cdir="notfound"; - fi - fi - fi + +# Check whether --with-f2c-bin or --without-f2c-bin was given. +if test "${with_f2c_bin+set}" = set; then + withval="$with_f2c_bin" + f2cbindir=$withval +else + f2cbindir=nada +fi; + +# Check whether --with-f2c-lib or --without-f2c-lib was given. +if test "${with_f2c_lib+set}" = set; then + withval="$with_f2c_lib" + f2clibdir=$withval +else + f2clibdir=nada +fi; + +# Check whether --with-f2c-inc or --without-f2c-inc was given. +if test "${with_f2c_inc+set}" = set; then + withval="$with_f2c_inc" + f2cincdir=$withval +else + f2cincdir=nada +fi; +pfxvar=f2cpfxdir +binvar=f2cbindir +incvar=f2cincdir +libvar=f2clibdir +if test "${!pfxvar}" != "nada" ; then + +if test -n "${!pfxvar}" -a -d "${!pfxvar}" -a -n "f2c" -a -d "${!pfxvar}/bin" -a -x "${!pfxvar}/bin/f2c" ; then + USE_F2C="USE_F2C = 1" + + F2C=${!pfxvar}/bin/f2c + + F2C_BIN=${!pfxvar}/bin + + F2C_DIR=${!pfxvar} + + if test -n "f2c.h" -a -d "${!pfxvar}/include" -a -f "${!pfxvar}/include/f2c.h" ; then + F2C_INC=${!pfxvar}/include + + fi + if test -n "libf2c.a" -a -d "${!pfxvar}/lib" -a -f "${!pfxvar}/lib/libf2c.a" ; then + F2C_LIB=${!pfxvar}/lib + + fi fi -if test -d "$f2cdir" && - test -d "$f2cdir/bin" && test -f "$f2cdir/bin/f2c" && - test -d "$f2cdir/include" && test -f "$f2cdir/include/f2c.h" && - test -d "$f2cdir/lib" && test -f "$f2cdir/lib/libf2c.a" -then - F2C=$f2cdir/bin/f2c +elif test "${!binvar}" != "nada" ; then + if test "${!libvar}" != "nada" ; then + if test "${!incvar}" != "nada" ; then + if test -d "${!binvar}" ; then + if test -d "${!incvar}" ; then + if test -d "${!libvar}" ; then + F2C=${!binvar}/f2c + + F2C_BIN=${!binvar} + + F2C_INC=${!incvar} + + F2C_LIB=${!libvar} + + USE_F2C=1 + + echo "$as_me:$LINENO: result: found via --with options" >&5 +echo "${ECHO_T}found via --with options" >&6 + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f2c-libdir value must be a directory" >&5 +echo "$as_me: error: The --with-f2c-libdir value must be a directory" >&2;} + { (exit 1); exit 1; }; } + fi + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f2c-incdir value must be a directory" >&5 +echo "$as_me: error: The --with-f2c-incdir value must be a directory" >&2;} + { (exit 1); exit 1; }; } + fi + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f2c-bindir value must be a directory" >&5 +echo "$as_me: error: The --with-f2c-bindir value must be a directory" >&2;} + { (exit 1); exit 1; }; } + fi + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f2c-incdir option must be specified" >&5 +echo "$as_me: error: The --with-f2c-incdir option must be specified" >&2;} + { (exit 1); exit 1; }; } + fi + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f2c-libdir option must be specified" >&5 +echo "$as_me: error: The --with-f2c-libdir option must be specified" >&2;} + { (exit 1); exit 1; }; } + fi +else + tmppfxdir=`which f2c 2>&1` + if test -n "$tmppfxdir" -a -d "${tmppfxdir%*f2c}" -a \ + -d "${tmppfxdir%*f2c}/.." ; then + tmppfxdir=`cd "${tmppfxdir%*f2c}/.." ; pwd` + +if test -n "$tmppfxdir" -a -d "$tmppfxdir" -a -n "f2c" -a -d "$tmppfxdir/bin" -a -x "$tmppfxdir/bin/f2c" ; then + USE_F2C="USE_F2C = 1" + + F2C=$tmppfxdir/bin/f2c + + F2C_BIN=$tmppfxdir/bin + + F2C_DIR=$tmppfxdir + + if test -n "f2c.h" -a -d "$tmppfxdir/include" -a -f "$tmppfxdir/include/f2c.h" ; then + F2C_INC=$tmppfxdir/include - F2C_INC=$f2cdir/include + fi + if test -n "libf2c.a" -a -d "$tmppfxdir/lib" -a -f "$tmppfxdir/lib/libf2c.a" ; then + F2C_LIB=$tmppfxdir/lib + + fi +fi + + echo "$as_me:$LINENO: result: found in PATH at $tmppfxdir" >&5 +echo "${ECHO_T}found in PATH at $tmppfxdir" >&6 + else + checkresult="yes" + checkvar="USE_"F2C - F2C_LIB=$f2cdir/lib +if test -n "/usr" -a -d "/usr" -a -n "f2c" -a -d "/usr/bin" -a -x "/usr/bin/f2c" ; then + USE_F2C="USE_F2C = 1" - USE_F2C=USE_F2C=1 + F2C=/usr/bin/f2c - F2C_DIR=$f2cdir + F2C_BIN=/usr/bin + F2C_DIR=/usr + + if test -n "f2c.h" -a -d "/usr/include" -a -f "/usr/include/f2c.h" ; then + F2C_INC=/usr/include + + fi + if test -n "libf2c.a" -a -d "/usr/lib" -a -f "/usr/lib/libf2c.a" ; then + F2C_LIB=/usr/lib + + fi fi -if test "x$F2C" = "x"; then + if test -z "${!checkvar}" ; then -if test -d ""/usr"" && - test -d ""/usr"/bin" && test -f ""/usr"/bin/f2c" && - test -d ""/usr"/include" && test -f ""/usr"/include/f2c.h" && - test -d ""/usr"/lib" && test -f ""/usr"/lib/libf2c.a" -then - F2C="/usr"/bin/f2c +if test -n "/usr/local" -a -d "/usr/local" -a -n "f2c" -a -d "/usr/local/bin" -a -x "/usr/local/bin/f2c" ; then + USE_F2C="USE_F2C = 1" - F2C_INC="/usr"/include + F2C=/usr/local/bin/f2c - F2C_LIB="/usr"/lib + F2C_BIN=/usr/local/bin - USE_F2C=USE_F2C=1 + F2C_DIR=/usr/local - F2C_DIR="/usr" + if test -n "f2c.h" -a -d "/usr/local/include" -a -f "/usr/local/include/f2c.h" ; then + F2C_INC=/usr/local/include + fi + if test -n "libf2c.a" -a -d "/usr/local/lib" -a -f "/usr/local/lib/libf2c.a" ; then + F2C_LIB=/usr/local/lib + + fi fi - if test "x$F2C" = "x"; then + if test -z "${!checkvar}" ; then -if test -d ""/usr/local"" && - test -d ""/usr/local"/bin" && test -f ""/usr/local"/bin/f2c" && - test -d ""/usr/local"/include" && test -f ""/usr/local"/include/f2c.h" && - test -d ""/usr/local"/lib" && test -f ""/usr/local"/lib/libf2c.a" -then - F2C="/usr/local"/bin/f2c +if test -n "/sw" -a -d "/sw" -a -n "f2c" -a -d "/sw/bin" -a -x "/sw/bin/f2c" ; then + USE_F2C="USE_F2C = 1" - F2C_INC="/usr/local"/include + F2C=/sw/bin/f2c - F2C_LIB="/usr/local"/lib + F2C_BIN=/sw/bin - USE_F2C=USE_F2C=1 + F2C_DIR=/sw - F2C_DIR="/usr/local" + if test -n "f2c.h" -a -d "/sw/include" -a -f "/sw/include/f2c.h" ; then + F2C_INC=/sw/include + fi + if test -n "libf2c.a" -a -d "/sw/lib" -a -f "/sw/lib/libf2c.a" ; then + F2C_LIB=/sw/lib + + fi fi - if test "x$F2C" = "x"; then + if test -z "${!checkvar}" ; then -if test -d ""/sw"" && - test -d ""/sw"/bin" && test -f ""/sw"/bin/f2c" && - test -d ""/sw"/include" && test -f ""/sw"/include/f2c.h" && - test -d ""/sw"/lib" && test -f ""/sw"/lib/libf2c.a" -then - F2C="/sw"/bin/f2c +if test -n "/opt" -a -d "/opt" -a -n "f2c" -a -d "/opt/bin" -a -x "/opt/bin/f2c" ; then + USE_F2C="USE_F2C = 1" - F2C_INC="/sw"/include + F2C=/opt/bin/f2c - F2C_LIB="/sw"/lib + F2C_BIN=/opt/bin - USE_F2C=USE_F2C=1 + F2C_DIR=/opt - F2C_DIR="/sw" + if test -n "f2c.h" -a -d "/opt/include" -a -f "/opt/include/f2c.h" ; then + F2C_INC=/opt/include + fi + if test -n "libf2c.a" -a -d "/opt/lib" -a -f "/opt/lib/libf2c.a" ; then + F2C_LIB=/opt/lib + + fi fi - if test "x$F2C" = "x"; then + if test -z "${!checkvar}" ; then -if test -d ""/opt"" && - test -d ""/opt"/bin" && test -f ""/opt"/bin/f2c" && - test -d ""/opt"/include" && test -f ""/opt"/include/f2c.h" && - test -d ""/opt"/lib" && test -f ""/opt"/lib/libf2c.a" -then - F2C="/opt"/bin/f2c +if test -n "/" -a -d "/" -a -n "f2c" -a -d "//bin" -a -x "//bin/f2c" ; then + USE_F2C="USE_F2C = 1" + + F2C=//bin/f2c + + F2C_BIN=//bin + + F2C_DIR=/ + + if test -n "f2c.h" -a -d "//include" -a -f "//include/f2c.h" ; then + F2C_INC=//include + + fi + if test -n "libf2c.a" -a -d "//lib" -a -f "//lib/libf2c.a" ; then + F2C_LIB=//lib + + fi +fi + + if test -z "${!checkvar}" ; then + checkresult="no" + fi + fi + fi + fi + fi + echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6 + fi +fi + + +echo "$as_me:$LINENO: checking for f95 bin/lib/include locations" >&5 +echo $ECHO_N "checking for f95 bin/lib/include locations... $ECHO_C" >&6 + +# Check whether --with-f95 or --without-f95 was given. +if test "${with_f95+set}" = set; then + withval="$with_f95" + f95pfxdir=$withval +else + f95pfxdir=nada +fi; + +# Check whether --with-f95-bin or --without-f95-bin was given. +if test "${with_f95_bin+set}" = set; then + withval="$with_f95_bin" + f95bindir=$withval +else + f95bindir=nada +fi; + +# Check whether --with-f95-lib or --without-f95-lib was given. +if test "${with_f95_lib+set}" = set; then + withval="$with_f95_lib" + f95libdir=$withval +else + f95libdir=nada +fi; + +# Check whether --with-f95-inc or --without-f95-inc was given. +if test "${with_f95_inc+set}" = set; then + withval="$with_f95_inc" + f95incdir=$withval +else + f95incdir=nada +fi; +pfxvar=f95pfxdir +binvar=f95bindir +incvar=f95incdir +libvar=f95libdir +if test "${!pfxvar}" != "nada" ; then - F2C_INC="/opt"/include +if test -n "${!pfxvar}" -a -d "${!pfxvar}" -a -n "f95" -a -d "${!pfxvar}/bin" -a -x "${!pfxvar}/bin/f95" ; then + USE_F95="USE_F95 = 1" - F2C_LIB="/opt"/lib + F95=${!pfxvar}/bin/f95 - USE_F2C=USE_F2C=1 + F95_BIN=${!pfxvar}/bin - F2C_DIR="/opt" + F95_DIR=${!pfxvar} + if test -n "" -a -d "${!pfxvar}/include" -a -f "${!pfxvar}/include/" ; then + F95_INC=${!pfxvar}/include + + fi + if test -n "libf97.dylib" -a -d "${!pfxvar}/lib" -a -f "${!pfxvar}/lib/libf97.dylib" ; then + F95_LIB=${!pfxvar}/lib + + fi fi - if test "x$F2C" = "x"; then - F2C= +elif test "${!binvar}" != "nada" ; then + if test "${!libvar}" != "nada" ; then + if test "${!incvar}" != "nada" ; then + if test -d "${!binvar}" ; then + if test -d "${!incvar}" ; then + if test -d "${!libvar}" ; then + F95=${!binvar}/f95 + + F95_BIN=${!binvar} - F2C_INC= + F95_INC=${!incvar} - F2C_LIB= + F95_LIB=${!libvar} - USE_F2C= + USE_F95=1 - checkresult="no" + echo "$as_me:$LINENO: result: found via --with options" >&5 +echo "${ECHO_T}found via --with options" >&6 + else + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f95-libdir value must be a directory" >&5 +echo "$as_me: error: The --with-f95-libdir value must be a directory" >&2;} + { (exit 1); exit 1; }; } + fi else - checkresult="yes, all 3 found" + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f95-incdir value must be a directory" >&5 +echo "$as_me: error: The --with-f95-incdir value must be a directory" >&2;} + { (exit 1); exit 1; }; } fi else - checkresult="yes, all 3 found" + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f95-bindir value must be a directory" >&5 +echo "$as_me: error: The --with-f95-bindir value must be a directory" >&2;} + { (exit 1); exit 1; }; } fi else - checkresult="yes, all 3 found" + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f95-incdir option must be specified" >&5 +echo "$as_me: error: The --with-f95-incdir option must be specified" >&2;} + { (exit 1); exit 1; }; } fi else - checkresult="yes, all 3 found" + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 + { { echo "$as_me:$LINENO: error: The --with-f95-libdir option must be specified" >&5 +echo "$as_me: error: The --with-f95-libdir option must be specified" >&2;} + { (exit 1); exit 1; }; } fi else - checkresult="yes, all 3 found" -fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 + tmppfxdir=`which f95 2>&1` + if test -n "$tmppfxdir" -a -d "${tmppfxdir%*f95}" -a \ + -d "${tmppfxdir%*f95}/.." ; then + tmppfxdir=`cd "${tmppfxdir%*f95}/.." ; pwd` -if test "x${F2C}" = "x"; then +if test -n "$tmppfxdir" -a -d "$tmppfxdir" -a -n "f95" -a -d "$tmppfxdir/bin" -a -x "$tmppfxdir/bin/f95" ; then + USE_F95="USE_F95 = 1" -# Check whether --with-f2cbin or --without-f2cbin was given. -if test "${with_f2cbin+set}" = set; then - withval="$with_f2cbin" - f2cbin=$withval -fi; -echo "$as_me:$LINENO: checking for f2c binary" >&5 -echo $ECHO_N "checking for f2c binary... $ECHO_C" >&6 -if test -d "$f2cbin" && test -f "$f2cbin/f2c"; then - F2C=$f2cbin/f2c + F95=$tmppfxdir/bin/f95 + + F95_BIN=$tmppfxdir/bin + + F95_DIR=$tmppfxdir + + if test -n "" -a -d "$tmppfxdir/include" -a -f "$tmppfxdir/include/" ; then + F95_INC=$tmppfxdir/include + + fi + if test -n "libf97.dylib" -a -d "$tmppfxdir/lib" -a -f "$tmppfxdir/lib/libf97.dylib" ; then + F95_LIB=$tmppfxdir/lib + + fi +fi + echo "$as_me:$LINENO: result: found in PATH at $tmppfxdir" >&5 +echo "${ECHO_T}found in PATH at $tmppfxdir" >&6 + else checkresult="yes" -else - checkresult="no" + checkvar="USE_"F95 + +if test -n "/usr" -a -d "/usr" -a -n "f95" -a -d "/usr/bin" -a -x "/usr/bin/f95" ; then + USE_F95="USE_F95 = 1" + + F95=/usr/bin/f95 + + F95_BIN=/usr/bin + + F95_DIR=/usr + + if test -n "" -a -d "/usr/include" -a -f "/usr/include/" ; then + F95_INC=/usr/include + + fi + if test -n "libf97.dylib" -a -d "/usr/lib" -a -f "/usr/lib/libf97.dylib" ; then + F95_LIB=/usr/lib + + fi fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 + if test -z "${!checkvar}" ; then -# Check whether --with-f2cinc or --without-f2cinc was given. -if test "${with_f2cinc+set}" = set; then - withval="$with_f2cinc" - f2cinc=$withval -fi; -echo "$as_me:$LINENO: checking for f2c.h" >&5 -echo $ECHO_N "checking for f2c.h... $ECHO_C" >&6 -if test -d "$f2cinc" && test -f "$f2cinc/f2c.h"; then - F2C_INC=$f2cinc +if test -n "/usr/local" -a -d "/usr/local" -a -n "f95" -a -d "/usr/local/bin" -a -x "/usr/local/bin/f95" ; then + USE_F95="USE_F95 = 1" - checkresult="yes" -else - checkresult="no" + F95=/usr/local/bin/f95 + + F95_BIN=/usr/local/bin + + F95_DIR=/usr/local + + if test -n "" -a -d "/usr/local/include" -a -f "/usr/local/include/" ; then + F95_INC=/usr/local/include + + fi + if test -n "libf97.dylib" -a -d "/usr/local/lib" -a -f "/usr/local/lib/libf97.dylib" ; then + F95_LIB=/usr/local/lib + + fi fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 + if test -z "${!checkvar}" ; then -# Check whether --with-f2clib or --without-f2clib was given. -if test "${with_f2clib+set}" = set; then - withval="$with_f2clib" - f2clib=$withval -fi; -echo "$as_me:$LINENO: checking for libf2c.a" >&5 -echo $ECHO_N "checking for libf2c.a... $ECHO_C" >&6 -if test -d "$f2clib" && test -f "$f2clib/libf2c.a"; then - F2C_LIB=$f2clib +if test -n "/sw" -a -d "/sw" -a -n "f95" -a -d "/sw/bin" -a -x "/sw/bin/f95" ; then + USE_F95="USE_F95 = 1" - checkresult="yes" -else - checkresult="no" + F95=/sw/bin/f95 + + F95_BIN=/sw/bin + + F95_DIR=/sw + + if test -n "" -a -d "/sw/include" -a -f "/sw/include/" ; then + F95_INC=/sw/include + + fi + if test -n "libf97.dylib" -a -d "/sw/lib" -a -f "/sw/lib/libf97.dylib" ; then + F95_LIB=/sw/lib + + fi fi -echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6 - echo "$as_me:$LINENO: checking whether f2c install is complete" >&5 -echo $ECHO_N "checking whether f2c install is complete... $ECHO_C" >&6 -if test -f "$F2C" && test -d "$F2C_INC" && test -d "$F2C_LIB"; then - USE_F2C=USE_F2C=1 + if test -z "${!checkvar}" ; then - checkresult="yes" -else - USE_F2C= +if test -n "/opt" -a -d "/opt" -a -n "f95" -a -d "/opt/bin" -a -x "/opt/bin/f95" ; then + USE_F95="USE_F95 = 1" + + F95=/opt/bin/f95 + + F95_BIN=/opt/bin - checkresult="no" + F95_DIR=/opt + + if test -n "" -a -d "/opt/include" -a -f "/opt/include/" ; then + F95_INC=/opt/include + + fi + if test -n "libf97.dylib" -a -d "/opt/lib" -a -f "/opt/lib/libf97.dylib" ; then + F95_LIB=/opt/lib + + fi fi -echo "$as_me:$LINENO: result: $checkresult" >&5 + + if test -z "${!checkvar}" ; then + +if test -n "/" -a -d "/" -a -n "f95" -a -d "//bin" -a -x "//bin/f95" ; then + USE_F95="USE_F95 = 1" + + F95=//bin/f95 + + F95_BIN=//bin + + F95_DIR=/ + + if test -n "" -a -d "//include" -a -f "//include/" ; then + F95_INC=//include + + fi + if test -n "libf97.dylib" -a -d "//lib" -a -f "//lib/libf97.dylib" ; then + F95_LIB=//lib + + fi +fi + + if test -z "${!checkvar}" ; then + checkresult="no" + fi + fi + fi + fi + fi + echo "$as_me:$LINENO: result: $checkresult" >&5 echo "${ECHO_T}$checkresult" >&6 + fi +fi + +echo "$as_me:$LINENO: checking sanity for program f95" >&5 +echo $ECHO_N "checking sanity for program f95... $ECHO_C" >&6 +sanity_path=`which f95 2>/dev/null` +if test "$?" -eq 0 -a -x "$sanity_path" ; then + sanity=`f95 -V 2>&1 | grep "NAGWare Fortran 95"` + if test -z "$sanity" ; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: Program f95 failed to pass sanity check." >&5 +echo "$as_me: error: Program f95 failed to pass sanity check." >&2;} + { (exit 1); exit 1; }; } + fi + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6 fi + echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -20385,11 +20714,18 @@ s, at FFLAGS@,$FFLAGS,;t t s, at ac_ct_F77@,$ac_ct_F77,;t t s, at LIBTOOL@,$LIBTOOL,;t t +s, at USE_F2C@,$USE_F2C,;t t s, at F2C@,$F2C,;t t +s, at F2C_BIN@,$F2C_BIN,;t t +s, at F2C_DIR@,$F2C_DIR,;t t s, at F2C_INC@,$F2C_INC,;t t s, at F2C_LIB@,$F2C_LIB,;t t -s, at USE_F2C@,$USE_F2C,;t t -s, at F2C_DIR@,$F2C_DIR,;t t +s, at USE_F95@,$USE_F95,;t t +s, at F95@,$F95,;t t +s, at F95_BIN@,$F95_BIN,;t t +s, at F95_DIR@,$F95_DIR,;t t +s, at F95_INC@,$F95_INC,;t t +s, at F95_LIB@,$F95_LIB,;t t s, at HAVE_RE_COMP@,$HAVE_RE_COMP,;t t s, at SPEC95_ROOT@,$SPEC95_ROOT,;t t s, at USE_SPEC95@,$USE_SPEC95,;t t Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.17 llvm-test/Makefile.config.in:1.18 --- llvm-test/Makefile.config.in:1.17 Wed Jul 13 23:49:51 2005 +++ llvm-test/Makefile.config.in Sat Jul 16 19:58:54 2005 @@ -49,6 +49,13 @@ F2C_INC := @F2C_INC@ F2C_LIB := @F2C_LIB@ +# F95: Enable LLVM to run Fortran benchmarks without a Fortran front-end + at USE_F95@ +F95_DIR := @F95_DIR@ +F95 := @F95@ +F95_INC := @F95_INC@ +F95_LIB := @F95_LIB@ + # Path to the Povray source code. @USE_POVRAY@ POVRAY_ROOT := @POVRAY_ROOT@ From llvm at cs.uiuc.edu Sat Jul 16 19:59:06 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Sat, 16 Jul 2005 19:59:06 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/m4/f2c.m4 Message-ID: <200507170059.TAA11008@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf/m4: f2c.m4 (r1.5) removed --- Log message: Implement checks for the NAGWare F95 Fortran -> C translator. --- Diffs of the changes: (+0 -0) 0 files changed From reid at x10sys.com Sun Jul 17 00:28:56 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Jul 2005 00:28:56 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200507170528.AAA11935@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.24 -> 1.25 --- Log message: Scratch Chris' itch about alternate names for programs. --- Diffs of the changes: (+1 -1) configure.ac | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.24 llvm-test/autoconf/configure.ac:1.25 --- llvm-test/autoconf/configure.ac:1.24 Sat Jul 16 19:58:54 2005 +++ llvm-test/autoconf/configure.ac Sun Jul 17 00:28:45 2005 @@ -92,7 +92,7 @@ dnl Check for GNU f2c FORTRAN -> C translator FIND_STD_PROGRAM(f2c,f2c.h,libf2c.a) dnl Check for the NAG f95 FORTRAN -> C translator -FIND_STD_PROGRAM(f95,,libf97.dylib) +FIND_STD_PROGRAM(f95,,libf97.dylib,[NAG Fortran]) CHECK_PROGRAM_SANITY([f95],[-V],[NAGWare Fortran 95]) dnl Checks for header files. From reid at x10sys.com Sun Jul 17 00:28:56 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Jul 2005 00:28:56 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Message-ID: <200507170528.AAA11939@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.24 -> 1.25 --- Log message: Scratch Chris' itch about alternate names for programs. --- Diffs of the changes: (+43 -38) configure | 81 ++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 43 insertions(+), 38 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.24 llvm-test/configure:1.25 --- llvm-test/configure:1.24 Sat Jul 16 19:58:53 2005 +++ llvm-test/configure Sun Jul 17 00:28:45 2005 @@ -1047,14 +1047,17 @@ both] --with-tags[=TAGS] include additional configurations [automatic] - --with-f2c=DIR Specify that f2c's install prefix is DIR - --with-f2c-bin=DIR Specify that f2c binary are in DIR - --with-f2c-lib=DIR Specify that f2c libs are in DIR - --with-f2c-inc=DIR Specify that f2c includes are in DIR - --with-f95=DIR Specify that f95's install prefix is DIR - --with-f95-bin=DIR Specify that f95 binary are in DIR - --with-f95-lib=DIR Specify that f95 libs are in DIR - --with-f95-inc=DIR Specify that f95 includes are in DIR + --with-f2c=DIR Specify that the f2c install prefix is DIR + --with-f2c-bin=DIR Specify that the f2c binary is in DIR + --with-f2c-lib=DIR Specify that f2c libraries are in DIR + --with-f2c-inc=DIR Specify that the f2c includes are in DIR + --with-NAG-Fortran=DIR Specify that the NAG-Fortran install prefix is DIR + --with-NAG-Fortran-bin=DIR + Specify that the NAG-Fortran binary is in DIR + --with-NAG-Fortran-lib=DIR + Specify that NAG-Fortran libraries are in DIR + --with-NAG-Fortran-inc=DIR + Specify that the NAG-Fortran includes are in DIR Some influential environment variables: CXX C++ compiler command @@ -3984,7 +3987,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3987 "configure"' > conftest.$ac_ext + echo '#line 3990 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4858,7 +4861,7 @@ # Provide some information about the compiler. -echo "$as_me:4861:" \ +echo "$as_me:4864:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5915,11 +5918,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5918: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5921: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:5922: \$? = $ac_status" >&5 + echo "$as_me:5925: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6158,11 +6161,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6161: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6164: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6165: \$? = $ac_status" >&5 + echo "$as_me:6168: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6218,11 +6221,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6221: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6224: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6225: \$? = $ac_status" >&5 + echo "$as_me:6228: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8403,7 +8406,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10700: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10701: \$? = $ac_status" >&5 + echo "$as_me:10704: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10754,11 +10757,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10757: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10760: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10761: \$? = $ac_status" >&5 + echo "$as_me:10764: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12115,7 +12118,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13056: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13057: \$? = $ac_status" >&5 + echo "$as_me:13060: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13110,11 +13113,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13113: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13116: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13117: \$? = $ac_status" >&5 + echo "$as_me:13120: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15149,11 +15152,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15152: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15155: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15156: \$? = $ac_status" >&5 + echo "$as_me:15159: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15392,11 +15395,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15395: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15398: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15399: \$? = $ac_status" >&5 + echo "$as_me:15402: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15452,11 +15455,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15455: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15458: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15459: \$? = $ac_status" >&5 + echo "$as_me:15462: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17637,7 +17640,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 echo $ECHO_N "checking for f2c bin/lib/include locations... $ECHO_C" >&6 @@ -19014,8 +19018,9 @@ fi -echo "$as_me:$LINENO: checking for f95 bin/lib/include locations" >&5 -echo $ECHO_N "checking for f95 bin/lib/include locations... $ECHO_C" >&6 + +echo "$as_me:$LINENO: checking for NAG-Fortran bin/lib/include locations" >&5 +echo $ECHO_N "checking for NAG-Fortran bin/lib/include locations... $ECHO_C" >&6 # Check whether --with-f95 or --without-f95 was given. if test "${with_f95+set}" = set; then From reid at x10sys.com Sun Jul 17 00:30:44 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Jul 2005 00:30:44 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/m4/find_std_program.m4 Message-ID: <200507170530.AAA11971@zion.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: find_std_program.m4 updated: 1.1 -> 1.2 --- Log message: Add a parameter to the FIND_STD_PROGRAM macro that allows an alternate name for the command line options. This helps with situations where the executable name sought is too generic and a more meaningful name needs to be used for the command line options. It also helps satisfy picky project leaders. --- Diffs of the changes: (+13 -7) find_std_program.m4 | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) Index: llvm/autoconf/m4/find_std_program.m4 diff -u llvm/autoconf/m4/find_std_program.m4:1.1 llvm/autoconf/m4/find_std_program.m4:1.2 --- llvm/autoconf/m4/find_std_program.m4:1.1 Sat Jul 16 19:50:40 2005 +++ llvm/autoconf/m4/find_std_program.m4 Sun Jul 17 00:30:33 2005 @@ -24,23 +24,29 @@ dnl Find a program via --with options, in the path, or well known places dnl dnl Parameters: -dnl $1 - program name +dnl $1 - program's executable name dnl $2 - header file name to check (optional) dnl $3 - library file name to check (optional) +dnl $4 - alternate (long) name for the program AC_DEFUN([FIND_STD_PROGRAM], [m4_define([allcapsname],translit($1,a-z,A-Z)) -AC_MSG_CHECKING([for ]$1[ bin/lib/include locations]) +m4_define([stdprog_long_name],ifelse($4,,translit($1,[ !@#$%^&*()-+={}[]:;"',./?],[-]),translit($4,[ !@#$%^&*()-+={}[]:;"',./?],[-]))) +AC_MSG_CHECKING([for ]stdprog_long_name()[ bin/lib/include locations]) AC_ARG_WITH($1, - AS_HELP_STRING([--with-]$1[=DIR],[Specify that ]$1['s install prefix is DIR]), - $1[pfxdir=$withval],$1[pfxdir=nada]) + AS_HELP_STRING([--with-]stdprog_long_name()[=DIR], + [Specify that the ]stdprog_long_name()[ install prefix is DIR]), + $1[pfxdir=$withval],$1[pfxdir=nada]) AC_ARG_WITH($1[-bin], - AS_HELP_STRING([--with-]$1[-bin=DIR],[Specify that ]$1[ binary are in DIR]), + AS_HELP_STRING([--with-]stdprog_long_name()[-bin=DIR], + [Specify that the ]stdprog_long_name()[ binary is in DIR]), $1[bindir=$withval],$1[bindir=nada]) AC_ARG_WITH($1[-lib], - AS_HELP_STRING([--with-]$1[-lib=DIR],[Specify that ]$1[ libs are in DIR]), + AS_HELP_STRING([--with-]stdprog_long_name()[-lib=DIR], + [Specify that ]stdprog_long_name()[ libraries are in DIR]), $1[libdir=$withval],$1[libdir=nada]) AC_ARG_WITH($1[-inc], - AS_HELP_STRING([--with-]$1[-inc=DIR],[Specify that ]$1[ includes are in DIR]), + AS_HELP_STRING([--with-]stdprog_long_name()[-inc=DIR], + [Specify that the ]stdprog_long_name()[ includes are in DIR]), $1[incdir=$withval],$1[incdir=nada]) pfxvar=$1pfxdir binvar=$1bindir From lattner at cs.uiuc.edu Sun Jul 17 00:38:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 17 Jul 2005 00:38:02 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200507170538.AAA12173@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.25 -> 1.26 --- Log message: Rename option to -nag-fortran --- Diffs of the changes: (+1 -1) configure.ac | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.25 llvm-test/autoconf/configure.ac:1.26 --- llvm-test/autoconf/configure.ac:1.25 Sun Jul 17 00:28:45 2005 +++ llvm-test/autoconf/configure.ac Sun Jul 17 00:37:51 2005 @@ -92,7 +92,7 @@ dnl Check for GNU f2c FORTRAN -> C translator FIND_STD_PROGRAM(f2c,f2c.h,libf2c.a) dnl Check for the NAG f95 FORTRAN -> C translator -FIND_STD_PROGRAM(f95,,libf97.dylib,[NAG Fortran]) +FIND_STD_PROGRAM(f95,,libf97.dylib,[nag fortran]) CHECK_PROGRAM_SANITY([f95],[-V],[NAGWare Fortran 95]) dnl Checks for header files. From lattner at cs.uiuc.edu Sun Jul 17 00:38:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 17 Jul 2005 00:38:05 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Message-ID: <200507170538.AAA12180@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.25 -> 1.26 --- Log message: Rename option to -nag-fortran --- Diffs of the changes: (+9 -9) configure | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.25 llvm-test/configure:1.26 --- llvm-test/configure:1.25 Sun Jul 17 00:28:45 2005 +++ llvm-test/configure Sun Jul 17 00:37:54 2005 @@ -1051,13 +1051,13 @@ --with-f2c-bin=DIR Specify that the f2c binary is in DIR --with-f2c-lib=DIR Specify that f2c libraries are in DIR --with-f2c-inc=DIR Specify that the f2c includes are in DIR - --with-NAG-Fortran=DIR Specify that the NAG-Fortran install prefix is DIR - --with-NAG-Fortran-bin=DIR - Specify that the NAG-Fortran binary is in DIR - --with-NAG-Fortran-lib=DIR - Specify that NAG-Fortran libraries are in DIR - --with-NAG-Fortran-inc=DIR - Specify that the NAG-Fortran includes are in DIR + --with-nag-fortran=DIR Specify that the nag-fortran install prefix is DIR + --with-nag-fortran-bin=DIR + Specify that the nag-fortran binary is in DIR + --with-nag-fortran-lib=DIR + Specify that nag-fortran libraries are in DIR + --with-nag-fortran-inc=DIR + Specify that the nag-fortran includes are in DIR Some influential environment variables: CXX C++ compiler command @@ -19019,8 +19019,8 @@ -echo "$as_me:$LINENO: checking for NAG-Fortran bin/lib/include locations" >&5 -echo $ECHO_N "checking for NAG-Fortran bin/lib/include locations... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for nag-fortran bin/lib/include locations" >&5 +echo $ECHO_N "checking for nag-fortran bin/lib/include locations... $ECHO_C" >&6 # Check whether --with-f95 or --without-f95 was given. if test "${with_f95+set}" = set; then From lattner at cs.uiuc.edu Sun Jul 17 23:30:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 17 Jul 2005 23:30:01 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c Message-ID: <200507180430.XAA24641@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests: 2005-07-17-INT-To-FP.c added (r1.1) --- Log message: thorough tests for int-to-fp casting of all sizes --- Diffs of the changes: (+19 -0) 2005-07-17-INT-To-FP.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c diff -c /dev/null llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.1 *** /dev/null Sun Jul 17 23:30:00 2005 --- llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c Sun Jul 17 23:29:50 2005 *************** *** 0 **** --- 1,19 ---- + // Test the various SINT-TO-FP and UINT-TO-FP conversions. + #include + + int main() { + unsigned i; + for (i = 0; i < 64; ++i) { + printf("%d %f, %f, %f, %f\n", i, + (double)(signed char)(i << 2), // i8 + (double)(signed short)(i << 10), // i16 + (double)(signed int)(i << 26), // i32 + (double)(signed long long)((long long)i << 58ULL)); // i64 + + printf("%d %f, %f, %f, %f\n", i, + (double)(unsigned char)(i << 2), // i8 + (double)(unsigned short)(i << 10), // i16 + (double)(unsigned int)(i << 26), // i32 + (double)(unsigned long long)((unsigned long long)i << 58ULL)); // i64 + } + } From lattner at cs.uiuc.edu Sun Jul 17 23:31:25 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 17 Jul 2005 23:31:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200507180431.XAA24751@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.142 -> 1.143 --- Log message: The assertion was wrong: the code only worked for i64. While we're at it, expand the code to work for all integer datatypes. This should unbreak alpha. --- Diffs of the changes: (+11 -3) LegalizeDAG.cpp | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.142 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.143 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.142 Fri Jul 15 21:02:34 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jul 17 23:31:14 2005 @@ -158,8 +158,6 @@ /// legal for the target. SDOperand SelectionDAGLegalize::ExpandLegalUINT_TO_FP(SDOperand Op0, MVT::ValueType DestVT) { - assert(Op0.getValueType() == MVT::i32 && - "This code only works for i32 input: extend in the future"); SDOperand Tmp1 = DAG.getNode(ISD::SINT_TO_FP, DestVT, Op0); SDOperand SignSet = DAG.getSetCC(ISD::SETLT, TLI.getSetCCResultTy(), @@ -170,7 +168,17 @@ SDOperand CstOffset = DAG.getNode(ISD::SELECT, Zero.getValueType(), SignSet, Four, Zero); - uint64_t FF = 0x5f800000ULL; + // If the sign bit of the integer is set, the large number will be treated as + // a negative number. To counteract this, the dynamic code adds an offset + // depending on the data type. + uint64_t FF; + switch (Op0.getValueType()) { + default: assert(0 && "Unsupported integer type!"); + case MVT::i8 : FF = 0x43800000ULL; break; // 2^8 (as a float) + case MVT::i16: FF = 0x47800000ULL; break; // 2^16 (as a float) + case MVT::i32: FF = 0x4F800000ULL; break; // 2^32 (as a float) + case MVT::i64: FF = 0x5F800000ULL; break; // 2^64 (as a float) + } if (TLI.isLittleEndian()) FF <<= 32; static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF);