[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.73 -> 1.74 --- Log message: Add support for a cycle counter intrinsic. As basically all processors have this and have it in about the same form, I think this makes sense. on X86, you do a RDTSC (64bit result, from any ring since the P5MMX) on Alpha, you do a RDCC on PPC, there is a sequence which may or may not work depending on how things are setup by the OS. Or something like that. Maybe someone who knows PPC can add support. Something about the time base register. on Sparc, you read %tick, which in some solaris versions (>=8) is readable by userspace on IA64 read ar.itc So I think the ulong is justified since all of those are 64bit. Support is slighly flaky on old chips (P5 and lower) and sometimes depends on OS (PPC, Sparc). But for modern OS/Hardware (aka this decade), we should be ok. I am still not sure what to do about lowering. I can either see a lower to 0, to gettimeofday (or the target os equivalent), or loudly complaining and refusing to continue. I am commiting an Alpha implementation. I will add the X86 implementation if I have to (I have use of it in the near future), but if someone who knows that backend (and the funky multi-register results) better wants to add it, it would take them a lot less time ;) TODO: better lowering and legalizing, and support more platforms --- Diffs of the changes: (+3 -0) SelectionDAGNodes.h |3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.73 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.74 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.73 Wed Nov 9 17:46:43 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Nov 11 10:45:18 2005 @@ -307,6 +307,9 @@ // PCMARKER - This corresponds to the pcmarker intrinsic. PCMARKER, +// READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic. +READCYCLECOUNTER, + // READPORT, WRITEPORT, READIO, WRITEIO - These correspond to the LLVM // intrinsics of the same name. The first operand is a token chain, the // other operands match the intrinsic. These produce a token chain in ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Intrinsics.h
Changes in directory llvm/include/llvm: Intrinsics.h updated: 1.32 -> 1.33 --- Log message: Add support for a cycle counter intrinsic. As basically all processors have this and have it in about the same form, I think this makes sense. on X86, you do a RDTSC (64bit result, from any ring since the P5MMX) on Alpha, you do a RDCC on PPC, there is a sequence which may or may not work depending on how things are setup by the OS. Or something like that. Maybe someone who knows PPC can add support. Something about the time base register. on Sparc, you read %tick, which in some solaris versions (>=8) is readable by userspace on IA64 read ar.itc So I think the ulong is justified since all of those are 64bit. Support is slighly flaky on old chips (P5 and lower) and sometimes depends on OS (PPC, Sparc). But for modern OS/Hardware (aka this decade), we should be ok. I am still not sure what to do about lowering. I can either see a lower to 0, to gettimeofday (or the target os equivalent), or loudly complaining and refusing to continue. I am commiting an Alpha implementation. I will add the X86 implementation if I have to (I have use of it in the near future), but if someone who knows that backend (and the funky multi-register results) better wants to add it, it would take them a lot less time ;) TODO: better lowering and legalizing, and support more platforms --- Diffs of the changes: (+5 -4) Intrinsics.h |9 + 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Intrinsics.h diff -u llvm/include/llvm/Intrinsics.h:1.32 llvm/include/llvm/Intrinsics.h:1.33 --- llvm/include/llvm/Intrinsics.h:1.32 Tue May 3 12:19:29 2005 +++ llvm/include/llvm/Intrinsics.h Fri Nov 11 10:45:18 2005 @@ -32,10 +32,11 @@ vacopy, // Used to implement the va_copy macro in C // Code generator intrinsics. -returnaddress, // Yields the return address of a dynamic call frame -frameaddress, // Yields the frame address of a dynamic call frame -prefetch, // Prefetch a value into the cache -pcmarker, // Export a PC from near the marker +returnaddress,// Yields the return address of a dynamic call frame +frameaddress, // Yields the frame address of a dynamic call frame +prefetch, // Prefetch a value into the cache +pcmarker, // Export a PC from near the marker +readcyclecounter, // Read cycle counter register // setjmp/longjmp intrinsics. setjmp, // Used to represent a setjmp call in C ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.35 -> 1.36 --- Log message: continued readcyclecounter support --- Diffs of the changes: (+6 -0) IntrinsicLowering.cpp |6 ++ 1 files changed, 6 insertions(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.35 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.36 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.35 Sat Oct 22 23:37:20 2005 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Fri Nov 11 10:46:18 2005 @@ -262,6 +262,12 @@ case Intrinsic::pcmarker: break;// Simply strip out pcmarker on unsupported architectures + case Intrinsic::readcyclecounter: { +std::cerr << "WARNING: this target does not support the llvm.readcyclecounter" + << " intrinsic. It is being lowered to a constant 0\n"; +CI->replaceAllUsesWith(ConstantUInt::get(Type::ULongTy, 0)); +break; + } case Intrinsic::dbg_stoppoint: case Intrinsic::dbg_region_start: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.206 -> 1.207 SelectionDAG.cpp updated: 1.211 -> 1.212 SelectionDAGISel.cpp updated: 1.97 -> 1.98 --- Log message: continued readcyclecounter support --- Diffs of the changes: (+9 -0) LegalizeDAG.cpp |5 + SelectionDAG.cpp |1 + SelectionDAGISel.cpp |3 +++ 3 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.206 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.207 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.206 Wed Nov 9 17:47:37 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Nov 11 10:46:18 2005 @@ -1122,6 +1122,11 @@ if (Tmp1 != Node->getOperand(0)) Result = DAG.getNode(ISD::PCMARKER, MVT::Other, Tmp1,Node->getOperand(1)); break; + case ISD::READCYCLECOUNTER: +Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain +if (Tmp1 != Node->getOperand(0)) + Result = DAG.getNode(ISD::READCYCLECOUNTER, MVT::i64, Tmp1); +break; case ISD::TRUNCSTORE: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the pointer. Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.211 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.212 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.211Wed Nov 9 17:47:37 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Nov 11 10:46:18 2005 @@ -1624,6 +1624,7 @@ } case ISD::PCMARKER: return "PCMarker"; + case ISD::READCYCLECOUNTER: return "ReadCycleCounter"; case ISD::SRCVALUE: return "SrcValue"; case ISD::VALUETYPE: return "ValueType"; case ISD::EntryToken:return "EntryToken"; Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.97 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.98 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.97 Wed Nov 9 13:44:01 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Nov 11 10:46:18 2005 @@ -804,6 +804,9 @@ DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Tmp)); return 0; } + case Intrinsic::readcyclecounter: +setValue(&I, DAG.getNode(ISD::READCYCLECOUNTER, MVT::i64, getRoot())); +return 0; case Intrinsic::cttz: setValue(&I, DAG.getNode(ISD::CTTZ, getValue(I.getOperand(1)).getValueType(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Verifier.cpp
Changes in directory llvm/lib/VMCore: Function.cpp updated: 1.95 -> 1.96 Verifier.cpp updated: 1.134 -> 1.135 --- Log message: continued readcyclecounter support --- Diffs of the changes: (+12 -3) Function.cpp |7 --- Verifier.cpp |8 2 files changed, 12 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.95 llvm/lib/VMCore/Function.cpp:1.96 --- llvm/lib/VMCore/Function.cpp:1.95 Fri May 6 15:26:43 2005 +++ llvm/lib/VMCore/Function.cppFri Nov 11 10:46:18 2005 @@ -243,9 +243,10 @@ if (getName() == "llvm.pcmarker") return Intrinsic::pcmarker; break; case 'r': -if (getName() == "llvm.returnaddress") return Intrinsic::returnaddress; -if (getName() == "llvm.readport") return Intrinsic::readport; -if (getName() == "llvm.readio") return Intrinsic::readio; +if (getName() == "llvm.returnaddress")return Intrinsic::returnaddress; +if (getName() == "llvm.readport") return Intrinsic::readport; +if (getName() == "llvm.readio") return Intrinsic::readio; +if (getName() == "llvm.readcyclecounter") return Intrinsic::readcyclecounter; break; case 's': if (getName() == "llvm.setjmp") return Intrinsic::setjmp; Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.134 llvm/lib/VMCore/Verifier.cpp:1.135 --- llvm/lib/VMCore/Verifier.cpp:1.134 Sat Jun 18 13:34:52 2005 +++ llvm/lib/VMCore/Verifier.cppFri Nov 11 10:46:18 2005 @@ -726,6 +726,14 @@ NumArgs = 2; break; + case Intrinsic::readcyclecounter: +Assert1(FT->getNumParams() == 0, +"Illegal # arguments for intrinsic function!", IF); +Assert1(FT->getReturnType() == Type::ULongTy, +"Return type is not ulong!", IF); +NumArgs = 0; +break; + case Intrinsic::ctpop: case Intrinsic::ctlz: case Intrinsic::cttz: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.73 -> 1.74 --- Log message: continued readcyclecounter support --- 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.73 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.74 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.73 Wed Aug 24 11:58:56 2005 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppFri Nov 11 10:46:18 2005 @@ -709,6 +709,7 @@ // LLVM intrinsics: "llvm.frameaddress", "llvm.returnaddress", "llvm.readport", "llvm.isunordered", "llvm.sqrt", "llvm.ctpop", "llvm.ctlz", "llvm.cttz", + "llvm.readcyclecounter", "abs", "labs", "llabs", "imaxabs", "fabs", "fabsf", "fabsl", "trunc", "truncf", "truncl", "ldexp", ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrFormats.td AlphaInstrInfo.td
Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.179 -> 1.180 AlphaInstrFormats.td updated: 1.12 -> 1.13 AlphaInstrInfo.td updated: 1.71 -> 1.72 --- Log message: continued readcyclecounter support --- Diffs of the changes: (+16 -1) AlphaISelPattern.cpp |5 + AlphaInstrFormats.td |9 + AlphaInstrInfo.td|3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.179 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.180 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.179Thu Nov 10 10:59:55 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Nov 11 10:46:18 2005 @@ -549,6 +549,11 @@ Node->dump(); assert(0 && "Node not handled!\n"); + case ISD::READCYCLECOUNTER: +Select(N.getOperand(0)); //Select chain +BuildMI(BB, Alpha::RPCC, 1, Result).addReg(Alpha::R31); +return Result; + case ISD::CTPOP: case ISD::CTTZ: case ISD::CTLZ: Index: llvm/lib/Target/Alpha/AlphaInstrFormats.td diff -u llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.12 llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.13 --- llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.12 Wed Nov 9 13:17:08 2005 +++ llvm/lib/Target/Alpha/AlphaInstrFormats.td Fri Nov 11 10:46:18 2005 @@ -50,6 +50,15 @@ let Inst{20-16} = Rb; let Inst{15-0} = disp; } +class MfcForm opcode, bits<16> fc, string asmstr> +: InstAlpha { + bits<5> Ra; + bits<5> Rb; + + let Inst{25-21} = Ra; + let Inst{20-16} = Rb; + let Inst{15-0} = fc; +} class MgForm opcode, string asmstr> : InstAlpha { Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.71 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.72 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.71Wed Nov 9 13:17:08 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Fri Nov 11 10:46:18 2005 @@ -465,6 +465,8 @@ def FBLT : FBForm<0x32, "fblt $RA,$DISP">; //Floating branch if < zero def FBNE : FBForm<0x35, "fbne $RA,$DISP">; //Floating branch if != zero +def RPCC : MfcForm<0x18, 0xC000, "rpcc $RA">; //Read process cycle counter + //Basic Floating point ops //Floats @@ -558,7 +560,6 @@ //LDQ_L Mem 2B Load quadword locked //LDQ_U Mem 0B Load unaligned quadword //MB Mfc 18.4000 Memory barrier -//RPCC Mfc 18.C000 Read process cycle counter //STL_C Mem 2E Store longword conditional //STQ_C Mem 2F Store quadword conditional //STQ_U Mem 0F Store unaligned quadword ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.116 -> 1.117 --- Log message: continued readcyclecounter support --- Diffs of the changes: (+35 -1) LangRef.html | 36 +++- 1 files changed, 35 insertions(+), 1 deletion(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.116 llvm/docs/LangRef.html:1.117 --- llvm/docs/LangRef.html:1.116Thu Nov 10 20:15:27 2005 +++ llvm/docs/LangRef.html Fri Nov 11 10:46:55 2005 @@ -128,6 +128,7 @@ 'llvm.frameaddress' Intrinsic 'llvm.prefetch' Intrinsic 'llvm.pcmarker' Intrinsic + llvm.readcyclecounter' Intrinsic Operating System Intrinsics @@ -2811,6 +2812,39 @@ + + + 'llvm.readcyclecounter' Intrinsic + + + + +Syntax: + + declare ulong %llvm.readcyclecounter( ) + + +Overview: + + + +The 'llvm.readcyclecounter' intrinsic provides access to the cycle +counter register (or similar low latency, high accuracy clocks) on those targets +that support it. On X86, it should map to RDTSC. On Alpha, it should map to RPCC. +As the backing counters overflow quickly (on the order of 9 seconds on alpha), this +should only be used for small timings. + + +Semantics: + + +When directly supported, reading the cycle counter should not modify any memory. +Implementations are allowed to either return a application specific value or a +system wide value. On backends without support, this is lowered to a constant 0. + + + + @@ -3388,7 +3422,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.cs.uiuc.edu";>The LLVM Compiler Infrastructure - Last modified: $Date: 2005/11/11 02:15:27 $ + Last modified: $Date: 2005/11/11 16:46:55 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/rpcc.ll
Changes in directory llvm/test/Regression/CodeGen/Alpha: rpcc.ll added (r1.1) --- Log message: continued readcyclecounter support --- Diffs of the changes: (+10 -0) rpcc.ll | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/rpcc.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/rpcc.ll:1.1 *** /dev/null Fri Nov 11 10:47:41 2005 --- llvm/test/Regression/CodeGen/Alpha/rpcc.ll Fri Nov 11 10:47:31 2005 *** *** 0 --- 1,10 + ; RUN: llvm-as < %s | llc -march=alpha | grep rpcc + + declare ulong %llvm.readcyclecounter() + + ulong %foo() { + entry: + %tmp.1 = call ulong %llvm.readcyclecounter () + ret ulong %tmp.1 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.74 -> 1.75 --- Log message: prevent cse of readcyclecounter --- Diffs of the changes: (+0 -1) BasicAliasAnalysis.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.74 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.75 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.74 Fri Nov 11 10:46:18 2005 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppFri Nov 11 13:02:54 2005 @@ -709,7 +709,6 @@ // LLVM intrinsics: "llvm.frameaddress", "llvm.returnaddress", "llvm.readport", "llvm.isunordered", "llvm.sqrt", "llvm.ctpop", "llvm.ctlz", "llvm.cttz", - "llvm.readcyclecounter", "abs", "labs", "llabs", "imaxabs", "fabs", "fabsf", "fabsl", "trunc", "truncf", "truncl", "ldexp", ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.180 -> 1.181 --- Log message: Fix a bunch more alpha regressions --- Diffs of the changes: (+1 -1) AlphaISelPattern.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.180 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.181 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.180Fri Nov 11 10:46:18 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Nov 11 13:52:25 2005 @@ -1533,7 +1533,7 @@ N.getOperand(0).getValueType() == MVT::f32 && "only f32 to f64 conversion supported here"); Tmp1 = SelectExpr(N.getOperand(0)); -BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Alpha::F31).addReg(Tmp1); +BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp1); return Result; case ISD::ConstantFP: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c
Changes in directory llvm-test/SingleSource/UnitTests: 2005-07-17-INT-To-FP.c updated: 1.3 -> 1.4 --- Log message: I can only assume the test case is suppose to be correct. Passing the wrong number of args to printf is bad :) --- Diffs of the changes: (+2 -1) 2005-07-17-INT-To-FP.c |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c diff -u llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.3 llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.4 --- llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.3 Fri Aug 19 11:08:50 2005 +++ llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c Fri Nov 11 16:25:53 2005 @@ -34,7 +34,8 @@ } // edge case tests for (i = 0; i < (sizeof(tests) / sizeof(int)); i++) { -printf("%d %f %f %f %f\n", (double)(unsigned)tests[i], +printf("%d %f %f %f %f\n", i, + (double)(unsigned)tests[i], (double)( signed)tests[i], (float) (unsigned)tests[i], (float) ( signed)tests[i]); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.74 -> 1.75 --- Log message: added a chain output --- Diffs of the changes: (+3 -0) SelectionDAGNodes.h |3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.74 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.75 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.74 Fri Nov 11 10:45:18 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Nov 11 16:48:54 2005 @@ -308,6 +308,9 @@ PCMARKER, // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic. +// The only operand is a chain and a value and a chain are produced. The +// value is the contents of the architecture specific cycle counter like +// register (or other high accuracy low latency clock source) READCYCLECOUNTER, // READPORT, WRITEPORT, READIO, WRITEIO - These correspond to the LLVM ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.98 -> 1.99 --- Log message: added a chain output --- Diffs of the changes: (+10 -2) SelectionDAGISel.cpp | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.98 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.99 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.98 Fri Nov 11 10:46:18 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Nov 11 16:48:54 2005 @@ -804,9 +804,17 @@ DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Tmp)); return 0; } - case Intrinsic::readcyclecounter: -setValue(&I, DAG.getNode(ISD::READCYCLECOUNTER, MVT::i64, getRoot())); + case Intrinsic::readcyclecounter: { +std::vector VTs; +VTs.push_back(MVT::i64); +VTs.push_back(MVT::Other); +std::vector Ops; +Ops.push_back(getRoot()); +SDOperand Tmp = DAG.getNode(ISD::READCYCLECOUNTER, VTs, Ops); +setValue(&I, Tmp); +DAG.setRoot(Tmp.getValue(1)); return 0; + } case Intrinsic::cttz: setValue(&I, DAG.getNode(ISD::CTTZ, getValue(I.getOperand(1)).getValueType(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.181 -> 1.182 --- Log message: generate chain result --- Diffs of the changes: (+5 -0) AlphaISelPattern.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.181 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.182 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.181Fri Nov 11 13:52:25 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Nov 11 17:02:55 2005 @@ -551,6 +551,11 @@ case ISD::READCYCLECOUNTER: Select(N.getOperand(0)); //Select chain +if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token +else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + BuildMI(BB, Alpha::RPCC, 1, Result).addReg(Alpha::R31); return Result; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.182 -> 1.183 --- Log message: fix yet more regressions --- Diffs of the changes: (+1 -1) AlphaISelPattern.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.182 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.183 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.182Fri Nov 11 17:02:55 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Nov 11 17:08:46 2005 @@ -1530,7 +1530,7 @@ N.getOperand(0).getValueType() == MVT::f64 && "only f64 to f32 conversion supported here"); Tmp1 = SelectExpr(N.getOperand(0)); -BuildMI(BB, Alpha::CVTTS, 1, Result).addReg(Alpha::F31).addReg(Tmp1); +BuildMI(BB, Alpha::CVTTS, 1, Result).addReg(Tmp1); return Result; case ISD::FP_EXTEND: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.26 -> 1.27 --- Log message: Add support for putting globals in a particular section --- Diffs of the changes: (+9 -4) GlobalValue.h | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.26 llvm/include/llvm/GlobalValue.h:1.27 --- llvm/include/llvm/GlobalValue.h:1.26Sun Nov 6 02:22:18 2005 +++ llvm/include/llvm/GlobalValue.h Fri Nov 11 18:09:49 2005 @@ -38,12 +38,13 @@ protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") -: Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), - Parent(0), Alignment(0) { } +: Constant(Ty, vty, Ops, NumOps, name), + Parent(0), Linkage(linkage), Alignment(0) { } - LinkageTypes Linkage; // The linkage of this global Module *Parent; - unsigned Alignment; + LinkageTypes Linkage; // The linkage of this global + unsigned Alignment; // Alignment of this symbol, must be power of two + std::string Section;// Section to emit this into, empty mean default public: ~GlobalValue() { removeDeadConstantUsers(); // remove any dead constants using this. @@ -55,6 +56,10 @@ Alignment = Align; } + bool hasSection() const { return !Section.empty(); } + const std::string &getSection() const { return Section; } + void setSection(const std::string &S) { Section = S; } + /// If the usage is empty (except transitively dead constants), then this /// global value can can be safely deleted since the destructor will /// delete the dead constants as well. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Feature/global_section.ll
Changes in directory llvm/test/Feature: global_section.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+10 -0) global_section.ll | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Feature/global_section.ll diff -c /dev/null llvm/test/Feature/global_section.ll:1.1 *** /dev/null Fri Nov 11 18:10:13 2005 --- llvm/test/Feature/global_section.ll Fri Nov 11 18:10:03 2005 *** *** 0 --- 1,10 + ; RUN: llvm-as %s -o - | llvm-dis > %t1.ll + ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll + ; RUN: diff %t1.ll %t2.ll + + %X = global int 4, section "foo", align 16 + + void %test() section "bar" { + ret void + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.184 -> 1.185 --- Log message: print section info --- Diffs of the changes: (+7 -4) AsmWriter.cpp | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.184 llvm/lib/VMCore/AsmWriter.cpp:1.185 --- llvm/lib/VMCore/AsmWriter.cpp:1.184 Sun Nov 6 00:48:53 2005 +++ llvm/lib/VMCore/AsmWriter.cpp Fri Nov 11 18:10:19 2005 @@ -833,10 +833,11 @@ writeOperand(GV->getInitializer(), false, isa(C)); } - if (GV->getAlignment()) { + if (GV->hasSection()) +Out << ", section \"" << GV->getSection() << '"'; + if (GV->getAlignment()) Out << ", align " << GV->getAlignment(); - } - + printInfoComment(*GV); Out << "\n"; } @@ -944,9 +945,11 @@ } Out << ')'; + if (F->hasSection()) +Out << " section \"" << F->getSection() << '"'; if (F->getAlignment()) Out << " align " << F->getAlignment(); - + if (F->isExternal()) { Out << "\n"; } else { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.237 -> 1.238 --- Log message: Parse section info --- Diffs of the changes: (+41 -9) llvmAsmParser.y | 50 +- 1 files changed, 41 insertions(+), 9 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.237 llvm/lib/AsmParser/llvmAsmParser.y:1.238 --- llvm/lib/AsmParser/llvmAsmParser.y:1.237Wed Nov 9 19:42:43 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Nov 11 18:11:10 2005 @@ -517,7 +517,8 @@ /// this is a declaration, otherwise it is a definition. static void ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, bool isConstantGlobal, const Type *Ty, -Constant *Initializer, unsigned Align) { +Constant *Initializer, char *Section, +unsigned Align) { if (Align != 0 && !isPowerOf2_32(Align)) ThrowException("Global alignment must be a power of two!"); @@ -551,6 +552,10 @@ GV->setLinkage(Linkage); GV->setConstant(isConstantGlobal); GV->setAlignment(Align); +if (Section) { + free(Section); + GV->setSection(Section); +} InsertValue(GV, CurModule.Values); return; } @@ -578,6 +583,10 @@ EGV->setConstant(true); EGV->setLinkage(Linkage); EGV->setAlignment(Align); +if (Section) { + free(Section); + EGV->setSection(Section); +} return; } @@ -591,6 +600,10 @@ new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, CurModule.CurrentModule); GV->setAlignment(Align); + if (Section) { +free(Section); +GV->setSection(Section); + } InsertValue(GV, CurModule.Values); } @@ -956,9 +969,10 @@ %token VAR_ID LABELSTR STRINGCONSTANT %type Name OptName OptAssign %type OptAlign OptCAlign +%type OptSection OptCSection SectionString %token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK -%token DECLARE GLOBAL CONSTANT VOLATILE +%token DECLARE GLOBAL CONSTANT SECTION VOLATILE %token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN %token DEPLIBS CALL TAIL @@ -1049,6 +1063,19 @@ OptCAlign : /*empty*/{ $$ = 0; } | ',' ALIGN EUINT64VAL { $$ = $3; }; +SectionString : SECTION STRINGCONSTANT { + for (unsigned i = 0, e = strlen($2); i != e; ++i) +if ($2[i] == '"' || $2[i] == '\\') + ThrowException("Invalid character in section name!"); + $$ = $2; +}; + +OptSection : /*empty*/ { $$ = 0; } | + SectionString { $$ = $1; }; +OptCSection : /*empty*/ { $$ = 0; } | + ',' SectionString { $$ = $2; }; + + //===--===// // Types includes all predefined types... except void, because it can only be // used in specific contexts (function returning void for example). To have @@ -1557,12 +1584,12 @@ } | ConstPool FunctionProto { // Function prototypes can be in const pool } - | ConstPool OptAssign OptLinkage GlobalType ConstVal OptCAlign { + | ConstPool OptAssign OptLinkage GlobalType ConstVal OptCSection OptCAlign { if ($5 == 0) ThrowException("Global value initializer is not a constant!"); -ParseGlobalVariable($2, $3, $4, $5->getType(), $5, $6); +ParseGlobalVariable($2, $3, $4, $5->getType(), $5, $6, $7); } - | ConstPool OptAssign EXTERNAL GlobalType Types OptCAlign { -ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0, $6); + | ConstPool OptAssign EXTERNAL GlobalType Types OptCSection OptCAlign { +ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0, $6, $7); delete $5; } | ConstPool TARGET TargetDefinition { @@ -1647,14 +1674,15 @@ $$ = 0; }; -FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')' OptAlign { +FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')' + OptSection OptAlign { UnEscapeLexed($3); std::string FunctionName($3); free($3); // Free strdup'd memory! if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy) ThrowException("LLVM functions cannot return aggregate types!"); - if ($7 != 0 && !isPowerOf2_32($7)) + if ($8 != 0 && !isPowerOf2_32($8)) ThrowException("Function alignment must be a power of two!"); std::vector ParamTypeList; @@ -1707,7 +1735,11 @@ CurFun.FunctionStart(Fn); Fn->setCallingConv($1); - Fn->setAlignment($7); + Fn->setAlignment($8); + if ($7) { +Fn->setSection($7); +free($7); + } // Add all of the arguments we parsed to the function... if ($5) { // Is null if empty... ___ llvm-commits mailing list llvm
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.65 -> 1.66 --- Log message: add a token --- Diffs of the changes: (+2 -1) Lexer.l |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.65 llvm/lib/AsmParser/Lexer.l:1.66 --- llvm/lib/AsmParser/Lexer.l:1.65 Sat Nov 5 03:21:28 2005 +++ llvm/lib/AsmParser/Lexer.l Fri Nov 11 18:11:30 2005 @@ -210,6 +210,8 @@ little { return LITTLE; } big { return BIG; } volatile{ return VOLATILE; } +align { return ALIGN; } +section { return SECTION; } cc { return CC_TOK; } ccc { return CCC_TOK; } @@ -231,7 +233,6 @@ label { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } type{ return TYPE; } opaque { return OPAQUE; } -align { return ALIGN; } add { RET_TOK(BinaryOpVal, Add, ADD); } sub { RET_TOK(BinaryOpVal, Sub, SUB); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.117 -> 1.118 --- Log message: document sections --- Diffs of the changes: (+11 -4) LangRef.html | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.117 llvm/docs/LangRef.html:1.118 --- llvm/docs/LangRef.html:1.117Fri Nov 11 10:46:55 2005 +++ llvm/docs/LangRef.html Fri Nov 11 18:45:07 2005 @@ -495,7 +495,8 @@ Global variables define regions of memory allocated at compilation time -instead of run-time. Global variables may optionally be initialized, and may +instead of run-time. Global variables may optionally be initialized, may have +an explicit section to be placed in, and may have an optional explicit alignment specified. A variable may be defined as a global "constant," which indicates that the contents of the variable will never be modified (enabling better @@ -518,6 +519,9 @@ describe a region of memory, and all memory objects in LLVM are accessed through pointers. +LLVM allows an explicit section to be specified for globals. If the target +supports it, it will emit globals to the section specified. + An explicit alignment may be specified for a global. If not present, or if the alignment is set to zero, the alignment of the global is set by the target to whatever it feels convenient. If an explicit alignment is specified, the @@ -536,8 +540,8 @@ LLVM function definitions consist of an optional linkage type, an optional calling convention, a return -type, a function name, a (possibly empty) argument list, an optional alignment, -an opening curly brace, +type, a function name, a (possibly empty) argument list, an optional section, +an optional alignment, an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM function declarations are defined with the "declare" keyword, an optional calling convention, a return type, a function name, @@ -560,6 +564,9 @@ considered different functions, and LLVM will resolve references to each appropriately. +LLVM allows an explicit section to be specified for functions. If the target +supports it, it will emit functions to the section specified. + An explicit alignment may be specified for a function. If not present, or if the alignment is set to zero, the alignment of the function is set by the target to whatever it feels convenient. If an explicit alignment is specified, the @@ -3422,7 +3429,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.cs.uiuc.edu";>The LLVM Compiler Infrastructure - Last modified: $Date: 2005/11/11 16:46:55 $ + Last modified: $Date: 2005/11/12 00:45:07 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.61 -> 1.62 --- Log message: Fix operator precedence bug caught by VC++. --- Diffs of the changes: (+2 -2) DAGCombiner.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.61 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.62 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.61 Wed Nov 9 17:47:37 2005 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 11 18:59:01 2005 @@ -967,8 +967,8 @@ // fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1) if (N1C && N0.getOpcode() == ISD::SIGN_EXTEND_INREG) { unsigned ExtendBits = -MVT::getSizeInBits(cast(N0.getOperand(1))->getVT()); -if (ExtendBits == 64 || (N1C->getValue() & (~0ULL << ExtendBits) == 0)) +MVT::getSizeInBits(cast(N0.getOperand(1))->getVT()); +if (ExtendBits == 64 || ((N1C->getValue() & (~0ULL << ExtendBits)) == 0)) return DAG.getNode(ISD::AND, VT, N0.getOperand(0), N1); } // fold (and (or x, 0x), 0xFF) -> 0xFF ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.112 -> 1.113 --- Log message: Fix VC++ warning that bools cannot be ORed. --- Diffs of the changes: (+1 -1) Writer.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.112 llvm/lib/Bytecode/Writer/Writer.cpp:1.113 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.112 Sun Nov 6 01:46:13 2005 +++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Nov 11 18:59:39 2005 @@ -948,7 +948,7 @@ // The extension word has this format: bit 0 = has initializer, bit 1-3 = // linkage, bit 4-8 = alignment (log2), bits 10+ = future use. - unsigned ExtWord = I->hasInitializer() | (getEncodedLinkage(I) << 1) | + unsigned ExtWord = (unsigned)I->hasInitializer() | (getEncodedLinkage(I) << 1) | ((Log2_32(I->getAlignment())+1) << 4); output_vbr(ExtWord); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.113 -> 1.114 --- Log message: Wrap long line. --- Diffs of the changes: (+2 -1) Writer.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.113 llvm/lib/Bytecode/Writer/Writer.cpp:1.114 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.113 Fri Nov 11 18:59:39 2005 +++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Nov 11 19:01:50 2005 @@ -948,7 +948,8 @@ // The extension word has this format: bit 0 = has initializer, bit 1-3 = // linkage, bit 4-8 = alignment (log2), bits 10+ = future use. - unsigned ExtWord = (unsigned)I->hasInitializer() | (getEncodedLinkage(I) << 1) | + unsigned ExtWord = (unsigned)I->hasInitializer() | + (getEncodedLinkage(I) << 1) | ((Log2_32(I->getAlignment())+1) << 4); output_vbr(ExtWord); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.173 -> 1.174 --- Log message: Read and write section info from/to .bc files --- Diffs of the changes: (+42 -10) Reader.cpp | 52 ++-- 1 files changed, 42 insertions(+), 10 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.173 llvm/lib/Bytecode/Reader/Reader.cpp:1.174 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.173 Sun Nov 6 02:23:17 2005 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Nov 11 19:33:40 2005 @@ -1891,6 +1891,10 @@ if (Handler) Handler->handleModuleGlobalsBegin(); + // SectionID - If a global has an explicit section specified, this map + // remembers the ID until we can translate it into a string. + std::map SectionID; + // Read global variables... unsigned VarType = read_vbr_uint(); while (VarType != Type::VoidTyID) { // List is terminated by Void @@ -1903,6 +1907,7 @@ bool isConstant = VarType & 1; bool hasInitializer = (VarType & 2) != 0; unsigned Alignment = 0; +unsigned GlobalSectionID = 0; // An extension word is present when linkage = 3 (internal) and hasinit = 0. if (LinkageID == 3 && !hasInitializer) { @@ -1912,6 +1917,9 @@ hasInitializer = ExtWord & 1; LinkageID = (ExtWord >> 1) & 7; Alignment = (1 << ((ExtWord >> 4) & 31)) >> 1; + + if (ExtWord & (1 << 9)) // Has a section ID. +GlobalSectionID = read_vbr_uint(); } GlobalValue::LinkageTypes Linkage; @@ -1942,6 +1950,9 @@ GV->setAlignment(Alignment); insertValue(GV, SlotNo, ModuleValues); +if (GlobalSectionID != 0) + SectionID[GV] = GlobalSectionID; + unsigned initSlot = 0; if (hasInitializer) { initSlot = read_vbr_uint(); @@ -1975,9 +1986,8 @@ const FunctionType* FTy = cast(cast(Ty)->getElementType()); - // Insert the place holder. -Function* Func = new Function(FTy, GlobalValue::ExternalLinkage, +Function *Func = new Function(FTy, GlobalValue::ExternalLinkage, "", TheModule); insertValue(Func, (FnSignature & (~0U >> 1)) >> 5, ModuleValues); @@ -1997,6 +2007,9 @@ unsigned ExtWord = read_vbr_uint(); Alignment = (1 << (ExtWord & 31)) >> 1; CC |= ((ExtWord >> 5) & 15) << 4; + + if (ExtWord & (1 << 10)) // Has a section ID. +SectionID[Func] = read_vbr_uint(); } Func->setCallingConv(CC-1); @@ -2014,28 +2027,47 @@ // remove elements efficiently from the back of the vector. std::reverse(FunctionSignatureList.begin(), FunctionSignatureList.end()); - // If this bytecode format has dependent library information in it .. - if (!hasNoDependentLibraries) { -// Read in the number of dependent library items that follow + /// SectionNames - This contains the list of section names encoded in the + /// moduleinfoblock. Functions and globals with an explicit section index + /// into this to get their section name. + std::vector SectionNames; + + if (hasInconsistentModuleGlobalInfo) { +align32(); + } else if (!hasNoDependentLibraries) { +// If this bytecode format has dependent library information in it, read in +// the number of dependent library items that follow. unsigned num_dep_libs = read_vbr_uint(); std::string dep_lib; -while( num_dep_libs-- ) { +while (num_dep_libs--) { dep_lib = read_str(); TheModule->addLibrary(dep_lib); if (Handler) Handler->handleDependentLibrary(dep_lib); } - -// Read target triple and place into the module +// Read target triple and place into the module. std::string triple = read_str(); TheModule->setTargetTriple(triple); if (Handler) Handler->handleTargetTriple(triple); + +if (At != BlockEnd) { + // If the file has section info in it, read the section names now. + unsigned NumSections = read_vbr_uint(); + while (NumSections--) +SectionNames.push_back(read_str()); +} } - if (hasInconsistentModuleGlobalInfo) -align32(); + // If any globals are in specified sections, assign them now. + for (std::map::iterator I = SectionID.begin(), E = + SectionID.end(); I != E; ++I) +if (I->second) { + if (I->second > SectionID.size()) +error("SectionID out of range for global!"); + I->first->setSection(SectionNames[I->second-1]); +} // This is for future proofing... in the future extra fields may be added that // we don't understand, so we transparently ignore them. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp WriterInternals.h
Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.114 -> 1.115 WriterInternals.h updated: 1.25 -> 1.26 --- Log message: Read and write section info from/to .bc files --- Diffs of the changes: (+38 -10) Writer.cpp| 44 ++-- WriterInternals.h |4 2 files changed, 38 insertions(+), 10 deletions(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.114 llvm/lib/Bytecode/Writer/Writer.cpp:1.115 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.114 Fri Nov 11 19:01:50 2005 +++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Nov 11 19:33:40 2005 @@ -922,6 +922,11 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) { BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfoBlockID, *this); + // Give numbers to sections as we encounter them. + unsigned SectionIDCounter = 0; + std::vector SectionNames; + std::map SectionID; + // Output the types for the global variables in the module... for (Module::const_global_iterator I = M->global_begin(), End = M->global_end(); I != End; ++I) { @@ -933,7 +938,7 @@ // Fields: bit0 = isConstant, bit1 = hasInitializer, bit2-4=Linkage, // bit5+ = Slot # for type. -bool HasExtensionWord = I->getAlignment() != 0; +bool HasExtensionWord = (I->getAlignment() != 0) || I->hasSection(); // If we need to use the extension byte, set linkage=3(internal) and // initializer = 0 (impossible!). @@ -947,11 +952,22 @@ output_vbr(oSlot); // The extension word has this format: bit 0 = has initializer, bit 1-3 = - // linkage, bit 4-8 = alignment (log2), bits 10+ = future use. + // linkage, bit 4-8 = alignment (log2), bit 9 = has SectionID, + // bits 10+ = future use. unsigned ExtWord = (unsigned)I->hasInitializer() | (getEncodedLinkage(I) << 1) | - ((Log2_32(I->getAlignment())+1) << 4); + ((Log2_32(I->getAlignment())+1) << 4) | + ((unsigned)I->hasSection() << 9); output_vbr(ExtWord); + if (I->hasSection()) { +// Give section names unique ID's. +unsigned &Entry = SectionID[I->getSection()]; +if (Entry == 0) { + Entry = ++SectionIDCounter; + SectionNames.push_back(I->getSection()); +} +output_vbr(Entry); + } } // If we have an initializer, output it now. @@ -975,16 +991,27 @@ if (I->isExternal()) // If external, we don't have an FunctionInfo block. ID |= 1 << 4; -if (I->getAlignment() || (CC & ~15) != 0) +if (I->getAlignment() || I->hasSection() || (CC & ~15) != 0) ID |= 1 << 31; // Do we need an extension word? output_vbr(ID); if (ID & (1 << 31)) { // Extension byte: bits 0-4 = alignment, bits 5-9 = top nibble of calling - // convention. - ID = (Log2_32(I->getAlignment())+1) | ((CC >> 4) << 5); + // convention, bit 10 = hasSectionID. + ID = (Log2_32(I->getAlignment())+1) | ((CC >> 4) << 5) | + (I->hasSection() << 10); output_vbr(ID); + + // Give section names unique ID's. + if (I->hasSection()) { +unsigned &Entry = SectionID[I->getSection()]; +if (Entry == 0) { + Entry = ++SectionIDCounter; + SectionNames.push_back(I->getSection()); +} +output_vbr(Entry); + } } } output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5); @@ -998,6 +1025,11 @@ // Output the target triple from the module output(M->getTargetTriple()); + + // Emit the table of section names. + output_vbr((unsigned)SectionNames.size()); + for (unsigned i = 0, e = SectionNames.size(); i != e; ++i) +output(SectionNames[i]); } void BytecodeWriter::outputInstructions(const Function *F) { Index: llvm/lib/Bytecode/Writer/WriterInternals.h diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.25 llvm/lib/Bytecode/Writer/WriterInternals.h:1.26 --- llvm/lib/Bytecode/Writer/WriterInternals.h:1.25 Thu Apr 21 16:48:46 2005 +++ llvm/lib/Bytecode/Writer/WriterInternals.h Fri Nov 11 19:33:40 2005 @@ -10,10 +10,6 @@ // This header defines the interface used between components of the bytecode // writer. // -// Note that the performance of this library is not terribly important, because -// it shouldn't be used by JIT type applications... so it is not a huge focus -// at least. :) -// //===--===// #ifndef LLVM_LIB_BYTECODE_WRITER_WRITERINTERNALS_H ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/BytecodeFormat.html
Changes in directory llvm/docs: BytecodeFormat.html updated: 1.47 -> 1.48 --- Log message: Describe section name encoding --- Diffs of the changes: (+67 -14) BytecodeFormat.html | 81 +++- 1 files changed, 67 insertions(+), 14 deletions(-) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.47 llvm/docs/BytecodeFormat.html:1.48 --- llvm/docs/BytecodeFormat.html:1.47 Sun Nov 6 01:48:11 2005 +++ llvm/docs/BytecodeFormat.html Fri Nov 11 19:46:21 2005 @@ -969,22 +969,29 @@ occurring in the module. - llist(string) + llist(string) - A length list + A length list of strings that specify the names of the libraries that this module depends upon. - string + string - The target + The target triple for the module (blank means no target triple specified, i.e. a platform independent module). + + llist(string) + + A length list +of strings that defines a table of section strings for globals. A global's +SectionID is an index into this table. + + @@ -1056,15 +1063,37 @@ The log-base-2 of the alignment for the global. - bit(9-31) + bit(9) + If this bit is set, a SectionID follows this vbr. + + + bit(10-31) Currently unassigned. -The table below provides the format of the constant initializers for -the global variable field, if it has one (indicated by the "Has initializer" -field). +If the SectionID bit is set above, the following field is included: + + + + + Type + Description + + + uint32_vbr + + An optional section ID number, specifying the string +to use for the section of the global. This an index (+1) of an entry +into the SectionID llist in the Module Global +Info block. If this value is 0 or not present, the global has an +empty section string. + + + + +If the "Has initializer" field is set, the following field is included: @@ -1073,10 +1102,10 @@ Description - (zlist(uint32_vbr))? + uint32_vbr - An optional zero-terminated list of value slot -numbers of the global variable's constant initializer. + An optional value slot number for the global + variable's constant initializer. @@ -1141,12 +1170,36 @@ The top nibble of the calling convention. - bit(10-31) + bit(10) + If this bit is set, a SectionID follows this vbr. + + + bit(11-31) Currently unassigned. +If the SectionID bit is set above, the following field is included: + + + + + Type + Description + + + uint32_vbr + + An optional section ID number, specifying the string +to use for the section of the function. This an index (+1) of an entry +into the SectionID llist in the Module Global +Info block. If this value is 0 or not present, the function has an +empty section string. + + + + @@ -2046,7 +2099,7 @@ mailto:[EMAIL PROTECTED]">Reid Spencer and mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.cs.uiuc.edu";>The LLVM Compiler Infrastructure -Last modified: $Date: 2005/11/06 07:48:11 $ +Last modified: $Date: 2005/11/12 01:46:21 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits