- Implementing the instruction scheduling pass
General plumbing
-------------------
+----------------
I tried to keep the code clean, well, as far as C++ can be really clean. There
are some header cleaning steps required though, in particular in the backend
/*! All possible definitions for a use */
typedef set<ValueDef*> DefSet;
- /*! Get the chains (in both directions) for the complete program */
+ /*! Get the chains (in both directions) for the complete program. This data
+ * structure is unfortunately way too brutal. Using std::sets all over the
+ * place just burns a huge amount of memory. There is work to do to decrease
+ * the memory footprint
+ */
class FunctionDAG : public NonCopyable
{
public:
TheModule = &M;
TAsm = new CBEMCAsmInfo();
- TD = new TargetData(&M);
+ TD = new TargetData(&M);
MRI = new MCRegisterInfo();
TCtx = new MCContext(*TAsm, *MRI, NULL);
Mang = new Mangler(*TCtx, *TD);
if(isa<GlobalVariable>(parentPointer)) //HACK: !!!!
{
-#if FORMER_VERSION
+#if 1//FORMER_VERSION
Function *constWrapper =
Function::Create(FunctionType::get(parentPointer->getType(),true),
GlobalValue::ExternalLinkage,
- Twine(CONSTWRAPPERNAME));
+ Twine("__gen_ocl_const_wrapper"));
- std::vector<Value*> params;
- params.push_back(parentPointer);
+ llvm::ArrayRef<Value*> params(parentPointer);
+ // params.push_back(parentPointer);
//create and insert wrapper call
CallInst * wrapperCall =
- CallInst::Create(constWrapper,params.begin(), params.end(),"",GEPInst);
+ CallInst::Create(constWrapper,params,"",GEPInst);
parentPointer = wrapperCall;
#else
- NOT_IMPLEMENTED;
+ // NOT_IMPLEMENTED;
#endif
}
*/
#if GBE_COMPILE_UTESTS
-#include "assert.hpp"
-#include "exception.hpp"
+#include "sys/assert.hpp"
+#include "sys/exception.hpp"
+#include "sys/cvar.hpp"
#include <cassert>
#include <cstdlib>
namespace gbe
{
+ BVAR(OCL_BREAK_POINT_IN_ASSERTION, false);
+ BVAR(OCL_ABORT_IN_ASSERTION, false);
+
void onFailedAssertion(const char *msg, const char *file, const char *fn, int line)
{
char lineString[256];
+ std::string(file)
+ ", function " + std::string(fn)
+ ", line " + std::string(lineString);
- // assert(0);
+ if (OCL_BREAK_POINT_IN_ASSERTION)
+ DEBUGBREAK();
+ if (OCL_ABORT_IN_ASSERTION) {
+ assert(false);
+ exit(-1);
+ }
throw Exception(str);
}
} /* namespace gbe */