summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-05-25 08:46:15 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-05-25 08:46:15 +0000
commit7b8a3b550ac1b2f89ef6f7edd77fd384dc612b6e (patch)
treeb17a0e2733893f26b5f9655c6d901becb65c3a02 /llvm/lib/ExecutionEngine/Interpreter
parent50e3db3a64302c2cff299d5670c694ec1f4b1e28 (diff)
downloadbcm5719-llvm-7b8a3b550ac1b2f89ef6f7edd77fd384dc612b6e.tar.gz
bcm5719-llvm-7b8a3b550ac1b2f89ef6f7edd77fd384dc612b6e.zip
Get rid of a wart: useless getFILE function is now a cast macro.
llvm-svn: 13747
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp44
1 files changed, 2 insertions, 42 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 9246c0b8517..96d5d56cb2a 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -22,7 +22,6 @@
#include "Interpreter.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
#include "llvm/Target/TargetData.h"
#include "Support/DynamicLinker.h"
#include "Config/dlfcn.h"
@@ -541,47 +540,8 @@ GenericValue lle_X_memcpy(FunctionType *M, const vector<GenericValue> &Args) {
//===----------------------------------------------------------------------===//
// getFILE - Turn a pointer in the host address space into a legit pointer in
-// the interpreter address space. For the most part, this is an identity
-// transformation, but if the program refers to stdio, stderr, stdin then they
-// have pointers that are relative to the __iob array. If this is the case,
-// change the FILE into the REAL stdio stream.
-//
-static FILE *getFILE(void *Ptr) {
- static Module *LastMod = 0;
- static PointerTy IOBBase = 0;
- static unsigned FILESize;
-
- if (LastMod != &TheInterpreter->getModule()) { // Module change or initialize?
- Module *M = LastMod = &TheInterpreter->getModule();
-
- // Check to see if the currently loaded module contains an __iob symbol...
- GlobalVariable *IOB = 0;
- SymbolTable &ST = M->getSymbolTable();
- for (SymbolTable::iterator I = ST.begin(), E = ST.end(); I != E; ++I) {
- SymbolTable::VarMap &M = I->second;
- for (SymbolTable::VarMap::iterator J = M.begin(), E = M.end();
- J != E; ++J)
- if (J->first == "__iob")
- if ((IOB = dyn_cast<GlobalVariable>(J->second)))
- break;
- if (IOB) break;
- }
- }
-
- // Check to see if this is a reference to __iob...
- if (IOBBase) {
- unsigned FDNum = ((unsigned long)Ptr-IOBBase)/FILESize;
- if (FDNum == 0)
- return stdin;
- else if (FDNum == 1)
- return stdout;
- else if (FDNum == 2)
- return stderr;
- }
-
- return (FILE*)Ptr;
-}
-
+// the interpreter address space. This is an identity transformation.
+#define getFILE(ptr) ((FILE*)ptr)
// FILE *fopen(const char *filename, const char *mode);
GenericValue lle_X_fopen(FunctionType *M, const vector<GenericValue> &Args) {
OpenPOWER on IntegriCloud