llvm.org GIT mirror llvm / 652f7ea
Revert 51775. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51795 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 11 years ago
13 changed file(s) with 40 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
448448
449449 # Building universal cannot compute dependencies automatically.
450450 DISABLE_AUTO_DEPENDENCIES=1
451 endif
452
453 # Solaris requires the following flags to compile
454 ifeq ($(OS),SunOS)
455 CXX.Flags += -D_POSIX_C_SOURCE=199506L -U_XOPEN_SOURCE
456451 endif
457452
458453 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
186186 };
187187
188188 /// getModRefBehavior - Return the behavior when calling the given call site.
189 ModRefBehavior getModRefBehavior(CallSite cs,
189 ModRefBehavior getModRefBehavior(CallSite CS,
190190 std::vector *Info = 0);
191191
192192 /// getModRefBehavior - Return the behavior when calling the given function.
205205 ///
206206 /// This property corresponds to the GCC 'const' attribute.
207207 ///
208 bool doesNotAccessMemory(CallSite cs) {
209 return getModRefBehavior(cs) == DoesNotAccessMemory;
208 bool doesNotAccessMemory(CallSite CS) {
209 return getModRefBehavior(CS) == DoesNotAccessMemory;
210210 }
211211
212212 /// doesNotAccessMemory - If the specified function is known to never read or
225225 ///
226226 /// This property corresponds to the GCC 'pure' attribute.
227227 ///
228 bool onlyReadsMemory(CallSite cs) {
229 ModRefBehavior MRB = getModRefBehavior(cs);
228 bool onlyReadsMemory(CallSite CS) {
229 ModRefBehavior MRB = getModRefBehavior(CS);
230230 return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory;
231231 }
232232
248248 /// a particular call site modifies or reads the memory specified by the
249249 /// pointer.
250250 ///
251 virtual ModRefResult getModRefInfo(CallSite cs, Value *P, unsigned Size);
251 virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size);
252252
253253 /// getModRefInfo - Return information about whether two call sites may refer
254254 /// to the same set of memory locations. This function returns NoModRef if
256256 /// written by CS2, Mod if CS1 writes to memory read or written by CS2, or
257257 /// ModRef if CS1 might read or write memory accessed by CS2.
258258 ///
259 virtual ModRefResult getModRefInfo(CallSite cs1, CallSite cs2);
259 virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2);
260260
261261 /// hasNoModRefInfoForCalls - Return true if the analysis has no mod/ref
262262 /// information for pairs of function calls (other than "pure" and "const"
270270 /// getModRefBehavior - Return the behavior of the specified function if
271271 /// called from the specified call site. The call site may be null in which
272272 /// case the most generic behavior of this function should be returned.
273 virtual ModRefBehavior getModRefBehavior(Function *F, CallSite cs,
273 virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
274274 std::vector *Info = 0);
275275
276276 public:
229229
230230 void addPointer(AliasSetTracker &AST, HashNodePair &Entry, unsigned Size,
231231 bool KnownMustAlias = false);
232 void addCallSite(CallSite cs, AliasAnalysis &AA);
233 void removeCallSite(CallSite cs) {
232 void addCallSite(CallSite CS, AliasAnalysis &AA);
233 void removeCallSite(CallSite CS) {
234234 for (size_t i = 0, e = CallSites.size(); i != e; ++i)
235 if (CallSites[i].getInstruction() == cs.getInstruction()) {
235 if (CallSites[i].getInstruction() == CS.getInstruction()) {
236236 CallSites[i] = CallSites.back();
237237 CallSites.pop_back();
238238 }
243243 /// alias one of the members in the set.
244244 ///
245245 bool aliasesPointer(const Value *Ptr, unsigned Size, AliasAnalysis &AA) const;
246 bool aliasesCallSite(CallSite cs, AliasAnalysis &AA) const;
246 bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
247247 };
248248
249249 inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) {
282282 bool add(StoreInst *SI);
283283 bool add(FreeInst *FI);
284284 bool add(VAArgInst *VAAI);
285 bool add(CallSite cs); // Call/Invoke instructions
285 bool add(CallSite CS); // Call/Invoke instructions
286286 bool add(CallInst *CI) { return add(CallSite(CI)); }
287287 bool add(InvokeInst *II) { return add(CallSite(II)); }
288288 bool add(Instruction *I); // Dispatch to one of the other add methods...
297297 bool remove(StoreInst *SI);
298298 bool remove(FreeInst *FI);
299299 bool remove(VAArgInst *VAAI);
300 bool remove(CallSite cs);
300 bool remove(CallSite CS);
301301 bool remove(CallInst *CI) { return remove(CallSite(CI)); }
302302 bool remove(InvokeInst *II) { return remove(CallSite(II)); }
303303 bool remove(Instruction *I);
382382 }
383383 AliasSet *findAliasSetForPointer(const Value *Ptr, unsigned Size);
384384
385 AliasSet *findAliasSetForCallSite(CallSite cs);
385 AliasSet *findAliasSetForCallSite(CallSite CS);
386386 };
387387
388388 inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) {
215215
216216 /// addCalledFunction add a function to the list of functions called by this
217217 /// one.
218 void addCalledFunction(CallSite cs, CallGraphNode *M) {
219 CalledFunctions.push_back(std::make_pair(cs, M));
218 void addCalledFunction(CallSite CS, CallGraphNode *M) {
219 CalledFunctions.push_back(std::make_pair(CS, M));
220220 }
221221
222222 /// removeCallEdgeTo - This method removes a *single* edge to the specified
227227 /// removeCallEdgeFor - This method removes the edge in the node for the
228228 /// specified call site. Note that this method takes linear time, so it
229229 /// should be used sparingly.
230 void removeCallEdgeFor(CallSite cs);
230 void removeCallEdgeFor(CallSite CS);
231231
232232 /// removeAnyCallEdgeTo - This method removes any call edges from this node to
233233 /// the specified callee function. This takes more time to execute than
4646 enum LocResult {
4747 Yes, No, Unknown
4848 };
49 LocResult (*isLocation)(CallSite cs, const Value *Ptr, unsigned Size);
49 LocResult (*isLocation)(CallSite CS, const Value *Ptr, unsigned Size);
5050 };
5151
5252 /// LibCallFunctionInfo - Each record in the array of FunctionInfo structs
3030 static char ID;
3131 PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&cerr),
3232 DeleteStream(false) {}
33 PrintModulePass(OStream *o, bool ds = false)
34 : ModulePass(intptr_t(&ID)), Out(o), DeleteStream(ds) {}
33 PrintModulePass(OStream *o, bool DS = false)
34 : ModulePass(intptr_t(&ID)), Out(o), DeleteStream(DS) {}
3535
3636 ~PrintModulePass() {
3737 if (DeleteStream) delete Out;
5656 PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&cerr),
5757 DeleteStream(false) {}
5858 PrintFunctionPass(const std::string &B, OStream *o = &cout,
59 bool ds = false)
60 : FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(ds) {}
59 bool DS = false)
60 : FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(DS) {}
6161
6262 inline ~PrintFunctionPass() {
6363 if (DeleteStream) delete Out;
132132 /// symbol, like "free".
133133 ///
134134 static MachineRelocation getExtSym(intptr_t offset, unsigned RelocationType,
135 const char *es, intptr_t cst = 0,
135 const char *ES, intptr_t cst = 0,
136136 bool GOTrelative = 0) {
137137 assert((RelocationType & ~63) == 0 && "Relocation type too large!");
138138 MachineRelocation Result;
142142 Result.AddrType = isExtSym;
143143 Result.NeedStub = true;
144144 Result.GOTRelative = GOTrelative;
145 Result.Target.ExtSym = es;
145 Result.Target.ExtSym = ES;
146146 return Result;
147147 }
148148
3535 CallSite(CallInst *CI) : I(reinterpret_cast(CI)) {}
3636 CallSite(InvokeInst *II) : I(reinterpret_cast(II)) {}
3737 CallSite(Instruction *C);
38 CallSite(const CallSite &cs) : I(cs.I) {}
39 CallSite &operator=(const CallSite &cs) { I = cs.I; return *this; }
38 CallSite(const CallSite &CS) : I(CS.I) {}
39 CallSite &operator=(const CallSite &CS) { I = CS.I; return *this; }
4040
41 bool operator==(const CallSite &cs) const { return I == cs.I; }
42 bool operator!=(const CallSite &cs) const { return I != cs.I; }
41 bool operator==(const CallSite &CS) const { return I == CS.I; }
42 bool operator!=(const CallSite &CS) const { return I != CS.I; }
4343
4444 /// CallSite::get - This static method is sort of like a constructor. It will
4545 /// create an appropriate call site for a Call or Invoke instruction, but it
147147 bool arg_empty() const { return arg_end() == arg_begin(); }
148148 unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
149149
150 bool operator<(const CallSite &cs) const {
151 return getInstruction() < cs.getInstruction();
150 bool operator<(const CallSite &CS) const {
151 return getInstruction() < CS.getInstruction();
152152 }
153153 };
154154
6969 /// The type 'TargetMachineImpl' should provide a constructor with two
7070 /// parameters:
7171 /// - const Module& M: the module that is being compiled:
72 /// - const std::string& fs: target-specific string describing target
72 /// - const std::string& FS: target-specific string describing target
7373 /// flavour.
7474
7575 template
8585 TargetMachineRegistry::entry Entry;
8686 TargetMachineRegistry::node Node;
8787
88 static TargetMachine *Allocator(const Module &M, const std::string &fs) {
89 return new TargetMachineImpl(M, fs);
88 static TargetMachine *Allocator(const Module &M, const std::string &FS) {
89 return new TargetMachineImpl(M, FS);
9090 }
9191 };
9292
5252 /// returned is greater than the current inline threshold, the call site is
5353 /// not inlined.
5454 ///
55 virtual int getInlineCost(CallSite cs) = 0;
55 virtual int getInlineCost(CallSite CS) = 0;
5656
5757 // getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a
5858 // higher threshold to determine if the function call should be inlined.
5959 ///
60 virtual float getInlineFudgeFactor(CallSite cs) = 0;
60 virtual float getInlineFudgeFactor(CallSite CS) = 0;
6161
6262 private:
6363 // InlineThreshold - Cache the value here for easy access.
183183 ///
184184 bool InlineFunction(CallInst *C, CallGraph *CG = 0, const TargetData *TD = 0);
185185 bool InlineFunction(InvokeInst *II, CallGraph *CG = 0, const TargetData *TD =0);
186 bool InlineFunction(CallSite cs, CallGraph *CG = 0, const TargetData *TD = 0);
186 bool InlineFunction(CallSite CS, CallGraph *CG = 0, const TargetData *TD = 0);
187187
188188 } // End llvm namespace
189189
7676 // getInlineCost - The heuristic used to determine if we should inline the
7777 // function call or not.
7878 //
79 int getInlineCost(CallSite cs,
79 int getInlineCost(CallSite CS,
8080 SmallPtrSet &NeverInline);
8181
8282 // getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a
8383 // higher threshold to determine if the function call should be inlined.
84 float getInlineFudgeFactor(CallSite cs);
84 float getInlineFudgeFactor(CallSite CS);
8585 };
8686 }
8787
9595 print "
$lib
    \n";
9696 }
9797 open UNDEFS,
98 "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |";
98 "$nmPath -g -u $Directory/$lib | sed -e 's/^ *U //' | sort | uniq |";
9999 my %DepLibs;
100100 while () {
101101 chomp;