comparison src/pt-jit.h @ 14944:c0a5ab3b9278

jit_const no longer inherits from jit_instruction
author Max Brister <max@2bass.com>
date Fri, 08 Jun 2012 15:30:07 -0500
parents 8efcaf5aa233
children 591aeec5c520
comparison
equal deleted inserted replaced
14943:8efcaf5aa233 14944:c0a5ab3b9278
929 virtual void accept (jit_ir_walker& walker); 929 virtual void accept (jit_ir_walker& walker);
930 930
931 template <typename T, jit_type *(*EXTRACT_T)(void), typename PASS_T, 931 template <typename T, jit_type *(*EXTRACT_T)(void), typename PASS_T,
932 bool QUOTE> 932 bool QUOTE>
933 class 933 class
934 jit_const : public jit_instruction 934 jit_const : public jit_value
935 { 935 {
936 public: 936 public:
937 typedef PASS_T pass_t; 937 typedef PASS_T pass_t;
938 938
939 jit_const (PASS_T avalue) : mvalue (avalue) 939 jit_const (PASS_T avalue) : mvalue (avalue)
944 PASS_T value (void) const { return mvalue; } 944 PASS_T value (void) const { return mvalue; }
945 945
946 virtual std::ostream& print (std::ostream& os, size_t indent) const 946 virtual std::ostream& print (std::ostream& os, size_t indent) const
947 { 947 {
948 print_indent (os, indent); 948 print_indent (os, indent);
949 short_print (os) << " = "; 949 jit_print (os, type ()) << ": ";
950 if (QUOTE) 950 if (QUOTE)
951 os << "\""; 951 os << "\"";
952 os << mvalue; 952 os << mvalue;
953 if (QUOTE) 953 if (QUOTE)
954 os << "\""; 954 os << "\"";
1324 1324
1325 class 1325 class
1326 jit_assign : public jit_assign_base 1326 jit_assign : public jit_assign_base
1327 { 1327 {
1328 public: 1328 public:
1329 jit_assign (jit_variable *adest, jit_instruction *asrc) 1329 jit_assign (jit_variable *adest, jit_value *asrc)
1330 : jit_assign_base (adest, adest, asrc) {} 1330 : jit_assign_base (adest, adest, asrc) {}
1331 1331
1332 jit_instruction *src (void) const 1332 jit_instruction *src (void) const
1333 { 1333 {
1334 return static_cast<jit_instruction *> (argument (1)); 1334 return static_cast<jit_instruction *> (argument (1));
1866 1866
1867 std::vector<std::pair<std::string, bool> > arguments; 1867 std::vector<std::pair<std::string, bool> > arguments;
1868 type_bound_vector bounds; 1868 type_bound_vector bounds;
1869 1869
1870 // used instead of return values from visit_* functions 1870 // used instead of return values from visit_* functions
1871 jit_instruction *result; 1871 jit_value *result;
1872 1872
1873 jit_block *entry_block; 1873 jit_block *entry_block;
1874 1874
1875 jit_block *final_block; 1875 jit_block *final_block;
1876 1876
1891 typedef std::map<std::string, jit_variable *> vmap_t; 1891 typedef std::map<std::string, jit_variable *> vmap_t;
1892 vmap_t vmap; 1892 vmap_t vmap;
1893 1893
1894 jit_variable *get_variable (const std::string& vname); 1894 jit_variable *get_variable (const std::string& vname);
1895 1895
1896 jit_instruction *do_assign (const std::string& lhs, jit_instruction *rhs, 1896 jit_value *do_assign (const std::string& lhs, jit_value *rhs, bool print);
1897 bool print); 1897
1898 1898
1899 jit_instruction *visit (tree *tee) { return visit (*tee); } 1899 jit_value *visit (tree *tee) { return visit (*tee); }
1900 1900
1901 jit_instruction *visit (tree& tee); 1901 jit_value *visit (tree& tee);
1902 1902
1903 void append_users (jit_value *v) 1903 void append_users (jit_value *v)
1904 { 1904 {
1905 for (jit_use *use = v->first_use (); use; use = use->next ()) 1905 for (jit_use *use = v->first_use (); use; use = use->next ())
1906 worklist.push_back (use->user ()); 1906 worklist.push_back (use->user ());
1965 convert_llvm : public jit_ir_walker 1965 convert_llvm : public jit_ir_walker
1966 { 1966 {
1967 public: 1967 public:
1968 llvm::Function *convert (llvm::Module *module, 1968 llvm::Function *convert (llvm::Module *module,
1969 const std::vector<std::pair<std::string, bool> >& args, 1969 const std::vector<std::pair<std::string, bool> >& args,
1970 const std::list<jit_block *>& blocks); 1970 const std::list<jit_block *>& blocks,
1971 const std::list<jit_value *>& constants);
1971 1972
1972 #define JIT_METH(clname) \ 1973 #define JIT_METH(clname) \
1973 virtual void visit (jit_ ## clname&); 1974 virtual void visit (jit_ ## clname&);
1974 1975
1975 JIT_VISIT_IR_CLASSES; 1976 JIT_VISIT_IR_CLASSES;